linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] wl12xx: add support for SSID matching in sched_scan
@ 2011-09-02 11:28 Luciano Coelho
  2011-09-02 11:28 ` [PATCH 1/3] wl12xx: add support for sched_scan filters Luciano Coelho
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Luciano Coelho @ 2011-09-02 11:28 UTC (permalink / raw)
  To: coelho; +Cc: linux-wireless

Hi,

This patchset adds support for SSID matching (ie. filtering) on
scheduled scans.  I have also increased the number of supported SSIDs,
because recent versions of the firmware support 16 SSIDs at once.

Due to the increased number of SSIDs supported, I also had to increase
the dwell times for the scheduled scan.  I used large arbitrary values
that work fine for now, but they should probably be fine-tuned later.

This patchset depends on "nl80211/cfg80211: add match filtering for
sched_scan".

Please review.

Cheers,
Luca.


Luciano Coelho (3):
  wl12xx: add support for sched_scan filters
  wl12xx: increase number of allowed SSIDs in sched_scan
  wl12xx: ignore sched scan match sets without SSID

 drivers/net/wireless/wl12xx/main.c |    7 +-
 drivers/net/wireless/wl12xx/scan.c |  116 +++++++++++++++++++++++++-----------
 2 files changed, 85 insertions(+), 38 deletions(-)


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

* [PATCH 1/3] wl12xx: add support for sched_scan filters
  2011-09-02 11:28 [PATCH 0/3] wl12xx: add support for SSID matching in sched_scan Luciano Coelho
@ 2011-09-02 11:28 ` Luciano Coelho
  2011-09-02 11:28 ` [PATCH 2/3] wl12xx: increase number of allowed SSIDs in sched_scan Luciano Coelho
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Luciano Coelho @ 2011-09-02 11:28 UTC (permalink / raw)
  To: coelho; +Cc: linux-wireless

Implement support for filtering in scheduled scans.

With this commit we now use the match sets passed by cfg80211 to
filter on SSIDs.  Due to the nature of the wl12xx firmware API, we
don't allow SSIDs to be sent in the probe requests if they are not
going to match any of the filters.

Signed-off-by: Luciano Coelho <coelho@ti.com>
---
 drivers/net/wireless/wl12xx/scan.c |  107 ++++++++++++++++++++++++------------
 1 files changed, 72 insertions(+), 35 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c
index af4ad23..793f143 100644
--- a/drivers/net/wireless/wl12xx/scan.c
+++ b/drivers/net/wireless/wl12xx/scan.c
@@ -473,34 +473,77 @@ wl1271_scan_sched_scan_channels(struct wl1271 *wl,
 		cfg->passive[2] || cfg->active[2];
 }
 
-/* Returns 0 if no wildcard is used, 1 if wildcard is used or a
- * negative value on error */
+/* Returns the scan type to be used or a negative value on error */
 static int
 wl12xx_scan_sched_scan_ssid_list(struct wl1271 *wl,
 				 struct cfg80211_sched_scan_request *req)
 {
 	struct wl1271_cmd_sched_scan_ssid_list *cmd = NULL;
-	struct cfg80211_ssid *ssid = req->ssids;
-	int ret, wildcard = 0;
+	struct cfg80211_match_set *sets = req->match_sets;
+	struct cfg80211_ssid *ssids = req->ssids;
+	int ret = 0, type, i, j;
 
 	wl1271_debug(DEBUG_CMD, "cmd sched scan ssid list");
 
+	/* No filter, no ssids or only bcast ssid */
+	if (!req->n_match_sets &&
+	    (!req->n_ssids ||
+	     (req->n_ssids == 1 && req->ssids[0].ssid_len == 0))) {
+		type = SCAN_SSID_FILTER_ANY;
+		goto out;
+	}
+
 	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
-	if (!cmd)
-		return -ENOMEM;
+	if (!cmd) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	if (!req->n_match_sets) {
+		/* No filter, with ssids */
+		type = SCAN_SSID_FILTER_DISABLED;
+
+		for (i = 0; i < req->n_ssids; i++) {
+			cmd->ssids[cmd->n_ssids].type = (ssids[i].ssid_len)?
+				SCAN_SSID_TYPE_HIDDEN : SCAN_SSID_TYPE_PUBLIC;
+			cmd->ssids[cmd->n_ssids].len = ssids[i].ssid_len;
+			memcpy(cmd->ssids[cmd->n_ssids].ssid, ssids[i].ssid,
+			       ssids[i].ssid_len);
+			cmd->n_ssids++;
+		}
+	} else {
+		type = SCAN_SSID_FILTER_LIST;
 
-	while ((cmd->n_ssids < req->n_ssids) && ssid) {
-		if (ssid->ssid_len == 0) {
-			wildcard = 1;
+		/* Add all SSIDs from the filters */
+		for (i = 0; i < req->n_match_sets; i++) {
 			cmd->ssids[cmd->n_ssids].type = SCAN_SSID_TYPE_PUBLIC;
-		} else {
-			cmd->ssids[cmd->n_ssids].type = SCAN_SSID_TYPE_HIDDEN;
+			cmd->ssids[cmd->n_ssids].len = sets[i].ssid.ssid_len;
+			memcpy(cmd->ssids[cmd->n_ssids].ssid,
+			       sets[i].ssid.ssid, sets[i].ssid.ssid_len);
+			cmd->n_ssids++;
+		}
+		if ((req->n_ssids > 1) ||
+		    (req->n_ssids == 1 && req->ssids[0].ssid_len > 0)) {
+			/*
+			 * Mark all the SSIDs passed in the SSID list as HIDDEN,
+			 * so they're used in probe requests.
+			 */
+			for (i = 0; i < req->n_ssids; i++) {
+				for (j = 0; j < cmd->n_ssids; j++)
+					if (!memcmp(req->ssids[i].ssid,
+						   cmd->ssids[j].ssid,
+						   req->ssids[i].ssid_len)) {
+						cmd->ssids[j].type =
+							SCAN_SSID_TYPE_HIDDEN;
+						break;
+					}
+				/* Fail if SSID isn't present in the filters */
+				if (j == req->n_ssids) {
+					ret = -EINVAL;
+					goto out_free;
+				}
+			}
 		}
-		cmd->ssids[cmd->n_ssids].len = ssid->ssid_len;
-		memcpy(cmd->ssids[cmd->n_ssids].ssid, ssid->ssid,
-		       ssid->ssid_len);
-		ssid++;
-		cmd->n_ssids++;
 	}
 
 	wl1271_dump(DEBUG_SCAN, "SSID_LIST: ", cmd, sizeof(*cmd));
@@ -509,13 +552,15 @@ wl12xx_scan_sched_scan_ssid_list(struct wl1271 *wl,
 			      sizeof(*cmd), 0);
 	if (ret < 0) {
 		wl1271_error("cmd sched scan ssid list failed");
-		goto out;
+		goto out_free;
 	}
 
-	ret = wildcard;
-out:
+out_free:
 	kfree(cmd);
-	return ret;
+out:
+	if (ret < 0)
+		return ret;
+	return type;
 }
 
 int wl1271_scan_sched_scan_config(struct wl1271 *wl,
@@ -550,21 +595,13 @@ int wl1271_scan_sched_scan_config(struct wl1271 *wl,
 		cfg->intervals[i] = cpu_to_le32(req->interval);
 
 	cfg->ssid_len = 0;
-	if (req->n_ssids == 0) {
-		wl1271_debug(DEBUG_SCAN, "using SCAN_SSID_FILTER_ANY");
-		cfg->filter_type = SCAN_SSID_FILTER_ANY;
-	} else {
-		ret = wl12xx_scan_sched_scan_ssid_list(wl, req);
-		if (ret < 0)
-			goto out;
-		if (ret) {
-			wl1271_debug(DEBUG_SCAN, "using SCAN_SSID_FILTER_DISABLED");
-			cfg->filter_type = SCAN_SSID_FILTER_DISABLED;
-		} else {
-			wl1271_debug(DEBUG_SCAN, "using SCAN_SSID_FILTER_LIST");
-			cfg->filter_type = SCAN_SSID_FILTER_LIST;
-		}
-	}
+	ret = wl12xx_scan_sched_scan_ssid_list(wl, req);
+	if (ret < 0)
+		goto out;
+
+	cfg->filter_type = ret;
+
+	wl1271_debug(DEBUG_SCAN, "filter_type = %d", cfg->filter_type);
 
 	if (!wl1271_scan_sched_scan_channels(wl, req, cfg)) {
 		wl1271_error("scan channel list is empty");
-- 
1.7.1


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

* [PATCH 2/3] wl12xx: increase number of allowed SSIDs in sched_scan
  2011-09-02 11:28 [PATCH 0/3] wl12xx: add support for SSID matching in sched_scan Luciano Coelho
  2011-09-02 11:28 ` [PATCH 1/3] wl12xx: add support for sched_scan filters Luciano Coelho
