2017-12-13 17:52:20

by Jouni Malinen

[permalink] [raw]
Subject: [PATCH] nl80211: Introduce scan flags to emphasize requested scan behavior

From: Sunil Dutt <[email protected]>

This commit defines new scan flags (LOW_SPAN, LOW_POWER, HIGH_LATENCY)
to emphasize the requested scan behavior for the driver. These flags are
optional and are mutually exclusive. Driver shall resort to default
behavior if a respective flag is not supported. The implementation of
the respective functionality can be driver/hardware specific.

These flags can be used to control the compromise between how long a
scan takes, how much power it uses, and high accurate/complete the scan
is in finding the BSSs.

Signed-off-by: Sunil Dutt <[email protected]>
Signed-off-by: Jouni Malinen <[email protected]>
---
include/uapi/linux/nl80211.h | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 6dd6939..68fdb95 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -5059,6 +5059,11 @@ enum nl80211_timeout_reason {
* of NL80211_CMD_TRIGGER_SCAN and NL80211_CMD_START_SCHED_SCAN
* requests.
*
+ * NL80211_SCAN_FLAG_LOW_SPAN, NL80211_SCAN_FLAG_LOW_POWER, and
+ * NL80211_SCAN_FLAG_HIGH_ACCURACY flags are exclusive of each other, i.e., only
+ * one of them can be used in the request. If the driver does not support the
+ * requested behavior, default scan behavior will be used instead.
+ *
* @NL80211_SCAN_FLAG_LOW_PRIORITY: scan request has low priority
* @NL80211_SCAN_FLAG_FLUSH: flush cache before scanning
* @NL80211_SCAN_FLAG_AP: force a scan even if the interface is configured
@@ -5086,7 +5091,20 @@ enum nl80211_timeout_reason {
* and suppression (if it has received a broadcast Probe Response frame,
* Beacon frame or FILS Discovery frame from an AP that the STA considers
* a suitable candidate for (re-)association - suitable in terms of
- * SSID and/or RSSI
+ * SSID and/or RSSI.
+ * @NL80211_SCAN_FLAG_LOW_SPAN: Span corresponds to the total time taken to
+ * accomplish the scan. Thus, this flag intends the driver to perform the
+ * scan request with lesser span/duration. It is specific to the driver
+ * implementations on how this is accomplished. Scan accuracy may get
+ * impacted with this flag. This flag cannot be used with
+ * @NL80211_SCAN_FLAG_LOW_POWER: This flag intends the scan attempts to consume
+ * optimal possible power. Drivers can resort to their specific means to
+ * optimize the power. Scan accuracy may get impacted with this flag.
+ * @NL80211_SCAN_FLAG_HIGH_ACCURACY: Accuracy here intends to the extent of scan
+ * results obtained. Thus HIGH_ACCURACY scan flag aims to get maximum
+ * possible scan results. This flag hints the driver to use the best
+ * possible scan configuration to improve the accuracy in scanning.
+ * Latency and power use may get impacted with this flag.
*/
enum nl80211_scan_flags {
NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0,
@@ -5097,6 +5115,9 @@ enum nl80211_scan_flags {
NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP = 1<<5,
NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE = 1<<6,
NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION = 1<<7,
+ NL80211_SCAN_FLAG_LOW_SPAN = 1<<8,
+ NL80211_SCAN_FLAG_LOW_POWER = 1<<9,
+ NL80211_SCAN_FLAG_HIGH_ACCURACY = 1<<10,
};

/**
--
2.7.4


2017-12-14 18:16:55

by Sunil Dutt Undekari

[permalink] [raw]
Subject: RE: [PATCH] nl80211: Introduce scan flags to emphasize requested scan behavior

PiBDYW4ndCB3ZSBoYXZlIHNvbWUga2luZCBvZiBjYXBhYmlsaXR5IGluZGljYXRpb24gdGhhdCB0
aGUgZHJpdmVyIHN1cHBvcnRzIGVhY2ggb2YgdGhlc2UgZmxhZ3Mgb3Igbm90PyAgT3RoZXJ3aXNl
IHdlIGdldCBpbnRvIGEgc2l0dWF0aW9uIHdoZXJlIHlvdSBqdXN0IGhhdmUgdG8gdHJ5IHRoZSBm
bGFnIGFuZCBob3BlIGl0IHdvcmtzLCBzaW5jZSBpdCBkb2Vzbid0IGxvb2sgbGlrZSBkcml2ZXJz
IGFyZSByZXF1aXJl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W5jeSBhbmQgcG93ZXIgdXNlIG1heSBnZXQgaW1w
YWN0ZWQgd2l0aCB0aGlzIGZsYWcuDQo+IMKgICovDQo+IMKgZW51bSBubDgwMjExX3NjYW5fZmxh
Z3Mgew0KPiDCoAlOTDgwMjExX1NDQU5fRkxBR19MT1dfUFJJT1JJVFkJCQkJDQo+ID0gMTw8MCwN
Cj4gQEAgLTUwOTcsNiArNTExNSw5IEBAIGVudW0gbmw4MDIxMV9zY2FuX2ZsYWdzIHsNCj4gwqAJ
Tkw4MDIxMV9TQ0FOX0ZMQUdfQUNDRVBUX0JDQVNUX1BST0JFX1JFU1AJCT0NCj4gMTw8NSwNCj4g
wqAJTkw4MDIxMV9TQ0FOX0ZMQUdfT0NFX1BST0JFX1JFUV9ISUdIX1RYX1JBVEUJCQ0KPiA9IDE8
PDYsDQo+IMKgCU5MODAyMTFfU0NBTl9GTEFHX09DRV9QUk9CRV9SRVFfREVGRVJSQUxfU1VQUFJF
U1NJT04JDQo+ID0gMTw8NywNCj4gKwlOTDgwMjExX1NDQU5fRkxBR19MT1dfU1BBTgkJCQk9DQo+
IDE8PDgsDQo+ICsJTkw4MDIxMV9TQ0FOX0ZMQUdfTE9XX1BPV0VSCQkJCT0NCj4gMTw8OSwNCj4g
KwlOTDgwMjExX1NDQU5fRkxBR19ISUdIX0FDQ1VSQUNZCQkJCQ0KPiA9IDE8PDEwLA0KPiDCoH07
DQo+IMKgDQo+IMKgLyoqDQo=

2017-12-13 19:09:34

by Dan Williams

[permalink] [raw]
Subject: Re: [PATCH] nl80211: Introduce scan flags to emphasize requested scan behavior

On Wed, 2017-12-13 at 19:52 +0200, Jouni Malinen wrote:
> From: Sunil Dutt <[email protected]>
>
> This commit defines new scan flags (LOW_SPAN, LOW_POWER,
> HIGH_LATENCY)
> to emphasize the requested scan behavior for the driver. These flags
> are
> optional and are mutually exclusive. Driver shall resort to default
> behavior if a respective flag is not supported. The implementation of
> the respective functionality can be driver/hardware specific.

Can't we have some kind of capability indication that the driver
supports each of these flags or not? Otherwise we get into a situation
where you just have to try the flag and hope it works, since it doesn't
look like drivers are required to error out if they don't support the
flag.

Dan

> These flags can be used to control the compromise between how long a
> scan takes, how much power it uses, and high accurate/complete the
> scan
> is in finding the BSSs.
>
> Signed-off-by: Sunil Dutt <[email protected]>
> Signed-off-by: Jouni Malinen <[email protected]>
> ---
>  include/uapi/linux/nl80211.h | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/include/uapi/linux/nl80211.h
> b/include/uapi/linux/nl80211.h
> index 6dd6939..68fdb95 100644
> --- a/include/uapi/linux/nl80211.h
> +++ b/include/uapi/linux/nl80211.h
> @@ -5059,6 +5059,11 @@ enum nl80211_timeout_reason {
>   * of NL80211_CMD_TRIGGER_SCAN and NL80211_CMD_START_SCHED_SCAN
>   * requests.
>   *
> + * NL80211_SCAN_FLAG_LOW_SPAN, NL80211_SCAN_FLAG_LOW_POWER, and
> + * NL80211_SCAN_FLAG_HIGH_ACCURACY flags are exclusive of each
> other, i.e., only
> + * one of them can be used in the request. If the driver does not
> support the
> + * requested behavior, default scan behavior will be used instead.
> + *
>   * @NL80211_SCAN_FLAG_LOW_PRIORITY: scan request has low priority
>   * @NL80211_SCAN_FLAG_FLUSH: flush cache before scanning
>   * @NL80211_SCAN_FLAG_AP: force a scan even if the interface is
> configured
> @@ -5086,7 +5091,20 @@ enum nl80211_timeout_reason {
>   * and suppression (if it has received a broadcast Probe
> Response frame,
>   * Beacon frame or FILS Discovery frame from an AP that the
> STA considers
>   * a suitable candidate for (re-)association - suitable in
> terms of
> - * SSID and/or RSSI
> + * SSID and/or RSSI.
> + * @NL80211_SCAN_FLAG_LOW_SPAN: Span corresponds to the total time
> taken to
> + * accomplish the scan. Thus, this flag intends the driver to
> perform the
> + * scan request with lesser span/duration. It is specific to
> the driver
> + * implementations on how this is accomplished. Scan accuracy
> may get
> + * impacted with this flag. This flag cannot be used with
> + * @NL80211_SCAN_FLAG_LOW_POWER: This flag intends the scan attempts
> to consume
> + * optimal possible power. Drivers can resort to their
> specific means to
> + * optimize the power. Scan accuracy may get impacted with
> this flag.
> + * @NL80211_SCAN_FLAG_HIGH_ACCURACY: Accuracy here intends to the
> extent of scan
> + * results obtained. Thus HIGH_ACCURACY scan flag aims to get
> maximum
> + * possible scan results. This flag hints the driver to use
> the best
> + * possible scan configuration to improve the accuracy in
> scanning.
> + * Latency and power use may get impacted with this flag.
>   */
>  enum nl80211_scan_flags {
>   NL80211_SCAN_FLAG_LOW_PRIORITY
> = 1<<0,
> @@ -5097,6 +5115,9 @@ enum nl80211_scan_flags {
>   NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP =
> 1<<5,
>   NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE
> = 1<<6,
>   NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION
> = 1<<7,
> + NL80211_SCAN_FLAG_LOW_SPAN =
> 1<<8,
> + NL80211_SCAN_FLAG_LOW_POWER =
> 1<<9,
> + NL80211_SCAN_FLAG_HIGH_ACCURACY
> = 1<<10,
>  };
>  
>  /**

2017-12-15 09:22:34

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH] nl80211: Introduce scan flags to emphasize requested scan behavior

On 12/14/2017 7:16 PM, Sunil Dutt Undekari wrote:
>> Can't we have some kind of capability indication that the driver supports each of these flags or not? Otherwise we get into a situation where you just have to try the flag and hope it works, since it doesn't look like drivers are required to error out if they don't support the flag.
> Sure Dan . We shall have the support for capability indication from the driver.

No top-post please. The capability indication should be done through the
nl80211 api so I would expect to see a patch for that or just included
in this patch. So maybe in struct wiphy add supported_scan_flags field
and provide that through NL80211_CMD_GET_WIPHY command.

Regards,
Arend

> Regards,
> Sunil
>
>
>
> -----Original Message-----
> From: Dan Williams [mailto:[email protected]]
> Sent: Thursday, December 14, 2017 12:40 AM
> To: Jouni Malinen <[email protected]>; Johannes Berg <[email protected]>
> Cc: [email protected]; Sunil Dutt Undekari <[email protected]>
> Subject: Re: [PATCH] nl80211: Introduce scan flags to emphasize requested scan behavior
>
> On Wed, 2017-12-13 at 19:52 +0200, Jouni Malinen wrote:
>> From: Sunil Dutt <[email protected]>
>>
>> This commit defines new scan flags (LOW_SPAN, LOW_POWER,
>> HIGH_LATENCY)
>> to emphasize the requested scan behavior for the driver. These flags
>> are optional and are mutually exclusive. Driver shall resort to
>> default behavior if a respective flag is not supported. The
>> implementation of the respective functionality can be driver/hardware
>> specific.
>
> Can't we have some kind of capability indication that the driver supports each of these flags or not? Otherwise we get into a situation where you just have to try the flag and hope it works, since it doesn't look like drivers are required to error out if they don't support the flag.
>
> Dan
>
>> These flags can be used to control the compromise between how long a
>> scan takes, how much power it uses, and high accurate/complete the
>> scan is in finding the BSSs.
>>
>> Signed-off-by: Sunil Dutt <[email protected]>
>> Signed-off-by: Jouni Malinen <[email protected]>
>> ---
>> include/uapi/linux/nl80211.h | 23 ++++++++++++++++++++++-
>> 1 file changed, 22 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/uapi/linux/nl80211.h
>> b/include/uapi/linux/nl80211.h index 6dd6939..68fdb95 100644
>> --- a/include/uapi/linux/nl80211.h
>> +++ b/include/uapi/linux/nl80211.h
>> @@ -5059,6 +5059,11 @@ enum nl80211_timeout_reason {
>> * of NL80211_CMD_TRIGGER_SCAN and NL80211_CMD_START_SCHED_SCAN
>> * requests.
>> *
>> + * NL80211_SCAN_FLAG_LOW_SPAN, NL80211_SCAN_FLAG_LOW_POWER, and
>> + * NL80211_SCAN_FLAG_HIGH_ACCURACY flags are exclusive of each
>> other, i.e., only
>> + * one of them can be used in the request. If the driver does not
>> support the
>> + * requested behavior, default scan behavior will be used instead.
>> + *
>> * @NL80211_SCAN_FLAG_LOW_PRIORITY: scan request has low priority
>> * @NL80211_SCAN_FLAG_FLUSH: flush cache before scanning
>> * @NL80211_SCAN_FLAG_AP: force a scan even if the interface is
>> configured @@ -5086,7 +5091,20 @@ enum nl80211_timeout_reason {
>> * and suppression (if it has received a broadcast Probe
>> Response frame,
>> * Beacon frame or FILS Discovery frame from an AP that the
>> STA considers
>> * a suitable candidate for (re-)association - suitable in
>> terms of
>> - * SSID and/or RSSI
>> + * SSID and/or RSSI.
>> + * @NL80211_SCAN_FLAG_LOW_SPAN: Span corresponds to the total time
>> taken to
>> + * accomplish the scan. Thus, this flag intends the driver to
>> perform the
>> + * scan request with lesser span/duration. It is specific to
>> the driver
>> + * implementations on how this is accomplished. Scan accuracy
>> may get
>> + * impacted with this flag. This flag cannot be used with
>> + * @NL80211_SCAN_FLAG_LOW_POWER: This flag intends the scan attempts
>> to consume
>> + * optimal possible power. Drivers can resort to their
>> specific means to
>> + * optimize the power. Scan accuracy may get impacted with
>> this flag.
>> + * @NL80211_SCAN_FLAG_HIGH_ACCURACY: Accuracy here intends to the
>> extent of scan
>> + * results obtained. Thus HIGH_ACCURACY scan flag aims to get
>> maximum
>> + * possible scan results. This flag hints the driver to use
>> the best
>> + * possible scan configuration to improve the accuracy in
>> scanning.
>> + * Latency and power use may get impacted with this flag.
>> */
>> enum nl80211_scan_flags {
>> NL80211_SCAN_FLAG_LOW_PRIORITY
>> = 1<<0,
>> @@ -5097,6 +5115,9 @@ enum nl80211_scan_flags {
>> NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP =
>> 1<<5,
>> NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE
>> = 1<<6,
>> NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION
>> = 1<<7,
>> + NL80211_SCAN_FLAG_LOW_SPAN =
>> 1<<8,
>> + NL80211_SCAN_FLAG_LOW_POWER =
>> 1<<9,
>> + NL80211_SCAN_FLAG_HIGH_ACCURACY
>> = 1<<10,
>> };
>>
>> /**

2017-12-14 19:51:20

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH] nl80211: Introduce scan flags to emphasize requested scan behavior

Hi Jouni,

> This commit defines new scan flags (LOW_SPAN, LOW_POWER, HIGH_LATENCY)
> to emphasize the requested scan behavior for the driver. These flags are
> optional and are mutually exclusive. Driver shall resort to default
> behavior if a respective flag is not supported. The implementation of
> the respective functionality can be driver/hardware specific.

I really dislike falling back to some unspecified default behavior in case something is not supported. That is a really bad API towards userspace. Let the driver just fail and reject that operation. Userspace can define the policy and behavior if certain low power or high accuracy functionality is not available. Asking the kernel to do one thing and then the driver does whatever it wants anyway is Wireless Extensions behavior. We complained about it back then and falling back into the same pattern is bad.

And as Dan mentioned, just indicate the capabilities to userspace and then it knows what it can use. That means a good userspace will not use unsupported flags and a bad one gets hit with an error (which is a good thing).

Regards

Marcel