aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Leffler <sleffler@chromium.org>2012-10-12 00:03:32 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-10-18 03:01:50 -0400
commit46856bbf0f0412c12e9674df68822cb531d49327 (patch)
treeef5a3cb5642a6736e5bae7f1bafd9fd48f98a59f
parente8e27c668bf5977d9fe1a64d0b69598ff9e292b7 (diff)
cfg80211: add scan flag to indicate its priority
Add NL80211_SCAN_FLAG_LOW_PRIORITY flag support. It tells drivers that this is a low priority scan request, so that they can take necessary action. Drivers need to advertise low priority scan capability during registration. Signed-off-by: Sam Leffler <sleffler@chromium.org> Tested-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--include/uapi/linux/nl80211.h8
-rw-r--r--net/wireless/nl80211.c16
2 files changed, 20 insertions, 4 deletions
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 4d0b49ee4c2..c68e15e4132 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -3048,6 +3048,7 @@ enum nl80211_ap_sme_features {
3048 * @NL80211_FEATURE_SAE: This driver supports simultaneous authentication of 3048 * @NL80211_FEATURE_SAE: This driver supports simultaneous authentication of
3049 * equals (SAE) with user space SME (NL80211_CMD_AUTHENTICATE) in station 3049 * equals (SAE) with user space SME (NL80211_CMD_AUTHENTICATE) in station
3050 * mode 3050 * mode
3051 * @NL80211_FEATURE_LOW_PRIORITY_SCAN: This driver supports low priority scan
3051 */ 3052 */
3052enum nl80211_feature_flags { 3053enum nl80211_feature_flags {
3053 NL80211_FEATURE_SK_TX_STATUS = 1 << 0, 3054 NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
@@ -3056,6 +3057,7 @@ enum nl80211_feature_flags {
3056 NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3, 3057 NL80211_FEATURE_CELL_BASE_REG_HINTS = 1 << 3,
3057 NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL = 1 << 4, 3058 NL80211_FEATURE_P2P_DEVICE_NEEDS_CHANNEL = 1 << 4,
3058 NL80211_FEATURE_SAE = 1 << 5, 3059 NL80211_FEATURE_SAE = 1 << 5,
3060 NL80211_FEATURE_LOW_PRIORITY_SCAN = 1 << 6,
3059}; 3061};
3060 3062
3061/** 3063/**
@@ -3096,9 +3098,11 @@ enum nl80211_connect_failed_reason {
3096 * Scan request control flags are used to control the handling 3098 * Scan request control flags are used to control the handling
3097 * of NL80211_CMD_TRIGGER_SCAN and NL80211_CMD_START_SCHED_SCAN 3099 * of NL80211_CMD_TRIGGER_SCAN and NL80211_CMD_START_SCHED_SCAN
3098 * requests. 3100 * requests.
3099 * (will be filled) 3101 *
3102 * @NL80211_SCAN_FLAG_LOW_PRIORITY: scan request has low priority
3103 */
3100enum nl80211_scan_flags { 3104enum nl80211_scan_flags {
3105 NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0,
3101}; 3106};
3102 */
3103 3107
3104#endif /* __LINUX_NL80211_H */ 3108#endif /* __LINUX_NL80211_H */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index dc08211c6c6..aee252d65b8 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4368,9 +4368,15 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
4368 } 4368 }
4369 } 4369 }
4370 4370
4371 if (info->attrs[NL80211_ATTR_SCAN_FLAGS]) 4371 if (info->attrs[NL80211_ATTR_SCAN_FLAGS]) {
4372 request->flags = nla_get_u32( 4372 request->flags = nla_get_u32(
4373 info->attrs[NL80211_ATTR_SCAN_FLAGS]); 4373 info->attrs[NL80211_ATTR_SCAN_FLAGS]);
4374 if ((request->flags & NL80211_SCAN_FLAG_LOW_PRIORITY) &&
4375 !(wiphy->features & NL80211_FEATURE_LOW_PRIORITY_SCAN)) {
4376 err = -EOPNOTSUPP;
4377 goto out_free;
4378 }
4379 }
4374 4380
4375 request->no_cck = 4381 request->no_cck =
4376 nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); 4382 nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]);
@@ -4603,9 +4609,15 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
4603 request->ie_len); 4609 request->ie_len);
4604 } 4610 }
4605 4611
4606 if (info->attrs[NL80211_ATTR_SCAN_FLAGS]) 4612 if (info->attrs[NL80211_ATTR_SCAN_FLAGS]) {
4607 request->flags = nla_get_u32( 4613 request->flags = nla_get_u32(
4608 info->attrs[NL80211_ATTR_SCAN_FLAGS]); 4614 info->attrs[NL80211_ATTR_SCAN_FLAGS]);
4615 if ((request->flags & NL80211_SCAN_FLAG_LOW_PRIORITY) &&
4616 !(wiphy->features & NL80211_FEATURE_LOW_PRIORITY_SCAN)) {
4617 err = -EOPNOTSUPP;
4618 goto out_free;
4619 }
4620 }
4609 4621
4610 request->dev = dev; 4622 request->dev = dev;
4611 request->wiphy = &rdev->wiphy; 4623 request->wiphy = &rdev->wiphy;