cfg80211/nl80211: add interval attribute for scheduled scans
Introduce NL80211_ATTR_SCHED_SCAN_INTERVAL as a required attribute for NL80211_CMD_START_SCHED_SCAN. This value informs the driver at which intervals the scheduled scan cycles should be executed. Signed-off-by: Luciano Coelho <coelho@ti.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
parent
79f460ca49
commit
bbe6ad6dcb
3 changed files with 28 additions and 9 deletions
|
@ -203,15 +203,17 @@
|
||||||
* @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
|
* @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
|
||||||
* partial scan results may be available
|
* partial scan results may be available
|
||||||
*
|
*
|
||||||
* @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan. Like with normal
|
* @NL80211_CMD_START_SCHED_SCAN: start a scheduled scan at certain
|
||||||
* scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS) are passed, they are used
|
* intervals, as specified by %NL80211_ATTR_SCHED_SCAN_INTERVAL.
|
||||||
* in the probe requests. For broadcast, a broadcast SSID must be
|
* Like with normal scans, if SSIDs (%NL80211_ATTR_SCAN_SSIDS)
|
||||||
* passed (ie. an empty string). If no SSID is passed, no probe
|
* are passed, they are used in the probe requests. For
|
||||||
* requests are sent and a passive scan is performed.
|
* broadcast, a broadcast SSID must be passed (ie. an empty
|
||||||
* %NL80211_ATTR_SCAN_FREQUENCIES, if passed, define which channels
|
* string). If no SSID is passed, no probe requests are sent and
|
||||||
* should be scanned; if not passed, all channels allowed for the
|
* a passive scan is performed. %NL80211_ATTR_SCAN_FREQUENCIES,
|
||||||
* current regulatory domain are used. Extra IEs can also be passed
|
* if passed, define which channels should be scanned; if not
|
||||||
* from the userspace by using the %NL80211_ATTR_IE attribute.
|
* passed, all channels allowed for the current regulatory domain
|
||||||
|
* are used. Extra IEs can also be passed from the userspace by
|
||||||
|
* using the %NL80211_ATTR_IE attribute.
|
||||||
* @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan
|
* @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan
|
||||||
* @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan
|
* @NL80211_CMD_SCHED_SCAN_RESULTS: indicates that there are scheduled scan
|
||||||
* results available.
|
* results available.
|
||||||
|
@ -948,6 +950,9 @@ enum nl80211_commands {
|
||||||
* indicate which WoW triggers should be enabled. This is also
|
* indicate which WoW triggers should be enabled. This is also
|
||||||
* used by %NL80211_CMD_GET_WOWLAN to get the currently enabled WoWLAN
|
* used by %NL80211_CMD_GET_WOWLAN to get the currently enabled WoWLAN
|
||||||
* triggers.
|
* triggers.
|
||||||
|
|
||||||
|
* @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan
|
||||||
|
* cycles, in msecs.
|
||||||
*
|
*
|
||||||
* @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
|
||||||
|
@ -1142,6 +1147,8 @@ enum nl80211_attrs {
|
||||||
NL80211_ATTR_WOWLAN_TRIGGERS,
|
NL80211_ATTR_WOWLAN_TRIGGERS,
|
||||||
NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED,
|
NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED,
|
||||||
|
|
||||||
|
NL80211_ATTR_SCHED_SCAN_INTERVAL,
|
||||||
|
|
||||||
/* 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,
|
||||||
|
|
|
@ -829,6 +829,7 @@ struct cfg80211_scan_request {
|
||||||
* @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
|
* @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
|
||||||
* @n_ssids: number of SSIDs
|
* @n_ssids: number of SSIDs
|
||||||
* @n_channels: total number of channels to scan
|
* @n_channels: total number of channels to scan
|
||||||
|
* @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
|
||||||
* @wiphy: the wiphy this was for
|
* @wiphy: the wiphy this was for
|
||||||
|
@ -839,6 +840,7 @@ struct cfg80211_sched_scan_request {
|
||||||
struct cfg80211_ssid *ssids;
|
struct cfg80211_ssid *ssids;
|
||||||
int n_ssids;
|
int n_ssids;
|
||||||
u32 n_channels;
|
u32 n_channels;
|
||||||
|
u32 interval;
|
||||||
const u8 *ie;
|
const u8 *ie;
|
||||||
size_t ie_len;
|
size_t ie_len;
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,7 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
|
||||||
[NL80211_ATTR_KEY_DEFAULT_TYPES] = { .type = NLA_NESTED },
|
[NL80211_ATTR_KEY_DEFAULT_TYPES] = { .type = NLA_NESTED },
|
||||||
[NL80211_ATTR_WOWLAN_TRIGGERS] = { .type = NLA_NESTED },
|
[NL80211_ATTR_WOWLAN_TRIGGERS] = { .type = NLA_NESTED },
|
||||||
[NL80211_ATTR_STA_PLINK_STATE] = { .type = NLA_U8 },
|
[NL80211_ATTR_STA_PLINK_STATE] = { .type = NLA_U8 },
|
||||||
|
[NL80211_ATTR_SCHED_SCAN_INTERVAL] = { .type = NLA_U32 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* policy for the key attributes */
|
/* policy for the key attributes */
|
||||||
|
@ -3370,6 +3371,7 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
|
||||||
struct nlattr *attr;
|
struct nlattr *attr;
|
||||||
struct wiphy *wiphy;
|
struct wiphy *wiphy;
|
||||||
int err, tmp, n_ssids = 0, n_channels, i;
|
int err, tmp, n_ssids = 0, n_channels, i;
|
||||||
|
u32 interval;
|
||||||
enum ieee80211_band band;
|
enum ieee80211_band band;
|
||||||
size_t ie_len;
|
size_t ie_len;
|
||||||
|
|
||||||
|
@ -3383,6 +3385,13 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
|
||||||
if (rdev->sched_scan_req)
|
if (rdev->sched_scan_req)
|
||||||
return -EINPROGRESS;
|
return -EINPROGRESS;
|
||||||
|
|
||||||
|
if (!info->attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL])
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
interval = nla_get_u32(info->attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]);
|
||||||
|
if (interval == 0)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
wiphy = &rdev->wiphy;
|
wiphy = &rdev->wiphy;
|
||||||
|
|
||||||
if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) {
|
if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) {
|
||||||
|
@ -3505,6 +3514,7 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
|
||||||
|
|
||||||
request->dev = dev;
|
request->dev = dev;
|
||||||
request->wiphy = &rdev->wiphy;
|
request->wiphy = &rdev->wiphy;
|
||||||
|
request->interval = interval;
|
||||||
|
|
||||||
err = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request);
|
err = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
|
|
Loading…
Reference in a new issue