8e7b6066a87b875627dc841a705686e3cc5b1f6b
[openwrt/svn-archive/archive.git] / package / madwifi / patches-testing / 308-minrate.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -1300,6 +1300,7 @@
4 vap->iv_key_update_begin = ath_key_update_begin;
5 vap->iv_key_update_end = ath_key_update_end;
6 vap->iv_maxrateindex = 0;
7 + vap->iv_minrateindex = 0;
8 if (sc->sc_default_ieee80211_debug) {
9 /* User specified defaults for new VAPs were provided, so
10 * use those (only). */
11 --- a/ath_rate/minstrel/minstrel.c
12 +++ b/ath_rate/minstrel/minstrel.c
13 @@ -652,6 +652,8 @@
14
15 sn->num_rates = ni->ni_rates.rs_nrates;
16 for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
17 + int idx = x;
18 +
19 sn->rs_rateattempts [x] = 0;
20 sn->rs_thisprob [x] = 0;
21 sn->rs_ratesuccess [x] = 0;
22 @@ -662,8 +664,12 @@
23 sn->rs_att_hist [x] = 0;
24 sn->rs_this_tp [x] = 0;
25
26 - sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL;
27 - sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
28 + if (vap->iv_minrateindex && (vap->iv_minrateindex <
29 + ni->ni_rates.rs_nrates))
30 + idx = vap->iv_minrateindex;
31 +
32 + sn->rates[x].rate = ni->ni_rates.rs_rates[idx] & IEEE80211_RATE_VAL;
33 + sn->rates[x].rix = sc->sc_rixmap[sn->rates[idx].rate];
34 if (sn->rates[x].rix == 0xff) {
35 DPRINTF(sc, "%s: %s ignore bogus rix at %d\n",
36 dev_info, __func__, x);
37 --- a/ath_rate/sample/sample.c
38 +++ b/ath_rate/sample/sample.c
39 @@ -845,8 +845,15 @@
40 sn->num_rates = vap->iv_maxrateindex;
41
42 for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
43 - sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL;
44 - sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
45 + int idx = x;
46 +
47 + if (vap->iv_minrateindex && vap->iv_minrateindex <
48 + ni->ni_rates.rs_nrates)
49 + idx = vap->iv_minrateindex;
50 +
51 + sn->rates[x].rate = ni->ni_rates.rs_rates[idx] & IEEE80211_RATE_VAL;
52 + sn->rates[x].rix = sc->sc_rixmap[sn->rates[idx].rate];
53 +
54 if (sn->rates[x].rix == 0xff) {
55 DPRINTF(sc, ATH_DEBUG_RATE, "%s: %s ignore bogus rix at %u\n",
56 dev_info, __func__, x);
57 --- a/net80211/ieee80211_ioctl.h
58 +++ b/net80211/ieee80211_ioctl.h
59 @@ -651,6 +651,7 @@
60 IEEE80211_PARAM_SCANBUFS = 81, /* Heap analysis for TX DMA */
61 IEEE80211_PARAM_LEAKTXBUFS = 82, /* Leak tx buffers */
62 IEEE80211_PARAM_MAXRATE = 83, /* Maximum rate (by table index) */
63 + IEEE80211_PARAM_MINRATE = 84, /* Minimum rate (by table index) */
64 };
65
66 #define SIOCG80211STATS (SIOCDEVPRIVATE+2)
67 --- a/net80211/ieee80211_var.h
68 +++ b/net80211/ieee80211_var.h
69 @@ -292,6 +292,7 @@
70 struct ieee80211_app_ie app_ie[IEEE80211_APPIE_NUM_OF_FRAME]; /* app-specified IEs by frame type */
71 u_int32_t app_filter; /* filters which management frames are forwarded to app */
72 int iv_maxrateindex;
73 + int iv_minrateindex;
74 };
75
76 /* Debug functions need the defintion of struct ieee80211vap because iv_debug
77 --- a/net80211/ieee80211_wireless.c
78 +++ b/net80211/ieee80211_wireless.c
79 @@ -2879,6 +2879,12 @@
80 else
81 vap->iv_maxrateindex = 0;
82 break;
83 + case IEEE80211_PARAM_MINRATE:
84 + if (value > 0)
85 + vap->iv_minrateindex = value;
86 + else
87 + vap->iv_minrateindex = 0;
88 + break;
89 #ifdef ATH_REVERSE_ENGINEERING
90 case IEEE80211_PARAM_DUMPREGS:
91 ieee80211_dump_registers(dev, info, w, extra);
92 @@ -3220,6 +3226,9 @@
93 case IEEE80211_PARAM_MAXRATE:
94 param[0] = vap->iv_maxrateindex;
95 break;
96 + case IEEE80211_PARAM_MINRATE:
97 + param[0] = vap->iv_minrateindex;
98 + break;
99 default:
100 return -EOPNOTSUPP;
101 }
102 @@ -5679,6 +5688,10 @@
103 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "maxrate"},
104 {IEEE80211_PARAM_MAXRATE,
105 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_maxrate"},
106 + {IEEE80211_PARAM_MINRATE,
107 + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "minrate"},
108 + {IEEE80211_PARAM_MINRATE,
109 + 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_minrate"},
110
111 #ifdef ATH_REVERSE_ENGINEERING
112 /*