1 From: Felix Fietkau <nbd@openwrt.org>
2 Date: Thu, 18 Feb 2016 19:30:05 +0100
3 Subject: [PATCH] mac80211: minstrel_ht: set A-MSDU tx limits based on selected
6 Prevents excessive A-MSDU aggregation at low data rates or bad
9 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
12 --- a/net/mac80211/rc80211_minstrel_ht.c
13 +++ b/net/mac80211/rc80211_minstrel_ht.c
14 @@ -883,6 +883,39 @@ minstrel_ht_set_rate(struct minstrel_pri
15 ratetbl->rate[offset].flags = flags;
19 +minstrel_ht_get_max_amsdu_len(struct minstrel_ht_sta *mi)
21 + int group = mi->max_prob_rate / MCS_GROUP_RATES;
22 + const struct mcs_group *g = &minstrel_mcs_groups[group];
23 + int rate = mi->max_prob_rate % MCS_GROUP_RATES;
25 + /* Disable A-MSDU if max_prob_rate is bad */
26 + if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100))
29 + /* If the rate is slower than single-stream MCS1, make A-MSDU limit small */
30 + if (g->duration[rate] > MCS_DURATION(1, 0, 52))
34 + * If the rate is slower than single-stream MCS4, limit A-MSDU to usual
37 + if (g->duration[rate] > MCS_DURATION(1, 0, 104))
41 + * If the rate is slower than single-stream MCS7, limit A-MSDU to twice
42 + * the usual data packet size
44 + if (g->duration[rate] > MCS_DURATION(1, 0, 260))
52 minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
54 @@ -907,6 +940,7 @@ minstrel_ht_update_rates(struct minstrel
55 minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate);
58 + mi->sta->max_rc_amsdu_len = minstrel_ht_get_max_amsdu_len(mi);
59 rates->rate[i].idx = -1;
60 rate_control_set_rates(mp->hw, mi->sta, rates);