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