madwifi: fix crash on 2.6.30
[openwrt.git] / package / madwifi / patches / 340-maxrate.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -1307,6 +1307,7 @@ ath_vap_create(struct ieee80211com *ic,
4 vap->iv_key_set = ath_key_set;
5 vap->iv_key_update_begin = ath_key_update_begin;
6 vap->iv_key_update_end = ath_key_update_end;
7 + vap->iv_maxrateindex = 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 @@ -622,8 +622,12 @@ ath_rate_ctl_reset(struct ath_softc *sc,
14 return;
15 }
16 sn->static_rate_ndx = -1;
17 + if (vap->iv_maxrateindex == 0 || ni->ni_rates.rs_nrates <= 0
18 + || vap->iv_maxrateindex > ni->ni_rates.rs_nrates)
19 + sn->num_rates = ni->ni_rates.rs_nrates;
20 + else
21 + sn->num_rates = vap->iv_maxrateindex;
22
23 - sn->num_rates = ni->ni_rates.rs_nrates;
24 for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
25 sn->rs_rateattempts [x] = 0;
26 sn->rs_thisprob [x] = 0;
27 --- a/ath_rate/sample/sample.c
28 +++ b/ath_rate/sample/sample.c
29 @@ -835,7 +835,12 @@ ath_rate_ctl_reset(struct ath_softc *sc,
30 }
31 sn->static_rate_ndx = -1;
32
33 - sn->num_rates = ni->ni_rates.rs_nrates;
34 + if (vap->iv_maxrateindex == 0 || ni->ni_rates.rs_nrates <= 0
35 + || vap->iv_maxrateindex > ni->ni_rates.rs_nrates)
36 + sn->num_rates = ni->ni_rates.rs_nrates;
37 + else
38 + sn->num_rates = vap->iv_maxrateindex;
39 +
40 for (x = 0; x < ni->ni_rates.rs_nrates; x++) {
41 sn->rates[x].rate = ni->ni_rates.rs_rates[x] & IEEE80211_RATE_VAL;
42 sn->rates[x].rix = sc->sc_rixmap[sn->rates[x].rate];
43 --- a/net80211/ieee80211_ioctl.h
44 +++ b/net80211/ieee80211_ioctl.h
45 @@ -641,6 +641,7 @@ enum {
46 FCC requires 30m, so that is the default. */
47 IEEE80211_PARAM_BEACON_MISS_THRESH = 73, /* Beacon miss threshold (in beacons) */
48 IEEE80211_PARAM_BEACON_MISS_THRESH_MS = 74, /* Beacon miss threshold (in ms) */
49 + IEEE80211_PARAM_MAXRATE = 75, /* Maximum rate (by table index) */
50 };
51
52 #define SIOCG80211STATS (SIOCDEVPRIVATE+2)
53 --- a/net80211/ieee80211_var.h
54 +++ b/net80211/ieee80211_var.h
55 @@ -281,6 +281,7 @@ struct ieee80211vap {
56 struct ieee80211_spy iv_spy; /* IWSPY support */
57 struct ieee80211_app_ie app_ie[IEEE80211_APPIE_NUM_OF_FRAME]; /* app-specified IEs by frame type */
58 u_int32_t app_filter; /* filters which management frames are forwarded to app */
59 + u_int iv_maxrateindex;
60 };
61
62 /* Debug functions need the defintion of struct ieee80211vap because iv_debug
63 --- a/net80211/ieee80211_wireless.c
64 +++ b/net80211/ieee80211_wireless.c
65 @@ -2839,6 +2839,12 @@ ieee80211_ioctl_setparam(struct net_devi
66 else
67 ic->ic_flags_ext &= ~IEEE80211_FEXT_MARKDFS;
68 break;
69 + case IEEE80211_PARAM_MAXRATE:
70 + if (value > 0)
71 + vap->iv_maxrateindex = value;
72 + else
73 + vap->iv_maxrateindex = 0;
74 + break;
75 #ifdef ATH_REVERSE_ENGINEERING
76 case IEEE80211_PARAM_DUMPREGS:
77 ieee80211_dump_registers(dev, info, w, extra);
78 @@ -3174,6 +3180,9 @@ ieee80211_ioctl_getparam(struct net_devi
79 else
80 param[0] = 0;
81 break;
82 + case IEEE80211_PARAM_MAXRATE:
83 + param[0] = vap->iv_maxrateindex;
84 + break;
85 default:
86 return -EOPNOTSUPP;
87 }
88 @@ -5610,6 +5619,10 @@ static const struct iw_priv_args ieee802
89 0, IW_PRIV_TYPE_APPIEBUF, "getiebuf" },
90 { IEEE80211_IOCTL_FILTERFRAME,
91 IW_PRIV_TYPE_FILTER , 0, "setfilter" },
92 + {IEEE80211_PARAM_MAXRATE,
93 + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "maxrate"},
94 + {IEEE80211_PARAM_MAXRATE,
95 + 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_maxrate"},
96
97 #ifdef ATH_REVERSE_ENGINEERING
98 /*
This page took 0.042324 seconds and 5 git commands to generate.