mac80211: update brcmfmac including missing boardrev workaround
[openwrt.git] / package / kernel / mac80211 / patches / 330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch
1 From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
2 Date: Tue, 2 Feb 2016 08:12:26 +0100
3 Subject: [PATCH] mac80211: minstrel: Change expected throughput unit back to
4  Kbps
5
6 The change from cur_tp to the function
7 minstrel_get_tp_avg/minstrel_ht_get_tp_avg changed the unit used for the
8 current throughput. For example in minstrel_ht the correct
9 conversion between them would be:
10
11     mrs->cur_tp / 10 == minstrel_ht_get_tp_avg(..).
12
13 This factor 10 must also be included in the calculation of
14 minstrel_get_expected_throughput and minstrel_ht_get_expected_throughput to
15 return values with the unit [Kbps] instead of [10Kbps]. Otherwise routing
16 algorithms like B.A.T.M.A.N. V will make incorrect decision based on these
17 values. Its kernel based implementation expects expected_throughput always
18 to have the unit [Kbps] and not sometimes [10Kbps] and sometimes [Kbps].
19
20 The same requirement has iw or olsrdv2's nl80211 based statistics module
21 which retrieve the same data via NL80211_STA_INFO_TX_BITRATE.
22
23 Cc: stable@vger.kernel.org
24 Fixes: 6a27b2c40b48 ("mac80211: restructure per-rate throughput calculation into function")
25 Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
26 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
27 ---
28
29 --- a/net/mac80211/rc80211_minstrel.c
30 +++ b/net/mac80211/rc80211_minstrel.c
31 @@ -711,7 +711,7 @@ static u32 minstrel_get_expected_through
32          * computing cur_tp
33          */
34         tmp_mrs = &mi->r[idx].stats;
35 -       tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma);
36 +       tmp_cur_tp = minstrel_get_tp_avg(&mi->r[idx], tmp_mrs->prob_ewma) * 10;
37         tmp_cur_tp = tmp_cur_tp * 1200 * 8 / 1024;
38  
39         return tmp_cur_tp;
40 --- a/net/mac80211/rc80211_minstrel_ht.c
41 +++ b/net/mac80211/rc80211_minstrel_ht.c
42 @@ -1335,7 +1335,8 @@ static u32 minstrel_ht_get_expected_thro
43         prob = mi->groups[i].rates[j].prob_ewma;
44  
45         /* convert tp_avg from pkt per second in kbps */
46 -       tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * AVG_PKT_SIZE * 8 / 1024;
47 +       tp_avg = minstrel_ht_get_tp_avg(mi, i, j, prob) * 10;
48 +       tp_avg = tp_avg * AVG_PKT_SIZE * 8 / 1024;
49  
50         return tp_avg;
51  }