@ 2011-09-02 11:28 ` Luciano Coelho
  2011-09-02 11:28 ` [PATCH 3/3] wl12xx: ignore sched scan match sets without SSID Luciano Coelho
  2011-09-14  9:25 ` [PATCH 0/3] wl12xx: add support for SSID matching in sched_scan Luciano Coelho
  3 siblings, 0 replies; 5+ messages in thread
From: Luciano Coelho @ 2011-09-02 11:28 UTC (permalink / raw)
  To: coelho; +Cc: linux-wireless

The latest firmware supports up to 16 SSIDs in the scheduled scan
lists.  Increase the number we report to cfg80211 and increase the
min/max dwell time to 30 and 60 TUs respectively, because otherwise we
don't have the time to send the probes for all SSIDs.

Signed-off-by: Luciano Coelho <coelho@ti.com>
---
 drivers/net/wireless/wl12xx/main.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index bde8402..49da03d 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -267,8 +267,8 @@ static struct conf_drv_settings default_conf = {
 	},
 	.sched_scan = {
 		/* sched_scan requires dwell times in TU instead of TU/1000 */
-		.min_dwell_time_active = 8,
-		.max_dwell_time_active = 30,
+		.min_dwell_time_active = 30,
+		.max_dwell_time_active = 60,
 		.dwell_time_passive    = 100,
 		.dwell_time_dfs        = 150,
 		.num_probe_reqs        = 2,
@@ -4491,7 +4491,8 @@ int wl1271_init_ieee80211(struct wl1271 *wl)
 	wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
 		BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP);
 	wl->hw->wiphy->max_scan_ssids = 1;
-	wl->hw->wiphy->max_sched_scan_ssids = 8;
+	wl->hw->wiphy->max_sched_scan_ssids = 16;
+	wl->hw->wiphy->max_match_sets = 16;
 	/*
 	 * Maximum length of elements in scanning probe request templates
 	 * should be the maximum length possible for a template, without
-- 
1.7.1


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

* [PATCH 3/3] wl12xx: ignore sched scan match sets without SSID
  2011-09-02 11:28 [PATCH 0/3] wl12xx: add support for SSID matching in sched_scan Luciano Coelho
  2011-09-02 11:28 ` [PATCH 1/3] wl12xx: add support for sched_scan filters Luciano Coelho
  2011-09-02 11:28 ` [PATCH 2/3] wl12xx: increase number of allowed SSIDs in sched_scan Luciano Coelho
@ 2011-09-02 11:28 ` Luciano Coelho
  2011-09-14  9:25 ` [PATCH 0/3] wl12xx: add support for SSID matching in sched_scan Luciano Coelho
  3 siblings, 0 replies; 5+ messages in thread
From: Luciano Coelho @ 2011-09-02 11:28 UTC (permalink / raw)
  To: coelho; +Cc: linux-wireless

For now, cfg80211 only support match sets with SSIDs, but in the
future more parameters will be added.  This patch ignores eventual
matches that do not contain SSIDs in preparation for the future.  This
change also affects the case where broadcast SSIDs are used.  Matching
a broadcast SSID will match everything, so they can be ignored.

Signed-off-by: Luciano Coelho <coelho@ti.com>
---
 drivers/net/wireless/wl12xx/scan.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c
index 793f143..e167651 100644
--- a/drivers/net/wireless/wl12xx/scan.c
+++ b/drivers/net/wireless/wl12xx/scan.c
@@ -481,12 +481,17 @@ wl12xx_scan_sched_scan_ssid_list(struct wl1271 *wl,
 	struct wl1271_cmd_sched_scan_ssid_list *cmd = NULL;
 	struct cfg80211_match_set *sets = req->match_sets;
 	struct cfg80211_ssid *ssids = req->ssids;
-	int ret = 0, type, i, j;
+	int ret = 0, type, i, j, n_match_ssids = 0;
 
 	wl1271_debug(DEBUG_CMD, "cmd sched scan ssid list");
 
+	/* count the match sets that contain SSIDs */
+	for (i = 0; i < req->n_match_sets; i++)
+		if (sets[i].ssid.ssid_len > 0)
+			n_match_ssids++;
+
 	/* No filter, no ssids or only bcast ssid */
-	if (!req->n_match_sets &&
+	if (!n_match_ssids &&
 	    (!req->n_ssids ||
 	     (req->n_ssids == 1 && req->ssids[0].ssid_len == 0))) {
 		type = SCAN_SSID_FILTER_ANY;
@@ -499,7 +504,7 @@ wl12xx_scan_sched_scan_ssid_list(struct wl1271 *wl,
 		goto out;
 	}
 
-	if (!req->n_match_sets) {
+	if (!n_match_ssids) {
 		/* No filter, with ssids */
 		type = SCAN_SSID_FILTER_DISABLED;
 
@@ -516,6 +521,10 @@ wl12xx_scan_sched_scan_ssid_list(struct wl1271 *wl,
 
 		/* Add all SSIDs from the filters */
 		for (i = 0; i < req->n_match_sets; i++) {
+			/* ignore sets without SSIDs */
+			if (!sets[i].ssid.ssid_len)
+				continue;
+
 			cmd->ssids[cmd->n_ssids].type = SCAN_SSID_TYPE_PUBLIC;
 			cmd->ssids[cmd->n_ssids].len = sets[i].ssid.ssid_len;
 			memcpy(cmd->ssids[cmd->n_ssids].ssid,
-- 
1.7.1


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

* Re: [PATCH 0/3] wl12xx: add support for SSID matching in sched_scan
  2011-09-02 11:28 [PATCH 0/3] wl12xx: add support for SSID matching in sched_scan Luciano Coelho
                   ` (2 preceding siblings ...)
  2011-09-02 11:28 ` [PATCH 3/3] wl12xx: ignore sched scan match sets without SSID Luciano Coelho
@ 2011-09-14  9:25 ` Luciano Coelho
  3 siblings, 0 replies; 5+ messages in thread
