[package] iwinfo: populate tx power offsets for most ubnt devices, add NSM2/5 and...
[openwrt.git] / package / madwifi / patches / 345-minstrel_sampling.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -8103,6 +8103,7 @@ ath_tx_start(struct net_device *dev, str
4 ath_hal_setupxtxdesc(sc->sc_ah, ds, mrr.rate1, mrr.retries1,
5 mrr.rate2, mrr.retries2,
6 mrr.rate3, mrr.retries3);
7 + bf->rcflags = mrr.privflags;
8 }
9
10 #ifndef ATH_SUPERG_FF
11 --- a/ath/if_athvar.h
12 +++ b/ath/if_athvar.h
13 @@ -446,6 +446,7 @@ struct ath_buf {
14 u_int16_t bf_flags; /* tx descriptor flags */
15 u_int64_t bf_tsf;
16 int16_t bf_channoise;
17 + unsigned int rcflags;
18 #ifdef ATH_SUPERG_FF
19 /* XXX: combine this with bf_skbaddr if it ever changes to accommodate
20 * multiple segments.
21 --- a/ath_rate/minstrel/minstrel.c
22 +++ b/ath_rate/minstrel/minstrel.c
23 @@ -333,15 +333,19 @@ ath_rate_findrate(struct ath_softc *sc,
24 if (sn->static_rate_ndx >= 0) {
25 ndx = sn->static_rate_ndx;
26 } else {
27 + int delta;
28 sn->packet_count++;
29 sn->random_n = (sn->a * sn->random_n) + sn->b;
30 offset = sn->random_n & 0xf;
31 - if ((((100 * sn->sample_count) / (sn->sample_count + sn->packet_count)) < ath_lookaround_rate) && (offset < 2)) {
32 + delta = (sn->packet_count * ath_lookaround_rate / 100) - sn->sample_count;
33 + if ((delta > 0) && (offset < 2)) {
34 sn->sample_count++;
35 sn->is_sampling = 1;
36 if (sn->packet_count >= 10000) {
37 sn->sample_count = 0;
38 sn->packet_count = 0;
39 + } else if (delta > sn->num_rates * 2) {
40 + sn->sample_count += ((delta - sn->num_rates * 2) * ath_lookaround_rate) / 100;
41 }
42
43 /* Don't look for slowest rate (i.e. slowest
44 @@ -398,11 +402,14 @@ ath_rate_get_mrr(struct ath_softc *sc, s
45 if (sn->num_rates <= 0)
46 return;
47
48 + mrr->privflags = sn->is_sampling;
49 if (sn->is_sampling) {
50 sn->is_sampling = 0;
51 - if (sn->rs_sample_rate_slower)
52 + if (sn->rs_sample_rate_slower) {
53 rc1 = sn->rs_sample_rate;
54 - else
55 + if (sn->sample_count > 0)
56 + sn->sample_count--;
57 + } else
58 rc1 = sn->max_tp_rate;
59 } else {
60 rc1 = sn->max_tp_rate2;
61 @@ -525,6 +532,9 @@ ath_rate_tx_complete(struct ath_softc *s
62 if (tries <= tries1)
63 return;
64
65 + if (bf->rcflags)
66 + sn->sample_count++;
67 +
68 if (tries2 < 0)
69 return;
70 tries = tries - tries1;
71 --- a/net80211/ieee80211_rate.h
72 +++ b/net80211/ieee80211_rate.h
73 @@ -87,6 +87,7 @@ struct ieee80211_mrr {
74 int retries2;
75 int rate3;
76 int retries3;
77 + int privflags;
78 };
79
80 struct ieee80211_rate_ops {
This page took 0.0448190000000001 seconds and 5 git commands to generate.