Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

nl80211: support short and long interval in sched scan (INTERNAL)

Enable having a short interval for sched scan for a
given number of intervals and then switch to a longer interval.
Have sched scan users (ath6kl and wl12xx) use long_interval
field instead of just interval as a rename was needed.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
  • Loading branch information...
commit 59bfc5aedfa53a9356888040147d9fd1872a2674 1 parent a00d9ae
@eyalsh eyalsh authored ariknem committed
View
2  drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -3245,7 +3245,7 @@ static int ath6kl_cfg80211_sscan_start(struct wiphy *wiphy,
}
/* fw uses seconds, also make sure that it's >0 */
- interval = max_t(u16, 1, request->interval / 1000);
+ interval = max_t(u16, 1, request->long_interval / 1000);
ath6kl_wmi_scanparams_cmd(ar->wmi, vif->fw_vif_idx,
interval, interval,
View
2  drivers/net/wireless/ti/wlcore/scan.c
@@ -723,7 +723,7 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl,
cfg->bss_type = SCAN_BSS_TYPE_ANY;
/* currently NL80211 supports only a single interval */
for (i = 0; i < SCAN_MAX_CYCLE_INTERVALS; i++)
- cfg->intervals[i] = cpu_to_le32(req->interval);
+ cfg->intervals[i] = cpu_to_le32(req->long_interval);
cfg->ssid_len = 0;
ret = wl12xx_scan_sched_scan_ssid_list(wl, wlvif, req);
View
16 include/linux/nl80211.h
@@ -1125,7 +1125,9 @@ enum nl80211_commands {
* triggers.
*
* @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan
- * cycles, in msecs.
+ * cycles, in msecs. If short interval is supported by the driver
+ * and configured then this will be used only after the requested
+ * number of short intervals
*
* @NL80211_ATTR_SCHED_SCAN_MATCH: Nested attribute with one or more
* sets of attributes to match during scheduled scans. Only BSSs
@@ -1285,6 +1287,11 @@ enum nl80211_commands {
* requests to transmit on each active scan channel, used with
* %NL80211_CMD_TRIGGER_SCAN command.
*
+ * @NL80211_ATTR_SCHED_SCAN_SHORT_INTERVAL: interval between
+ * each short interval scheduled scan cycle in msecs.
+ * @NL80211_ATTR_SCHED_SCAN_NUM_SHORT_INTERVALS: number of short
+ * sched scan intervals before switching to the long interval
+ *
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
@@ -1543,6 +1550,9 @@ enum nl80211_attrs {
NL80211_ATTR_SCAN_MAX_DWELL,
NL80211_ATTR_SCAN_NUM_PROBE,
+ NL80211_ATTR_SCHED_SCAN_SHORT_INTERVAL,
+ NL80211_ATTR_SCHED_SCAN_NUM_SHORT_INTERVALS,
+
/* add attributes here, update the policy in nl80211.c */
__NL80211_ATTR_AFTER_LAST,
@@ -2992,11 +3002,15 @@ enum nl80211_ap_sme_features {
* @NL80211_FEATURE_HT_IBSS: This driver supports IBSS with HT datarates.
* @NL80211_FEATURE_INACTIVITY_TIMER: This driver takes care of freeing up
* the connected inactive stations in AP mode.
+ * @NL80211_FEATURE_SCHED_SCAN_INTERVALS: This driver supports using
+ * short interval for sched scan and then switching to a longer
+ * interval.
*/
enum nl80211_feature_flags {
NL80211_FEATURE_SK_TX_STATUS = 1 << 0,
NL80211_FEATURE_HT_IBSS = 1 << 1,
NL80211_FEATURE_INACTIVITY_TIMER = 1 << 2,
+ NL80211_FEATURE_SCHED_SCAN_INTERVALS = 1 << 3,
};
/**
View
9 include/net/cfg80211.h
@@ -1044,7 +1044,10 @@ struct cfg80211_match_set {
* @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
* @n_ssids: number of SSIDs
* @n_channels: total number of channels to scan
- * @interval: interval between each scheduled scan cycle
+ * @long_interval: interval between each long scheduled scan cycle
+ * @short_interval: interval between each short scheduled scan cycle
+ * @n_short_intevals: number of short intervals scheduled scan cycles before
+ * switching to the long interval
* @ie: optional information element(s) to add into Probe Request or %NULL
* @ie_len: length of ie in octets
* @match_sets: sets of parameters to be matched for a scan result
@@ -1061,7 +1064,9 @@ struct cfg80211_sched_scan_request {
struct cfg80211_ssid *ssids;
int n_ssids;
u32 n_channels;
- u32 interval;
+ u32 long_interval;
+ u32 short_interval;
+ u8 n_short_intervals;
const u8 *ie;
size_t ie_len;
struct cfg80211_match_set *match_sets;
View
30 net/wireless/nl80211.c
@@ -299,6 +299,8 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
[NL80211_ATTR_SCAN_MIN_DWELL] = { .type = NLA_U32 },
[NL80211_ATTR_SCAN_MAX_DWELL] = { .type = NLA_U32 },
[NL80211_ATTR_SCAN_NUM_PROBE] = { .type = NLA_U8 },
+ [NL80211_ATTR_SCHED_SCAN_SHORT_INTERVAL] = { .type = NLA_U32 },
+ [NL80211_ATTR_SCHED_SCAN_NUM_SHORT_INTERVALS] = { .type = NLA_U8 },
};
/* policy for the key attributes */
@@ -4259,7 +4261,8 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
struct nlattr *attr;
struct wiphy *wiphy;
int err, tmp, n_ssids = 0, n_match_sets = 0, n_channels, i;
- u32 interval;
+ u32 long_interval = 0, short_interval = 0;
+ u8 n_short_intervals = 0;
enum ieee80211_band band;
size_t ie_len;
struct nlattr *tb[NL80211_SCHED_SCAN_MATCH_ATTR_MAX + 1];
@@ -4274,10 +4277,27 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
if (!info->attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL])
return -EINVAL;
- interval = nla_get_u32(info->attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]);
- if (interval == 0)
+ long_interval = nla_get_u32(
+ info->attrs[NL80211_ATTR_SCHED_SCAN_INTERVAL]);
+ if (long_interval == 0)
return -EINVAL;
+ if (info->attrs[NL80211_ATTR_SCHED_SCAN_SHORT_INTERVAL]) {
+ if (!(rdev->wiphy.features &
+ NL80211_FEATURE_SCHED_SCAN_INTERVALS))
+ return -EOPNOTSUPP;
+
+ if (!info->attrs[NL80211_ATTR_SCHED_SCAN_NUM_SHORT_INTERVALS])
+ return -EINVAL;
+
+ n_short_intervals = nla_get_u8(
+ info->attrs[NL80211_ATTR_SCHED_SCAN_NUM_SHORT_INTERVALS]);
+ short_interval = nla_get_u32(
+ info->attrs[NL80211_ATTR_SCHED_SCAN_SHORT_INTERVAL]);
+ if (short_interval == 0)
+ return -EINVAL;
+ }
+
wiphy = &rdev->wiphy;
if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) {
@@ -4461,7 +4481,9 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
request->dev = dev;
request->wiphy = &rdev->wiphy;
- request->interval = interval;
+ request->long_interval = long_interval;
+ request->short_interval = short_interval;
+ request->n_short_intervals = n_short_intervals;
err = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request);
if (!err) {
Please sign in to comment.
Something went wrong with that request. Please try again.