aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-11-08 12:31:02 -0500
committerJohannes Berg <johannes.berg@intel.com>2012-11-26 06:42:58 -0500
commit42d97a599eb6b2aab3a401b3e5799a399d6c7652 (patch)
tree1905b71c2092ad299503515dd0d59fa74573cd12
parent028e8da0723a6f6a00d9d1e3dae9ad448a28987e (diff)
cfg80211: remove remain-on-channel channel type
As mwifiex (and mac80211 in the software case) are the only drivers actually implementing remain-on-channel with channel type, userspace can't be relying on it. This is the case, as it's used only for P2P operations right now. Rather than adding a flag to tell userspace whether or not it can actually rely on it, simplify all the code by removing the ability to use different channel types. Leave only the validation of the attribute, so that if we extend it again later (with the needed capability flag), it can't break userspace sending invalid data. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/ath/ath6kl/cfg80211.c7
-rw-r--r--drivers/net/wireless/ath/ath6kl/wmi.c5
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/dev.h1
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/mac80211.c2
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c1
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c16
-rw-r--r--drivers/net/wireless/mwifiex/main.h2
-rw-r--r--drivers/net/wireless/mwifiex/sta_event.c1
-rw-r--r--drivers/net/wireless/mwifiex/sta_ioctl.c3
-rw-r--r--include/net/cfg80211.h11
-rw-r--r--include/net/mac80211.h1
-rw-r--r--include/uapi/linux/nl80211.h14
-rw-r--r--net/mac80211/cfg.c27
-rw-r--r--net/mac80211/driver-ops.h5
-rw-r--r--net/mac80211/ieee80211_i.h2
-rw-r--r--net/mac80211/main.c2
-rw-r--r--net/mac80211/offchannel.c8
-rw-r--r--net/mac80211/trace.h6
-rw-r--r--net/wireless/core.h6
-rw-r--r--net/wireless/mlme.c21
-rw-r--r--net/wireless/nl80211.c36
-rw-r--r--net/wireless/nl80211.h4
-rw-r--r--net/wireless/rdev-ops.h20
-rw-r--r--net/wireless/trace.h52
24 files changed, 81 insertions, 172 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index d615f9f7506..74091d33ed6 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -2976,7 +2976,6 @@ static int ath6kl_change_station(struct wiphy *wiphy, struct net_device *dev,
2976static int ath6kl_remain_on_channel(struct wiphy *wiphy, 2976static int ath6kl_remain_on_channel(struct wiphy *wiphy,
2977 struct wireless_dev *wdev, 2977 struct wireless_dev *wdev,
2978 struct ieee80211_channel *chan, 2978 struct ieee80211_channel *chan,
2979 enum nl80211_channel_type channel_type,
2980 unsigned int duration, 2979 unsigned int duration,
2981 u64 *cookie) 2980 u64 *cookie)
2982{ 2981{
@@ -3135,10 +3134,8 @@ static bool ath6kl_is_p2p_go_ssid(const u8 *buf, size_t len)
3135 3134
3136static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, 3135static int ath6kl_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
3137 struct ieee80211_channel *chan, bool offchan, 3136 struct ieee80211_channel *chan, bool offchan,
3138 enum nl80211_channel_type channel_type, 3137 unsigned int wait, const u8 *buf, size_t len,
3139 bool channel_type_valid, unsigned int wait, 3138 bool no_cck, bool dont_wait_for_ack, u64 *cookie)
3140 const u8 *buf, size_t len, bool no_cck,
3141 bool dont_wait_for_ack, u64 *cookie)
3142{ 3139{
3143 struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev); 3140 struct ath6kl_vif *vif = ath6kl_vif_from_wdev(wdev);
3144 struct ath6kl *ar = ath6kl_priv(vif->ndev); 3141 struct ath6kl *ar = ath6kl_priv(vif->ndev);
diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c
index c30ab4b11d6..0e05c41cdcf 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->wdev, id, chan, NL80211_CHAN_NO_HT, 477 cfg80211_ready_on_channel(&vif->wdev, id, chan,
478 dur, GFP_ATOMIC); 478 dur, GFP_ATOMIC);
479 479
480 return 0; 480 return 0;
@@ -513,8 +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->wdev, id, chan, 516 cfg80211_remain_on_channel_expired(&vif->wdev, id, chan, GFP_ATOMIC);
517 NL80211_CHAN_NO_HT, GFP_ATOMIC);
518 517
519 return 0; 518 return 0;
520} 519}
diff --git a/drivers/net/wireless/iwlwifi/dvm/dev.h b/drivers/net/wireless/iwlwifi/dvm/dev.h
index 8141f91c372..29c571a5625 100644
--- a/drivers/net/wireless/iwlwifi/dvm/dev.h
+++ b/drivers/net/wireless/iwlwifi/dvm/dev.h
@@ -789,7 +789,6 @@ struct iwl_priv {
789 /* remain-on-channel offload support */ 789 /* remain-on-channel offload support */
790 struct ieee80211_channel *hw_roc_channel; 790 struct ieee80211_channel *hw_roc_channel;
791 struct delayed_work hw_roc_disable_work; 791 struct delayed_work hw_roc_disable_work;
792 enum nl80211_channel_type hw_roc_chantype;
793 int hw_roc_duration; 792 int hw_roc_duration;
794 bool hw_roc_setup, hw_roc_start_notified; 793 bool hw_roc_setup, hw_roc_start_notified;
795 794
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
index e75d80341f2..852edb02e5f 100644
--- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c
@@ -1034,7 +1034,6 @@ done:
1034static int iwlagn_mac_remain_on_channel(struct ieee80211_hw *hw, 1034static int iwlagn_mac_remain_on_channel(struct ieee80211_hw *hw,
1035 struct ieee80211_vif *vif, 1035 struct ieee80211_vif *vif,
1036 struct ieee80211_channel *channel, 1036 struct ieee80211_channel *channel,
1037 enum nl80211_channel_type channel_type,
1038 int duration) 1037 int duration)
1039{ 1038{
1040 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw); 1039 struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);
@@ -1066,7 +1065,6 @@ static int iwlagn_mac_remain_on_channel(struct ieee80211_hw *hw,
1066 } 1065 }
1067 1066
1068 priv->hw_roc_channel = channel; 1067 priv->hw_roc_channel = channel;
1069 priv->hw_roc_chantype = channel_type;
1070 /* convert from ms to TU */ 1068 /* convert from ms to TU */
1071 priv->hw_roc_duration = DIV_ROUND_UP(1000 * duration, 1024); 1069 priv->hw_roc_duration = DIV_ROUND_UP(1000 * duration, 1024);
1072 priv->hw_roc_start_notified = false; 1070 priv->hw_roc_start_notified = false;
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 3baa51f1bb8..b0338543547 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -1455,7 +1455,6 @@ static void hw_roc_done(struct work_struct *work)
1455static int mac80211_hwsim_roc(struct ieee80211_hw *hw, 1455static int mac80211_hwsim_roc(struct ieee80211_hw *hw,
1456 struct ieee80211_vif *vif, 1456 struct ieee80211_vif *vif,
1457 struct ieee80211_channel *chan, 1457 struct ieee80211_channel *chan,
1458 enum nl80211_channel_type channel_type,
1459 int duration) 1458 int duration)
1460{ 1459{
1461 struct mac80211_hwsim_data *hwsim = hw->priv; 1460 struct mac80211_hwsim_data *hwsim = hw->priv;
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 8e829b251d8..f69190b492a 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -180,10 +180,8 @@ mwifiex_form_mgmt_frame(struct sk_buff *skb, const u8 *buf, size_t len)
180static int 180static int
181mwifiex_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, 181mwifiex_cfg80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
182 struct ieee80211_channel *chan, bool offchan, 182 struct ieee80211_channel *chan, bool offchan,
183 enum nl80211_channel_type channel_type, 183 unsigned int wait, const u8 *buf, size_t len,
184 bool channel_type_valid, unsigned int wait, 184 bool no_cck, bool dont_wait_for_ack, u64 *cookie)
185 const u8 *buf, size_t len, bool no_cck,
186 bool dont_wait_for_ack, u64 *cookie)
187{ 185{
188 struct sk_buff *skb; 186 struct sk_buff *skb;
189 u16 pkt_len; 187 u16 pkt_len;
@@ -253,7 +251,6 @@ static int
253mwifiex_cfg80211_remain_on_channel(struct wiphy *wiphy, 251mwifiex_cfg80211_remain_on_channel(struct wiphy *wiphy,
254 struct wireless_dev *wdev, 252 struct wireless_dev *wdev,
255 struct ieee80211_channel *chan, 253 struct ieee80211_channel *chan,
256 enum nl80211_channel_type channel_type,
257 unsigned int duration, u64 *cookie) 254 unsigned int duration, u64 *cookie)
258{ 255{
259 struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev); 256 struct mwifiex_private *priv = mwifiex_netdev_get_priv(wdev->netdev);
@@ -271,15 +268,14 @@ mwifiex_cfg80211_remain_on_channel(struct wiphy *wiphy,
271 } 268 }
272 269
273 ret = mwifiex_remain_on_chan_cfg(priv, HostCmd_ACT_GEN_SET, chan, 270 ret = mwifiex_remain_on_chan_cfg(priv, HostCmd_ACT_GEN_SET, chan,
274 &channel_type, duration); 271 duration);
275 272
276 if (!ret) { 273 if (!ret) {
277 *cookie = random32() | 1; 274 *cookie = random32() | 1;
278 priv->roc_cfg.cookie = *cookie; 275 priv->roc_cfg.cookie = *cookie;
279 priv->roc_cfg.chan = *chan; 276 priv->roc_cfg.chan = *chan;
280 priv->roc_cfg.chan_type = channel_type;
281 277
282 cfg80211_ready_on_channel(wdev, *cookie, chan, channel_type, 278 cfg80211_ready_on_channel(wdev, *cookie, chan,
283 duration, GFP_ATOMIC); 279 duration, GFP_ATOMIC);
284 280
285 wiphy_dbg(wiphy, "info: ROC, cookie = 0x%llx\n", *cookie); 281 wiphy_dbg(wiphy, "info: ROC, cookie = 0x%llx\n", *cookie);
@@ -302,13 +298,11 @@ mwifiex_cfg80211_cancel_remain_on_channel(struct wiphy *wiphy,
302 return -ENOENT; 298 return -ENOENT;
303 299
304 ret = mwifiex_remain_on_chan_cfg(priv, HostCmd_ACT_GEN_REMOVE, 300 ret = mwifiex_remain_on_chan_cfg(priv, HostCmd_ACT_GEN_REMOVE,
305 &priv->roc_cfg.chan, 301 &priv->roc_cfg.chan, 0);
306 &priv->roc_cfg.chan_type, 0);
307 302
308 if (!ret) { 303 if (!ret) {
309 cfg80211_remain_on_channel_expired(wdev, cookie, 304 cfg80211_remain_on_channel_expired(wdev, cookie,
310 &priv->roc_cfg.chan, 305 &priv->roc_cfg.chan,
311 priv->roc_cfg.chan_type,
312 GFP_ATOMIC); 306 GFP_ATOMIC);
313 307
314 memset(&priv->roc_cfg, 0, sizeof(struct mwifiex_roc_cfg)); 308 memset(&priv->roc_cfg, 0, sizeof(struct mwifiex_roc_cfg));
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 81f8772dcb0..771717df1c5 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -371,7 +371,6 @@ struct wps {
371struct mwifiex_roc_cfg { 371struct mwifiex_roc_cfg {
372 u64 cookie; 372 u64 cookie;
373 struct ieee80211_channel chan; 373 struct ieee80211_channel chan;
374 enum nl80211_channel_type chan_type;
375}; 374};
376 375
377struct mwifiex_adapter; 376struct mwifiex_adapter;
@@ -1016,7 +1015,6 @@ int mwifiex_get_ver_ext(struct mwifiex_private *priv);
1016 1015
1017int mwifiex_remain_on_chan_cfg(struct mwifiex_private *priv, u16 action, 1016int mwifiex_remain_on_chan_cfg(struct mwifiex_private *priv, u16 action,
1018 struct ieee80211_channel *chan, 1017 struct ieee80211_channel *chan,
1019 enum nl80211_channel_type *channel_type,
1020 unsigned int duration); 1018 unsigned int duration);
1021 1019
1022int mwifiex_set_bss_role(struct mwifiex_private *priv, u8 bss_role); 1020int mwifiex_set_bss_role(struct mwifiex_private *priv, u8 bss_role);
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c
index 8132119e1a2..78dfa31c908 100644
--- a/drivers/net/wireless/mwifiex/sta_event.c
+++ b/drivers/net/wireless/mwifiex/sta_event.c
@@ -424,7 +424,6 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
424 cfg80211_remain_on_channel_expired(priv->wdev, 424 cfg80211_remain_on_channel_expired(priv->wdev,
425 priv->roc_cfg.cookie, 425 priv->roc_cfg.cookie,
426 &priv->roc_cfg.chan, 426 &priv->roc_cfg.chan,
427 priv->roc_cfg.chan_type,
428 GFP_ATOMIC); 427 GFP_ATOMIC);
429 428
430 memset(&priv->roc_cfg, 0x00, sizeof(struct mwifiex_roc_cfg)); 429 memset(&priv->roc_cfg, 0x00, sizeof(struct mwifiex_roc_cfg));
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 552d72ed055..24af6ba7d8a 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -1046,7 +1046,6 @@ mwifiex_get_ver_ext(struct mwifiex_private *priv)
1046int 1046int
1047mwifiex_remain_on_chan_cfg(struct mwifiex_private *priv, u16 action, 1047mwifiex_remain_on_chan_cfg(struct mwifiex_private *priv, u16 action,
1048 struct ieee80211_channel *chan, 1048 struct ieee80211_channel *chan,
1049 enum nl80211_channel_type *ct,
1050 unsigned int duration) 1049 unsigned int duration)
1051{ 1050{
1052 struct host_cmd_ds_remain_on_chan roc_cfg; 1051 struct host_cmd_ds_remain_on_chan roc_cfg;
@@ -1056,7 +1055,7 @@ mwifiex_remain_on_chan_cfg(struct mwifiex_private *priv, u16 action,
1056 roc_cfg.action = cpu_to_le16(action); 1055 roc_cfg.action = cpu_to_le16(action);
1057 if (action == HostCmd_ACT_GEN_SET) { 1056 if (action == HostCmd_ACT_GEN_SET) {
1058 roc_cfg.band_cfg = chan->band; 1057 roc_cfg.band_cfg = chan->band;
1059 sc = mwifiex_chan_type_to_sec_chan_offset(*ct); 1058 sc = mwifiex_chan_type_to_sec_chan_offset(NL80211_CHAN_NO_HT);
1060 roc_cfg.band_cfg |= (sc << 2); 1059 roc_cfg.band_cfg |= (sc << 2);
1061 1060
1062 roc_cfg.channel = 1061 roc_cfg.channel =
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index c2c185febb8..1effe0682d2 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1791,7 +1791,6 @@ struct cfg80211_ops {
1791 int (*remain_on_channel)(struct wiphy *wiphy, 1791 int (*remain_on_channel)(struct wiphy *wiphy,
1792 struct wireless_dev *wdev, 1792 struct wireless_dev *wdev,
1793 struct ieee80211_channel *chan, 1793 struct ieee80211_channel *chan,
1794 enum nl80211_channel_type channel_type,
1795 unsigned int duration, 1794 unsigned int duration,
1796 u64 *cookie); 1795 u64 *cookie);
1797 int (*cancel_remain_on_channel)(struct wiphy *wiphy, 1796 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
@@ -1800,10 +1799,8 @@ struct cfg80211_ops {
1800 1799
1801 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev, 1800 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
1802 struct ieee80211_channel *chan, bool offchan, 1801 struct ieee80211_channel *chan, bool offchan,
1803 enum nl80211_channel_type channel_type, 1802 unsigned int wait, const u8 *buf, size_t len,
1804 bool channel_type_valid, unsigned int wait, 1803 bool no_cck, bool dont_wait_for_ack, u64 *cookie);
1805 const u8 *buf, size_t len, bool no_cck,
1806 bool dont_wait_for_ack, u64 *cookie);
1807 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy, 1804 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
1808 struct wireless_dev *wdev, 1805 struct wireless_dev *wdev,
1809 u64 cookie); 1806 u64 cookie);
@@ -3350,14 +3347,12 @@ void cfg80211_disconnected(struct net_device *dev, u16 reason,
3350 * @wdev: wireless device 3347 * @wdev: wireless device
3351 * @cookie: the request cookie 3348 * @cookie: the request cookie
3352 * @chan: The current channel (from remain_on_channel request) 3349 * @chan: The current channel (from remain_on_channel request)
3353 * @channel_type: Channel type
3354 * @duration: Duration in milliseconds that the driver intents to remain on the 3350 * @duration: Duration in milliseconds that the driver intents to remain on the
3355 * channel 3351 * channel
3356 * @gfp: allocation flags 3352 * @gfp: allocation flags
3357 */ 3353 */
3358void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 3354void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
3359 struct ieee80211_channel *chan, 3355 struct ieee80211_channel *chan,
3360 enum nl80211_channel_type channel_type,
3361 unsigned int duration, gfp_t gfp); 3356 unsigned int duration, gfp_t gfp);
3362 3357
3363/** 3358/**
@@ -3365,12 +3360,10 @@ void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
3365 * @wdev: wireless device 3360 * @wdev: wireless device
3366 * @cookie: the request cookie 3361 * @cookie: the request cookie
3367 * @chan: The current channel (from remain_on_channel request) 3362 * @chan: The current channel (from remain_on_channel request)
3368 * @channel_type: Channel type
3369 * @gfp: allocation flags 3363 * @gfp: allocation flags
3370 */ 3364 */
3371void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 3365void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
3372 struct ieee80211_channel *chan, 3366 struct ieee80211_channel *chan,
3373 enum nl80211_channel_type channel_type,
3374 gfp_t gfp); 3367 gfp_t gfp);
3375 3368
3376 3369
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index e1293c7e4d2..12093778b05 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2550,7 +2550,6 @@ struct ieee80211_ops {
2550 int (*remain_on_channel)(struct ieee80211_hw *hw, 2550 int (*remain_on_channel)(struct ieee80211_hw *hw,
2551 struct ieee80211_vif *vif, 2551 struct ieee80211_vif *vif,
2552 struct ieee80211_channel *chan, 2552 struct ieee80211_channel *chan,
2553 enum nl80211_channel_type channel_type,
2554 int duration); 2553 int duration);
2555 int (*cancel_remain_on_channel)(struct ieee80211_hw *hw); 2554 int (*cancel_remain_on_channel)(struct ieee80211_hw *hw);
2556 int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx); 2555 int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx);
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 1a9a819cfab..43cd6fa084c 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -401,8 +401,7 @@
401 * a response while being associated to an AP on another channel. 401 * a response while being associated to an AP on another channel.
402 * %NL80211_ATTR_IFINDEX is used to specify which interface (and thus 402 * %NL80211_ATTR_IFINDEX is used to specify which interface (and thus
403 * radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the 403 * radio) is used. %NL80211_ATTR_WIPHY_FREQ is used to specify the
404 * frequency for the operation and %NL80211_ATTR_WIPHY_CHANNEL_TYPE may be 404 * frequency for the operation.
405 * optionally used to specify additional channel parameters.
406 * %NL80211_ATTR_DURATION is used to specify the duration in milliseconds 405 * %NL80211_ATTR_DURATION is used to specify the duration in milliseconds
407 * to remain on the channel. This command is also used as an event to 406 * to remain on the channel. This command is also used as an event to
408 * notify when the requested duration starts (it may take a while for the 407 * notify when the requested duration starts (it may take a while for the
@@ -440,12 +439,11 @@
440 * as an event indicating reception of a frame that was not processed in 439 * as an event indicating reception of a frame that was not processed in
441 * kernel code, but is for us (i.e., which may need to be processed in a 440 * kernel code, but is for us (i.e., which may need to be processed in a
442 * user space application). %NL80211_ATTR_FRAME is used to specify the 441 * user space application). %NL80211_ATTR_FRAME is used to specify the
443 * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ (and 442 * frame contents (including header). %NL80211_ATTR_WIPHY_FREQ is used
444 * optionally %NL80211_ATTR_WIPHY_CHANNEL_TYPE) is used to indicate on 443 * to indicate on which channel the frame is to be transmitted or was
445 * which channel the frame is to be transmitted or was received. If this 444 * received. If this channel is not the current channel (remain-on-channel
446 * channel is not the current channel (remain-on-channel or the 445 * or the operational channel) the device will switch to the given channel
447 * operational channel) the device will switch to the given channel and 446 * and transmit the frame, optionally waiting for a response for the time
448 * transmit the frame, optionally waiting for a response for the time
449 * specified using %NL80211_ATTR_DURATION. When called, this operation 447 * specified using %NL80211_ATTR_DURATION. When called, this operation
450 * returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the 448 * returns a cookie (%NL80211_ATTR_COOKIE) that will be included with the
451 * TX status event pertaining to the TX request. 449 * TX status event pertaining to the TX request.
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 18926aea480..ac0241e3539 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -2236,7 +2236,6 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy,
2236static int ieee80211_start_roc_work(struct ieee80211_local *local, 2236static int ieee80211_start_roc_work(struct ieee80211_local *local,
2237 struct ieee80211_sub_if_data *sdata, 2237 struct ieee80211_sub_if_data *sdata,
2238 struct ieee80211_channel *channel, 2238 struct ieee80211_channel *channel,
2239 enum nl80211_channel_type channel_type,
2240 unsigned int duration, u64 *cookie, 2239 unsigned int duration, u64 *cookie,
2241 struct sk_buff *txskb) 2240 struct sk_buff *txskb)
2242{ 2241{
@@ -2254,7 +2253,6 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
2254 return -ENOMEM; 2253 return -ENOMEM;
2255 2254
2256 roc->chan = channel; 2255 roc->chan = channel;
2257 roc->chan_type = channel_type;
2258 roc->duration = duration; 2256 roc->duration = duration;
2259 roc->req_duration = duration; 2257 roc->req_duration = duration;
2260 roc->frame = txskb; 2258 roc->frame = txskb;
@@ -2287,8 +2285,7 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
2287 if (!duration) 2285 if (!duration)
2288 duration = 10; 2286 duration = 10;
2289 2287
2290 ret = drv_remain_on_channel(local, sdata, channel, channel_type, 2288 ret = drv_remain_on_channel(local, sdata, channel, duration);
2291 duration);
2292 if (ret) { 2289 if (ret) {
2293 kfree(roc); 2290 kfree(roc);
2294 return ret; 2291 return ret;
@@ -2299,8 +2296,7 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
2299 2296
2300 out_check_combine: 2297 out_check_combine:
2301 list_for_each_entry(tmp, &local->roc_list, list) { 2298 list_for_each_entry(tmp, &local->roc_list, list) {
2302 if (tmp->chan != channel || tmp->chan_type != channel_type || 2299 if (tmp->chan != channel || tmp->sdata != sdata)
2303 tmp->sdata != sdata)
2304 continue; 2300 continue;
2305 2301
2306 /* 2302 /*
@@ -2417,7 +2413,6 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
2417static int ieee80211_remain_on_channel(struct wiphy *wiphy, 2413static int ieee80211_remain_on_channel(struct wiphy *wiphy,
2418 struct wireless_dev *wdev, 2414 struct wireless_dev *wdev,
2419 struct ieee80211_channel *chan, 2415 struct ieee80211_channel *chan,
2420 enum nl80211_channel_type channel_type,
2421 unsigned int duration, 2416 unsigned int duration,
2422 u64 *cookie) 2417 u64 *cookie)
2423{ 2418{
@@ -2426,7 +2421,7 @@ static int ieee80211_remain_on_channel(struct wiphy *wiphy,
2426 int ret; 2421 int ret;
2427 2422
2428 mutex_lock(&local->mtx); 2423 mutex_lock(&local->mtx);
2429 ret = ieee80211_start_roc_work(local, sdata, chan, channel_type, 2424 ret = ieee80211_start_roc_work(local, sdata, chan,
2430 duration, cookie, NULL); 2425 duration, cookie, NULL);
2431 mutex_unlock(&local->mtx); 2426 mutex_unlock(&local->mtx);
2432 2427
@@ -2519,10 +2514,8 @@ static int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy,
2519 2514
2520static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, 2515static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
2521 struct ieee80211_channel *chan, bool offchan, 2516 struct ieee80211_channel *chan, bool offchan,
2522 enum nl80211_channel_type channel_type, 2517 unsigned int wait, const u8 *buf, size_t len,
2523 bool channel_type_valid, unsigned int wait, 2518 bool no_cck, bool dont_wait_for_ack, u64 *cookie)
2524 const u8 *buf, size_t len, bool no_cck,
2525 bool dont_wait_for_ack, u64 *cookie)
2526{ 2519{
2527 struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); 2520 struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
2528 struct ieee80211_local *local = sdata->local; 2521 struct ieee80211_local *local = sdata->local;
@@ -2591,14 +2584,10 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
2591 rcu_read_lock(); 2584 rcu_read_lock();
2592 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 2585 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
2593 2586
2594 if (chanctx_conf) { 2587 if (chanctx_conf)
2595 need_offchan = chan != chanctx_conf->channel; 2588 need_offchan = chan != chanctx_conf->channel;
2596 if (channel_type_valid && 2589 else
2597 channel_type != chanctx_conf->channel_type)
2598 need_offchan = true;
2599 } else {
2600 need_offchan = true; 2590 need_offchan = true;
2601 }
2602 rcu_read_unlock(); 2591 rcu_read_unlock();
2603 } 2592 }
2604 2593
@@ -2633,7 +2622,7 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
2633 local->hw.offchannel_tx_hw_queue; 2622 local->hw.offchannel_tx_hw_queue;
2634 2623
2635 /* This will handle all kinds of coalescing and immediate TX */ 2624 /* This will handle all kinds of coalescing and immediate TX */
2636 ret = ieee80211_start_roc_work(local, sdata, chan, channel_type, 2625 ret = ieee80211_start_roc_work(local, sdata, chan,
2637 wait, cookie, skb); 2626 wait, cookie, skb);
2638 if (ret) 2627 if (ret)
2639 kfree_skb(skb); 2628 kfree_skb(skb);
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 68c27aaf5c9..c6560cc7a9d 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -738,16 +738,15 @@ static inline int drv_get_antenna(struct ieee80211_local *local,
738static inline int drv_remain_on_channel(struct ieee80211_local *local, 738static inline int drv_remain_on_channel(struct ieee80211_local *local,
739 struct ieee80211_sub_if_data *sdata, 739 struct ieee80211_sub_if_data *sdata,
740 struct ieee80211_channel *chan, 740 struct ieee80211_channel *chan,
741 enum nl80211_channel_type chantype,
742 unsigned int duration) 741 unsigned int duration)
743{ 742{
744 int ret; 743 int ret;
745 744
746 might_sleep(); 745 might_sleep();
747 746
748 trace_drv_remain_on_channel(local, sdata, chan, chantype, duration); 747 trace_drv_remain_on_channel(local, sdata, chan, duration);
749 ret = local->ops->remain_on_channel(&local->hw, &sdata->vif, 748 ret = local->ops->remain_on_channel(&local->hw, &sdata->vif,
750 chan, chantype, duration); 749 chan, duration);
751 trace_drv_return_int(local, ret); 750 trace_drv_return_int(local, ret);
752 751
753 return ret; 752 return ret;
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index d5da0fe1431..fba4b1f425c 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -348,7 +348,6 @@ struct ieee80211_roc_work {
348 struct ieee80211_sub_if_data *sdata; 348 struct ieee80211_sub_if_data *sdata;
349 349
350 struct ieee80211_channel *chan; 350 struct ieee80211_channel *chan;
351 enum nl80211_channel_type chan_type;
352 351
353 bool started, abort, hw_begun, notified; 352 bool started, abort, hw_begun, notified;
354 353
@@ -1048,7 +1047,6 @@ struct ieee80211_local {
1048 1047
1049 /* Temporary remain-on-channel for off-channel operations */ 1048 /* Temporary remain-on-channel for off-channel operations */
1050 struct ieee80211_channel *tmp_channel; 1049 struct ieee80211_channel *tmp_channel;
1051 enum nl80211_channel_type tmp_channel_type;
1052 1050
1053 /* channel contexts */ 1051 /* channel contexts */
1054 struct list_head chanctx_list; 1052 struct list_head chanctx_list;
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 70e87600cac..b229cded456 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -115,7 +115,7 @@ static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local)
115 channel_type = NL80211_CHAN_NO_HT; 115 channel_type = NL80211_CHAN_NO_HT;
116 } else if (local->tmp_channel) { 116 } else if (local->tmp_channel) {
117 chan = local->tmp_channel; 117 chan = local->tmp_channel;
118 channel_type = local->tmp_channel_type; 118 channel_type = NL80211_CHAN_NO_HT;
119 } else { 119 } else {
120 chan = local->_oper_channel; 120 chan = local->_oper_channel;
121 channel_type = local->_oper_channel_type; 121 channel_type = local->_oper_channel_type;
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index 7f8a3651081..5abddfe3e10 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -205,8 +205,8 @@ void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc)
205 } 205 }
206 } else { 206 } else {
207 cfg80211_ready_on_channel(&roc->sdata->wdev, roc->cookie, 207 cfg80211_ready_on_channel(&roc->sdata->wdev, roc->cookie,
208 roc->chan, roc->chan_type, 208 roc->chan, roc->req_duration,
209 roc->req_duration, GFP_KERNEL); 209 GFP_KERNEL);
210 } 210 }
211 211
212 roc->notified = true; 212 roc->notified = true;
@@ -284,7 +284,6 @@ void ieee80211_start_next_roc(struct ieee80211_local *local)
284 duration = 10; 284 duration = 10;
285 285
286 ret = drv_remain_on_channel(local, roc->sdata, roc->chan, 286 ret = drv_remain_on_channel(local, roc->sdata, roc->chan,
287 roc->chan_type,
288 duration); 287 duration);
289 288
290 roc->started = true; 289 roc->started = true;
@@ -321,7 +320,7 @@ void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc)
321 if (!roc->mgmt_tx_cookie) 320 if (!roc->mgmt_tx_cookie)
322 cfg80211_remain_on_channel_expired(&roc->sdata->wdev, 321 cfg80211_remain_on_channel_expired(&roc->sdata->wdev,
323 roc->cookie, roc->chan, 322 roc->cookie, roc->chan,
324 roc->chan_type, GFP_KERNEL); 323 GFP_KERNEL);
325 324
326 list_for_each_entry_safe(dep, tmp, &roc->dependents, list) 325 list_for_each_entry_safe(dep, tmp, &roc->dependents, list)
327 ieee80211_roc_notify_destroy(dep); 326 ieee80211_roc_notify_destroy(dep);
@@ -359,7 +358,6 @@ void ieee80211_sw_roc_work(struct work_struct *work)
359 ieee80211_recalc_idle(local); 358 ieee80211_recalc_idle(local);
360 359
361 local->tmp_channel = roc->chan; 360 local->tmp_channel = roc->chan;
362 local->tmp_channel_type = roc->chan_type;
363 ieee80211_hw_config(local, 0); 361 ieee80211_hw_config(local, 0);
364 362
365 /* tell userspace or send frame */ 363 /* tell userspace or send frame */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index e9579b7a2cd..bc28346ba20 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -1022,15 +1022,14 @@ TRACE_EVENT(drv_remain_on_channel,
1022 TP_PROTO(struct ieee80211_local *local, 1022 TP_PROTO(struct ieee80211_local *local,
1023 struct ieee80211_sub_if_data *sdata, 1023 struct ieee80211_sub_if_data *sdata,
1024 struct ieee80211_channel *chan, 1024 struct ieee80211_channel *chan,
1025 enum nl80211_channel_type chantype, unsigned int duration), 1025 unsigned int duration),
1026 1026
1027 TP_ARGS(local, sdata, chan, chantype, duration), 1027 TP_ARGS(local, sdata, chan, duration),
1028 1028
1029 TP_STRUCT__entry( 1029 TP_STRUCT__entry(
1030 LOCAL_ENTRY 1030 LOCAL_ENTRY
1031 VIF_ENTRY 1031 VIF_ENTRY
1032 __field(int, center_freq) 1032 __field(int, center_freq)
1033 __field(int, channel_type)
1034 __field(unsigned int, duration) 1033 __field(unsigned int, duration)
1035 ), 1034 ),
1036 1035
@@ -1038,7 +1037,6 @@ TRACE_EVENT(drv_remain_on_channel,
1038 LOCAL_ASSIGN; 1037 LOCAL_ASSIGN;
1039 VIF_ASSIGN; 1038 VIF_ASSIGN;
1040 __entry->center_freq = chan->center_freq; 1039 __entry->center_freq = chan->center_freq;
1041 __entry->channel_type = chantype;
1042 __entry->duration = duration; 1040 __entry->duration = duration;
1043 ), 1041 ),
1044 1042
diff --git a/net/wireless/core.h b/net/wireless/core.h
index e53831c876b..b0a09cf56e0 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -378,10 +378,8 @@ void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev);
378int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, 378int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
379 struct wireless_dev *wdev, 379 struct wireless_dev *wdev,
380 struct ieee80211_channel *chan, bool offchan, 380 struct ieee80211_channel *chan, bool offchan,
381 enum nl80211_channel_type channel_type, 381 unsigned int wait, const u8 *buf, size_t len,
382 bool channel_type_valid, unsigned int wait, 382 bool no_cck, bool dont_wait_for_ack, u64 *cookie);
383 const u8 *buf, size_t len, bool no_cck,
384 bool dont_wait_for_ack, u64 *cookie);
385void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa, 383void cfg80211_oper_and_ht_capa(struct ieee80211_ht_cap *ht_capa,
386 const struct ieee80211_ht_cap *ht_capa_mask); 384 const struct ieee80211_ht_cap *ht_capa_mask);
387 385
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 4bfd14f7c59..a9646b53a09 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -579,31 +579,25 @@ void cfg80211_mlme_down(struct cfg80211_registered_device *rdev,
579 579
580void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie, 580void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
581 struct ieee80211_channel *chan, 581 struct ieee80211_channel *chan,
582 enum nl80211_channel_type channel_type,
583 unsigned int duration, gfp_t gfp) 582 unsigned int duration, gfp_t gfp)
584{ 583{
585 struct wiphy *wiphy = wdev->wiphy; 584 struct wiphy *wiphy = wdev->wiphy;
586 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 585 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
587 586
588 trace_cfg80211_ready_on_channel(wdev, cookie, chan, channel_type, 587 trace_cfg80211_ready_on_channel(wdev, cookie, chan, duration);
589 duration); 588 nl80211_send_remain_on_channel(rdev, wdev, cookie, chan, duration, gfp);
590 nl80211_send_remain_on_channel(rdev, wdev, cookie, chan, channel_type,
591 duration, gfp);
592} 589}
593EXPORT_SYMBOL(cfg80211_ready_on_channel); 590EXPORT_SYMBOL(cfg80211_ready_on_channel);
594 591
595void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie, 592void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
596 struct ieee80211_channel *chan, 593 struct ieee80211_channel *chan,
597 enum nl80211_channel_type channel_type,
598 gfp_t gfp) 594 gfp_t gfp)
599{ 595{
600 struct wiphy *wiphy = wdev->wiphy; 596 struct wiphy *wiphy = wdev->wiphy;
601 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 597 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
602 598
603 trace_cfg80211_ready_on_channel_expired(wdev, cookie, chan, 599 trace_cfg80211_ready_on_channel_expired(wdev, cookie, chan);
604 channel_type); 600 nl80211_send_remain_on_channel_cancel(rdev, wdev, cookie, chan, gfp);
605 nl80211_send_remain_on_channel_cancel(rdev, wdev, cookie, chan,
606 channel_type, gfp);
607} 601}
608EXPORT_SYMBOL(cfg80211_remain_on_channel_expired); 602EXPORT_SYMBOL(cfg80211_remain_on_channel_expired);
609 603
@@ -758,10 +752,8 @@ void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev)
758int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev, 752int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
759 struct wireless_dev *wdev, 753 struct wireless_dev *wdev,
760 struct ieee80211_channel *chan, bool offchan, 754 struct ieee80211_channel *chan, bool offchan,
761 enum nl80211_channel_type channel_type, 755 unsigned int wait, const u8 *buf, size_t len,
762 bool channel_type_valid, unsigned int wait, 756 bool no_cck, bool dont_wait_for_ack, u64 *cookie)
763 const u8 *buf, size_t len, bool no_cck,
764 bool dont_wait_for_ack, u64 *cookie)
765{ 757{
766 const struct ieee80211_mgmt *mgmt; 758 const struct ieee80211_mgmt *mgmt;
767 u16 stype; 759 u16 stype;
@@ -855,7 +847,6 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
855 847
856 /* Transmit the Action frame as requested by user space */ 848 /* Transmit the Action frame as requested by user space */
857 return rdev_mgmt_tx(rdev, wdev, chan, offchan, 849 return rdev_mgmt_tx(rdev, wdev, chan, offchan,
858 channel_type, channel_type_valid,
859 wait, buf, len, no_cck, dont_wait_for_ack, 850 wait, buf, len, no_cck, dont_wait_for_ack,
860 cookie); 851 cookie);
861} 852}
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 4c427fa5c45..e880f449495 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5952,7 +5952,6 @@ static int nl80211_remain_on_channel(struct sk_buff *skb,
5952 struct sk_buff *msg; 5952 struct sk_buff *msg;
5953 void *hdr; 5953 void *hdr;
5954 u64 cookie; 5954 u64 cookie;
5955 enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
5956 u32 freq, duration; 5955 u32 freq, duration;
5957 int err; 5956 int err;
5958 5957
@@ -5975,11 +5974,11 @@ static int nl80211_remain_on_channel(struct sk_buff *skb,
5975 return -EINVAL; 5974 return -EINVAL;
5976 5975
5977 if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE] && 5976 if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE] &&
5978 !nl80211_valid_channel_type(info, &channel_type)) 5977 !nl80211_valid_channel_type(info, NULL))
5979 return -EINVAL; 5978 return -EINVAL;
5980 5979
5981 freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); 5980 freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]);
5982 chan = rdev_freq_to_chan(rdev, freq, channel_type); 5981 chan = rdev_freq_to_chan(rdev, freq, NL80211_CHAN_NO_HT);
5983 if (chan == NULL) 5982 if (chan == NULL)
5984 return -EINVAL; 5983 return -EINVAL;
5985 5984
@@ -5995,8 +5994,7 @@ static int nl80211_remain_on_channel(struct sk_buff *skb,
5995 goto free_msg; 5994 goto free_msg;
5996 } 5995 }
5997 5996
5998 err = rdev_remain_on_channel(rdev, wdev, chan, channel_type, duration, 5997 err = rdev_remain_on_channel(rdev, wdev, chan, duration, &cookie);
5999 &cookie);
6000 5998
6001 if (err) 5999 if (err)
6002 goto free_msg; 6000 goto free_msg;
@@ -6216,8 +6214,6 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
6216 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 6214 struct cfg80211_registered_device *rdev = info->user_ptr[0];
6217 struct wireless_dev *wdev = info->user_ptr[1]; 6215 struct wireless_dev *wdev = info->user_ptr[1];
6218 struct ieee80211_channel *chan; 6216 struct ieee80211_channel *chan;
6219 enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT;
6220 bool channel_type_valid = false;
6221 u32 freq; 6217 u32 freq;
6222 int err; 6218 int err;
6223 void *hdr = NULL; 6219 void *hdr = NULL;
@@ -6264,11 +6260,9 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
6264 6260
6265 } 6261 }
6266 6262
6267 if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { 6263 if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE] &&
6268 if (!nl80211_valid_channel_type(info, &channel_type)) 6264 !nl80211_valid_channel_type(info, NULL))
6269 return -EINVAL; 6265 return -EINVAL;
6270 channel_type_valid = true;
6271 }
6272 6266
6273 offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK]; 6267 offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK];
6274 6268
@@ -6278,7 +6272,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
6278 no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); 6272 no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]);
6279 6273
6280 freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); 6274 freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]);
6281 chan = rdev_freq_to_chan(rdev, freq, channel_type); 6275 chan = rdev_freq_to_chan(rdev, freq, NL80211_CHAN_NO_HT);
6282 if (chan == NULL) 6276 if (chan == NULL)
6283 return -EINVAL; 6277 return -EINVAL;
6284 6278
@@ -6296,8 +6290,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
6296 } 6290 }
6297 } 6291 }
6298 6292
6299 err = cfg80211_mlme_mgmt_tx(rdev, wdev, chan, offchan, channel_type, 6293 err = cfg80211_mlme_mgmt_tx(rdev, wdev, chan, offchan, wait,
6300 channel_type_valid, wait,
6301 nla_data(info->attrs[NL80211_ATTR_FRAME]), 6294 nla_data(info->attrs[NL80211_ATTR_FRAME]),
6302 nla_len(info->attrs[NL80211_ATTR_FRAME]), 6295 nla_len(info->attrs[NL80211_ATTR_FRAME]),
6303 no_cck, dont_wait_for_ack, &cookie); 6296 no_cck, dont_wait_for_ack, &cookie);
@@ -8395,7 +8388,6 @@ static void nl80211_send_remain_on_chan_event(
8395 int cmd, struct cfg80211_registered_device *rdev, 8388 int cmd, struct cfg80211_registered_device *rdev,
8396 struct wireless_dev *wdev, u64 cookie, 8389 struct wireless_dev *wdev, u64 cookie,
8397 struct ieee80211_channel *chan, 8390 struct ieee80211_channel *chan,
8398 enum nl80211_channel_type channel_type,
8399 unsigned int duration, gfp_t gfp) 8391 unsigned int duration, gfp_t gfp)
8400{ 8392{
8401 struct sk_buff *msg; 8393 struct sk_buff *msg;
@@ -8416,7 +8408,8 @@ static void nl80211_send_remain_on_chan_event(
8416 wdev->netdev->ifindex)) || 8408 wdev->netdev->ifindex)) ||
8417 nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) || 8409 nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev)) ||
8418 nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq) || 8410 nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, chan->center_freq) ||
8419 nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE, channel_type) || 8411 nla_put_u32(msg, NL80211_ATTR_WIPHY_CHANNEL_TYPE,
8412 NL80211_CHAN_NO_HT) ||
8420 nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie)) 8413 nla_put_u64(msg, NL80211_ATTR_COOKIE, cookie))
8421 goto nla_put_failure; 8414 goto nla_put_failure;
8422 8415
@@ -8438,23 +8431,20 @@ static void nl80211_send_remain_on_chan_event(
8438void nl80211_send_remain_on_channel(struct cfg80211_registered_device *rdev, 8431void nl80211_send_remain_on_channel(struct cfg80211_registered_device *rdev,
8439 struct wireless_dev *wdev, u64 cookie, 8432 struct wireless_dev *wdev, u64 cookie,
8440 struct ieee80211_channel *chan, 8433 struct ieee80211_channel *chan,
8441 enum nl80211_channel_type channel_type,
8442 unsigned int duration, gfp_t gfp) 8434 unsigned int duration, gfp_t gfp)
8443{ 8435{
8444 nl80211_send_remain_on_chan_event(NL80211_CMD_REMAIN_ON_CHANNEL, 8436 nl80211_send_remain_on_chan_event(NL80211_CMD_REMAIN_ON_CHANNEL,
8445 rdev, wdev, cookie, chan, 8437 rdev, wdev, cookie, chan,
8446 channel_type, duration, gfp); 8438 duration, gfp);
8447} 8439}
8448 8440
8449void nl80211_send_remain_on_channel_cancel( 8441void nl80211_send_remain_on_channel_cancel(
8450 struct cfg80211_registered_device *rdev, 8442 struct cfg80211_registered_device *rdev,
8451 struct wireless_dev *wdev, 8443 struct wireless_dev *wdev,
8452 u64 cookie, struct ieee80211_channel *chan, 8444 u64 cookie, struct ieee80211_channel *chan, gfp_t gfp)
8453 enum nl80211_channel_type channel_type, gfp_t gfp)
8454{ 8445{
8455 nl80211_send_remain_on_chan_event(NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL, 8446 nl80211_send_remain_on_chan_event(NL80211_CMD_CANCEL_REMAIN_ON_CHANNEL,
8456 rdev, wdev, cookie, chan, 8447 rdev, wdev, cookie, chan, 0, gfp);
8457 channel_type, 0, gfp);
8458} 8448}
8459 8449
8460void nl80211_send_sta_event(struct cfg80211_registered_device *rdev, 8450void nl80211_send_sta_event(struct cfg80211_registered_device *rdev,
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h
index f6153516068..7adbd767dbf 100644
--- a/net/wireless/nl80211.h
+++ b/net/wireless/nl80211.h
@@ -76,13 +76,11 @@ void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev,
76void nl80211_send_remain_on_channel(struct cfg80211_registered_device *rdev, 76void nl80211_send_remain_on_channel(struct cfg80211_registered_device *rdev,
77 struct wireless_dev *wdev, u64 cookie, 77 struct wireless_dev *wdev, u64 cookie,
78 struct ieee80211_channel *chan, 78 struct ieee80211_channel *chan,
79 enum nl80211_channel_type channel_type,
80 unsigned int duration, gfp_t gfp); 79 unsigned int duration, gfp_t gfp);
81void nl80211_send_remain_on_channel_cancel( 80void nl80211_send_remain_on_channel_cancel(
82 struct cfg80211_registered_device *rdev, 81 struct cfg80211_registered_device *rdev,
83 struct wireless_dev *wdev, 82 struct wireless_dev *wdev,
84 u64 cookie, struct ieee80211_channel *chan, 83 u64 cookie, struct ieee80211_channel *chan, gfp_t gfp);
85 enum nl80211_channel_type channel_type, gfp_t gfp);
86 84
87void nl80211_send_sta_event(struct cfg80211_registered_device *rdev, 85void nl80211_send_sta_event(struct cfg80211_registered_device *rdev,
88 struct net_device *dev, const u8 *mac_addr, 86 struct net_device *dev, const u8 *mac_addr,
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
index 6e5fa659068..ee54a5aa438 100644
--- a/net/wireless/rdev-ops.h
+++ b/net/wireless/rdev-ops.h
@@ -600,14 +600,12 @@ static inline int
600rdev_remain_on_channel(struct cfg80211_registered_device *rdev, 600rdev_remain_on_channel(struct cfg80211_registered_device *rdev,
601 struct wireless_dev *wdev, 601 struct wireless_dev *wdev,
602 struct ieee80211_channel *chan, 602 struct ieee80211_channel *chan,
603 enum nl80211_channel_type channel_type,
604 unsigned int duration, u64 *cookie) 603 unsigned int duration, u64 *cookie)
605{ 604{
606 int ret; 605 int ret;
607 trace_rdev_remain_on_channel(&rdev->wiphy, wdev, chan, channel_type, 606 trace_rdev_remain_on_channel(&rdev->wiphy, wdev, chan, duration);
608 duration);
609 ret = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan, 607 ret = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan,
610 channel_type, duration, cookie); 608 duration, cookie);
611 trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie); 609 trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
612 return ret; 610 return ret;
613} 611}
@@ -626,17 +624,15 @@ rdev_cancel_remain_on_channel(struct cfg80211_registered_device *rdev,
626static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev, 624static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev,
627 struct wireless_dev *wdev, 625 struct wireless_dev *wdev,
628 struct ieee80211_channel *chan, bool offchan, 626 struct ieee80211_channel *chan, bool offchan,
629 enum nl80211_channel_type channel_type, 627 unsigned int wait, const u8 *buf, size_t len,
630 bool channel_type_valid, unsigned int wait, 628 bool no_cck, bool dont_wait_for_ack, u64 *cookie)
631 const u8 *buf, size_t len, bool no_cck,
632 bool dont_wait_for_ack, u64 *cookie)
633{ 629{
634 int ret; 630 int ret;
635 trace_rdev_mgmt_tx(&rdev->wiphy, wdev, chan, offchan, channel_type, 631 trace_rdev_mgmt_tx(&rdev->wiphy, wdev, chan, offchan,
636 channel_type_valid, wait, no_cck, dont_wait_for_ack); 632 wait, no_cck, dont_wait_for_ack);
637 ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, chan, offchan, 633 ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, chan, offchan,
638 channel_type, channel_type_valid, wait, buf, 634 wait, buf, len, no_cck,
639 len, no_cck, dont_wait_for_ack, cookie); 635 dont_wait_for_ack, cookie);
640 trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie); 636 trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
641 return ret; 637 return ret;
642} 638}
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index f264c20a709..ed10833f9a3 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -1573,25 +1573,22 @@ DEFINE_EVENT(rdev_pmksa, rdev_del_pmksa,
1573TRACE_EVENT(rdev_remain_on_channel, 1573TRACE_EVENT(rdev_remain_on_channel,
1574 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, 1574 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev,
1575 struct ieee80211_channel *chan, 1575 struct ieee80211_channel *chan,
1576 enum nl80211_channel_type channel_type, unsigned int duration), 1576 unsigned int duration),
1577 TP_ARGS(wiphy, wdev, chan, channel_type, duration), 1577 TP_ARGS(wiphy, wdev, chan, duration),
1578 TP_STRUCT__entry( 1578 TP_STRUCT__entry(
1579 WIPHY_ENTRY 1579 WIPHY_ENTRY
1580 WDEV_ENTRY 1580 WDEV_ENTRY
1581 CHAN_ENTRY 1581 CHAN_ENTRY
1582 __field(enum nl80211_channel_type, channel_type)
1583 __field(unsigned int, duration) 1582 __field(unsigned int, duration)
1584 ), 1583 ),
1585 TP_fast_assign( 1584 TP_fast_assign(
1586 WIPHY_ASSIGN; 1585 WIPHY_ASSIGN;
1587 WDEV_ASSIGN; 1586 WDEV_ASSIGN;
1588 CHAN_ASSIGN(chan); 1587 CHAN_ASSIGN(chan);
1589 __entry->channel_type = channel_type;
1590 __entry->duration = duration; 1588 __entry->duration = duration;
1591 ), 1589 ),
1592 TP_printk(WIPHY_PR_FMT WDEV_PR_FMT CHAN_PR_FMT ", channel type: %d, duration: %u", 1590 TP_printk(WIPHY_PR_FMT WDEV_PR_FMT CHAN_PR_FMT ", duration: %u",
1593 WIPHY_PR_ARG, WDEV_PR_ARG, CHAN_PR_ARG, __entry->channel_type, 1591 WIPHY_PR_ARG, WDEV_PR_ARG, CHAN_PR_ARG, __entry->duration)
1594 __entry->duration)
1595); 1592);
1596 1593
1597TRACE_EVENT(rdev_return_int_cookie, 1594TRACE_EVENT(rdev_return_int_cookie,
@@ -1631,18 +1628,13 @@ TRACE_EVENT(rdev_cancel_remain_on_channel,
1631TRACE_EVENT(rdev_mgmt_tx, 1628TRACE_EVENT(rdev_mgmt_tx,
1632 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, 1629 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev,
1633 struct ieee80211_channel *chan, bool offchan, 1630 struct ieee80211_channel *chan, bool offchan,
1634 enum nl80211_channel_type channel_type, 1631 unsigned int wait, bool no_cck, bool dont_wait_for_ack),
1635 bool channel_type_valid, unsigned int wait, bool no_cck, 1632 TP_ARGS(wiphy, wdev, chan, offchan, wait, no_cck, dont_wait_for_ack),
1636 bool dont_wait_for_ack),
1637 TP_ARGS(wiphy, wdev, chan, offchan, channel_type, channel_type_valid,
1638 wait, no_cck, dont_wait_for_ack),
1639 TP_STRUCT__entry( 1633 TP_STRUCT__entry(
1640 WIPHY_ENTRY 1634 WIPHY_ENTRY
1641 WDEV_ENTRY 1635 WDEV_ENTRY
1642 CHAN_ENTRY 1636 CHAN_ENTRY
1643 __field(bool, offchan) 1637 __field(bool, offchan)
1644 __field(enum nl80211_channel_type, channel_type)
1645 __field(bool, channel_type_valid)
1646 __field(unsigned int, wait) 1638 __field(unsigned int, wait)
1647 __field(bool, no_cck) 1639 __field(bool, no_cck)
1648 __field(bool, dont_wait_for_ack) 1640 __field(bool, dont_wait_for_ack)
@@ -1652,18 +1644,14 @@ TRACE_EVENT(rdev_mgmt_tx,
1652 WDEV_ASSIGN; 1644 WDEV_ASSIGN;
1653 CHAN_ASSIGN(chan); 1645 CHAN_ASSIGN(chan);
1654 __entry->offchan = offchan; 1646 __entry->offchan = offchan;
1655 __entry->channel_type = channel_type;
1656 __entry->channel_type_valid = channel_type_valid;
1657 __entry->wait = wait; 1647 __entry->wait = wait;
1658 __entry->no_cck = no_cck; 1648 __entry->no_cck = no_cck;
1659 __entry->dont_wait_for_ack = dont_wait_for_ack; 1649 __entry->dont_wait_for_ack = dont_wait_for_ack;
1660 ), 1650 ),
1661 TP_printk(WIPHY_PR_FMT WDEV_PR_FMT CHAN_PR_FMT ", offchan: %s, " 1651 TP_printk(WIPHY_PR_FMT WDEV_PR_FMT CHAN_PR_FMT ", offchan: %s,"
1662 "channel type: %d, channel type valid: %s, wait: %u, " 1652 " wait: %u, no cck: %s, dont wait for ack: %s",
1663 "no cck: %s, dont wait for ack: %s",
1664 WIPHY_PR_ARG, WDEV_PR_ARG, CHAN_PR_ARG, 1653 WIPHY_PR_ARG, WDEV_PR_ARG, CHAN_PR_ARG,
1665 BOOL_TO_STR(__entry->offchan), __entry->channel_type, 1654 BOOL_TO_STR(__entry->offchan), __entry->wait,
1666 BOOL_TO_STR(__entry->channel_type_valid), __entry->wait,
1667 BOOL_TO_STR(__entry->no_cck), 1655 BOOL_TO_STR(__entry->no_cck),
1668 BOOL_TO_STR(__entry->dont_wait_for_ack)) 1656 BOOL_TO_STR(__entry->dont_wait_for_ack))
1669); 1657);
@@ -1894,47 +1882,41 @@ TRACE_EVENT(cfg80211_michael_mic_failure,
1894TRACE_EVENT(cfg80211_ready_on_channel, 1882TRACE_EVENT(cfg80211_ready_on_channel,
1895 TP_PROTO(struct wireless_dev *wdev, u64 cookie, 1883 TP_PROTO(struct wireless_dev *wdev, u64 cookie,
1896 struct ieee80211_channel *chan, 1884 struct ieee80211_channel *chan,
1897 enum nl80211_channel_type channel_type, unsigned int duration), 1885 unsigned int duration),
1898 TP_ARGS(wdev, cookie, chan, channel_type, duration), 1886 TP_ARGS(wdev, cookie, chan, duration),
1899 TP_STRUCT__entry( 1887 TP_STRUCT__entry(
1900 WDEV_ENTRY 1888 WDEV_ENTRY
1901 __field(u64, cookie) 1889 __field(u64, cookie)
1902 CHAN_ENTRY 1890 CHAN_ENTRY
1903 __field(enum nl80211_channel_type, channel_type)
1904 __field(unsigned int, duration) 1891 __field(unsigned int, duration)
1905 ), 1892 ),
1906 TP_fast_assign( 1893 TP_fast_assign(
1907 WDEV_ASSIGN; 1894 WDEV_ASSIGN;
1908 __entry->cookie = cookie; 1895 __entry->cookie = cookie;
1909 CHAN_ASSIGN(chan); 1896 CHAN_ASSIGN(chan);
1910 __entry->channel_type = channel_type;
1911 __entry->duration = duration; 1897 __entry->duration = duration;
1912 ), 1898 ),
1913 TP_printk(WDEV_PR_FMT ", cookie: %llu, " CHAN_PR_FMT ", channel type: %d, duration: %u", 1899 TP_printk(WDEV_PR_FMT ", cookie: %llu, " CHAN_PR_FMT ", duration: %u",
1914 WDEV_PR_ARG, __entry->cookie, CHAN_PR_ARG, 1900 WDEV_PR_ARG, __entry->cookie, CHAN_PR_ARG,
1915 __entry->channel_type, __entry->duration) 1901 __entry->duration)
1916); 1902);
1917 1903
1918TRACE_EVENT(cfg80211_ready_on_channel_expired, 1904TRACE_EVENT(cfg80211_ready_on_channel_expired,
1919 TP_PROTO(struct wireless_dev *wdev, u64 cookie, 1905 TP_PROTO(struct wireless_dev *wdev, u64 cookie,
1920 struct ieee80211_channel *chan, 1906 struct ieee80211_channel *chan),
1921 enum nl80211_channel_type channel_type), 1907 TP_ARGS(wdev, cookie, chan),
1922 TP_ARGS(wdev, cookie, chan, channel_type),
1923 TP_STRUCT__entry( 1908 TP_STRUCT__entry(
1924 WDEV_ENTRY 1909 WDEV_ENTRY
1925 __field(u64, cookie) 1910 __field(u64, cookie)
1926 CHAN_ENTRY 1911 CHAN_ENTRY
1927 __field(enum nl80211_channel_type, channel_type)
1928 ), 1912 ),
1929 TP_fast_assign( 1913 TP_fast_assign(
1930 WDEV_ASSIGN; 1914 WDEV_ASSIGN;
1931 __entry->cookie = cookie; 1915 __entry->cookie = cookie;
1932 CHAN_ASSIGN(chan); 1916 CHAN_ASSIGN(chan);
1933 __entry->channel_type = channel_type;
1934 ), 1917 ),
1935 TP_printk(WDEV_PR_FMT ", cookie: %llu, " CHAN_PR_FMT ", channel type: %d", 1918 TP_printk(WDEV_PR_FMT ", cookie: %llu, " CHAN_PR_FMT,
1936 WDEV_PR_ARG, __entry->cookie, CHAN_PR_ARG, 1919 WDEV_PR_ARG, __entry->cookie, CHAN_PR_ARG)
1937 __entry->channel_type)
1938); 1920);
1939 1921
1940TRACE_EVENT(cfg80211_new_sta, 1922TRACE_EVENT(cfg80211_new_sta,