refresh madwifi patches, fix an issue with napi polling (thx SeG)
[openwrt/svn-archive/archive.git] / package / madwifi / patches / 305-pureg_fix.patch
1 Index: madwifi-trunk-r3314/ath/if_ath.c
2 ===================================================================
3 --- madwifi-trunk-r3314.orig/ath/if_ath.c 2008-02-20 21:57:41.025078273 +0100
4 +++ madwifi-trunk-r3314/ath/if_ath.c 2008-02-20 21:57:44.393270217 +0100
5 @@ -4146,7 +4146,9 @@
6 rfilt |= HAL_RX_FILTER_PROM;
7 if (ic->ic_opmode == IEEE80211_M_STA ||
8 sc->sc_opmode == HAL_M_IBSS || /* NB: AHDEMO too */
9 - (sc->sc_nostabeacons) || sc->sc_scanning)
10 + (sc->sc_nostabeacons) || sc->sc_scanning ||
11 + ((ic->ic_opmode == IEEE80211_M_HOSTAP) &&
12 + (ic->ic_protmode != IEEE80211_PROT_NONE)))
13 rfilt |= HAL_RX_FILTER_BEACON;
14 if (sc->sc_nmonvaps > 0)
15 rfilt |= (HAL_RX_FILTER_CONTROL | HAL_RX_FILTER_BEACON |
16 Index: madwifi-trunk-r3314/net80211/ieee80211_input.c
17 ===================================================================
18 --- madwifi-trunk-r3314.orig/net80211/ieee80211_input.c 2008-02-20 21:57:41.037078957 +0100
19 +++ madwifi-trunk-r3314/net80211/ieee80211_input.c 2008-02-20 21:57:44.401270672 +0100
20 @@ -346,11 +346,12 @@
21 bssid = wh->i_addr3;
22 }
23 /*
24 - * Validate the bssid.
25 + * Validate the bssid. Let beacons get through though for 11g protection mode.
26 */
27 -#ifdef ATH_SUPERG_XR
28 if (!IEEE80211_ADDR_EQ(bssid, vap->iv_bssid) &&
29 - !IEEE80211_ADDR_EQ(bssid, dev->broadcast)) {
30 + !IEEE80211_ADDR_EQ(bssid, dev->broadcast) &&
31 + (subtype != IEEE80211_FC0_SUBTYPE_BEACON)) {
32 +#ifdef ATH_SUPERG_XR
33 /*
34 * allow MGT frames to vap->iv_xrvap.
35 * this will allow roaming between XR and normal vaps
36 @@ -366,18 +367,14 @@
37 vap->iv_stats.is_rx_wrongbss++;
38 goto out;
39 }
40 - }
41 #else
42 - if (!IEEE80211_ADDR_EQ(bssid, vap->iv_bssid) &&
43 - !IEEE80211_ADDR_EQ(bssid, dev->broadcast)) {
44 /* not interested in */
45 IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
46 bssid, NULL, "%s", "not to bss");
47 vap->iv_stats.is_rx_wrongbss++;
48 goto out;
49 - }
50 -
51 #endif
52 + }
53 break;
54 case IEEE80211_M_WDS:
55 if (skb->len < sizeof(struct ieee80211_frame_addr4)) {
56 @@ -3066,7 +3063,7 @@
57 u_int8_t *frm, *efrm;
58 u_int8_t *ssid, *rates, *xrates, *suppchan, *wpa, *rsn, *wme, *ath;
59 u_int8_t rate;
60 - int reassoc, resp, allocbs = 0;
61 + int reassoc, resp, allocbs = 0, has_erp = 0;
62 u_int8_t qosinfo;
63
64 if (ni_or_null == NULL)
65 @@ -3096,11 +3093,15 @@
66 * o station mode when associated (to collect state
67 * updates such as 802.11g slot time), or
68 * o adhoc mode (to discover neighbors)
69 + * o ap mode in protection mode (beacons only)
70 * Frames otherwise received are discarded.
71 */
72 if (!((ic->ic_flags & IEEE80211_F_SCAN) ||
73 (vap->iv_opmode == IEEE80211_M_STA && ni->ni_associd) ||
74 - vap->iv_opmode == IEEE80211_M_IBSS)) {
75 + (vap->iv_opmode == IEEE80211_M_IBSS) ||
76 + ((subtype == IEEE80211_FC0_SUBTYPE_BEACON) &&
77 + (vap->iv_opmode == IEEE80211_M_HOSTAP) &&
78 + (ic->ic_protmode != IEEE80211_PROT_NONE)))) {
79 vap->iv_stats.is_rx_mgtdiscard++;
80 return;
81 }
82 @@ -3184,6 +3185,7 @@
83 break;
84 }
85 scan.erp = frm[2];
86 + has_erp = 1;
87 break;
88 case IEEE80211_ELEMID_RSN:
89 scan.rsn = frm;
90 @@ -3421,6 +3423,20 @@
91 ieee80211_bg_scan(vap);
92 return;
93 }
94 +
95 + /* Update AP protection mode when in 11G mode */
96 + if ((vap->iv_opmode == IEEE80211_M_HOSTAP) &&
97 + IEEE80211_IS_CHAN_ANYG(ic->ic_curchan)) {
98 +
99 + /* Assume no ERP IE == 11b AP */
100 + if ((!has_erp || (has_erp && (scan.erp & IEEE80211_ERP_NON_ERP_PRESENT))) &&
101 + !(ic->ic_flags & IEEE80211_F_USEPROT)) {
102 +
103 + ic->ic_flags |= IEEE80211_F_USEPROT;
104 + ic->ic_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
105 + }
106 + }
107 +
108 /*
109 * If scanning, just pass information to the scan module.
110 */
111 Index: madwifi-trunk-r3314/net80211/ieee80211_node.c
112 ===================================================================
113 --- madwifi-trunk-r3314.orig/net80211/ieee80211_node.c 2008-02-20 21:56:33.629237604 +0100
114 +++ madwifi-trunk-r3314/net80211/ieee80211_node.c 2008-02-20 21:57:44.409271127 +0100
115 @@ -383,10 +383,16 @@
116 /* Update country ie information */
117 ieee80211_build_countryie(ic);
118
119 - if (IEEE80211_IS_CHAN_HALF(chan))
120 + if (IEEE80211_IS_CHAN_HALF(chan)) {
121 ni->ni_rates = ic->ic_sup_half_rates;
122 - else if (IEEE80211_IS_CHAN_QUARTER(chan))
123 + } else if (IEEE80211_IS_CHAN_QUARTER(chan)) {
124 ni->ni_rates = ic->ic_sup_quarter_rates;
125 + }
126 +
127 + if ((vap->iv_flags & IEEE80211_F_PUREG) &&
128 + IEEE80211_IS_CHAN_ANYG(chan)) {
129 + ieee80211_setpuregbasicrates(&ni->ni_rates);
130 + }
131
132 (void) ieee80211_sta_join1(PASS_NODE(ni));
133 }
134 Index: madwifi-trunk-r3314/net80211/ieee80211_proto.c
135 ===================================================================
136 --- madwifi-trunk-r3314.orig/net80211/ieee80211_proto.c 2008-02-20 21:56:33.633237829 +0100
137 +++ madwifi-trunk-r3314/net80211/ieee80211_proto.c 2008-02-20 21:57:44.413271357 +0100
138 @@ -595,6 +595,28 @@
139 { 4, { 2, 4, 11, 22 } }, /* IEEE80211_MODE_TURBO_G (mixed b/g) */
140 };
141
142 +static const struct ieee80211_rateset basicpureg[] = {
143 + { 7, {2, 4, 11, 22, 12, 24, 48 } },
144 +};
145 +
146 +/*
147 + * Mark basic rates for the 11g rate table based on the pureg setting
148 + */
149 +void
150 +ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs)
151 +{
152 + int i, j;
153 +
154 + for (i = 0; i < rs->rs_nrates; i++) {
155 + rs->rs_rates[i] &= IEEE80211_RATE_VAL;
156 + for (j = 0; j < basicpureg[0].rs_nrates; j++)
157 + if (basicpureg[0].rs_rates[j] == rs->rs_rates[i]) {
158 + rs->rs_rates[i] |= IEEE80211_RATE_BASIC;
159 + break;
160 + }
161 + }
162 +}
163 +
164 /*
165 * Mark the basic rates for the 11g rate table based on the
166 * specified mode. For 11b compatibility we mark only 11b
167 Index: madwifi-trunk-r3314/net80211/ieee80211_var.h
168 ===================================================================
169 --- madwifi-trunk-r3314.orig/net80211/ieee80211_var.h 2008-02-20 21:56:33.645238517 +0100
170 +++ madwifi-trunk-r3314/net80211/ieee80211_var.h 2008-02-20 21:57:44.417271583 +0100
171 @@ -707,6 +707,7 @@
172 void ieee80211_build_sc_ie(struct ieee80211com *);
173 void ieee80211_dfs_action(struct ieee80211com *);
174 void ieee80211_expire_channel_excl_restrictions(struct ieee80211com *);
175 +void ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs);
176
177 /*
178 * Iterate through ic_channels to enumerate all distinct ic_ieee channel numbers.