aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
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 /net/wireless/nl80211.c
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>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r--net/wireless/nl80211.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 4c427fa5c450..e880f4494950 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,