aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2011-11-18 09:33:48 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-11-21 16:20:49 -0500
commit7c4ef7122cef54dc49562eea35cbfaf0f44faa0b (patch)
tree97cc3b8e602c432375fbe0cdeea9aac8ecbb0fbd /net
parentf2dc7989bf821a0ca78289b32f16078c76c88e7e (diff)
cfg80211: add flags for off-channel capabilities
Currently mac80211 implements these for all devices, but given restrictions of some devices that isn't really true, so prepare for being able to remove the capability for some mac80211 devices. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Acked-by: Kalle Valo <kvalo@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/main.c4
-rw-r--r--net/wireless/nl80211.c16
2 files changed, 14 insertions, 6 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 3df4482bb1d9..f0106d331938 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -594,7 +594,9 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
594 wiphy->flags |= WIPHY_FLAG_NETNS_OK | 594 wiphy->flags |= WIPHY_FLAG_NETNS_OK |
595 WIPHY_FLAG_4ADDR_AP | 595 WIPHY_FLAG_4ADDR_AP |
596 WIPHY_FLAG_4ADDR_STATION | 596 WIPHY_FLAG_4ADDR_STATION |
597 WIPHY_FLAG_REPORTS_OBSS; 597 WIPHY_FLAG_REPORTS_OBSS |
598 WIPHY_FLAG_OFFCHAN_TX |
599 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
598 600
599 wiphy->features = NL80211_FEATURE_SK_TX_STATUS; 601 wiphy->features = NL80211_FEATURE_SK_TX_STATUS;
600 602
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ae8ea3827acd..9755b3f04dd7 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -882,7 +882,8 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
882 CMD(set_pmksa, SET_PMKSA); 882 CMD(set_pmksa, SET_PMKSA);
883 CMD(del_pmksa, DEL_PMKSA); 883 CMD(del_pmksa, DEL_PMKSA);
884 CMD(flush_pmksa, FLUSH_PMKSA); 884 CMD(flush_pmksa, FLUSH_PMKSA);
885 CMD(remain_on_channel, REMAIN_ON_CHANNEL); 885 if (dev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL)
886 CMD(remain_on_channel, REMAIN_ON_CHANNEL);
886 CMD(set_bitrate_mask, SET_TX_BITRATE_MASK); 887 CMD(set_bitrate_mask, SET_TX_BITRATE_MASK);
887 CMD(mgmt_tx, FRAME); 888 CMD(mgmt_tx, FRAME);
888 CMD(mgmt_tx_cancel_wait, FRAME_WAIT_CANCEL); 889 CMD(mgmt_tx_cancel_wait, FRAME_WAIT_CANCEL);
@@ -922,11 +923,12 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
922 923
923 nla_nest_end(msg, nl_cmds); 924 nla_nest_end(msg, nl_cmds);
924 925
925 if (dev->ops->remain_on_channel) 926 if (dev->ops->remain_on_channel &&
927 dev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL)
926 NLA_PUT_U32(msg, NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION, 928 NLA_PUT_U32(msg, NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION,
927 dev->wiphy.max_remain_on_channel_duration); 929 dev->wiphy.max_remain_on_channel_duration);
928 930
929 if (dev->ops->mgmt_tx_cancel_wait) 931 if (dev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX)
930 NLA_PUT_FLAG(msg, NL80211_ATTR_OFFCHANNEL_TX_OK); 932 NLA_PUT_FLAG(msg, NL80211_ATTR_OFFCHANNEL_TX_OK);
931 933
932 if (mgmt_stypes) { 934 if (mgmt_stypes) {
@@ -5127,7 +5129,8 @@ static int nl80211_remain_on_channel(struct sk_buff *skb,
5127 duration > rdev->wiphy.max_remain_on_channel_duration) 5129 duration > rdev->wiphy.max_remain_on_channel_duration)
5128 return -EINVAL; 5130 return -EINVAL;
5129 5131
5130 if (!rdev->ops->remain_on_channel) 5132 if (!rdev->ops->remain_on_channel ||
5133 !(rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL))
5131 return -EOPNOTSUPP; 5134 return -EOPNOTSUPP;
5132 5135
5133 if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { 5136 if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) {
@@ -5340,7 +5343,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
5340 return -EOPNOTSUPP; 5343 return -EOPNOTSUPP;
5341 5344
5342 if (info->attrs[NL80211_ATTR_DURATION]) { 5345 if (info->attrs[NL80211_ATTR_DURATION]) {
5343 if (!rdev->ops->mgmt_tx_cancel_wait) 5346 if (!(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX))
5344 return -EINVAL; 5347 return -EINVAL;
5345 wait = nla_get_u32(info->attrs[NL80211_ATTR_DURATION]); 5348 wait = nla_get_u32(info->attrs[NL80211_ATTR_DURATION]);
5346 } 5349 }
@@ -5358,6 +5361,9 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
5358 5361
5359 offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK]; 5362 offchan = info->attrs[NL80211_ATTR_OFFCHANNEL_TX_OK];
5360 5363
5364 if (offchan && !(rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX))
5365 return -EINVAL;
5366
5361 no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); 5367 no_cck = nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]);
5362 5368
5363 freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); 5369 freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]);