linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] mt76: use AC specific reorder timeout
@ 2019-12-10 12:20 Markus Theil
  2019-12-13 21:57 ` Felix Fietkau
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Theil @ 2019-12-10 12:20 UTC (permalink / raw)
  To: nbd
  Cc: linux-wireless, lorenzo.bianconi, Stanislaw Gruszka, kvalo, Markus Theil

Before this patch, mt76 handled rx traffic for all TIDs  equally,
when released from reorder buffer early. This patch uses an AC specific
reorder timeout, in order to release partial aggregated frames for voice
or video ACs earlier. For example, ath10k also uses AC specific reorder
timeouts (reported by firmware in that case).

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
---
v3: fix changelog
v2: use static const mapping arrays

 drivers/net/wireless/mediatek/mt76/agg-rx.c | 30 ++++++++++++++++++---
 drivers/net/wireless/mediatek/mt76/mt76.h   |  2 ++
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/agg-rx.c b/drivers/net/wireless/mediatek/mt76/agg-rx.c
index 53b5a4b2dcc5..572cf26b0fa1 100644
--- a/drivers/net/wireless/mediatek/mt76/agg-rx.c
+++ b/drivers/net/wireless/mediatek/mt76/agg-rx.c
@@ -4,7 +4,27 @@
  */
 #include "mt76.h"

-#define REORDER_TIMEOUT (HZ / 10)
+static unsigned long mt76_aggr_tid_to_timeo(u8 tidno)
+{
+	static const int ieee802_1d_to_ac[8] = {
+		IEEE80211_AC_BE,
+		IEEE80211_AC_BK,
+		IEEE80211_AC_BK,
+		IEEE80211_AC_BE,
+		IEEE80211_AC_VI,
+		IEEE80211_AC_VI,
+		IEEE80211_AC_VO,
+		IEEE80211_AC_VO
+	};
+	static const int ac_to_timeout[] = {
+		[IEEE80211_AC_VO] = HZ / 30,
+		[IEEE80211_AC_VI] = HZ / 25,
+		[IEEE80211_AC_BE] = HZ / 10,
+		[IEEE80211_AC_BK] = HZ / 10
+	};
+
+	return ac_to_timeout[ieee802_1d_to_ac[tidno & 7]];
+}

 static void
 mt76_aggr_release(struct mt76_rx_tid *tid, struct sk_buff_head *frames, int idx)
@@ -71,7 +91,8 @@ mt76_rx_aggr_check_release(struct mt76_rx_tid *tid, struct sk_buff_head *frames)
 		nframes--;
 		status = (struct mt76_rx_status *)skb->cb;
 		if (!time_after(jiffies,
-				status->reorder_time + REORDER_TIMEOUT))
+				status->reorder_time +
+				mt76_aggr_tid_to_timeo(tid->num)))
 			continue;

 		mt76_rx_aggr_release_frames(tid, frames, status->seqno);
@@ -101,7 +122,7 @@ mt76_rx_aggr_reorder_work(struct work_struct *work)

 	if (nframes)
 		ieee80211_queue_delayed_work(tid->dev->hw, &tid->reorder_work,
-					     REORDER_TIMEOUT);
+					     mt76_aggr_tid_to_timeo(tid->num));
 	mt76_rx_complete(dev, &frames, NULL);

 	rcu_read_unlock();
@@ -225,7 +246,7 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
 	mt76_rx_aggr_release_head(tid, frames);

 	ieee80211_queue_delayed_work(tid->dev->hw, &tid->reorder_work,
-				     REORDER_TIMEOUT);
+				     mt76_aggr_tid_to_timeo(tid->num));

 out:
 	spin_unlock_bh(&tid->lock);
@@ -245,6 +266,7 @@ int mt76_rx_aggr_start(struct mt76_dev *dev, struct mt76_wcid *wcid, u8 tidno,
 	tid->dev = dev;
 	tid->head = ssn;
 	tid->size = size;
+	tid->num = tidno;
 	INIT_DELAYED_WORK(&tid->reorder_work, mt76_rx_aggr_reorder_work);
 	spin_lock_init(&tid->lock);

diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h
index c268c3d76b3d..b604d8d5f0bc 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76.h
@@ -237,6 +237,8 @@ struct mt76_rx_tid {
 	u8 size;
 	u8 nframes;

+	u8 num;
+
 	u8 started:1, stopped:1, timer_pending:1;

 	struct sk_buff *reorder_buf[];
--
2.24.0


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

* Re: [PATCH v3] mt76: use AC specific reorder timeout
  2019-12-10 12:20 [PATCH v3] mt76: use AC specific reorder timeout Markus Theil
@ 2019-12-13 21:57 ` Felix Fietkau
  0 siblings, 0 replies; 2+ messages in thread
From: Felix Fietkau @ 2019-12-13 21:57 UTC (permalink / raw)
  To: Markus Theil; +Cc: linux-wireless, lorenzo.bianconi, Stanislaw Gruszka, kvalo

On 2019-12-10 13:20, Markus Theil wrote:
> Before this patch, mt76 handled rx traffic for all TIDs  equally,
> when released from reorder buffer early. This patch uses an AC specific
> reorder timeout, in order to release partial aggregated frames for voice
> or video ACs earlier. For example, ath10k also uses AC specific reorder
> timeouts (reported by firmware in that case).
> 
> Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
> ---
> v3: fix changelog
> v2: use static const mapping arrays
> 
>  drivers/net/wireless/mediatek/mt76/agg-rx.c | 30 ++++++++++++++++++---
>  drivers/net/wireless/mediatek/mt76/mt76.h   |  2 ++
>  2 files changed, 28 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/agg-rx.c b/drivers/net/wireless/mediatek/mt76/agg-rx.c
> index 53b5a4b2dcc5..572cf26b0fa1 100644
> --- a/drivers/net/wireless/mediatek/mt76/agg-rx.c
> +++ b/drivers/net/wireless/mediatek/mt76/agg-rx.c
> @@ -4,7 +4,27 @@
>   */
>  #include "mt76.h"
> 
> -#define REORDER_TIMEOUT (HZ / 10)
> +static unsigned long mt76_aggr_tid_to_timeo(u8 tidno)
> +{
> +	static const int ieee802_1d_to_ac[8] = {
> +		IEEE80211_AC_BE,
> +		IEEE80211_AC_BK,
> +		IEEE80211_AC_BK,
> +		IEEE80211_AC_BE,
> +		IEEE80211_AC_VI,
> +		IEEE80211_AC_VI,
> +		IEEE80211_AC_VO,
> +		IEEE80211_AC_VO
> +	};
> +	static const int ac_to_timeout[] = {
> +		[IEEE80211_AC_VO] = HZ / 30,
> +		[IEEE80211_AC_VI] = HZ / 25,
> +		[IEEE80211_AC_BE] = HZ / 10,
> +		[IEEE80211_AC_BK] = HZ / 10
> +	};
> +
> +	return ac_to_timeout[ieee802_1d_to_ac[tidno & 7]];
In the current implementation, voice traffic always runs without
aggregation, so it does not need special timeout handling.

Given that tid values 0-3 are BE/BK and you use the same timeout for
those, you could simplify this function to:
return HZ / (tidno >= 4 ? 25 : 10);

- Felix

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

end of thread, other threads:[~2019-12-13 21:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-10 12:20 [PATCH v3] mt76: use AC specific reorder timeout Markus Theil
2019-12-13 21:57 ` Felix Fietkau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).