From: Luciano Coelho @ 2011-09-14  9:25 UTC (permalink / raw)
  To: linux-wireless

On Fri, 2011-09-02 at 14:28 +0300, Luciano Coelho wrote: 
> Hi,
> 
> This patchset adds support for SSID matching (ie. filtering) on
> scheduled scans.  I have also increased the number of supported SSIDs,
> because recent versions of the firmware support 16 SSIDs at once.
> 
> Due to the increased number of SSIDs supported, I also had to increase
> the dwell times for the scheduled scan.  I used large arbitrary values
> that work fine for now, but they should probably be fine-tuned later.
> 
> This patchset depends on "nl80211/cfg80211: add match filtering for
> sched_scan".
> 
> Please review.
> 
> Cheers,
> Luca.
> 
> 
> Luciano Coelho (3):
>   wl12xx: add support for sched_scan filters
>   wl12xx: increase number of allowed SSIDs in sched_scan
>   wl12xx: ignore sched scan match sets without SSID
> 
>  drivers/net/wireless/wl12xx/main.c |    7 +-
>  drivers/net/wireless/wl12xx/scan.c |  116 +++++++++++++++++++++++++-----------
>  2 files changed, 85 insertions(+), 38 deletions(-)

Applied the series, thank me. :)

-- 
Cheers,
Luca.


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

end of thread, other threads:[~2011-09-14  9:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-02 11:28 [PATCH 0/3] wl12xx: add support for SSID matching in sched_scan Luciano Coelho
2011-09-02 11:28 ` [PATCH 1/3] wl12xx: add support for sched_scan filters Luciano Coelho
2011-09-02 11:28 ` [PATCH 2/3] wl12xx: increase number of allowed SSIDs in sched_scan Luciano Coelho
2011-09-02 11:28 ` [PATCH 3/3] wl12xx: ignore sched scan match sets without SSID Luciano Coelho
2011-09-14  9:25 ` [PATCH 0/3] wl12xx: add support for SSID matching in sched_scan Luciano Coelho

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).