All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3 v2] mac80211: RX BA support for sta max_rx_aggregation_subframes
@ 2016-08-21 11:24 Maxim Altshul
  2016-08-21 11:24 ` [PATCH 2/3 v2] wlcore: Pass win_size taken from ieee80211_sta to FW Maxim Altshul
  2016-08-22 13:37 ` [PATCH 1/3 v2] mac80211: RX BA support for sta max_rx_aggregation_subframes Johannes Berg
  0 siblings, 2 replies; 6+ messages in thread
From: Maxim Altshul @ 2016-08-21 11:24 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo, johannes, Maxim Altshul

The ability to change the max_rx_aggregation frames is useful
in cases of IOP.

There exist some devices (latest mobile phones and some AP's)
that tend to not respect a BA sessions maximum size (in Kbps).
These devices won't respect the AMPDU size that was negotiated during
associasion (even though they do respect the maximal number of packets).

This violation is characterized by a valid number of packets in
a single AMPDU. Even so, the total size will exceed the size negotiated
during association.

Eventually, this will cause some undefined behavior, which in turn
causes the hw to drop packets, causing the throughput to plummet.

This patch will:
a. Make the subframe limitation to be held by each station,
instead of being held only by hw.
b. Create an api for the driver to call which will remove violating
BA sessions with a specific peer. When the session is reopened, it
will use the new size, limiting the aggregation.

Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>
---
Change documentation and removed unnecessary function

 include/net/mac80211.h  |  4 ++++
 net/mac80211/agg-rx.c   | 10 ++++++----
 net/mac80211/sta_info.c |  3 +++
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index cca510a..a1457ca 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1735,6 +1735,9 @@ struct ieee80211_sta_rates {
  * @supp_rates: Bitmap of supported rates (per band)
  * @ht_cap: HT capabilities of this STA; restricted to our own capabilities
  * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities
+ * @max_rx_aggregation_subframes: maximal amount of frames in a single AMPDU
+ *	that this station is allowed to transmit to us.
+ *	Can be modified by driver.
  * @wme: indicates whether the STA supports QoS/WME (if local devices does,
  *	otherwise always false)
  * @drv_priv: data area for driver use, will always be aligned to
@@ -1775,6 +1778,7 @@ struct ieee80211_sta {
 	u16 aid;
 	struct ieee80211_sta_ht_cap ht_cap;
 	struct ieee80211_sta_vht_cap vht_cap;
+	u8 max_rx_aggregation_subframes;
 	bool wme;
 	u8 uapsd_queues;
 	u8 max_sp;
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
index a9aff60..8532e36 100644
--- a/net/mac80211/agg-rx.c
+++ b/net/mac80211/agg-rx.c
@@ -297,13 +297,15 @@ void __ieee80211_start_rx_ba_session(struct sta_info *sta,
 	if (buf_size == 0)
 		buf_size = IEEE80211_MAX_AMPDU_BUF;
 
+	/* examine state machine */
+	mutex_lock(&sta->ampdu_mlme.mtx);
+
 	/* make sure the size doesn't exceed the maximum supported by the hw */
-	if (buf_size > local->hw.max_rx_aggregation_subframes)
-		buf_size = local->hw.max_rx_aggregation_subframes;
+	if (buf_size > sta->sta.max_rx_aggregation_subframes)
+		buf_size = sta->sta.max_rx_aggregation_subframes;
 	params.buf_size = buf_size;
 
-	/* examine state machine */
-	mutex_lock(&sta->ampdu_mlme.mtx);
+	ht_dbg(sta->sdata, "AddBA Req buf_size=%d\n", buf_size);
 
 	if (test_bit(tid, sta->ampdu_mlme.agg_session_valid)) {
 		tid_agg_rx = rcu_dereference_protected(
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c
index 19f14c9..5e70fa5 100644
--- a/net/mac80211/sta_info.c
+++ b/net/mac80211/sta_info.c
@@ -340,6 +340,9 @@ struct sta_info *sta_info_alloc(struct ieee80211_sub_if_data *sdata,
 
 	memcpy(sta->addr, addr, ETH_ALEN);
 	memcpy(sta->sta.addr, addr, ETH_ALEN);
+	sta->sta.max_rx_aggregation_subframes =
+		local->hw.max_rx_aggregation_subframes;
+
 	sta->local = local;
 	sta->sdata = sdata;
 	sta->rx_stats.last_rx = jiffies;
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3 v2] wlcore: Pass win_size taken from ieee80211_sta to FW
  2016-08-21 11:24 [PATCH 1/3 v2] mac80211: RX BA support for sta max_rx_aggregation_subframes Maxim Altshul
@ 2016-08-21 11:24 ` Maxim Altshul
  2016-08-21 11:24   ` [PATCH 3/3 v2] wlcore: Add RX_BA_WIN_SIZE_CHANGE_EVENT event Maxim Altshul
                     ` (2 more replies)
  2016-08-22 13:37 ` [PATCH 1/3 v2] mac80211: RX BA support for sta max_rx_aggregation_subframes Johannes Berg
  1 sibling, 3 replies; 6+ messages in thread
From: Maxim Altshul @ 2016-08-21 11:24 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo, johannes, Maxim Altshul

When starting a new BA session, we must pass the win_size to the FW.

To do this we take max_rx_aggregation_subframes (BA RX win size)
which is stored in ieee80211_sta structure (e.g per link and not per HW)

We will use the value stored per link when passing the win_size to
firmware through the ACX_BA_SESSION_RX_SETUP command.

Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>
---
Now sending params->buf_size instead of sta->max_aggregation_subframes.
buf_size is already set in the function ampdu_action when action is IEEE80211_AMPDU_RX_START.

 drivers/net/wireless/ti/wlcore/acx.c  | 5 +++--
 drivers/net/wireless/ti/wlcore/acx.h  | 3 ++-
 drivers/net/wireless/ti/wlcore/main.c | 6 ++++--
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/acx.c b/drivers/net/wireless/ti/wlcore/acx.c
index 26cc23f..a485999 100644
--- a/drivers/net/wireless/ti/wlcore/acx.c
+++ b/drivers/net/wireless/ti/wlcore/acx.c
@@ -1419,7 +1419,8 @@ out:
 
 /* setup BA session receiver setting in the FW. */
 int wl12xx_acx_set_ba_receiver_session(struct wl1271 *wl, u8 tid_index,
-				       u16 ssn, bool enable, u8 peer_hlid)
+				       u16 ssn, bool enable, u8 peer_hlid,
+				       u8 win_size)
 {
 	struct wl1271_acx_ba_receiver_setup *acx;
 	int ret;
@@ -1435,7 +1436,7 @@ int wl12xx_acx_set_ba_receiver_session(struct wl1271 *wl, u8 tid_index,
 	acx->hlid = peer_hlid;
 	acx->tid = tid_index;
 	acx->enable = enable;
-	acx->win_size = wl->conf.ht.rx_ba_win_size;
+	acx->win_size =	win_size;
 	acx->ssn = ssn;
 
 	ret = wlcore_cmd_configure_failsafe(wl, ACX_BA_SESSION_RX_SETUP, acx,
diff --git a/drivers/net/wireless/ti/wlcore/acx.h b/drivers/net/wireless/ti/wlcore/acx.h
index 6321ed4..f46d7fd 100644
--- a/drivers/net/wireless/ti/wlcore/acx.h
+++ b/drivers/net/wireless/ti/wlcore/acx.h
@@ -1113,7 +1113,8 @@ int wl1271_acx_set_ht_information(struct wl1271 *wl,
 int wl12xx_acx_set_ba_initiator_policy(struct wl1271 *wl,
 				       struct wl12xx_vif *wlvif);
 int wl12xx_acx_set_ba_receiver_session(struct wl1271 *wl, u8 tid_index,
-				       u16 ssn, bool enable, u8 peer_hlid);
+				       u16 ssn, bool enable, u8 peer_hlid,
+				       u8 win_size);
 int wl12xx_acx_tsf_info(struct wl1271 *wl, struct wl12xx_vif *wlvif,
 			u64 *mactime);
 int wl1271_acx_ps_rx_streaming(struct wl1271 *wl, struct wl12xx_vif *wlvif,
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 9e1f2d9..8f954b4 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -5286,7 +5286,9 @@ static int wl1271_op_ampdu_action(struct ieee80211_hw *hw,
 		}
 
 		ret = wl12xx_acx_set_ba_receiver_session(wl, tid, *ssn, true,
-							 hlid);
+				hlid,
+				params->buf_size);
+
 		if (!ret) {
 			*ba_bitmap |= BIT(tid);
 			wl->ba_rx_session_count++;
@@ -5307,7 +5309,7 @@ static int wl1271_op_ampdu_action(struct ieee80211_hw *hw,
 		}
 
 		ret = wl12xx_acx_set_ba_receiver_session(wl, tid, 0, false,
-							 hlid);
+							 hlid, 0);
 		if (!ret) {
 			*ba_bitmap &= ~BIT(tid);
 			wl->ba_rx_session_count--;
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3 v2] wlcore: Add RX_BA_WIN_SIZE_CHANGE_EVENT event
  2016-08-21 11:24 ` [PATCH 2/3 v2] wlcore: Pass win_size taken from ieee80211_sta to FW Maxim Altshul
@ 2016-08-21 11:24   ` Maxim Altshul
  2016-09-14 16:41   ` [2/3,v2] wlcore: Pass win_size taken from ieee80211_sta to FW Kalle Valo
  2016-11-17  6:39   ` Kalle Valo
  2 siblings, 0 replies; 6+ messages in thread
From: Maxim Altshul @ 2016-08-21 11:24 UTC (permalink / raw)
  To: linux-wireless; +Cc: kvalo, johannes, Maxim Altshul

This event is used by the Firmware to limit the RX BA win size
for a specific link.

The event handler updates the new size in the mac's sta->sta struct.

BA sessions opened for that link will use the new restricted
win_size. This limitation remains until a new update is received or
until the link is closed.

Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>
---
Instead of calling ieee80211_change_rx_ba_max_subframes which was removed in v2,
we will find the station, change the window size and call for a stop on it's active RX BA sessions.
 
 drivers/net/wireless/ti/wl18xx/event.c | 28 ++++++++++++++++++++++++++++
 drivers/net/wireless/ti/wl18xx/event.h |  1 +
 drivers/net/wireless/ti/wl18xx/main.c  |  3 ++-
 3 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ti/wl18xx/event.c b/drivers/net/wireless/ti/wl18xx/event.c
index 2c5df43..9fd1c69 100644
--- a/drivers/net/wireless/ti/wl18xx/event.c
+++ b/drivers/net/wireless/ti/wl18xx/event.c
@@ -217,5 +217,33 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl)
 	if (vector & FW_LOGGER_INDICATION)
 		wlcore_event_fw_logger(wl);
 
+	if (vector & RX_BA_WIN_SIZE_CHANGE_EVENT_ID) {
+		struct wl12xx_vif *wlvif;
+		struct ieee80211_vif *vif;
+		struct ieee80211_sta *sta;
+		u8 link_id = mbox->rx_ba_link_id;
+		u8 win_size = mbox->rx_ba_win_size;
+		const u8 *addr;
+
+		wlvif = wl->links[link_id].wlvif;
+		vif = wl12xx_wlvif_to_vif(wlvif);
+
+		/* Update RX aggregation window size and call
+		 * MAC routine to stop active RX aggregations for this link
+		 */
+		if (wlvif->bss_type != BSS_TYPE_AP_BSS)
+			addr = vif->bss_conf.bssid;
+		else
+			addr = wl->links[link_id].addr;
+
+		sta = ieee80211_find_sta(vif, addr);
+		if (sta) {
+			sta->max_rx_aggregation_subframes = win_size;
+			ieee80211_stop_rx_ba_session(vif,
+						wl->links[link_id].ba_bitmap,
+						addr);
+		}
+	}
+
 	return 0;
 }
diff --git a/drivers/net/wireless/ti/wl18xx/event.h b/drivers/net/wireless/ti/wl18xx/event.h
index ce8ea9c0..4af297f 100644
--- a/drivers/net/wireless/ti/wl18xx/event.h
+++ b/drivers/net/wireless/ti/wl18xx/event.h
@@ -38,6 +38,7 @@ enum {
 	REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID      = BIT(18),
 	DFS_CHANNELS_CONFIG_COMPLETE_EVENT       = BIT(19),
 	PERIODIC_SCAN_REPORT_EVENT_ID            = BIT(20),
+	RX_BA_WIN_SIZE_CHANGE_EVENT_ID           = BIT(21),
 	SMART_CONFIG_SYNC_EVENT_ID               = BIT(22),
 	SMART_CONFIG_DECODE_EVENT_ID             = BIT(23),
 	TIME_SYNC_EVENT_ID                       = BIT(24),
diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c
index 00a04df..dafb2fd 100644
--- a/drivers/net/wireless/ti/wl18xx/main.c
+++ b/drivers/net/wireless/ti/wl18xx/main.c
@@ -1041,7 +1041,8 @@ static int wl18xx_boot(struct wl1271 *wl)
 		SMART_CONFIG_SYNC_EVENT_ID |
 		SMART_CONFIG_DECODE_EVENT_ID |
 		TIME_SYNC_EVENT_ID |
-		FW_LOGGER_INDICATION;
+		FW_LOGGER_INDICATION |
+		RX_BA_WIN_SIZE_CHANGE_EVENT_ID;
 
 	wl->ap_event_mask = MAX_TX_FAILURE_EVENT_ID;
 
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3 v2] mac80211: RX BA support for sta max_rx_aggregation_subframes
  2016-08-21 11:24 [PATCH 1/3 v2] mac80211: RX BA support for sta max_rx_aggregation_subframes Maxim Altshul
  2016-08-21 11:24 ` [PATCH 2/3 v2] wlcore: Pass win_size taken from ieee80211_sta to FW Maxim Altshul
@ 2016-08-22 13:37 ` Johannes Berg
  1 sibling, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2016-08-22 13:37 UTC (permalink / raw)
  To: Maxim Altshul, linux-wireless; +Cc: kvalo


> +	/* examine state machine */
> +	mutex_lock(&sta->ampdu_mlme.mtx);
> +
>  	/* make sure the size doesn't exceed the maximum supported
> by the hw */
> -	if (buf_size > local->hw.max_rx_aggregation_subframes)
> -		buf_size = local->hw.max_rx_aggregation_subframes;
> +	if (buf_size > sta->sta.max_rx_aggregation_subframes)
> +		buf_size = sta->sta.max_rx_aggregation_subframes;
>  	params.buf_size = buf_size;
> 
Since the driver is updating this value without any locking, is there
any point in changing the locking?

> +	ht_dbg(sta->sdata, "AddBA Req buf_size=%d\n", buf_size);

I think the station address should be in there.

johannes

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [2/3,v2] wlcore: Pass win_size taken from ieee80211_sta to FW
  2016-08-21 11:24 ` [PATCH 2/3 v2] wlcore: Pass win_size taken from ieee80211_sta to FW Maxim Altshul
  2016-08-21 11:24   ` [PATCH 3/3 v2] wlcore: Add RX_BA_WIN_SIZE_CHANGE_EVENT event Maxim Altshul
@ 2016-09-14 16:41   ` Kalle Valo
  2016-11-17  6:39   ` Kalle Valo
  2 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2016-09-14 16:41 UTC (permalink / raw)
  To: Maxim Altshul; +Cc: linux-wireless, johannes, Maxim Altshul

Maxim Altshul <maxim.altshul@ti.com> wrote:
> When starting a new BA session, we must pass the win_size to the FW.
> 
> To do this we take max_rx_aggregation_subframes (BA RX win size)
> which is stored in ieee80211_sta structure (e.g per link and not per HW)
> 
> We will use the value stored per link when passing the win_size to
> firmware through the ACX_BA_SESSION_RX_SETUP command.
> 
> Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>

Depends on this commit which is currently in mac80211-next:

480dd46b9d68 mac80211: RX BA support for sta max_rx_aggregation_subframes

-- 
Sent by pwcli
https://patchwork.kernel.org/patch/9292121/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [2/3,v2] wlcore: Pass win_size taken from ieee80211_sta to FW
  2016-08-21 11:24 ` [PATCH 2/3 v2] wlcore: Pass win_size taken from ieee80211_sta to FW Maxim Altshul
  2016-08-21 11:24   ` [PATCH 3/3 v2] wlcore: Add RX_BA_WIN_SIZE_CHANGE_EVENT event Maxim Altshul
  2016-09-14 16:41   ` [2/3,v2] wlcore: Pass win_size taken from ieee80211_sta to FW Kalle Valo
@ 2016-11-17  6:39   ` Kalle Valo
  2 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2016-11-17  6:39 UTC (permalink / raw)
  To: Maxim Altshul; +Cc: linux-wireless, johannes, Maxim Altshul

Maxim Altshul <maxim.altshul@ti.com> wrote:
> When starting a new BA session, we must pass the win_size to the FW.
> 
> To do this we take max_rx_aggregation_subframes (BA RX win size)
> which is stored in ieee80211_sta structure (e.g per link and not per HW)
> 
> We will use the value stored per link when passing the win_size to
> firmware through the ACX_BA_SESSION_RX_SETUP command.
> 
> Signed-off-by: Maxim Altshul <maxim.altshul@ti.com>

2 patches applied to wireless-drivers-next.git, thanks.

42c7372a1116 wlcore: Pass win_size taken from ieee80211_sta to FW
e7ee74b56f23 wlcore: Add RX_BA_WIN_SIZE_CHANGE_EVENT event

-- 
https://patchwork.kernel.org/patch/9292121/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-17  6:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-21 11:24 [PATCH 1/3 v2] mac80211: RX BA support for sta max_rx_aggregation_subframes Maxim Altshul
2016-08-21 11:24 ` [PATCH 2/3 v2] wlcore: Pass win_size taken from ieee80211_sta to FW Maxim Altshul
2016-08-21 11:24   ` [PATCH 3/3 v2] wlcore: Add RX_BA_WIN_SIZE_CHANGE_EVENT event Maxim Altshul
2016-09-14 16:41   ` [2/3,v2] wlcore: Pass win_size taken from ieee80211_sta to FW Kalle Valo
2016-11-17  6:39   ` Kalle Valo
2016-08-22 13:37 ` [PATCH 1/3 v2] mac80211: RX BA support for sta max_rx_aggregation_subframes Johannes Berg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.