[package] mac80211: refresh patches
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 300-pending_work.patch
1 --- a/drivers/net/wireless/ath/ath5k/base.c
2 +++ b/drivers/net/wireless/ath/ath5k/base.c
3 @@ -325,6 +325,8 @@ ath5k_setup_channels(struct ath5k_hw *ah
4 if (!ath5k_is_standard_channel(ch, band))
5 continue;
6
7 + channels[count].max_power = AR5K_TUNE_MAX_TXPOWER/2;
8 +
9 count++;
10 }
11
12 --- a/net/mac80211/agg-rx.c
13 +++ b/net/mac80211/agg-rx.c
14 @@ -203,6 +203,8 @@ static void ieee80211_send_addba_resp(st
15 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
16 else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
17 memcpy(mgmt->bssid, sdata->u.ibss.bssid, ETH_ALEN);
18 + else if (sdata->vif.type == NL80211_IFTYPE_WDS)
19 + memcpy(mgmt->bssid, da, ETH_ALEN);
20
21 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
22 IEEE80211_STYPE_ACTION);
23 --- a/net/mac80211/agg-tx.c
24 +++ b/net/mac80211/agg-tx.c
25 @@ -81,7 +81,8 @@ static void ieee80211_send_addba_request
26 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
27 if (sdata->vif.type == NL80211_IFTYPE_AP ||
28 sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
29 - sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
30 + sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
31 + sdata->vif.type == NL80211_IFTYPE_WDS)
32 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
33 else if (sdata->vif.type == NL80211_IFTYPE_STATION)
34 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN);
35 @@ -460,6 +461,7 @@ int ieee80211_start_tx_ba_session(struct
36 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
37 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
38 sdata->vif.type != NL80211_IFTYPE_AP &&
39 + sdata->vif.type != NL80211_IFTYPE_WDS &&
40 sdata->vif.type != NL80211_IFTYPE_ADHOC)
41 return -EINVAL;
42
43 @@ -869,7 +871,7 @@ void ieee80211_process_addba_resp(struct
44
45 } else {
46 ___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR,
47 - true);
48 + false);
49 }
50
51 out:
52 --- a/net/mac80211/debugfs_sta.c
53 +++ b/net/mac80211/debugfs_sta.c
54 @@ -63,11 +63,11 @@ static ssize_t sta_flags_read(struct fil
55 test_sta_flag(sta, WLAN_STA_##flg) ? #flg "\n" : ""
56
57 int res = scnprintf(buf, sizeof(buf),
58 - "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
59 + "%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
60 TEST(AUTH), TEST(ASSOC), TEST(PS_STA),
61 TEST(PS_DRIVER), TEST(AUTHORIZED),
62 TEST(SHORT_PREAMBLE),
63 - TEST(WME), TEST(WDS), TEST(CLEAR_PS_FILT),
64 + TEST(WME), TEST(CLEAR_PS_FILT),
65 TEST(MFP), TEST(BLOCK_BA), TEST(PSPOLL),
66 TEST(UAPSD), TEST(SP), TEST(TDLS_PEER),
67 TEST(TDLS_PEER_AUTH), TEST(4ADDR_EVENT),
68 --- a/net/mac80211/iface.c
69 +++ b/net/mac80211/iface.c
70 @@ -420,7 +420,6 @@ int ieee80211_do_open(struct wireless_de
71 struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
72 struct net_device *dev = wdev->netdev;
73 struct ieee80211_local *local = sdata->local;
74 - struct sta_info *sta;
75 u32 changed = 0;
76 int res;
77 u32 hw_reconf_flags = 0;
78 @@ -575,30 +574,8 @@ int ieee80211_do_open(struct wireless_de
79
80 set_bit(SDATA_STATE_RUNNING, &sdata->state);
81
82 - if (sdata->vif.type == NL80211_IFTYPE_WDS) {
83 - /* Create STA entry for the WDS peer */
84 - sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
85 - GFP_KERNEL);
86 - if (!sta) {
87 - res = -ENOMEM;
88 - goto err_del_interface;
89 - }
90 -
91 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
92 - sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
93 - sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
94 -
95 - res = sta_info_insert(sta);
96 - if (res) {
97 - /* STA has been freed */
98 - goto err_del_interface;
99 - }
100 -
101 - rate_control_rate_init(sta);
102 - netif_carrier_on(dev);
103 - } else if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE) {
104 + if (sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE)
105 rcu_assign_pointer(local->p2p_sdata, sdata);
106 - }
107
108 /*
109 * set_multicast_list will be invoked by the networking core
110 @@ -997,6 +974,72 @@ static void ieee80211_if_setup(struct ne
111 dev->destructor = free_netdev;
112 }
113
114 +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
115 + struct sk_buff *skb)
116 +{
117 + struct ieee80211_local *local = sdata->local;
118 + struct ieee80211_rx_status *rx_status;
119 + struct ieee802_11_elems elems;
120 + struct ieee80211_mgmt *mgmt;
121 + struct sta_info *sta;
122 + size_t baselen;
123 + u32 rates = 0;
124 + u16 stype;
125 + bool new = false;
126 + enum ieee80211_band band = local->hw.conf.channel->band;
127 + struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
128 +
129 + rx_status = IEEE80211_SKB_RXCB(skb);
130 + mgmt = (struct ieee80211_mgmt *) skb->data;
131 + stype = le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE;
132 +
133 + if (stype != IEEE80211_STYPE_BEACON)
134 + return;
135 +
136 + baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
137 + if (baselen > skb->len)
138 + return;
139 +
140 + ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
141 + skb->len - baselen, &elems);
142 +
143 + rates = ieee80211_sta_get_rates(local, &elems, band, NULL);
144 +
145 + rcu_read_lock();
146 +
147 + sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
148 +
149 + if (!sta) {
150 + rcu_read_unlock();
151 + sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
152 + GFP_KERNEL);
153 + if (!sta)
154 + return;
155 +
156 + new = true;
157 + }
158 +
159 + sta->last_rx = jiffies;
160 + sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
161 +
162 + if (elems.ht_cap_elem)
163 + ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband,
164 + elems.ht_cap_elem, &sta->sta.ht_cap);
165 +
166 + if (elems.wmm_param)
167 + set_sta_flag(sta, WLAN_STA_WME);
168 +
169 + if (new) {
170 + sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
171 + sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
172 + sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
173 + rate_control_rate_init(sta);
174 + sta_info_insert_rcu(sta);
175 + }
176 +
177 + rcu_read_unlock();
178 +}
179 +
180 static void ieee80211_iface_work(struct work_struct *work)
181 {
182 struct ieee80211_sub_if_data *sdata =
183 @@ -1101,6 +1144,9 @@ static void ieee80211_iface_work(struct
184 break;
185 ieee80211_mesh_rx_queued_mgmt(sdata, skb);
186 break;
187 + case NL80211_IFTYPE_WDS:
188 + ieee80211_wds_rx_queued_mgmt(sdata, skb);
189 + break;
190 default:
191 WARN(1, "frame for unexpected interface type");
192 break;
193 --- a/net/mac80211/rx.c
194 +++ b/net/mac80211/rx.c
195 @@ -2279,6 +2279,7 @@ ieee80211_rx_h_action(struct ieee80211_r
196 sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
197 sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
198 sdata->vif.type != NL80211_IFTYPE_AP &&
199 + sdata->vif.type != NL80211_IFTYPE_WDS &&
200 sdata->vif.type != NL80211_IFTYPE_ADHOC)
201 break;
202
203 @@ -2496,14 +2497,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
204
205 if (!ieee80211_vif_is_mesh(&sdata->vif) &&
206 sdata->vif.type != NL80211_IFTYPE_ADHOC &&
207 - sdata->vif.type != NL80211_IFTYPE_STATION)
208 + sdata->vif.type != NL80211_IFTYPE_STATION &&
209 + sdata->vif.type != NL80211_IFTYPE_WDS)
210 return RX_DROP_MONITOR;
211
212 switch (stype) {
213 case cpu_to_le16(IEEE80211_STYPE_AUTH):
214 case cpu_to_le16(IEEE80211_STYPE_BEACON):
215 case cpu_to_le16(IEEE80211_STYPE_PROBE_RESP):
216 - /* process for all: mesh, mlme, ibss */
217 + /* process for all: mesh, mlme, ibss, wds */
218 break;
219 case cpu_to_le16(IEEE80211_STYPE_ASSOC_RESP):
220 case cpu_to_le16(IEEE80211_STYPE_REASSOC_RESP):
221 @@ -2827,10 +2829,16 @@ static int prepare_for_handlers(struct i
222 }
223 break;
224 case NL80211_IFTYPE_WDS:
225 - if (bssid || !ieee80211_is_data(hdr->frame_control))
226 - return 0;
227 if (!ether_addr_equal(sdata->u.wds.remote_addr, hdr->addr2))
228 return 0;
229 +
230 + if (ieee80211_is_data(hdr->frame_control) ||
231 + ieee80211_is_action(hdr->frame_control)) {
232 + if (compare_ether_addr(sdata->vif.addr, hdr->addr1))
233 + return 0;
234 + } else if (!ieee80211_is_beacon(hdr->frame_control))
235 + return 0;
236 +
237 break;
238 case NL80211_IFTYPE_P2P_DEVICE:
239 if (!ieee80211_is_public_action(hdr, skb->len) &&
240 --- a/net/mac80211/sta_info.h
241 +++ b/net/mac80211/sta_info.h
242 @@ -32,7 +32,6 @@
243 * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
244 * frames.
245 * @WLAN_STA_WME: Station is a QoS-STA.
246 - * @WLAN_STA_WDS: Station is one of our WDS peers.
247 * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
248 * IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
249 * frame to this station is transmitted.
250 @@ -64,7 +63,6 @@ enum ieee80211_sta_info_flags {
251 WLAN_STA_AUTHORIZED,
252 WLAN_STA_SHORT_PREAMBLE,
253 WLAN_STA_WME,
254 - WLAN_STA_WDS,
255 WLAN_STA_CLEAR_PS_FILT,
256 WLAN_STA_MFP,
257 WLAN_STA_BLOCK_BA,
258 --- a/net/mac80211/status.c
259 +++ b/net/mac80211/status.c
260 @@ -517,29 +517,41 @@ void ieee80211_tx_status(struct ieee8021
261
262 if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) {
263 u64 cookie = (unsigned long)skb;
264 + bool found = false;
265 +
266 acked = info->flags & IEEE80211_TX_STAT_ACK;
267
268 - if (ieee80211_is_nullfunc(hdr->frame_control) ||
269 - ieee80211_is_qos_nullfunc(hdr->frame_control)) {
270 - cfg80211_probe_status(skb->dev, hdr->addr1,
271 - cookie, acked, GFP_ATOMIC);
272 - } else if (skb->dev) {
273 - cfg80211_mgmt_tx_status(
274 - skb->dev->ieee80211_ptr, cookie, skb->data,
275 - skb->len, acked, GFP_ATOMIC);
276 - } else {
277 - struct ieee80211_sub_if_data *p2p_sdata;
278 + rcu_read_lock();
279
280 - rcu_read_lock();
281 + list_for_each_entry_rcu(sdata, &local->interfaces, list) {
282 + if (!sdata->dev)
283 + continue;
284 +
285 + if (skb->dev != sdata->dev)
286 + continue;
287 +
288 + found = true;
289 + break;
290 + }
291
292 - p2p_sdata = rcu_dereference(local->p2p_sdata);
293 - if (p2p_sdata) {
294 - cfg80211_mgmt_tx_status(
295 - &p2p_sdata->wdev, cookie, skb->data,
296 - skb->len, acked, GFP_ATOMIC);
297 - }
298 - rcu_read_unlock();
299 + if (!skb->dev) {
300 + sdata = rcu_dereference(local->p2p_sdata);
301 + if (sdata)
302 + found = true;
303 }
304 +
305 + if (!found)
306 + skb->dev = NULL;
307 + else if (ieee80211_is_nullfunc(hdr->frame_control) ||
308 + ieee80211_is_qos_nullfunc(hdr->frame_control)) {
309 + cfg80211_probe_status(sdata->dev, hdr->addr1,
310 + cookie, acked, GFP_ATOMIC);
311 + } else {
312 + cfg80211_mgmt_tx_status(&sdata->wdev, cookie, skb->data,
313 + skb->len, acked, GFP_ATOMIC);
314 + }
315 +
316 + rcu_read_unlock();
317 }
318
319 if (unlikely(info->ack_frame_id)) {
320 --- a/drivers/net/wireless/p54/main.c
321 +++ b/drivers/net/wireless/p54/main.c
322 @@ -139,6 +139,7 @@ static int p54_beacon_format_ie_tim(stru
323 static int p54_beacon_update(struct p54_common *priv,
324 struct ieee80211_vif *vif)
325 {
326 + struct ieee80211_tx_control control = { };
327 struct sk_buff *beacon;
328 int ret;
329
330 @@ -158,7 +159,7 @@ static int p54_beacon_update(struct p54_
331 * to cancel the old beacon template by hand, instead the firmware
332 * will release the previous one through the feedback mechanism.
333 */
334 - p54_tx_80211(priv->hw, NULL, beacon);
335 + p54_tx_80211(priv->hw, &control, beacon);
336 priv->tsf_high32 = 0;
337 priv->tsf_low32 = 0;
338
339 --- a/net/wireless/reg.c
340 +++ b/net/wireless/reg.c
341 @@ -352,6 +352,9 @@ static void reg_regdb_search(struct work
342 struct reg_regdb_search_request *request;
343 const struct ieee80211_regdomain *curdom, *regdom;
344 int i, r;
345 + bool set_reg = false;
346 +
347 + mutex_lock(&cfg80211_mutex);
348
349 mutex_lock(&reg_regdb_search_mutex);
350 while (!list_empty(&reg_regdb_search_list)) {
351 @@ -367,9 +370,7 @@ static void reg_regdb_search(struct work
352 r = reg_copy_regd(&regdom, curdom);
353 if (r)
354 break;
355 - mutex_lock(&cfg80211_mutex);
356 - set_regdom(regdom);
357 - mutex_unlock(&cfg80211_mutex);
358 + set_reg = true;
359 break;
360 }
361 }
362 @@ -377,6 +378,11 @@ static void reg_regdb_search(struct work
363 kfree(request);
364 }
365 mutex_unlock(&reg_regdb_search_mutex);
366 +
367 + if (set_reg)
368 + set_regdom(regdom);
369 +
370 + mutex_unlock(&cfg80211_mutex);
371 }
372
373 static DECLARE_WORK(reg_regdb_work, reg_regdb_search);
374 --- a/drivers/net/wireless/ath/ath9k/recv.c
375 +++ b/drivers/net/wireless/ath/ath9k/recv.c
376 @@ -424,8 +424,8 @@ u32 ath_calcrxfilter(struct ath_softc *s
377 rfilt |= ATH9K_RX_FILTER_COMP_BAR;
378
379 if (sc->nvifs > 1 || (sc->rx.rxfilter & FIF_OTHER_BSS)) {
380 - /* The following may also be needed for other older chips */
381 - if (sc->sc_ah->hw_version.macVersion == AR_SREV_VERSION_9160)
382 + /* This is needed for older chips */
383 + if (sc->sc_ah->hw_version.macVersion <= AR_SREV_VERSION_9160)
384 rfilt |= ATH9K_RX_FILTER_PROM;
385 rfilt |= ATH9K_RX_FILTER_MCAST_BCAST_ALL;
386 }
387 --- a/net/mac80211/mlme.c
388 +++ b/net/mac80211/mlme.c
389 @@ -1390,7 +1390,7 @@ static void ieee80211_set_disassoc(struc
390 sta = sta_info_get(sdata, ifmgd->bssid);
391 if (sta) {
392 set_sta_flag(sta, WLAN_STA_BLOCK_BA);
393 - ieee80211_sta_tear_down_BA_sessions(sta, tx);
394 + ieee80211_sta_tear_down_BA_sessions(sta, false);
395 }
396 mutex_unlock(&local->sta_mtx);
397
398 --- a/net/mac80211/sta_info.c
399 +++ b/net/mac80211/sta_info.c
400 @@ -674,7 +674,7 @@ int __must_check __sta_info_destroy(stru
401 * will be sufficient.
402 */
403 set_sta_flag(sta, WLAN_STA_BLOCK_BA);
404 - ieee80211_sta_tear_down_BA_sessions(sta, true);
405 + ieee80211_sta_tear_down_BA_sessions(sta, false);
406
407 ret = sta_info_hash_del(local, sta);
408 if (ret)