linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 5.9 v2 1/2] mac80211: extend AQL aggregation estimation to HE and fix unit mismatch
@ 2020-09-15  8:59 Felix Fietkau
  2020-09-15  8:59 ` [PATCH 5.9 v2 2/2] mac80211: add AQL support for VHT160 tx rates Felix Fietkau
  2020-09-15  9:24 ` [PATCH 5.9 v2 1/2] mac80211: extend AQL aggregation estimation to HE and fix unit mismatch Toke Høiland-Jørgensen
  0 siblings, 2 replies; 4+ messages in thread
From: Felix Fietkau @ 2020-09-15  8:59 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, toke

The unit of the return value of ieee80211_get_rate_duration is nanoseconds, not
microseconds. Adjust the duration checks to account for that.
For higher data rates, allow larger estimated aggregation sizes, and add some
values for HE as well, which can use much larger aggregates.
Since small packets with high data rates can now lead to duration values too
small for info->tx_time_est, return a minimum of 4us.

Fixes: f01cfbaf9b29 ("mac80211: improve AQL aggregation estimation for low data rates")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/mac80211/airtime.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/airtime.c b/net/mac80211/airtime.c
index 314973033d03..45140e535151 100644
--- a/net/mac80211/airtime.c
+++ b/net/mac80211/airtime.c
@@ -668,20 +668,26 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw,
 		 * This will not be very accurate, but much better than simply
 		 * assuming un-aggregated tx in all cases.
 		 */
-		if (duration > 400) /* <= VHT20 MCS2 1S */
+		if (duration > 400 * 1024) /* <= VHT20 MCS2 1S */
 			agg_shift = 1;
-		else if (duration > 250) /* <= VHT20 MCS3 1S or MCS1 2S */
+		else if (duration > 250 * 1024) /* <= VHT20 MCS3 1S or MCS1 2S */
 			agg_shift = 2;
-		else if (duration > 150) /* <= VHT20 MCS5 1S or MCS3 2S */
+		else if (duration > 150 * 1024) /* <= VHT20 MCS5 1S or MCS2 2S */
 			agg_shift = 3;
-		else
+		else if (duration > 70 * 1024) /* <= VHT20 MCS5 2S */
 			agg_shift = 4;
+		else if (stat.encoding != RX_ENC_HE ||
+			 duration > 20 * 1024) /* <= HE40 MCS6 2S */
+			agg_shift = 5;
+		else
+			agg_shift = 6;
 
 		duration *= len;
 		duration /= AVG_PKT_SIZE;
 		duration /= 1024;
+		duration += (overhead >> agg_shift);
 
-		return duration + (overhead >> agg_shift);
+		return max_t(u32, duration, 4);
 	}
 
 	if (!conf)
-- 
2.28.0


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

* [PATCH 5.9 v2 2/2] mac80211: add AQL support for VHT160 tx rates
  2020-09-15  8:59 [PATCH 5.9 v2 1/2] mac80211: extend AQL aggregation estimation to HE and fix unit mismatch Felix Fietkau
@ 2020-09-15  8:59 ` Felix Fietkau
  2020-09-15  9:24   ` Toke Høiland-Jørgensen
  2020-09-15  9:24 ` [PATCH 5.9 v2 1/2] mac80211: extend AQL aggregation estimation to HE and fix unit mismatch Toke Høiland-Jørgensen
  1 sibling, 1 reply; 4+ messages in thread
From: Felix Fietkau @ 2020-09-15  8:59 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, toke

When converting from struct ieee80211_tx_rate to ieee80211_rx_status,
there was one check missing to fill in the bandwidth for 160 MHz

Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/mac80211/airtime.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/airtime.c b/net/mac80211/airtime.c
index 45140e535151..26d2f8ba7029 100644
--- a/net/mac80211/airtime.c
+++ b/net/mac80211/airtime.c
@@ -560,7 +560,9 @@ static int ieee80211_fill_rx_status(struct ieee80211_rx_status *stat,
 	if (rate->idx < 0 || !rate->count)
 		return -1;
 
-	if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
+	if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH)
+		stat->bw = RATE_INFO_BW_160;
+	else if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
 		stat->bw = RATE_INFO_BW_80;
 	else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
 		stat->bw = RATE_INFO_BW_40;
-- 
2.28.0


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

* Re: [PATCH 5.9 v2 1/2] mac80211: extend AQL aggregation estimation to HE and fix unit mismatch
  2020-09-15  8:59 [PATCH 5.9 v2 1/2] mac80211: extend AQL aggregation estimation to HE and fix unit mismatch Felix Fietkau
  2020-09-15  8:59 ` [PATCH 5.9 v2 2/2] mac80211: add AQL support for VHT160 tx rates Felix Fietkau
@ 2020-09-15  9:24 ` Toke Høiland-Jørgensen
  1 sibling, 0 replies; 4+ messages in thread
From: Toke Høiland-Jørgensen @ 2020-09-15  9:24 UTC (permalink / raw)
  To: Felix Fietkau, linux-wireless; +Cc: johannes

Felix Fietkau <nbd@nbd.name> writes:

> The unit of the return value of ieee80211_get_rate_duration is nanoseconds, not
> microseconds. Adjust the duration checks to account for that.
> For higher data rates, allow larger estimated aggregation sizes, and add some
> values for HE as well, which can use much larger aggregates.
> Since small packets with high data rates can now lead to duration values too
> small for info->tx_time_est, return a minimum of 4us.
>
> Fixes: f01cfbaf9b29 ("mac80211: improve AQL aggregation estimation for low data rates")
> Signed-off-by: Felix Fietkau <nbd@nbd.name>

Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>


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

* Re: [PATCH 5.9 v2 2/2] mac80211: add AQL support for VHT160 tx rates
  2020-09-15  8:59 ` [PATCH 5.9 v2 2/2] mac80211: add AQL support for VHT160 tx rates Felix Fietkau
@ 2020-09-15  9:24   ` Toke Høiland-Jørgensen
  0 siblings, 0 replies; 4+ messages in thread
From: Toke Høiland-Jørgensen @ 2020-09-15  9:24 UTC (permalink / raw)
  To: Felix Fietkau, linux-wireless; +Cc: johannes

Felix Fietkau <nbd@nbd.name> writes:

> When converting from struct ieee80211_tx_rate to ieee80211_rx_status,
> there was one check missing to fill in the bandwidth for 160 MHz
>
> Signed-off-by: Felix Fietkau <nbd@nbd.name>

Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>


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

end of thread, other threads:[~2020-09-15  9:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-15  8:59 [PATCH 5.9 v2 1/2] mac80211: extend AQL aggregation estimation to HE and fix unit mismatch Felix Fietkau
2020-09-15  8:59 ` [PATCH 5.9 v2 2/2] mac80211: add AQL support for VHT160 tx rates Felix Fietkau
2020-09-15  9:24   ` Toke Høiland-Jørgensen
2020-09-15  9:24 ` [PATCH 5.9 v2 1/2] mac80211: extend AQL aggregation estimation to HE and fix unit mismatch Toke Høiland-Jørgensen

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).