diff options
author | Luciano Coelho <luciano.coelho@intel.com> | 2015-01-16 09:04:09 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2015-01-23 04:30:47 -0500 |
commit | 9c74893441d3cf4b258a82b19cbf6bfd2ed6e549 (patch) | |
tree | 4e2d61d97961013e4a8db0be6c5386b43f123476 | |
parent | db82d8a966ded064bd4cf0e1fcca13442f50d0ae (diff) |
nl80211: add an attribute to allow delaying the first scheduled scan cycle
The userspace may want to delay the the first scheduled scan or
net-detect cycle. Add an optional attribute to the scheduled scan
configuration to pass the delay to be (optionally) used by the driver.
Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
[add the attribute to the policy to validate it]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | include/net/cfg80211.h | 5 | ||||
-rw-r--r-- | include/uapi/linux/nl80211.h | 20 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 5 |
3 files changed, 24 insertions, 6 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 7b44ba0a7632..64e09e1e8099 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -1493,6 +1493,10 @@ struct cfg80211_match_set { | |||
1493 | * @rcu_head: RCU callback used to free the struct | 1493 | * @rcu_head: RCU callback used to free the struct |
1494 | * @owner_nlportid: netlink portid of owner (if this should is a request | 1494 | * @owner_nlportid: netlink portid of owner (if this should is a request |
1495 | * owned by a particular socket) | 1495 | * owned by a particular socket) |
1496 | * @delay: delay in seconds to use before starting the first scan | ||
1497 | * cycle. The driver may ignore this parameter and start | ||
1498 | * immediately (or at any other time), if this feature is not | ||
1499 | * supported. | ||
1496 | */ | 1500 | */ |
1497 | struct cfg80211_sched_scan_request { | 1501 | struct cfg80211_sched_scan_request { |
1498 | struct cfg80211_ssid *ssids; | 1502 | struct cfg80211_ssid *ssids; |
@@ -1506,6 +1510,7 @@ struct cfg80211_sched_scan_request { | |||
1506 | struct cfg80211_match_set *match_sets; | 1510 | struct cfg80211_match_set *match_sets; |
1507 | int n_match_sets; | 1511 | int n_match_sets; |
1508 | s32 min_rssi_thold; | 1512 | s32 min_rssi_thold; |
1513 | u32 delay; | ||
1509 | 1514 | ||
1510 | u8 mac_addr[ETH_ALEN] __aligned(2); | 1515 | u8 mac_addr[ETH_ALEN] __aligned(2); |
1511 | u8 mac_addr_mask[ETH_ALEN] __aligned(2); | 1516 | u8 mac_addr_mask[ETH_ALEN] __aligned(2); |
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index f68532b015db..1cbc3aae425c 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h | |||
@@ -324,7 +324,9 @@ | |||
324 | * if passed, define which channels should be scanned; if not | 324 | * if passed, define which channels should be scanned; if not |
325 | * passed, all channels allowed for the current regulatory domain | 325 | * passed, all channels allowed for the current regulatory domain |
326 | * are used. Extra IEs can also be passed from the userspace by | 326 | * are used. Extra IEs can also be passed from the userspace by |
327 | * using the %NL80211_ATTR_IE attribute. | 327 | * using the %NL80211_ATTR_IE attribute. The first cycle of the |
328 | * scheduled scan can be delayed by %NL80211_ATTR_SCHED_SCAN_DELAY | ||
329 | * is supplied. | ||
328 | * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT if | 330 | * @NL80211_CMD_STOP_SCHED_SCAN: stop a scheduled scan. Returns -ENOENT if |
329 | * scheduled scan is not running. The caller may assume that as soon | 331 | * scheduled scan is not running. The caller may assume that as soon |
330 | * as the call returns, it is safe to start a new scheduled scan again. | 332 | * as the call returns, it is safe to start a new scheduled scan again. |
@@ -1735,6 +1737,9 @@ enum nl80211_commands { | |||
1735 | * should be contained in the result as the sum of the respective counters | 1737 | * should be contained in the result as the sum of the respective counters |
1736 | * over all channels. | 1738 | * over all channels. |
1737 | * | 1739 | * |
1740 | * @NL80211_ATTR_SCHED_SCAN_DELAY: delay before a scheduled scan (or a | ||
1741 | * WoWLAN net-detect scan) is started, u32 in seconds. | ||
1742 | * | ||
1738 | * @NUM_NL80211_ATTR: total number of nl80211_attrs available | 1743 | * @NUM_NL80211_ATTR: total number of nl80211_attrs available |
1739 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 1744 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
1740 | * @__NL80211_ATTR_AFTER_LAST: internal use | 1745 | * @__NL80211_ATTR_AFTER_LAST: internal use |
@@ -2100,6 +2105,8 @@ enum nl80211_attrs { | |||
2100 | 2105 | ||
2101 | NL80211_ATTR_NETNS_FD, | 2106 | NL80211_ATTR_NETNS_FD, |
2102 | 2107 | ||
2108 | NL80211_ATTR_SCHED_SCAN_DELAY, | ||
2109 | |||
2103 | /* add attributes here, update the policy in nl80211.c */ | 2110 | /* add attributes here, update the policy in nl80211.c */ |
2104 | 2111 | ||
2105 | __NL80211_ATTR_AFTER_LAST, | 2112 | __NL80211_ATTR_AFTER_LAST, |
@@ -3743,11 +3750,12 @@ struct nl80211_pattern_support { | |||
3743 | * @NL80211_WOWLAN_TRIG_NET_DETECT: wake up when a configured network | 3750 | * @NL80211_WOWLAN_TRIG_NET_DETECT: wake up when a configured network |
3744 | * is detected. This is a nested attribute that contains the | 3751 | * is detected. This is a nested attribute that contains the |
3745 | * same attributes used with @NL80211_CMD_START_SCHED_SCAN. It | 3752 | * same attributes used with @NL80211_CMD_START_SCHED_SCAN. It |
3746 | * specifies how the scan is performed (e.g. the interval and the | 3753 | * specifies how the scan is performed (e.g. the interval, the |
3747 | * channels to scan) as well as the scan results that will | 3754 | * channels to scan and the initial delay) as well as the scan |
3748 | * trigger a wake (i.e. the matchsets). This attribute is also | 3755 | * results that will trigger a wake (i.e. the matchsets). This |
3749 | * sent in a response to @NL80211_CMD_GET_WIPHY, indicating the | 3756 | * attribute is also sent in a response to |
3750 | * number of match sets supported by the driver (u32). | 3757 | * @NL80211_CMD_GET_WIPHY, indicating the number of match sets |
3758 | * supported by the driver (u32). | ||
3751 | * @NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS: nested attribute | 3759 | * @NL80211_WOWLAN_TRIG_NET_DETECT_RESULTS: nested attribute |
3752 | * containing an array with information about what triggered the | 3760 | * containing an array with information about what triggered the |
3753 | * wake up. If no elements are present in the array, it means | 3761 | * wake up. If no elements are present in the array, it means |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index c64100ec79e3..4542e8683beb 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -398,6 +398,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { | |||
398 | [NL80211_ATTR_MAC_MASK] = { .len = ETH_ALEN }, | 398 | [NL80211_ATTR_MAC_MASK] = { .len = ETH_ALEN }, |
399 | [NL80211_ATTR_WIPHY_SELF_MANAGED_REG] = { .type = NLA_FLAG }, | 399 | [NL80211_ATTR_WIPHY_SELF_MANAGED_REG] = { .type = NLA_FLAG }, |
400 | [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 }, | 400 | [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 }, |
401 | [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 }, | ||
401 | }; | 402 | }; |
402 | 403 | ||
403 | /* policy for the key attributes */ | 404 | /* policy for the key attributes */ |
@@ -6205,6 +6206,10 @@ nl80211_parse_sched_scan(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
6205 | } | 6206 | } |
6206 | } | 6207 | } |
6207 | 6208 | ||
6209 | if (attrs[NL80211_ATTR_SCHED_SCAN_DELAY]) | ||
6210 | request->delay = | ||
6211 | nla_get_u32(attrs[NL80211_ATTR_SCHED_SCAN_DELAY]); | ||
6212 | |||
6208 | request->interval = interval; | 6213 | request->interval = interval; |
6209 | request->scan_start = jiffies; | 6214 | request->scan_start = jiffies; |
6210 | 6215 | ||