diff options
author | Johannes Berg <johannes.berg@intel.com> | 2011-11-18 09:33:48 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-11-21 16:20:49 -0500 |
commit | 7c4ef7122cef54dc49562eea35cbfaf0f44faa0b (patch) | |
tree | 97cc3b8e602c432375fbe0cdeea9aac8ecbb0fbd | |
parent | f2dc7989bf821a0ca78289b32f16078c76c88e7e (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>
-rw-r--r-- | drivers/net/wireless/ath/ath6kl/init.c | 3 | ||||
-rw-r--r-- | include/net/cfg80211.h | 4 | ||||
-rw-r--r-- | net/mac80211/main.c | 4 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 16 |
4 files changed, 20 insertions, 7 deletions
diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c index 57529acb9144..30050af9d4c6 100644 --- a/drivers/net/wireless/ath/ath6kl/init.c +++ b/drivers/net/wireless/ath/ath6kl/init.c | |||
@@ -1602,7 +1602,8 @@ int ath6kl_core_init(struct ath6kl *ar) | |||
1602 | ar->conf_flags |= ATH6KL_CONF_SUSPEND_CUTPOWER; | 1602 | ar->conf_flags |= ATH6KL_CONF_SUSPEND_CUTPOWER; |
1603 | 1603 | ||
1604 | ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM | | 1604 | ar->wiphy->flags |= WIPHY_FLAG_SUPPORTS_FW_ROAM | |
1605 | WIPHY_FLAG_HAVE_AP_SME; | 1605 | WIPHY_FLAG_HAVE_AP_SME | |
1606 | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; | ||
1606 | 1607 | ||
1607 | set_bit(FIRST_BOOT, &ar->flag); | 1608 | set_bit(FIRST_BOOT, &ar->flag); |
1608 | 1609 | ||
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 8d7ba0961d3e..26890045dbd6 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -1700,6 +1700,8 @@ struct cfg80211_ops { | |||
1700 | * cfg80211_report_obss_beacon(). | 1700 | * cfg80211_report_obss_beacon(). |
1701 | * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device | 1701 | * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device |
1702 | * responds to probe-requests in hardware. | 1702 | * responds to probe-requests in hardware. |
1703 | * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX. | ||
1704 | * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. | ||
1703 | */ | 1705 | */ |
1704 | enum wiphy_flags { | 1706 | enum wiphy_flags { |
1705 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), | 1707 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), |
@@ -1721,6 +1723,8 @@ enum wiphy_flags { | |||
1721 | WIPHY_FLAG_HAVE_AP_SME = BIT(17), | 1723 | WIPHY_FLAG_HAVE_AP_SME = BIT(17), |
1722 | WIPHY_FLAG_REPORTS_OBSS = BIT(18), | 1724 | WIPHY_FLAG_REPORTS_OBSS = BIT(18), |
1723 | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), | 1725 | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19), |
1726 | WIPHY_FLAG_OFFCHAN_TX = BIT(20), | ||
1727 | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21), | ||
1724 | }; | 1728 | }; |
1725 | 1729 | ||
1726 | /** | 1730 | /** |
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]); |