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))
7 + channels[count].max_power = AR5K_TUNE_MAX_TXPOWER/2;
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);
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)
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" : ""
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),
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;
68 u32 hw_reconf_flags = 0;
69 @@ -575,30 +574,8 @@ int ieee80211_do_open(struct wireless_de
71 set_bit(SDATA_STATE_RUNNING, &sdata->state);
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,
79 - goto err_del_interface;
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);
86 - res = sta_info_insert(sta);
88 - /* STA has been freed */
89 - goto err_del_interface;
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);
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;
105 +static void ieee80211_wds_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
106 + struct sk_buff *skb)
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;
117 + enum ieee80211_band band = local->hw.conf.channel->band;
118 + struct ieee80211_supported_band *sband = local->hw.wiphy->bands[band];
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;
124 + if (stype != IEEE80211_STYPE_BEACON)
127 + baselen = (u8 *) mgmt->u.probe_resp.variable - (u8 *) mgmt;
128 + if (baselen > skb->len)
131 + ieee802_11_parse_elems(mgmt->u.probe_resp.variable,
132 + skb->len - baselen, &elems);
134 + rates = ieee80211_sta_get_rates(local, &elems, band, NULL);
138 + sta = sta_info_get(sdata, sdata->u.wds.remote_addr);
142 + sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr,
150 + sta->last_rx = jiffies;
151 + sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
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);
157 + if (elems.wmm_param)
158 + set_sta_flag(sta, WLAN_STA_WME);
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);
171 static void ieee80211_iface_work(struct work_struct *work)
173 struct ieee80211_sub_if_data *sdata =
174 @@ -1101,6 +1144,9 @@ static void ieee80211_iface_work(struct
176 ieee80211_mesh_rx_queued_mgmt(sdata, skb);
178 + case NL80211_IFTYPE_WDS:
179 + ieee80211_wds_rx_queued_mgmt(sdata, skb);
182 WARN(1, "frame for unexpected interface type");
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)
194 @@ -2496,14 +2497,15 @@ ieee80211_rx_h_mgmt(struct ieee80211_rx_
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;
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 */
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
215 case NL80211_IFTYPE_WDS:
216 - if (bssid || !ieee80211_is_data(hdr->frame_control))
218 if (!ether_addr_equal(sdata->u.wds.remote_addr, hdr->addr2))
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))
225 + } else if (!ieee80211_is_beacon(hdr->frame_control))
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
234 * @WLAN_STA_SHORT_PREAMBLE: Station is capable of receiving short-preamble
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 {
243 WLAN_STA_SHORT_PREAMBLE,
246 WLAN_STA_CLEAR_PS_FILT,
249 --- a/net/mac80211/status.c
250 +++ b/net/mac80211/status.c
251 @@ -517,29 +517,41 @@ void ieee80211_tx_status(struct ieee8021
253 if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) {
254 u64 cookie = (unsigned long)skb;
255 + bool found = false;
257 acked = info->flags & IEEE80211_TX_STAT_ACK;
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);
268 - struct ieee80211_sub_if_data *p2p_sdata;
272 + list_for_each_entry_rcu(sdata, &local->interfaces, list) {
276 - p2p_sdata = rcu_dereference(local->p2p_sdata);
278 - cfg80211_mgmt_tx_status(
279 - &p2p_sdata->wdev, cookie, skb->data,
280 - skb->len, acked, GFP_ATOMIC);
283 + if (skb->dev != sdata->dev)
291 + sdata = rcu_dereference(local->p2p_sdata);
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);
303 + cfg80211_mgmt_tx_status(&sdata->wdev, cookie, skb->data,
304 + skb->len, acked, GFP_ATOMIC);
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)
317 + struct ieee80211_tx_control control = { };
318 struct sk_buff *beacon;
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.
325 - p54_tx_80211(priv->hw, NULL, beacon);
326 + p54_tx_80211(priv->hw, &control, beacon);
327 priv->tsf_high32 = 0;