Commit ed473771 authored by Sam Leffler's avatar Sam Leffler Committed by Johannes Berg

{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: default avatarSam Leffler <sleffler@chromium.org>
Tested-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent f461be3e
...@@ -1002,6 +1002,7 @@ struct cfg80211_ssid { ...@@ -1002,6 +1002,7 @@ struct cfg80211_ssid {
* @n_channels: total number of channels to scan * @n_channels: total number of channels to scan
* @ie: optional information element(s) to add into Probe Request or %NULL * @ie: optional information element(s) to add into Probe Request or %NULL
* @ie_len: length of ie in octets * @ie_len: length of ie in octets
* @flags: bit field of flags controlling operation
* @rates: bitmap of rates to advertise for each band * @rates: bitmap of rates to advertise for each band
* @wiphy: the wiphy this was for * @wiphy: the wiphy this was for
* @wdev: the wireless device to scan for * @wdev: the wireless device to scan for
...@@ -1014,6 +1015,7 @@ struct cfg80211_scan_request { ...@@ -1014,6 +1015,7 @@ struct cfg80211_scan_request {
u32 n_channels; u32 n_channels;
const u8 *ie; const u8 *ie;
size_t ie_len; size_t ie_len;
u32 flags;
u32 rates[IEEE80211_NUM_BANDS]; u32 rates[IEEE80211_NUM_BANDS];
...@@ -1046,6 +1048,7 @@ struct cfg80211_match_set { ...@@ -1046,6 +1048,7 @@ struct cfg80211_match_set {
* @interval: interval between each scheduled scan cycle * @interval: interval between each scheduled scan cycle
* @ie: optional information element(s) to add into Probe Request or %NULL * @ie: optional information element(s) to add into Probe Request or %NULL
* @ie_len: length of ie in octets * @ie_len: length of ie in octets
* @flags: bit field of flags controlling operation
* @match_sets: sets of parameters to be matched for a scan result * @match_sets: sets of parameters to be matched for a scan result
* entry to be considered valid and to be passed to the host * entry to be considered valid and to be passed to the host
* (others are filtered out). * (others are filtered out).
...@@ -1063,6 +1066,7 @@ struct cfg80211_sched_scan_request { ...@@ -1063,6 +1066,7 @@ struct cfg80211_sched_scan_request {
u32 interval; u32 interval;
const u8 *ie; const u8 *ie;
size_t ie_len; size_t ie_len;
u32 flags;
struct cfg80211_match_set *match_sets; struct cfg80211_match_set *match_sets;
int n_match_sets; int n_match_sets;
s32 rssi_thold; s32 rssi_thold;
......
...@@ -1279,6 +1279,8 @@ enum nl80211_commands { ...@@ -1279,6 +1279,8 @@ enum nl80211_commands {
* @NL80211_ATTR_VHT_CAPABILITY: VHT Capability information element (from * @NL80211_ATTR_VHT_CAPABILITY: VHT Capability information element (from
* association request when used with NL80211_CMD_NEW_STATION) * association request when used with NL80211_CMD_NEW_STATION)
* *
* @NL80211_ATTR_SCAN_FLAGS: scan request control flags (u32)
*
* @NL80211_ATTR_MAX: highest attribute number currently defined * @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use * @__NL80211_ATTR_AFTER_LAST: internal use
*/ */
...@@ -1540,6 +1542,8 @@ enum nl80211_attrs { ...@@ -1540,6 +1542,8 @@ enum nl80211_attrs {
NL80211_ATTR_VHT_CAPABILITY, NL80211_ATTR_VHT_CAPABILITY,
NL80211_ATTR_SCAN_FLAGS,
/* add attributes here, update the policy in nl80211.c */ /* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST, __NL80211_ATTR_AFTER_LAST,
...@@ -3086,4 +3090,15 @@ enum nl80211_connect_failed_reason { ...@@ -3086,4 +3090,15 @@ enum nl80211_connect_failed_reason {
NL80211_CONN_FAIL_BLOCKED_CLIENT, NL80211_CONN_FAIL_BLOCKED_CLIENT,
}; };
/**
* enum nl80211_scan_flags - scan request control flags
*
* Scan request control flags are used to control the handling
* of NL80211_CMD_TRIGGER_SCAN and NL80211_CMD_START_SCHED_SCAN
* requests.
* (will be filled)
enum nl80211_scan_flags {
};
*/
#endif /* __LINUX_NL80211_H */ #endif /* __LINUX_NL80211_H */
...@@ -356,6 +356,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = { ...@@ -356,6 +356,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
[NL80211_ATTR_USER_REG_HINT_TYPE] = { .type = NLA_U32 }, [NL80211_ATTR_USER_REG_HINT_TYPE] = { .type = NLA_U32 },
[NL80211_ATTR_SAE_DATA] = { .type = NLA_BINARY, }, [NL80211_ATTR_SAE_DATA] = { .type = NLA_BINARY, },
[NL80211_ATTR_VHT_CAPABILITY] = { .len = NL80211_VHT_CAPABILITY_LEN }, [NL80211_ATTR_VHT_CAPABILITY] = { .len = NL80211_VHT_CAPABILITY_LEN },
[NL80211_ATTR_SCAN_FLAGS] = { .type = NLA_U32 },
}; };
/* policy for the key attributes */ /* policy for the key attributes */
...@@ -4367,6 +4368,10 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) ...@@ -4367,6 +4368,10 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
} }
} }
if (info->attrs[NL80211_ATTR_SCAN_FLAGS])
request->flags = nla_get_u32(
info->attrs[NL80211_ATTR_SCAN_FLAGS]);
request->no_cck = request->no_cck =
nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]);
...@@ -4598,6 +4603,10 @@ static int nl80211_start_sched_scan(struct sk_buff *skb, ...@@ -4598,6 +4603,10 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
request->ie_len); request->ie_len);
} }
if (info->attrs[NL80211_ATTR_SCAN_FLAGS])
request->flags = nla_get_u32(
info->attrs[NL80211_ATTR_SCAN_FLAGS]);
request->dev = dev; request->dev = dev;
request->wiphy = &rdev->wiphy; request->wiphy = &rdev->wiphy;
request->interval = interval; request->interval = interval;
...@@ -7663,6 +7672,9 @@ static int nl80211_add_scan_req(struct sk_buff *msg, ...@@ -7663,6 +7672,9 @@ static int nl80211_add_scan_req(struct sk_buff *msg,
nla_put(msg, NL80211_ATTR_IE, req->ie_len, req->ie)) nla_put(msg, NL80211_ATTR_IE, req->ie_len, req->ie))
goto nla_put_failure; goto nla_put_failure;
if (req->flags)
nla_put_u32(msg, NL80211_ATTR_SCAN_FLAGS, req->flags);
return 0; return 0;
nla_put_failure: nla_put_failure:
return -ENOBUFS; return -ENOBUFS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment