All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iw: add lowpri and flush scan operands
@ 2012-10-16  0:22 Bing Zhao
  2012-10-16 18:41 ` Johannes Berg
  0 siblings, 1 reply; 5+ messages in thread
From: Bing Zhao @ 2012-10-16  0:22 UTC (permalink / raw)
  To: linux-wireless
  Cc: Johannes Berg, John W. Linville, Sam Leffler, Amitkumar Karwar,
	Bing Zhao

From: Sam Leffler <sleffler@chromium.org>

Add lowpri (low priority) and flush operands to the scan cmd to
request the equivalent flags be set in the scan request. Note
these are applied regardless of the feature flags to support
testing drivers that do not implement them.

Signed-off-by: Sam Leffler <sleffler@chromium.org>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>

---
 info.c    |    6 ++++++
 nl80211.h |   27 +++++++++++++++++++++++++++
 scan.c    |   16 ++++++++++++++--
 3 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/info.c b/info.c
index f039bba..87b85c2 100644
--- a/info.c
+++ b/info.c
@@ -438,6 +438,12 @@ broken_combination:
 		if (nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]) &
 				NL80211_FEATURE_HT_IBSS)
 			printf("\tDevice supports HT-IBSS.\n");
+		if (nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]) &
+				NL80211_FEATURE_LOW_PRIORITY_SCAN)
+			printf("\tDevice supports low priority scan.\n");
+		if (nla_get_u32(tb_msg[NL80211_ATTR_FEATURE_FLAGS]) &
+				NL80211_FEATURE_SCAN_FLUSH)
+			printf("\tDevice supports scan flush.\n");
 	}
 
 	return NL_SKIP;
diff --git a/nl80211.h b/nl80211.h
index 2f38788..0a39e05 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -1506,6 +1506,14 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_USER_REG_HINT_TYPE,
 
+	NL80211_ATTR_CONN_FAILED_REASON,
+
+	NL80211_ATTR_SAE_DATA,
+
+	NL80211_ATTR_VHT_CAPABILITY,
+
+	NL80211_ATTR_SCAN_FLAGS,
+
 	/* add attributes here, update the policy in nl80211.c */
 
 	__NL80211_ATTR_AFTER_LAST,
@@ -2994,12 +3002,16 @@ enum nl80211_ap_sme_features {
  * @NL80211_FEATURE_CELL_BASE_REG_HINTS: This driver has been tested
  *	to work properly to suppport receiving regulatory hints from
  *	cellular base stations.
+ * @NL80211_FEATURE_LOW_PRIORITY_SCAN: This driver supports low priority scan
+ * @NL80211_FEATURE_SCAN_FLUSH: Scan flush is supported
  */
 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_CELL_BASE_REG_HINTS = 1 << 3,
+	NL80211_FEATURE_LOW_PRIORITY_SCAN		= 1 << 6,
+	NL80211_FEATURE_SCAN_FLUSH			= 1 << 7,
 };
 
 /**
@@ -3023,4 +3035,19 @@ enum nl80211_probe_resp_offload_support_attr {
 	NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U =	1<<3,
 };
 
+/**
+ * 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.
+ *
+ * @NL80211_SCAN_FLAG_LOW_PRIORITY: scan request has low priority
+ * @NL80211_SCAN_FLAG_FLUSH: flush cache before scanning
+ */
+enum nl80211_scan_flags {
+	NL80211_SCAN_FLAG_LOW_PRIORITY			= 1<<0,
+	NL80211_SCAN_FLAG_FLUSH				= 1<<1,
+};
+
 #endif /* __LINUX_NL80211_H */
diff --git a/scan.c b/scan.c
index bb84a67..85fb5a9 100644
--- a/scan.c
+++ b/scan.c
@@ -73,6 +73,7 @@ static int handle_scan(struct nl80211_state *state,
 	bool passive = false, have_ssids = false, have_freqs = false;
 	size_t tmp;
 	unsigned char *ies;
+	int flags = 0;
 
 	ssids = nlmsg_alloc();
 	if (!ssids)
@@ -102,6 +103,14 @@ static int handle_scan(struct nl80211_state *state,
 				parse = DONE;
 				passive = true;
 				break;
+			} else if (strcmp(argv[i], "lowpri") == 0) {
+				parse = DONE;
+				flags |= NL80211_SCAN_FLAG_LOW_PRIORITY;
+				break;
+			} else if (strcmp(argv[i], "flush") == 0) {
+				parse = DONE;
+				flags |= NL80211_SCAN_FLAG_FLUSH;
+				break;
 			}
 		case DONE:
 			return 1;
@@ -136,6 +145,8 @@ static int handle_scan(struct nl80211_state *state,
 
 	if (have_freqs)
 		nla_put_nested(msg, NL80211_ATTR_SCAN_FREQUENCIES, freqs);
+	if (flags)
+		NLA_PUT_U32(msg, NL80211_ATTR_SCAN_FLAGS, flags);
 
 	err = 0;
  nla_put_failure:
@@ -1344,7 +1355,7 @@ static int handle_scan_combined(struct nl80211_state *state,
 	dump_argv[0] = argv[0];
 	return handle_cmd(state, id, dump_argc, dump_argv);
 }
-TOPLEVEL(scan, "[-u] [freq <freq>*] [ies <hex as 00:11:..>] [ssid <ssid>*|passive]", 0, 0,
+TOPLEVEL(scan, "[-u] [freq <freq>*] [ies <hex as 00:11:..>] [ssid <ssid>*|passive|lowpri|flush]", 0, 0,
 	 CIB_NETDEV, handle_scan_combined,
 	 "Scan on the given frequencies and probe for the given SSIDs\n"
 	 "(or wildcard if not given) unless passive scanning is requested.\n"
@@ -1354,7 +1365,8 @@ COMMAND(scan, dump, "[-u]",
 	NL80211_CMD_GET_SCAN, NLM_F_DUMP, CIB_NETDEV, handle_scan_dump,
 	"Dump the current scan results. If -u is specified, print unknown\n"
 	"data in scan results.");
-COMMAND(scan, trigger, "[freq <freq>*] [ies <hex as 00:11:..>] [ssid <ssid>*|passive]",
+COMMAND(scan, trigger, "[freq <freq>*] [ies <hex as 00:11:..>] [ssid <ssid>*|passive|lowpri|flush]",
 	NL80211_CMD_TRIGGER_SCAN, 0, CIB_NETDEV, handle_scan,
 	 "Trigger a scan on the given frequencies with probing for the given\n"
+
 	 "SSIDs (or wildcard if not given) unless passive scanning is requested.");
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] iw: add lowpri and flush scan operands
  2012-10-16  0:22 [PATCH] iw: add lowpri and flush scan operands Bing Zhao
@ 2012-10-16 18:41 ` Johannes Berg
  2012-10-16 19:43   ` Bing Zhao
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2012-10-16 18:41 UTC (permalink / raw)
  To: Bing Zhao; +Cc: linux-wireless, John W. Linville, Sam Leffler, Amitkumar Karwar

On Mon, 2012-10-15 at 17:22 -0700, Bing Zhao wrote:

> --- a/nl80211.h
> +++ b/nl80211.h

No need to send nl80211.h updates, I do those directly by copying the
new file to avoid mismatch issues.


> -TOPLEVEL(scan, "[-u] [freq <freq>*] [ies <hex as 00:11:..>] [ssid <ssid>*|passive]", 0, 0,
> +TOPLEVEL(scan, "[-u] [freq <freq>*] [ies <hex as 00:11:..>] [ssid <ssid>*|passive|lowpri|flush]", 0, 0,

This seems a little wrong, you can't give lowpri/flush after giving
SSIDs, so it should probably be written as

... [ies <...>] [lowpri|flush] [ssid ...]

The SSID list has to be last since no keyword can terminate it
(everything could be a valid SSID)

>  	NL80211_CMD_TRIGGER_SCAN, 0, CIB_NETDEV, handle_scan,
>  	 "Trigger a scan on the given frequencies with probing for the given\n"
> +

spurious newline?

johannes


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] iw: add lowpri and flush scan operands
  2012-10-16 18:41 ` Johannes Berg
