330-mac80211-minstrel-Change-expected-throughput-unit-ba.patch 2.0 KB

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