mac80211: update brcmfmac including missing boardrev workaround
[openwrt.git] / package / kernel / mac80211 / patches / 335-mac80211-minstrel_ht-set-A-MSDU-tx-limits-based-on-s.patch
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
4  max_prob_rate
5
6 Prevents excessive A-MSDU aggregation at low data rates or bad
7 conditions.
8
9 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
10 ---
11
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;
16  }
17  
18 +static int
19 +minstrel_ht_get_max_amsdu_len(struct minstrel_ht_sta *mi)
20 +{
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;
24 +
25 +       /* Disable A-MSDU if max_prob_rate is bad */
26 +       if (mi->groups[group].rates[rate].prob_ewma < MINSTREL_FRAC(50, 100))
27 +               return 1;
28 +
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))
31 +               return 500;
32 +
33 +       /*
34 +        * If the rate is slower than single-stream MCS4, limit A-MSDU to usual
35 +        * data packet size
36 +        */
37 +       if (g->duration[rate] > MCS_DURATION(1, 0, 104))
38 +               return 1500;
39 +
40 +       /*
41 +        * If the rate is slower than single-stream MCS7, limit A-MSDU to twice
42 +        * the usual data packet size
43 +        */
44 +       if (g->duration[rate] > MCS_DURATION(1, 0, 260))
45 +               return 3000;
46 +
47 +       /* unlimited */
48 +       return 0;
49 +}
50 +
51  static void
52  minstrel_ht_update_rates(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
53  {
54 @@ -907,6 +940,7 @@ minstrel_ht_update_rates(struct minstrel
55                 minstrel_ht_set_rate(mp, mi, rates, i++, mi->max_prob_rate);
56         }
57  
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);
61  }