@ 2012-10-16 19:43   ` Bing Zhao
  2012-10-16 19:49     ` Johannes Berg
  0 siblings, 1 reply; 5+ messages in thread
From: Bing Zhao @ 2012-10-16 19:43 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless, John W. Linville, Sam Leffler, Amitkumar Karwar

SGkgSm9oYW5uZXMsDQoNCj4gPiAtLS0gYS9ubDgwMjExLmgNCj4gPiArKysgYi9ubDgwMjExLmg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vd3ByaS9mbHVzaCB0aGlzIHdheS4NCg0K
PiANCj4gPiAgCU5MODAyMTFfQ01EX1RSSUdHRVJfU0NBTiwgMCwgQ0lCX05FVERFViwgaGFuZGxl
X3NjYW4sDQo+ID4gIAkgIlRyaWdnZXIgYSBzY2FuIG9uIHRoZSBnaXZlbiBmcmVxdWVuY2llcyB3
aXRoIHByb2JpbmcgZm9yIHRoZSBnaXZlblxuIg0KPiA+ICsNCj4gDQo+IHNwdXJpb3VzIG5ld2xp
bmU/DQoNCkl0IHdpbGwgYmUgcmVtb3ZlZCBpbiB2Mi4NCg0KVGhhbmtzLA0KQmluZw0K

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] iw: add lowpri and flush scan operands
  2012-10-16 19:43   ` Bing Zhao
@ 2012-10-16 19:49     ` Johannes Berg
  2012-10-16 20:01       ` Bing Zhao
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2012-10-16 19:49 UTC (permalink / raw)
  To: Bing Zhao; +Cc: linux-wireless, John W. Linville, Sam Leffler, Amitkumar Karwar

On Tue, 2012-10-16 at 12:43 -0700, Bing Zhao wrote:

> > > -TOPLEVEL(scan, "[-u] [freq <freq>*] [ies <hex as 00:11:..>] [ssid <ssid>*|passive]", 0, 0,
> > > +TOPLEVEL(scan, "[-u] [freq <freq>*] [ies <hex as 00:11:..>] [ssid <ssid>*|passive|lowpri|flush]",
> > 0, 0,
> > 
> > This seems a little wrong, you can't give lowpri/flush after giving
> > SSIDs, so it should probably be written as
> 
> I think we are adding lowpri/flush support as similar to 'passive' flag.

but "passive" is mutually exclusive with "ssid", while the flags aren't.

johannes


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] iw: add lowpri and flush scan operands
  2012-10-16 19:49     ` Johannes Berg
