aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.c22
-rw-r--r--drivers/net/wireless/ath/ath6kl/core.h5
-rw-r--r--drivers/net/wireless/ath/ath6kl/wmi.c10
-rw-r--r--include/net/cfg80211.h27
-rw-r--r--net/mac80211/cfg.c21
-rw-r--r--net/mac80211/ieee80211_i.h6
-rw-r--r--net/mac80211/offchannel.c6
-rw-r--r--net/mac80211/rx.c2
-rw-r--r--net/mac80211/status.c9
-rw-r--r--net/wireless/core.h2
-rw-r--r--net/wireless/mlme.c34
-rw-r--r--net/wireless/nl80211.c119
-rw-r--r--net/wireless/nl80211.h10
13 files changed, 152 insertions, 121 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index aca1d2689e90..5f0c66bb6bdf 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -2975,14 +2975,14 @@ static int ath6kl_change_station(struct wiphy *wiphy, struct net_device *dev,
2975} 2975}
2976 2976
2977static int ath6kl_remain_on_channel(struct wiphy *wiphy, 2977static int ath6kl_remain_on_channel(struct wiphy *wiphy,
2978 struct net_device *dev, 2978 struct wireless_dev *wdev,
2979 struct ieee80211_channel *chan, 2979 struct ieee80211_channel *chan,
2980 enum nl80211_channel_type channel_type, 2980 enum nl80211_channel_type channel_type,
2981 unsigned int duration, 2981 unsigned int duration,
2982 u64 *cookie) 2982 u64 *cookie)
2983{ 2983{
2984 struct ath6kl *ar = ath6kl_priv(dev); 2984 struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev);
2985 struct ath6kl_vif *vif = netdev_priv(dev); 2985 struct ath6kl *ar = ath6kl_priv(vif->ndev);
2986 u32 id; 2986 u32 id;
2987 2987
2988 /* TODO: if already pending or ongoing remain-on-channel, 2988 /* TODO: if already pending or ongoing remain-on-channel,
@@ -2999,11 +2999,11 @@ static int ath6kl_remain_on_channel(struct wiphy *wiphy,
2999} 2999}
3000 3000
3001static int ath6kl_cancel_remain_on_channel(struct wiphy *wiphy, 3001static int ath6kl_cancel_remain_on_channel(struct wiphy *wiphy,
3002 struct net_device *dev, 3002 struct wireless_dev *wdev,
3003 u64 cookie) 3003 u64 cookie)
3004{ 3004{
3005 struct ath6kl *ar = ath6kl_priv(dev); 3005 struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev);
3006 struct ath6kl_vif *vif = netdev_priv(dev); 3006 struct ath6kl *ar = ath6kl_priv(vif->ndev);
3007 3007
3008 if (cookie != vif->last_roc_id) 3008 if (cookie != vif->last_roc_id)
3009 return -ENOENT; 3009 return -ENOENT;
@@ -3134,15 +3134,15 @@ static bool ath6kl_is_p2p_go_ssid(const u8 *buf, size_t len)
3134 return false; 3134 return false;
3135} 3135}
3136 3136
3137static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct net_device *dev, 3137static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
3138 struct ieee80211_channel *chan, bool offchan, 3138 struct ieee80211_channel *chan, bool offchan,
3139 enum nl80211_channel_type channel_type, 3139 enum nl80211_channel_type channel_type,
3140 bool channel_type_valid, unsigned int wait, 3140 bool channel_type_valid, unsigned int wait,
3141 const u8 *buf, size_t len, bool no_cck, 3141 const u8 *buf, size_t len, bool no_cck,
3142 bool dont_wait_for_ack, u64 *cookie) 3142 bool dont_wait_for_ack, u64 *cookie)
3143{ 3143{
3144 struct ath6kl *ar = ath6kl_priv(dev); 3144 struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev);
3145 struct ath6kl_vif *vif = netdev_priv(dev); 3145 struct ath6kl *ar = ath6kl_priv(vif->ndev);
3146 u32 id; 3146 u32 id;
3147 const struct ieee80211_mgmt *mgmt; 3147 const struct ieee80211_mgmt *mgmt;
3148 bool more_data, queued; 3148 bool more_data, queued;
@@ -3187,10 +3187,10 @@ static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
3187} 3187}
3188 3188
3189static void ath6kl_mgmt_frame_register(struct wiphy *wiphy, 3189static void ath6kl_mgmt_frame_register(struct wiphy *wiphy,
3190 struct net_device *dev, 3190 struct wireless_dev *wdev,
3191 u16 frame_type, bool reg) 3191 u16 frame_type, bool reg)
3192{ 3192{
3193 struct ath6kl_vif *vif = netdev_priv(dev); 3193 struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev);
3194 3194
3195 ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: frame_type=0x%x reg=%d\n", 3195 ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: frame_type=0x%x reg=%d\n",
3196 __func__, frame_type, reg); 3196 __func__, frame_type, reg);
diff --git a/drivers/net/wireless/ath/ath6kl/core.h b/drivers/net/wireless/ath/ath6kl/core.h
index d38a31de344c..cec49a31029a 100644
--- a/drivers/net/wireless/ath/ath6kl/core.h
+++ b/drivers/net/wireless/ath/ath6kl/core.h
@@ -589,6 +589,11 @@ struct ath6kl_vif {
589 struct list_head mc_filter; 589 struct list_head mc_filter;
590}; 590};
591 591
592static inline struct ath6kl_vif *ath6kl_vif_from_wdev(struct wireless_dev *wdev)
593{
594 return container_of(wdev, struct ath6kl_vif, wdev);
595}
596
592#define WOW_LIST_ID 0 597#define WOW_LIST_ID 0
593#define WOW_HOST_REQ_DELAY 500 /* ms */ 598#define WOW_HOST_REQ_DELAY 500 /* ms */
594 599
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
index a6caa673e8ad..c30ab4b11d61 100644
--- a/drivers/net/wireless/ath/ath6kl/wmi.c
+++ b/drivers/net/wireless/ath/ath6kl/wmi.c
@@ -474,7 +474,7 @@ static int ath6kl_wmi_remain_on_chnl_event_rx(struct wmi *wmi, u8 *datap,
474 return -EINVAL; 474 return -EINVAL;
475 } 475 }
476 id = vif->last_roc_id; 476 id = vif->last_roc_id;
477 cfg80211_ready_on_channel(vif->ndev, id, chan, NL80211_CHAN_NO_HT, 477 cfg80211_ready_on_channel(&vif->wdev, id, chan, NL80211_CHAN_NO_HT,
478 dur, GFP_ATOMIC); 478 dur, GFP_ATOMIC);
479 479
480 return 0; 480 return 0;
@@ -513,7 +513,7 @@ static int ath6kl_wmi_cancel_remain_on_chnl_event_rx(struct wmi *wmi,
513 else 513 else
514 id = vif->last_roc_id; /* timeout on uncanceled r-o-c */ 514 id = vif->last_roc_id; /* timeout on uncanceled r-o-c */
515 vif->last_cancel_roc_id = 0; 515 vif->last_cancel_roc_id = 0;
516 cfg80211_remain_on_channel_expired(vif->ndev, id, chan, 516 cfg80211_remain_on_channel_expired(&vif->wdev, id, chan,
517 NL80211_CHAN_NO_HT, GFP_ATOMIC); 517 NL80211_CHAN_NO_HT, GFP_ATOMIC);
518 518
519 return 0; 519 return 0;
@@ -533,7 +533,7 @@ static int ath6kl_wmi_tx_status_event_rx(struct wmi *wmi, u8 *datap, int len,
533 ath6kl_dbg(ATH6KL_DBG_WMI, "tx_status: id=%x ack_status=%u\n", 533 ath6kl_dbg(ATH6KL_DBG_WMI, "tx_status: id=%x ack_status=%u\n",
534 id, ev->ack_status); 534 id, ev->ack_status);
535 if (wmi->last_mgmt_tx_frame) { 535 if (wmi->last_mgmt_tx_frame) {
536 cfg80211_mgmt_tx_status(vif->ndev, id, 536 cfg80211_mgmt_tx_status(&vif->wdev, id,
537 wmi->last_mgmt_tx_frame, 537 wmi->last_mgmt_tx_frame,
538 wmi->last_mgmt_tx_frame_len, 538 wmi->last_mgmt_tx_frame_len,
539 !!ev->ack_status, GFP_ATOMIC); 539 !!ev->ack_status, GFP_ATOMIC);
@@ -568,7 +568,7 @@ static int ath6kl_wmi_rx_probe_req_event_rx(struct wmi *wmi, u8 *datap, int len,
568 dlen, freq, vif->probe_req_report); 568 dlen, freq, vif->probe_req_report);
569 569
570 if (vif->probe_req_report || vif->nw_type == AP_NETWORK) 570 if (vif->probe_req_report || vif->nw_type == AP_NETWORK)
571 cfg80211_rx_mgmt(vif->ndev, freq, 0, 571 cfg80211_rx_mgmt(&vif->wdev, freq, 0,
572 ev->data, dlen, GFP_ATOMIC); 572 ev->data, dlen, GFP_ATOMIC);
573 573
574 return 0; 574 return 0;
@@ -608,7 +608,7 @@ static int ath6kl_wmi_rx_action_event_rx(struct wmi *wmi, u8 *datap, int len,
608 return -EINVAL; 608 return -EINVAL;
609 } 609 }
610 ath6kl_dbg(ATH6KL_DBG_WMI, "rx_action: len=%u freq=%u\n", dlen, freq); 610 ath6kl_dbg(ATH6KL_DBG_WMI, "rx_action: len=%u freq=%u\n", dlen, freq);
611 cfg80211_rx_mgmt(vif->ndev, freq, 0, 611 cfg80211_rx_mgmt(&vif->wdev, freq, 0,
612 ev->data, dlen, GFP_ATOMIC); 612 ev->data, dlen, GFP_ATOMIC);
613 613
614 return 0; 614 return 0;
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index a14e6a406681..7eaaee7bb07d 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1753,23 +1753,23 @@ struct cfg80211_ops {
1753 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev); 1753 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
1754 1754
1755 int (*remain_on_channel)(struct wiphy *wiphy, 1755 int (*remain_on_channel)(struct wiphy *wiphy,
1756 struct net_device *dev, 1756 struct wireless_dev *wdev,
1757 struct ieee80211_channel *chan, 1757 struct ieee80211_channel *chan,
1758 enum nl80211_channel_type channel_type, 1758 enum nl80211_channel_type channel_type,
1759 unsigned int duration, 1759 unsigned int duration,
1760 u64 *cookie); 1760 u64 *cookie);
1761 int (*cancel_remain_on_channel)(struct wiphy *wiphy, 1761 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
1762 struct net_device *dev, 1762 struct wireless_dev *wdev,
1763 u64 cookie); 1763 u64 cookie);
1764 1764
1765 int (*mgmt_tx)(struct wiphy *wiphy, struct net_device *dev, 1765 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
1766 struct ieee80211_channel *chan, bool offchan, 1766 struct ieee80211_channel *chan, bool offchan,
1767 enum nl80211_channel_type channel_type, 1767 enum nl80211_channel_type channel_type,
1768 bool channel_type_valid, unsigned int wait, 1768 bool channel_type_valid, unsigned int wait,
1769 const u8 *buf, size_t len, bool no_cck, 1769 const u8 *buf, size_t len, bool no_cck,
1770 bool dont_wait_for_ack, u64 *cookie); 1770 bool dont_wait_for_ack, u64 *cookie);
1771 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 1771 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
1772 struct net_device *dev, 1772 struct wireless_dev *wdev,
1773 u64 cookie); 1773 u64 cookie);
1774 1774
1775 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev, 1775 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
@@ -1780,7 +1780,7 @@ struct cfg80211_ops {
1780 s32 rssi_thold, u32 rssi_hyst); 1780 s32 rssi_thold, u32 rssi_hyst);
1781 1781
1782 void (*mgmt_frame_register)(struct wiphy *wiphy, 1782 void (*mgmt_frame_register)(struct wiphy *wiphy,
1783 struct net_device *dev, 1783 struct wireless_dev *wdev,
1784 u16 frame_type, bool reg); 1784 u16 frame_type, bool reg);
1785 1785
1786 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant); 1786 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
@@ -3279,7 +3279,7 @@ void cfg80211_disconnected(struct net_device *dev, u16 reason,
3279 3279
3280/** 3280/**
3281 * cfg80211_ready_on_channel - notification of remain_on_channel start 3281 * cfg80211_ready_on_channel - notification of remain_on_channel start
3282 * @dev: network device 3282 * @wdev: wireless device
3283 * @cookie: the request cookie 3283 * @cookie: the request cookie
3284 * @chan: The current channel (from remain_on_channel request) 3284 * @chan: The current channel (from remain_on_channel request)
3285 * @channel_type: Channel type 3285 * @channel_type: Channel type
@@ -3287,21 +3287,20 @@ void cfg80211_disconnected(struct net_device *dev, u16 reason,
3287 * channel 3287 * channel
3288 * @gfp: allocation flags 3288 * @gfp: allocation flags
3289 */ 3289 */
3290void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie, 3290void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
3291 struct ieee80211_channel *chan, 3291 struct ieee80211_channel *chan,
3292 enum nl80211_channel_type channel_type, 3292 enum nl80211_channel_type channel_type,
3293 unsigned int duration, gfp_t gfp); 3293 unsigned int duration, gfp_t gfp);
3294 3294
3295/** 3295/**
3296 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired 3296 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
3297 * @dev: network device 3297 * @wdev: wireless device
3298 * @cookie: the request cookie 3298 * @cookie: the request cookie
3299 * @chan: The current channel (from remain_on_channel request) 3299 * @chan: The current channel (from remain_on_channel request)
3300 * @channel_type: Channel type 3300 * @channel_type: Channel type
3301 * @gfp: allocation flags 3301 * @gfp: allocation flags
3302 */ 3302 */
3303void cfg80211_remain_on_channel_expired(struct net_device *dev, 3303void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
3304 u64 cookie,
3305 struct ieee80211_channel *chan, 3304 struct ieee80211_channel *chan,
3306 enum nl80211_channel_type channel_type, 3305 enum nl80211_channel_type channel_type,
3307 gfp_t gfp); 3306 gfp_t gfp);
@@ -3329,7 +3328,7 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3329 3328
3330/** 3329/**
3331 * cfg80211_rx_mgmt - notification of received, unprocessed management frame 3330 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
3332 * @dev: network device 3331 * @wdev: wireless device receiving the frame
3333 * @freq: Frequency on which the frame was received in MHz 3332 * @freq: Frequency on which the frame was received in MHz
3334 * @sig_dbm: signal strength in mBm, or 0 if unknown 3333 * @sig_dbm: signal strength in mBm, or 0 if unknown
3335 * @buf: Management frame (header + body) 3334 * @buf: Management frame (header + body)
@@ -3344,12 +3343,12 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp);
3344 * This function is called whenever an Action frame is received for a station 3343 * This function is called whenever an Action frame is received for a station
3345 * mode interface, but is not processed in kernel. 3344 * mode interface, but is not processed in kernel.
3346 */ 3345 */
3347bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_dbm, 3346bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
3348 const u8 *buf, size_t len, gfp_t gfp); 3347 const u8 *buf, size_t len, gfp_t gfp);
3349 3348
3350/** 3349/**
3351 * cfg80211_mgmt_tx_status - notification of TX status for management frame 3350 * cfg80211_mgmt_tx_status - notification of TX status for management frame
3352 * @dev: network device 3351 * @wdev: wireless device receiving the frame
3353 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() 3352 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
3354 * @buf: Management frame (header + body) 3353 * @buf: Management frame (header + body)
3355 * @len: length of the frame data 3354 * @len: length of the frame data
@@ -3360,7 +3359,7 @@ bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_dbm,
3360 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the 3359 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
3361 * transmission attempt. 3360 * transmission attempt.
3362 */ 3361 */
3363void cfg80211_mgmt_tx_status(struct net_device *dev, u64 cookie, 3362void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
3364 const u8 *buf, size_t len, bool ack, gfp_t gfp); 3363 const u8 *buf, size_t len, bool ack, gfp_t gfp);
3365 3364
3366 3365
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 6a171e299b57..7d9abea37b17 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2299,13 +2299,13 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
2299} 2299}
2300 2300
2301static int ieee80211_remain_on_channel(struct wiphy *wiphy, 2301static int ieee80211_remain_on_channel(struct wiphy *wiphy,
2302 struct net_device *dev, 2302 struct wireless_dev *wdev,
2303 struct ieee80211_channel *chan, 2303 struct ieee80211_channel *chan,
2304 enum nl80211_channel_type channel_type, 2304 enum nl80211_channel_type channel_type,
2305 unsigned int duration, 2305 unsigned int duration,
2306 u64 *cookie) 2306 u64 *cookie)
2307{ 2307{
2308 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 2308 struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
2309 struct ieee80211_local *local = sdata->local; 2309 struct ieee80211_local *local = sdata->local;
2310 int ret; 2310 int ret;
2311 2311
@@ -2392,23 +2392,23 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
2392} 2392}
2393 2393
2394static int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy, 2394static int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy,
2395 struct net_device *dev, 2395 struct wireless_dev *wdev,
2396 u64 cookie) 2396 u64 cookie)
2397{ 2397{
2398 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 2398 struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
2399 struct ieee80211_local *local = sdata->local; 2399 struct ieee80211_local *local = sdata->local;
2400 2400
2401 return ieee80211_cancel_roc(local, cookie, false); 2401 return ieee80211_cancel_roc(local, cookie, false);
2402} 2402}
2403 2403
2404static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev, 2404static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
2405 struct ieee80211_channel *chan, bool offchan, 2405 struct ieee80211_channel *chan, bool offchan,
2406 enum nl80211_channel_type channel_type, 2406 enum nl80211_channel_type channel_type,
2407 bool channel_type_valid, unsigned int wait, 2407 bool channel_type_valid, unsigned int wait,
2408 const u8 *buf, size_t len, bool no_cck, 2408 const u8 *buf, size_t len, bool no_cck,
2409 bool dont_wait_for_ack, u64 *cookie) 2409 bool dont_wait_for_ack, u64 *cookie)
2410{ 2410{
2411 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 2411 struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
2412 struct ieee80211_local *local = sdata->local; 2412 struct ieee80211_local *local = sdata->local;
2413 struct sk_buff *skb; 2413 struct sk_buff *skb;
2414 struct sta_info *sta; 2414 struct sta_info *sta;
@@ -2513,21 +2513,20 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct net_device *dev,
2513} 2513}
2514 2514
2515static int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, 2515static int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
2516 struct net_device *dev, 2516 struct wireless_dev *wdev,
2517 u64 cookie) 2517 u64 cookie)
2518{ 2518{
2519 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 2519 struct ieee80211_local *local = wiphy_priv(wiphy);
2520 struct ieee80211_local *local = sdata->local;
2521 2520
2522 return ieee80211_cancel_roc(local, cookie, true); 2521 return ieee80211_cancel_roc(local, cookie, true);
2523} 2522}
2524 2523
2525static void ieee80211_mgmt_frame_register(struct wiphy *wiphy, 2524static void ieee80211_mgmt_frame_register(struct wiphy *wiphy,
2526 struct net_device *dev, 2525 struct wireless_dev *wdev,
2527 u16 frame_type, bool reg) 2526 u16 frame_type, bool reg)
2528{ 2527{
2529 struct ieee80211_local *local = wiphy_priv(wiphy); 2528 struct ieee80211_local *local = wiphy_priv(wiphy);
2530 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 2529 struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
2531 2530
2532 switch (frame_type) { 2531 switch (frame_type) {
2533 case IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH: 2532 case IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH:
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index e0423f8c0ce1..8f8535ee5995 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1091,6 +1091,12 @@ IEEE80211_DEV_TO_SUB_IF(struct net_device *dev)
1091 return netdev_priv(dev); 1091 return netdev_priv(dev);
1092} 1092}
1093 1093
1094static inline struct ieee80211_sub_if_data *
1095IEEE80211_WDEV_TO_SUB_IF(struct wireless_dev *wdev)
1096{
1097 return container_of(wdev, struct ieee80211_sub_if_data, wdev);
1098}
1099
1094/* this struct represents 802.11n's RA/TID combination */ 1100/* this struct represents 802.11n's RA/TID combination */
1095struct ieee80211_ra_tid { 1101struct ieee80211_ra_tid {
1096 u8 ra[ETH_ALEN]; 1102 u8 ra[ETH_ALEN];
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index b0fb6a2b89ad..8c047fc8b325 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -191,7 +191,7 @@ void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc)
191 roc->frame = NULL; 191 roc->frame = NULL;
192 } 192 }
193 } else { 193 } else {
194 cfg80211_ready_on_channel(roc->sdata->dev, (unsigned long)roc, 194 cfg80211_ready_on_channel(&roc->sdata->wdev, (unsigned long)roc,
195 roc->chan, roc->chan_type, 195 roc->chan, roc->chan_type,
196 roc->req_duration, GFP_KERNEL); 196 roc->req_duration, GFP_KERNEL);
197 } 197 }
@@ -299,7 +299,7 @@ void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc)
299 299
300 /* was never transmitted */ 300 /* was never transmitted */
301 if (roc->frame) { 301 if (roc->frame) {
302 cfg80211_mgmt_tx_status(roc->sdata->dev, 302 cfg80211_mgmt_tx_status(&roc->sdata->wdev,
303 (unsigned long)roc->frame, 303 (unsigned long)roc->frame,
304 roc->frame->data, roc->frame->len, 304 roc->frame->data, roc->frame->len,
305 false, GFP_KERNEL); 305 false, GFP_KERNEL);
@@ -307,7 +307,7 @@ void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc)
307 } 307 }
308 308
309 if (!roc->mgmt_tx_cookie) 309 if (!roc->mgmt_tx_cookie)
310 cfg80211_remain_on_channel_expired(roc->sdata->dev, 310 cfg80211_remain_on_channel_expired(&roc->sdata->wdev,
311 (unsigned long)roc, 311 (unsigned long)roc,
312 roc->chan, roc->chan_type, 312 roc->chan, roc->chan_type,
313 GFP_KERNEL); 313 GFP_KERNEL);
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index ab5185054e6c..f8cf9e7477a3 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2404,7 +2404,7 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)
2404 if (rx->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) 2404 if (rx->local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
2405 sig = status->signal; 2405 sig = status->signal;
2406 2406
2407 if (cfg80211_rx_mgmt(rx->sdata->dev, status->freq, sig, 2407 if (cfg80211_rx_mgmt(&rx->sdata->wdev, status->freq, sig,
2408 rx->skb->data, rx->skb->len, 2408 rx->skb->data, rx->skb->len,
2409 GFP_ATOMIC)) { 2409 GFP_ATOMIC)) {
2410 if (rx->sta) 2410 if (rx->sta)
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 2ed2f27fe8a7..8cd72914cdaf 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -519,14 +519,19 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
519 u64 cookie = (unsigned long)skb; 519 u64 cookie = (unsigned long)skb;
520 acked = info->flags & IEEE80211_TX_STAT_ACK; 520 acked = info->flags & IEEE80211_TX_STAT_ACK;
521 521
522 /*
523 * TODO: When we have non-netdev frame TX,
524 * we cannot use skb->dev->ieee80211_ptr
525 */
526
522 if (ieee80211_is_nullfunc(hdr->frame_control) || 527 if (ieee80211_is_nullfunc(hdr->frame_control) ||
523 ieee80211_is_qos_nullfunc(hdr->frame_control)) 528 ieee80211_is_qos_nullfunc(hdr->frame_control))
524 cfg80211_probe_status(skb->dev, hdr->addr1, 529 cfg80211_probe_status(skb->dev, hdr->addr1,
525 cookie, acked, GFP_ATOMIC); 530 cookie, acked, GFP_ATOMIC);
526 else 531 else
527 cfg80211_mgmt_tx_status( 532 cfg80211_mgmt_tx_status(
528 skb->dev, cookie, skb->data, skb->len, 533 skb->dev->ieee80211_ptr, cookie, skb->data,
529 acked, GFP_ATOMIC); 534 skb->len, acked, GFP_ATOMIC);
530 } 535 }
531 536
532 if (unlikely(info->ack_frame_id)) { 537 if (unlikely(info->ack_frame_id)) {
diff --git a/net/wireless/core.h b/net/wireless/core.h
index 6b0170a5f05f..eae5a25a1691 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -372,7 +372,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_pid,
372void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlpid); 372void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlpid);
373void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev); 373void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev);
374int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, 374int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
375 struct net_device *dev, 375 struct wireless_dev *wdev,
376 struct ieee80211_channel *chan, bool offchan, 376 struct ieee80211_channel *chan, bool offchan,
377 enum nl80211_channel_type channel_type, 377 enum nl80211_channel_type channel_type,
378 bool channel_type_valid, unsigned int wait, 378 bool channel_type_valid, unsigned int wait,
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index d4fece3bb18a..abe9f82d5a82 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -567,29 +567,28 @@ void cfg80211_mlme_down(struct cfg80211_registered_device *rdev,
567 } 567 }
568} 568}
569 569
570void cfg80211_ready_on_channel(struct net_device *dev, u64 cookie, 570void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
571 struct ieee80211_channel *chan, 571 struct ieee80211_channel *chan,
572 enum nl80211_channel_type channel_type, 572 enum nl80211_channel_type channel_type,
573 unsigned int duration, gfp_t gfp) 573 unsigned int duration, gfp_t gfp)
574{ 574{
575 struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; 575 struct wiphy *wiphy = wdev->wiphy;
576 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 576 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
577 577
578 nl80211_send_remain_on_channel(rdev, dev, cookie, chan, channel_type, 578 nl80211_send_remain_on_channel(rdev, wdev, cookie, chan, channel_type,
579 duration, gfp); 579 duration, gfp);
580} 580}
581EXPORT_SYMBOL(cfg80211_ready_on_channel); 581EXPORT_SYMBOL(cfg80211_ready_on_channel);
582 582
583void cfg80211_remain_on_channel_expired(struct net_device *dev, 583void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
584 u64 cookie,
585 struct ieee80211_channel *chan, 584 struct ieee80211_channel *chan,
586 enum nl80211_channel_type channel_type, 585 enum nl80211_channel_type channel_type,
587 gfp_t gfp) 586 gfp_t gfp)
588{ 587{
589 struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; 588 struct wiphy *wiphy = wdev->wiphy;
590 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 589 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
591 590
592 nl80211_send_remain_on_channel_cancel(rdev, dev, cookie, chan, 591 nl80211_send_remain_on_channel_cancel(rdev, wdev, cookie, chan,
593 channel_type, gfp); 592 channel_type, gfp);
594} 593}
595EXPORT_SYMBOL(cfg80211_remain_on_channel_expired); 594EXPORT_SYMBOL(cfg80211_remain_on_channel_expired);
@@ -678,8 +677,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_pid,
678 list_add(&nreg->list, &wdev->mgmt_registrations); 677 list_add(&nreg->list, &wdev->mgmt_registrations);
679 678
680 if (rdev->ops->mgmt_frame_register) 679 if (rdev->ops->mgmt_frame_register)
681 rdev->ops->mgmt_frame_register(wiphy, wdev->netdev, 680 rdev->ops->mgmt_frame_register(wiphy, wdev, frame_type, true);
682 frame_type, true);
683 681
684 out: 682 out:
685 spin_unlock_bh(&wdev->mgmt_registrations_lock); 683 spin_unlock_bh(&wdev->mgmt_registrations_lock);
@@ -702,7 +700,7 @@ void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlpid)
702 if (rdev->ops->mgmt_frame_register) { 700 if (rdev->ops->mgmt_frame_register) {
703 u16 frame_type = le16_to_cpu(reg->frame_type); 701 u16 frame_type = le16_to_cpu(reg->frame_type);
704 702
705 rdev->ops->mgmt_frame_register(wiphy, wdev->netdev, 703 rdev->ops->mgmt_frame_register(wiphy, wdev,
706 frame_type, false); 704 frame_type, false);
707 } 705 }
708 706
@@ -731,14 +729,14 @@ void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev)
731} 729}
732 730
733int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, 731int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
734 struct net_device *dev, 732 struct wireless_dev *wdev,
735 struct ieee80211_channel *chan, bool offchan, 733 struct ieee80211_channel *chan, bool offchan,
736 enum nl80211_channel_type channel_type, 734 enum nl80211_channel_type channel_type,
737 bool channel_type_valid, unsigned int wait, 735 bool channel_type_valid, unsigned int wait,
738 const u8 *buf, size_t len, bool no_cck, 736 const u8 *buf, size_t len, bool no_cck,
739 bool dont_wait_for_ack, u64 *cookie) 737 bool dont_wait_for_ack, u64 *cookie)
740{ 738{
741 struct wireless_dev *wdev = dev->ieee80211_ptr; 739 struct net_device *dev = wdev->netdev;
742 const struct ieee80211_mgmt *mgmt; 740 const struct ieee80211_mgmt *mgmt;
743 u16 stype; 741 u16 stype;
744 742
@@ -825,16 +823,15 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
825 return -EINVAL; 823 return -EINVAL;
826 824
827 /* Transmit the Action frame as requested by user space */ 825 /* Transmit the Action frame as requested by user space */
828 return rdev->ops->mgmt_tx(&rdev->wiphy, dev, chan, offchan, 826 return rdev->ops->mgmt_tx(&rdev->wiphy, wdev, chan, offchan,
829 channel_type, channel_type_valid, 827 channel_type, channel_type_valid,
830 wait, buf, len, no_cck, dont_wait_for_ack, 828 wait, buf, len, no_cck, dont_wait_for_ack,
831 cookie); 829 cookie);
832} 830}
833 831
834bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_mbm, 832bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm,
835 const u8 *buf, size_t len, gfp_t gfp) 833 const u8 *buf, size_t len, gfp_t gfp)
836{ 834{
837 struct wireless_dev *wdev = dev->ieee80211_ptr;
838 struct wiphy *wiphy = wdev->wiphy; 835 struct wiphy *wiphy = wdev->wiphy;
839 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 836 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
840 struct cfg80211_mgmt_registration *reg; 837 struct cfg80211_mgmt_registration *reg;
@@ -871,7 +868,7 @@ bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_mbm,
871 /* found match! */ 868 /* found match! */
872 869
873 /* Indicate the received Action frame to user space */ 870 /* Indicate the received Action frame to user space */
874 if (nl80211_send_mgmt(rdev, dev, reg->nlpid, 871 if (nl80211_send_mgmt(rdev, wdev, reg->nlpid,
875 freq, sig_mbm, 872 freq, sig_mbm,
876 buf, len, gfp)) 873 buf, len, gfp))
877 continue; 874 continue;
@@ -886,15 +883,14 @@ bool cfg80211_rx_mgmt(struct net_device *dev, int freq, int sig_mbm,
886} 883}
887EXPORT_SYMBOL(cfg80211_rx_mgmt); 884EXPORT_SYMBOL(cfg80211_rx_mgmt);
888 885
889void cfg80211_mgmt_tx_status(struct net_device *dev, u64 cookie, 886void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
890 const u8 *buf, size_t len, bool ack, gfp_t gfp) 887 const u8 *buf, size_t len, bool ack, gfp_t gfp)
891{ 888{
892 struct wireless_dev *wdev = dev->ieee80211_ptr;
893 struct wiphy *wiphy = wdev->wiphy; 889 struct wiphy *wiphy = wdev->wiphy;
894 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 890 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
895 891
896 /* Indicate TX status of the Action frame to user space */ 892 /* Indicate TX status of the Action frame to user space */
897 nl80211_send_mgmt_tx_status(rdev, dev, cookie, buf, len, ack, gfp); 893 nl80211_send_mgmt_tx_status(rdev, wdev, cookie, buf, len, ack, gfp);
898} 894}
899EXPORT_SYMBOL(cfg80211_mgmt_tx_status); 895EXPORT_SYMBOL(cfg80211_mgmt_tx_status);
900 896
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 5800c49d6942..0dc3356eea40 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -1728,6 +1728,11 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
1728 return result; 1728 return result;
1729} 1729}
1730 1730
1731static inline u64 wdev_id(struct wireless_dev *wdev)
1732{
1733 return (u64)wdev->identifier |
1734 ((u64)wiphy_to_dev(wdev->wiphy)->wiphy_idx << 32);
1735}
1731 1736
1732static int nl80211_send_iface(struct sk_buff *msg, u32 pid, u32 seq, int flags, 1737static int nl80211_send_iface(struct sk_buff *msg, u32 pid, u32 seq, int flags,
1733 struct cfg80211_registered_device *rdev, 1738 struct cfg80211_registered_device *rdev,
@@ -1735,8 +1740,6 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 pid, u32 seq, int flags,
1735{ 1740{
1736 struct net_device *dev = wdev->netdev; 1741 struct net_device *dev = wdev->netdev;
1737 void *hdr; 1742 void *hdr;
1738 u64 wdev_id = (u64)wdev->identifier |
1739 ((u64)rdev->wiphy_idx << 32);
1740 1743
1741 hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_INTERFACE); 1744 hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_INTERFACE);
1742 if (!hdr) 1745 if (!hdr)
@@ -1750,7 +1753,7 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 pid, u32 seq, int flags,
1750 1753
1751 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || 1754 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
1752 nla_put_u32(msg, NL80211_ATTR_IFTYPE, wdev->iftype) || 1755 nla_put_u32(msg, NL80211_ATTR_IFTYPE, wdev->iftype) ||
1753 nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id) || 1756 nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) ||
1754 nla_put_u32(msg, NL80211_ATTR_GENERATION, 1757 nla_put_u32(msg, NL80211_ATTR_GENERATION,
1755 rdev->devlist_generation ^ 1758 rdev->devlist_generation ^
1756 (cfg80211_rdev_list_generation << 2))) 1759 (cfg80211_rdev_list_generation << 2)))
@@ -5752,7 +5755,7 @@ static int nl80211_remain_on_channel(struct sk_buff *skb,
5752 struct genl_info *info) 5755 struct genl_info *info)
5753{ 5756{
5754 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 5757 struct cfg80211_registered_device *rdev = info->user_ptr[0];
5755 struct net_device *dev = info->user_ptr[1]; 5758 struct wireless_dev *wdev = info->user_ptr[1];
5756 struct ieee80211_channel *chan; 5759 struct ieee80211_channel *chan;
5757 struct sk_buff *msg; 5760 struct sk_buff *msg;
5758 void *hdr; 5761 void *hdr;
@@ -5800,7 +5803,7 @@ static int nl80211_remain_on_channel(struct sk_buff *skb,
5800 goto free_msg; 5803 goto free_msg;
5801 } 5804 }
5802 5805
5803 err = rdev->ops->remain_on_channel(&rdev->wiphy, dev, chan, 5806 err = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan,
5804 channel_type, duration, &cookie); 5807 channel_type, duration, &cookie);
5805 5808
5806 if (err) 5809 if (err)
@@ -5824,7 +5827,7 @@ static int nl80211_cancel_remain_on_channel(struct sk_buff *skb,
5824 struct genl_info *info) 5827 struct genl_info *info)
5825{ 5828{
5826 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 5829 struct cfg80211_registered_device *rdev = info->user_ptr[0];
5827 struct net_device *dev = info->user_ptr[1]; 5830 struct wireless_dev *wdev = info->user_ptr[1];
5828 u64 cookie; 5831 u64 cookie;
5829 5832
5830 if (!info->attrs[NL80211_ATTR_COOKIE]) 5833 if (!info->attrs[NL80211_ATTR_COOKIE])
@@ -5835,7 +5838,7 @@ static int nl80211_cancel_remain_on_channel(struct sk_buff *skb,
5835 5838
5836 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]); 5839 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]);
5837 5840
5838 return rdev->ops->cancel_remain_on_channel(&rdev->wiphy, dev, cookie); 5841 return rdev->ops->cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
5839} 5842}
5840 5843
5841static u32 rateset_to_mask(struct ieee80211_supported_band *sband, 5844static u32 rateset_to_mask(struct ieee80211_supported_band *sband,
@@ -5984,7 +5987,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
5984static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info) 5987static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info)
5985{ 5988{
5986 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 5989 struct cfg80211_registered_device *rdev = info->user_ptr[0];
5987 struct net_device *dev = info->user_ptr[1]; 5990 struct wireless_dev *wdev = info->user_ptr[1];
5988 u16 frame_type = IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION; 5991 u16 frame_type = IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION;
5989 5992
5990 if (!info->attrs[NL80211_ATTR_FRAME_MATCH]) 5993 if (!info->attrs[NL80211_ATTR_FRAME_MATCH])
@@ -5993,21 +5996,24 @@ static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info)
5993 if (info->attrs[NL80211_ATTR_FRAME_TYPE]) 5996 if (info->attrs[NL80211_ATTR_FRAME_TYPE])
5994 frame_type = nla_get_u16(info->attrs[NL80211_ATTR_FRAME_TYPE]); 5997 frame_type = nla_get_u16(info->attrs[NL80211_ATTR_FRAME_TYPE]);
5995 5998
5996 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && 5999 switch (wdev->iftype) {
5997 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC && 6000 case NL80211_IFTYPE_STATION:
5998 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT && 6001 case NL80211_IFTYPE_ADHOC:
5999 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && 6002 case NL80211_IFTYPE_P2P_CLIENT:
6000 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && 6003 case NL80211_IFTYPE_AP:
6001 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT && 6004 case NL80211_IFTYPE_AP_VLAN:
6002 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) 6005 case NL80211_IFTYPE_MESH_POINT:
6006 case NL80211_IFTYPE_P2P_GO:
6007 break;
6008 default:
6003 return -EOPNOTSUPP; 6009 return -EOPNOTSUPP;
6010 }
6004 6011
6005 /* not much point in registering if we can't reply */ 6012 /* not much point in registering if we can't reply */
6006 if (!rdev->ops->mgmt_tx) 6013 if (!rdev->ops->mgmt_tx)
6007 return -EOPNOTSUPP; 6014 return -EOPNOTSUPP;
6008 6015
6009 return cfg80211_mlme_register_mgmt(dev->ieee80211_ptr, info->snd_pid, 6016 return cfg80211_mlme_register_mgmt(wdev, info->snd_pid, frame_type,
6010 frame_type,
6011 nla_data(info->attrs[NL80211_ATTR_FRAME_MATCH]), 6017 nla_data(info->attrs[NL80211_ATTR_FRAME_MATCH]),
6012 nla_len(info->attrs[NL80211_ATTR_FRAME_MATCH])); 6018 nla_len(info->attrs[NL80211_ATTR_FRAME_MATCH]));
6013} 6019}
@@ -6015,7 +6021,7 @@ static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info)
6015static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info) 6021static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
6016{ 6022{
6017 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 6023 struct cfg80211_registered_device *rdev = info->user_ptr[0];
6018 struct net_device *dev = info->user_ptr[1]; 6024 struct wireless_dev *wdev = info->user_ptr[1];
6019 struct ieee80211_channel *chan; 6025 struct ieee80211_channel *chan;
6020 enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; 6026 enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
6021 bool channel_type_valid = false; 6027 bool channel_type_valid = false;
@@ -6036,14 +6042,18 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
6036 if (!rdev->ops->mgmt_tx) 6042 if (!rdev->ops->mgmt_tx)
6037 return -EOPNOTSUPP; 6043 return -EOPNOTSUPP;
6038 6044
6039 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && 6045 switch (wdev->iftype) {
6040 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC && 6046 case NL80211_IFTYPE_STATION:
6041 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT && 6047 case NL80211_IFTYPE_ADHOC:
6042 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && 6048 case NL80211_IFTYPE_P2P_CLIENT:
6043 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && 6049 case NL80211_IFTYPE_AP:
6044 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT && 6050 case NL80211_IFTYPE_AP_VLAN:
6045 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) 6051 case NL80211_IFTYPE_MESH_POINT:
6052 case NL80211_IFTYPE_P2P_GO:
6053 break;
6054 default:
6046 return -EOPNOTSUPP; 6055 return -EOPNOTSUPP;
6056 }
6047 6057
6048 if (info->attrs[NL80211_ATTR_DURATION]) { 6058 if (info->attrs[NL80211_ATTR_DURATION]) {
6049 if (!(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX)) 6059 if (!(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX))
@@ -6092,7 +6102,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
6092 } 6102 }
6093 } 6103 }
6094 6104
6095 err = cfg80211_mlme_mgmt_tx(rdev, dev, chan, offchan, channel_type, 6105 err = cfg80211_mlme_mgmt_tx(rdev, wdev, chan, offchan, channel_type,
6096 channel_type_valid, wait, 6106 channel_type_valid, wait,
6097 nla_data(info->attrs[NL80211_ATTR_FRAME]), 6107 nla_data(info->attrs[NL80211_ATTR_FRAME]),
6098 nla_len(info->attrs[NL80211_ATTR_FRAME]), 6108 nla_len(info->attrs[NL80211_ATTR_FRAME]),
@@ -6120,7 +6130,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
6120static int nl80211_tx_mgmt_cancel_wait(struct sk_buff *skb, struct genl_info *info) 6130static int nl80211_tx_mgmt_cancel_wait(struct sk_buff *skb, struct genl_info *info)
6121{ 6131{
6122 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 6132 struct cfg80211_registered_device *rdev = info->user_ptr[0];
6123 struct net_device *dev = info->user_ptr[1]; 6133 struct wireless_dev *wdev = info->user_ptr[1];
6124 u64 cookie; 6134 u64 cookie;
6125 6135
6126 if (!info->attrs[NL80211_ATTR_COOKIE]) 6136 if (!info->attrs[NL80211_ATTR_COOKIE])
@@ -6129,17 +6139,21 @@ static int nl80211_tx_mgmt_cancel_wait(struct sk_buff *skb, struct genl_info *in
6129 if (!rdev->ops->mgmt_tx_cancel_wait) 6139 if (!rdev->ops->mgmt_tx_cancel_wait)
6130 return -EOPNOTSUPP; 6140 return -EOPNOTSUPP;
6131 6141
6132 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION && 6142 switch (wdev->iftype) {
6133 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC && 6143 case NL80211_IFTYPE_STATION:
6134 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT && 6144 case NL80211_IFTYPE_ADHOC:
6135 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && 6145 case NL80211_IFTYPE_P2P_CLIENT:
6136 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN && 6146 case NL80211_IFTYPE_AP:
6137 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) 6147 case NL80211_IFTYPE_AP_VLAN:
6148 case NL80211_IFTYPE_P2P_GO:
6149 break;
6150 default:
6138 return -EOPNOTSUPP; 6151 return -EOPNOTSUPP;
6152 }
6139 6153
6140 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]); 6154 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]);
6141 6155
6142 return rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, dev, cookie); 6156 return rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
6143} 6157}
6144 6158
6145static int nl80211_set_power_save(struct sk_buff *skb, struct genl_info *info) 6159static int nl80211_set_power_save(struct sk_buff *skb, struct genl_info *info)
@@ -7172,7 +7186,7 @@ static struct genl_ops nl80211_ops[] = {
7172 .doit = nl80211_remain_on_channel, 7186 .doit = nl80211_remain_on_channel,
7173 .policy = nl80211_policy, 7187 .policy = nl80211_policy,
7174 .flags = GENL_ADMIN_PERM, 7188 .flags = GENL_ADMIN_PERM,
7175 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | 7189 .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
7176 NL80211_FLAG_NEED_RTNL, 7190 NL80211_FLAG_NEED_RTNL,
7177 }, 7191 },
7178 { 7192 {
@@ -7180,7 +7194,7 @@ static struct genl_ops nl80211_ops[] = {
7180 .doit = nl80211_cancel_remain_on_channel, 7194 .doit = nl80211_cancel_remain_on_channel,
7181 .policy = nl80211_policy, 7195 .policy = nl80211_policy,
7182 .flags = GENL_ADMIN_PERM, 7196 .flags = GENL_ADMIN_PERM,
7183 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | 7197 .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
7184 NL80211_FLAG_NEED_RTNL, 7198 NL80211_FLAG_NEED_RTNL,
7185 }, 7199 },
7186 { 7200 {
@@ -7196,7 +7210,7 @@ static struct genl_ops nl80211_ops[] = {
7196 .doit = nl80211_register_mgmt, 7210 .doit = nl80211_register_mgmt,
7197 .policy = nl80211_policy, 7211 .policy = nl80211_policy,
7198 .flags = GENL_ADMIN_PERM, 7212 .flags = GENL_ADMIN_PERM,
7199 .internal_flags = NL80211_FLAG_NEED_NETDEV | 7213 .internal_flags = NL80211_FLAG_NEED_WDEV |
7200 NL80211_FLAG_NEED_RTNL, 7214 NL80211_FLAG_NEED_RTNL,
7201 }, 7215 },
7202 { 7216 {
@@ -7204,7 +7218,7 @@ static struct genl_ops nl80211_ops[] = {
7204 .doit = nl80211_tx_mgmt, 7218 .doit = nl80211_tx_mgmt,
7205 .policy = nl80211_policy, 7219 .policy = nl80211_policy,
7206 .flags = GENL_ADMIN_PERM, 7220 .flags = GENL_ADMIN_PERM,
7207 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | 7221 .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
7208 NL80211_FLAG_NEED_RTNL, 7222 NL80211_FLAG_NEED_RTNL,
7209 }, 7223 },
7210 { 7224 {
@@ -7212,7 +7226,7 @@ static struct genl_ops nl80211_ops[] = {
7212 .doit = nl80211_tx_mgmt_cancel_wait, 7226 .doit = nl80211_tx_mgmt_cancel_wait,
7213 .policy = nl80211_policy, 7227 .policy = nl80211_policy,
7214 .flags = GENL_ADMIN_PERM, 7228 .flags = GENL_ADMIN_PERM,
7215 .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | 7229 .internal_flags = NL80211_FLAG_NEED_WDEV_UP |
7216 NL80211_FLAG_NEED_RTNL, 7230 NL80211_FLAG_NEED_RTNL,
7217 }, 7231 },
7218 { 7232 {
@@ -8040,7 +8054,7 @@ nla_put_failure:
8040 8054
8041static void nl80211_send_remain_on_chan_event( 8055static void nl80211_send_remain_on_chan_event(
8042 int cmd, struct cfg80211_registered_device *rdev, 8056 int cmd, struct cfg80211_registered_device *rdev,
8043 struct net_device *netdev, u64 cookie, 8057 struct wireless_dev *wdev, u64 cookie,
8044 struct ieee80211_channel *chan, 8058 struct ieee80211_channel *chan,
8045 enum nl80211_channel_type channel_type, 8059 enum nl80211_channel_type channel_type,
8046 unsigned int duration, gfp_t gfp) 8060 unsigned int duration, gfp_t gfp)
@@ -8059,7 +8073,9 @@ static void nl80211_send_remain_on_chan_event(
8059 } 8073 }
8060 8074
8061 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || 8075 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
8062 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || 8076 (wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX,
8077 wdev->netdev->ifindex)) ||
8078 nla_put_u32(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) ||
8063 nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq) || 8079 nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq) ||
8064 nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, channel_type) || 8080 nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, channel_type) ||
8065 nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie)) 8081 nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie))
@@ -8081,23 +8097,24 @@ static void nl80211_send_remain_on_chan_event(
8081} 8097}
8082 8098
8083void nl80211_send_remain_on_channel(struct cfg80211_registered_device *rdev, 8099void nl80211_send_remain_on_channel(struct cfg80211_registered_device *rdev,
8084 struct net_device *netdev, u64 cookie, 8100 struct wireless_dev *wdev, u64 cookie,
8085 struct ieee80211_channel *chan, 8101 struct ieee80211_channel *chan,
8086 enum nl80211_channel_type channel_type, 8102 enum nl80211_channel_type channel_type,
8087 unsigned int duration, gfp_t gfp) 8103 unsigned int duration, gfp_t gfp)
8088{ 8104{
8089 nl80211_send_remain_on_chan_event(NL80211_CMD_REMAIN_ON_CHANNEL, 8105 nl80211_send_remain_on_chan_event(NL80211_CMD_REMAIN_ON_CHANNEL,
8090 rdev, netdev, cookie, chan, 8106 rdev, wdev, cookie, chan,
8091 channel_type, duration, gfp); 8107 channel_type, duration, gfp);
8092} 8108}
8093 8109
8094void nl80211_send_remain_on_channel_cancel( 8110void nl80211_send_remain_on_channel_cancel(
8095 struct cfg80211_registered_device *rdev, struct net_device *netdev, 8111 struct cfg80211_registered_device *rdev,
8112 struct wireless_dev *wdev,
8096 u64 cookie, struct ieee80211_channel *chan, 8113 u64 cookie, struct ieee80211_channel *chan,
8097 enum nl80211_channel_type channel_type, gfp_t gfp) 8114 enum nl80211_channel_type channel_type, gfp_t gfp)
8098{ 8115{
8099 nl80211_send_remain_on_chan_event(NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, 8116 nl80211_send_remain_on_chan_event(NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL,
8100 rdev, netdev, cookie, chan, 8117 rdev, wdev, cookie, chan,
8101 channel_type, 0, gfp); 8118 channel_type, 0, gfp);
8102} 8119}
8103 8120
@@ -8211,10 +8228,11 @@ bool nl80211_unexpected_4addr_frame(struct net_device *dev,
8211} 8228}
8212 8229
8213int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, 8230int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
8214 struct net_device *netdev, u32 nlpid, 8231 struct wireless_dev *wdev, u32 nlpid,
8215 int freq, int sig_dbm, 8232 int freq, int sig_dbm,
8216 const u8 *buf, size_t len, gfp_t gfp) 8233 const u8 *buf, size_t len, gfp_t gfp)
8217{ 8234{
8235 struct net_device *netdev = wdev->netdev;
8218 struct sk_buff *msg; 8236 struct sk_buff *msg;
8219 void *hdr; 8237 void *hdr;
8220 8238
@@ -8229,7 +8247,8 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
8229 } 8247 }
8230 8248
8231 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || 8249 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
8232 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || 8250 (netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX,
8251 netdev->ifindex)) ||
8233 nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq) || 8252 nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq) ||
8234 (sig_dbm && 8253 (sig_dbm &&
8235 nla_put_u32(msg, NL80211_ATTR_RX_SIGNAL_DBM, sig_dbm)) || 8254 nla_put_u32(msg, NL80211_ATTR_RX_SIGNAL_DBM, sig_dbm)) ||
@@ -8247,10 +8266,11 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
8247} 8266}
8248 8267
8249void nl80211_send_mgmt_tx_status(struct cfg80211_registered_device *rdev, 8268void nl80211_send_mgmt_tx_status(struct cfg80211_registered_device *rdev,
8250 struct net_device *netdev, u64 cookie, 8269 struct wireless_dev *wdev, u64 cookie,
8251 const u8 *buf, size_t len, bool ack, 8270 const u8 *buf, size_t len, bool ack,
8252 gfp_t gfp) 8271 gfp_t gfp)
8253{ 8272{
8273 struct net_device *netdev = wdev->netdev;
8254 struct sk_buff *msg; 8274 struct sk_buff *msg;
8255 void *hdr; 8275 void *hdr;
8256 8276
@@ -8265,7 +8285,8 @@ void nl80211_send_mgmt_tx_status(struct cfg80211_registered_device *rdev,
8265 } 8285 }
8266 8286
8267 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || 8287 if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
8268 nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex) || 8288 (netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX,
8289 netdev->ifindex)) ||
8269 nla_put(msg, NL80211_ATTR_FRAME, len, buf) || 8290 nla_put(msg, NL80211_ATTR_FRAME, len, buf) ||
8270 nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie) || 8291 nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie) ||
8271 (ack && nla_put_flag(msg, NL80211_ATTR_ACK))) 8292 (ack && nla_put_flag(msg, NL80211_ATTR_ACK)))
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index 01a1122c3b33..0469303b5c3c 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -74,13 +74,13 @@ void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev,
74 gfp_t gfp); 74 gfp_t gfp);
75 75
76void nl80211_send_remain_on_channel(struct cfg80211_registered_device *rdev, 76void nl80211_send_remain_on_channel(struct cfg80211_registered_device *rdev,
77 struct net_device *netdev, 77 struct wireless_dev *wdev, u64 cookie,
78 u64 cookie,
79 struct ieee80211_channel *chan, 78 struct ieee80211_channel *chan,
80 enum nl80211_channel_type channel_type, 79 enum nl80211_channel_type channel_type,
81 unsigned int duration, gfp_t gfp); 80 unsigned int duration, gfp_t gfp);
82void nl80211_send_remain_on_channel_cancel( 81void nl80211_send_remain_on_channel_cancel(
83 struct cfg80211_registered_device *rdev, struct net_device *netdev, 82 struct cfg80211_registered_device *rdev,
83 struct wireless_dev *wdev,
84 u64 cookie, struct ieee80211_channel *chan, 84 u64 cookie, struct ieee80211_channel *chan,
85 enum nl80211_channel_type channel_type, gfp_t gfp); 85 enum nl80211_channel_type channel_type, gfp_t gfp);
86 86
@@ -92,11 +92,11 @@ void nl80211_send_sta_del_event(struct cfg80211_registered_device *rdev,
92 gfp_t gfp); 92 gfp_t gfp);
93 93
94int nl80211_send_mgmt(struct cfg80211_registered_device *rdev, 94int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
95 struct net_device *netdev, u32 nlpid, 95 struct wireless_dev *wdev, u32 nlpid,
96 int freq, int sig_dbm, 96 int freq, int sig_dbm,
97 const u8 *buf, size_t len, gfp_t gfp); 97 const u8 *buf, size_t len, gfp_t gfp);
98void nl80211_send_mgmt_tx_status(struct cfg80211_registered_device *rdev, 98void nl80211_send_mgmt_tx_status(struct cfg80211_registered_device *rdev,
99 struct net_device *netdev, u64 cookie, 99 struct wireless_dev *wdev, u64 cookie,
100 const u8 *buf, size_t len, bool ack, 100 const u8 *buf, size_t len, bool ack,
101 gfp_t gfp); 101 gfp_t gfp);
102 102