aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Leffler <sleffler@chromium.org>2012-10-12 00:03:31 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-10-18 03:01:23 -0400
commited47377154310fd2fd59d75fcdeb3d022344fb31 (patch)
tree228eb525b26b448b13b8d74de01ba91a42dedc06
parentf461be3eff662f01a177ecea8c1d7b040bb6bfbe (diff)
{nl,cfg}80211: add a flags word to scan requests
Add a flags word to direct and scheduled scan requests; it will be used for control of optional behaviours such as flushing the bss cache prior to doing a scan. 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/net/cfg80211.h4
-rw-r--r--include/uapi/linux/nl80211.h15
-rw-r--r--net/wireless/nl80211.c12
3 files changed, 31 insertions, 0 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 607b5c02f74..d95da8f55f6 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1002,6 +1002,7 @@ struct cfg80211_ssid {
1002 * @n_channels: total number of channels to scan 1002 * @n_channels: total number of channels to scan
1003 * @ie: optional information element(s) to add into Probe Request or %NULL 1003 * @ie: optional information element(s) to add into Probe Request or %NULL
1004 * @ie_len: length of ie in octets 1004 * @ie_len: length of ie in octets
1005 * @flags: bit field of flags controlling operation
1005 * @rates: bitmap of rates to advertise for each band 1006 * @rates: bitmap of rates to advertise for each band
1006 * @wiphy: the wiphy this was for 1007 * @wiphy: the wiphy this was for
1007 * @wdev: the wireless device to scan for 1008 * @wdev: the wireless device to scan for
@@ -1014,6 +1015,7 @@ struct cfg80211_scan_request {
1014 u32 n_channels; 1015 u32 n_channels;
1015 const u8 *ie; 1016 const u8 *ie;
1016 size_t ie_len; 1017 size_t ie_len;
1018 u32 flags;
1017 1019
1018 u32 rates[IEEE80211_NUM_BANDS]; 1020 u32 rates[IEEE80211_NUM_BANDS];
1019 1021
@@ -1046,6 +1048,7 @@ struct cfg80211_match_set {
1046 * @interval: interval between each scheduled scan cycle 1048 * @interval: interval between each scheduled scan cycle
1047 * @ie: optional information element(s) to add into Probe Request or %NULL 1049 * @ie: optional information element(s) to add into Probe Request or %NULL
1048 * @ie_len: length of ie in octets 1050 * @ie_len: length of ie in octets
1051 * @flags: bit field of flags controlling operation
1049 * @match_sets: sets of parameters to be matched for a scan result 1052 * @match_sets: sets of parameters to be matched for a scan result
1050 * entry to be considered valid and to be passed to the host 1053 * entry to be considered valid and to be passed to the host
1051 * (others are filtered out). 1054 * (others are filtered out).
@@ -1063,6 +1066,7 @@ struct cfg80211_sched_scan_request {
1063 u32 interval; 1066 u32 interval;
1064 const u8 *ie; 1067 const u8 *ie;
1065 size_t ie_len; 1068 size_t ie_len;
1069 u32 flags;
1066 struct cfg80211_match_set *match_sets; 1070 struct cfg80211_match_set *match_sets;
1067 int n_match_sets; 1071 int n_match_sets;
1068 s32 rssi_thold; 1072 s32 rssi_thold;
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 71ab23b0356..4d0b49ee4c2 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -1279,6 +1279,8 @@ enum nl80211_commands {
1279 * @NL80211_ATTR_VHT_CAPABILITY: VHT Capability information element (from 1279 * @NL80211_ATTR_VHT_CAPABILITY: VHT Capability information element (from
1280 * association request when used with NL80211_CMD_NEW_STATION) 1280 * association request when used with NL80211_CMD_NEW_STATION)
1281 * 1281 *
1282 * @NL80211_ATTR_SCAN_FLAGS: scan request control flags (u32)
1283 *
1282 * @NL80211_ATTR_MAX: highest attribute number currently defined 1284 * @NL80211_ATTR_MAX: highest attribute number currently defined
1283 * @__NL80211_ATTR_AFTER_LAST: internal use 1285 * @__NL80211_ATTR_AFTER_LAST: internal use
1284 */ 1286 */
@@ -1540,6 +1542,8 @@ enum nl80211_attrs {
1540 1542
1541 NL80211_ATTR_VHT_CAPABILITY, 1543 NL80211_ATTR_VHT_CAPABILITY,
1542 1544
1545 NL80211_ATTR_SCAN_FLAGS,
1546
1543 /* add attributes here, update the policy in nl80211.c */ 1547 /* add attributes here, update the policy in nl80211.c */
1544 1548
1545 __NL80211_ATTR_AFTER_LAST, 1549 __NL80211_ATTR_AFTER_LAST,
@@ -3086,4 +3090,15 @@ enum nl80211_connect_failed_reason {
3086 NL80211_CONN_FAIL_BLOCKED_CLIENT, 3090 NL80211_CONN_FAIL_BLOCKED_CLIENT,
3087}; 3091};
3088 3092
3093/**
3094 * enum nl80211_scan_flags - scan request control flags
3095 *
3096 * Scan request control flags are used to control the handling
3097 * of NL80211_CMD_TRIGGER_SCAN and NL80211_CMD_START_SCHED_SCAN
3098 * requests.
3099 * (will be filled)
3100enum nl80211_scan_flags {
3101};
3102 */
3103
3089#endif /* __LINUX_NL80211_H */ 3104#endif /* __LINUX_NL80211_H */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index ef170e982f9..dc08211c6c6 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -356,6 +356,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
356 [NL80211_ATTR_USER_REG_HINT_TYPE] = { .type = NLA_U32 }, 356 [NL80211_ATTR_USER_REG_HINT_TYPE] = { .type = NLA_U32 },
357 [NL80211_ATTR_SAE_DATA] = { .type = NLA_BINARY, }, 357 [NL80211_ATTR_SAE_DATA] = { .type = NLA_BINARY, },
358 [NL80211_ATTR_VHT_CAPABILITY] = { .len = NL80211_VHT_CAPABILITY_LEN }, 358 [NL80211_ATTR_VHT_CAPABILITY] = { .len = NL80211_VHT_CAPABILITY_LEN },
359 [NL80211_ATTR_SCAN_FLAGS] = { .type = NLA_U32 },
359}; 360};
360 361
361/* policy for the key attributes */ 362/* policy for the key attributes */
@@ -4367,6 +4368,10 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
4367 } 4368 }
4368 } 4369 }
4369 4370
4371 if (info->attrs[NL80211_ATTR_SCAN_FLAGS])
4372 request->flags = nla_get_u32(
4373 info->attrs[NL80211_ATTR_SCAN_FLAGS]);
4374
4370 request->no_cck = 4375 request->no_cck =
4371 nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); 4376 nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]);
4372 4377
@@ -4598,6 +4603,10 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
4598 request->ie_len); 4603 request->ie_len);
4599 } 4604 }
4600 4605
4606 if (info->attrs[NL80211_ATTR_SCAN_FLAGS])
4607 request->flags = nla_get_u32(
4608 info->attrs[NL80211_ATTR_SCAN_FLAGS]);
4609
4601 request->dev = dev; 4610 request->dev = dev;
4602 request->wiphy = &rdev->wiphy; 4611 request->wiphy = &rdev->wiphy;
4603 request->interval = interval; 4612 request->interval = interval;
@@ -7663,6 +7672,9 @@ static int nl80211_add_scan_req(struct sk_buff *msg,
7663 nla_put(msg, NL80211_ATTR_IE, req->ie_len, req->ie)) 7672 nla_put(msg, NL80211_ATTR_IE, req->ie_len, req->ie))
7664 goto nla_put_failure; 7673 goto nla_put_failure;
7665 7674
7675 if (req->flags)
7676 nla_put_u32(msg, NL80211_ATTR_SCAN_FLAGS, req->flags);
7677
7666 return 0; 7678 return 0;
7667 nla_put_failure: 7679 nla_put_failure:
7668 return -ENOBUFS; 7680 return -ENOBUFS;