@ 2012-10-16 20:01       ` Bing Zhao
  0 siblings, 0 replies; 5+ messages in thread
From: Bing Zhao @ 2012-10-16 20:01 UTC (permalink / raw)
  To: Johannes Berg
  Cc: linux-wireless, John W. Linville, Sam Leffler, Amitkumar Karwar

SGkgSm9oYW5uZXMsDQoNCj4gPiA+ID4gLVRPUExFVkVMKHNjYW4sICJbLXVdIFtmcmVxIDxmcmVx
PipdIFtpZXMgPGhleCBhcyAwMDoxMTouLj5dIFtzc2lkIDxzc2lkPip8cGFzc2l2ZV0iLCAwLCAw
LA0KPiA+ID4gPiArVE9QTEVWRUwoc2NhbiwgIlstdV0gW2ZyZXEgPGZyZXE+Kl0gW2llcyA8aGV4
IGFzIDAwOjExOi4uPl0gW3NzaWQNCj4gPHNzaWQ+KnxwYXNzaXZlfGxvd3ByaXxmbHVzaF0iLA0K
PiA+ID4gMCwgMCwNCj4gPiA+DQo+ID4gPiBUaGlzIHNlZW1zIGEgbGl0dGxlIHdyb25nLCB5b3Ug
Y2FuJ3QgZ2l2ZSBsb3dwcmkvZmx1c2ggYWZ0ZXIgZ2l2aW5nDQo+ID4gPiBTU0lEcywgc28gaXQg
c2hvdWxkIHByb2JhYmx5IGJlIHdyaXR0ZW4gYXMNCj4gPg0KPiA+IEkgdGhpbmsgd2UgYXJlIGFk
ZGluZyBsb3dwcmkvZmx1c2ggc3VwcG9ydCBhcyBzaW1pbGFyIHRvICdwYXNzaXZlJyBmbGFnLg0K
PiANCj4gYnV0ICJwYXNzaXZlIiBpcyBtdXR1YWxseSBleGNsdXNpdmUgd2l0aCAic3NpZCIsIHdo
aWxlIHRoZSBmbGFncyBhcmVuJ3QuDQoNCk9LLCB0aGFua3MgZm9yIHRoZSBjbGFyaWZpY2F0aW9u
LiBXZSB3aWxsIHVwZGF0ZSB0aGUgcGF0Y2ggYXMgeW91IGNvbW1lbnRlZC4NCg0KVGhhbmtzLA0K
QmluZw0KDQo=

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-10-16 20:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-16  0:22 [PATCH] iw: add lowpri and flush scan operands Bing Zhao
2012-10-16 18:41 ` Johannes Berg
2012-10-16 19:43   ` Bing Zhao
2012-10-16 19:49     ` Johannes Berg
2012-10-16 20:01       ` Bing Zhao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.