reorder patches
[openwrt-10.03/.git] / package / madwifi / patches / 345-minstrel_sampling.patch
1 Index: madwifi-trunk-r3314/ath/if_ath.c
2 ===================================================================
3 --- madwifi-trunk-r3314.orig/ath/if_ath.c       2008-04-21 02:44:23.000000000 +0200
4 +++ madwifi-trunk-r3314/ath/if_ath.c    2008-04-21 03:33:02.000000000 +0200
5 @@ -8095,6 +8095,7 @@
6                 ath_hal_setupxtxdesc(sc->sc_ah, ds, mrr.rate1, mrr.retries1,
7                                      mrr.rate2, mrr.retries2,
8                                      mrr.rate3, mrr.retries3);
9 +               bf->rcflags = mrr.privflags;
10         }
11  
12  #ifndef ATH_SUPERG_FF
13 Index: madwifi-trunk-r3314/ath/if_athvar.h
14 ===================================================================
15 --- madwifi-trunk-r3314.orig/ath/if_athvar.h    2008-04-21 00:50:13.000000000 +0200
16 +++ madwifi-trunk-r3314/ath/if_athvar.h 2008-04-21 03:31:48.000000000 +0200
17 @@ -446,6 +446,7 @@
18         u_int16_t bf_flags;                             /* tx descriptor flags */
19         u_int64_t bf_tsf;
20         int16_t bf_channoise;
21 +       unsigned int rcflags;
22  #ifdef ATH_SUPERG_FF
23         /* XXX: combine this with bf_skbaddr if it ever changes to accommodate
24          *      multiple segments.
25 Index: madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c
26 ===================================================================
27 --- madwifi-trunk-r3314.orig/ath_rate/minstrel/minstrel.c       2008-04-21 02:50:31.000000000 +0200
28 +++ madwifi-trunk-r3314/ath_rate/minstrel/minstrel.c    2008-04-21 04:08:36.000000000 +0200
29 @@ -336,7 +336,7 @@
30                         sn->packet_count++;
31                         sn->random_n = (sn->a * sn->random_n) + sn->b;
32                         offset = sn->random_n & 0xf;
33 -                       if ((((100 * sn->sample_count) / (sn->sample_count + sn->packet_count)) < ath_lookaround_rate) && (offset < 2)) {
34 +                       if ((((100 * sn->sample_count) / (sn->packet_count ?: 1)) < ath_lookaround_rate) && (offset < 2)) {
35                                 sn->sample_count++;
36                                 sn->is_sampling = 1;
37                                 if (sn->packet_count >= 10000) {
38 @@ -398,11 +398,14 @@
39                 if (sn->num_rates <= 0)
40                         return;
41  
42 +               mrr->privflags = sn->is_sampling;
43                 if (sn->is_sampling) {
44                         sn->is_sampling = 0;
45 -                       if (sn->rs_sample_rate_slower)
46 +                       if (sn->rs_sample_rate_slower) {
47                                 rc1 = sn->rs_sample_rate;
48 -                       else
49 +                               if (sn->sample_count > 0)
50 +                                       sn->sample_count--;
51 +                       } else
52                                 rc1 = sn->max_tp_rate;
53                 } else {
54                         rc1 = sn->max_tp_rate2;
55 @@ -525,6 +528,9 @@
56                 if (tries <= tries1)
57                         return;
58  
59 +               if (bf->rcflags)
60 +                       sn->sample_count++;
61 +
62                 if  (tries2 < 0)
63                         return;
64                 tries = tries - tries1;
65 Index: madwifi-trunk-r3314/net80211/ieee80211_rate.h
66 ===================================================================
67 --- madwifi-trunk-r3314.orig/net80211/ieee80211_rate.h  2008-01-31 03:29:42.000000000 +0100
68 +++ madwifi-trunk-r3314/net80211/ieee80211_rate.h       2008-04-21 03:30:25.000000000 +0200
69 @@ -87,6 +87,7 @@
70         int retries2;
71         int rate3;
72         int retries3;
73 +       int privflags;
74  };
75  
76  struct ieee80211_rate_ops {