All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 03/18] wl1251: fix scan behaviour while not associated
       [not found] <4D45A598.20709@davizone.at>
@ 2011-01-30 19:10 ` David Gnedt
  2011-02-01 21:24   ` Kalle Valo
  2011-02-02 22:17   ` Grazvydas Ignotas
  0 siblings, 2 replies; 4+ messages in thread
From: David Gnedt @ 2011-01-30 19:10 UTC (permalink / raw)
  To: John W. Linville
  Cc: linux-wireless, Kalle Valo, Grazvydas Ignotas,
	Denis 'GNUtoo' Carikli

With a dissacociated card I often encoutered very long scan delays.

My guess is that it has something to do with the cards DTIM handling and
another firmware bug mentioned in the TI WLAN driver, which is described as
the card may never end scanning if the channel is overloaded because it
can't send probe requests. I think the firmware somehow also tries to
receive DTIM messages when the BSSID is not set. Therefore most of the time
it waits for DTIM messages and can't do scanning work.

Anyway we can workaround this misbehaviour by setting the HIGH_PRIORITY
bit for scans in disassociated state.

Signed-off-by: David Gnedt <david.gnedt@davizone.at>
---
Sorry for the partly broken patches, I thought I configured my client the
right way. I tried to stop the mails at my mailserver, but it was mostly
already too late.
---
 drivers/net/wireless/wl1251/cmd.c  |   12 +++++++++++-
 drivers/net/wireless/wl1251/cmd.h  |    5 +++++
 drivers/net/wireless/wl1251/main.c |    1 +
 3 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/wl1251/cmd.c b/drivers/net/wireless/wl1251/cmd.c
index 0ade4bd..4e4987d 100644
--- a/drivers/net/wireless/wl1251/cmd.c
+++ b/drivers/net/wireless/wl1251/cmd.c
@@ -419,7 +419,10 @@ int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len,
 	struct wl1251_cmd_scan *cmd;
 	int i, ret = 0;
 
-	wl1251_debug(DEBUG_CMD, "cmd scan");
+	wl1251_debug(DEBUG_CMD, "cmd scan channels %d ssid(%d) '%s'",
+		     n_channels, ssid_len, ssid);
+
+	WARN_ON(n_channels > SCAN_MAX_NUM_OF_CHANNELS);
 
 	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
 	if (!cmd)
@@ -430,6 +433,13 @@ int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len,
 						    CFG_RX_MGMT_EN |
 						    CFG_RX_BCN_EN);
 	cmd->params.scan_options = 0;
+	/*
+	 * Use high priority scan when not associated to prevent fw issue
+	 * causing never-ending scans (sometimes 20+ minutes).
+	 * Note: This bug may be caused by the fw's DTIM handling.
+	 */
+	if (is_zero_ether_addr(wl->bssid))
+		cmd->params.scan_options |= WL1251_SCAN_OPT_PRIORITY_HIGH;
 	cmd->params.num_channels = n_channels;
 	cmd->params.num_probe_requests = n_probes;
 	cmd->params.tx_rate = cpu_to_le16(1 << 1); /* 2 Mbps */
diff --git a/drivers/net/wireless/wl1251/cmd.h b/drivers/net/wireless/wl1251/cmd.h
index e5c74c6..c4ed9cd 100644
--- a/drivers/net/wireless/wl1251/cmd.h
+++ b/drivers/net/wireless/wl1251/cmd.h
@@ -167,6 +167,11 @@ struct cmd_read_write_memory {
 #define CMDMBOX_HEADER_LEN 4
 #define CMDMBOX_INFO_ELEM_HEADER_LEN 4
 
+#define WL1251_SCAN_OPT_PASSIVE		1
+#define WL1251_SCAN_OPT_5GHZ_BAND	2
+#define WL1251_SCAN_OPT_TRIGGERD_SCAN	4
+#define WL1251_SCAN_OPT_PRIORITY_HIGH	8
+
 #define WL1251_SCAN_MIN_DURATION 30000
 #define WL1251_SCAN_MAX_DURATION 60000
 
diff --git a/drivers/net/wireless/wl1251/main.c b/drivers/net/wireless/wl1251/main.c
index 012e1a4..2c95b90 100644
--- a/drivers/net/wireless/wl1251/main.c
+++ b/drivers/net/wireless/wl1251/main.c
@@ -906,6 +906,7 @@ static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
 	ret = wl1251_cmd_scan(wl, ssid, ssid_len, req->channels,
 			      req->n_channels, WL1251_SCAN_NUM_PROBES);
 	if (ret < 0) {
+		wl1251_debug(DEBUG_SCAN, "scan failed %d", ret);
 		wl->scanning = false;
 		goto out_sleep;
 	}
-- 
1.7.0.4



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

* Re: [PATCH 03/18] wl1251: fix scan behaviour while not associated
  2011-01-30 19:10 ` [PATCH 03/18] wl1251: fix scan behaviour while not associated David Gnedt
@ 2011-02-01 21:24   ` Kalle Valo
  2011-02-06 14:04     ` David Gnedt
  2011-02-02 22:17   ` Grazvydas Ignotas
  1 sibling, 1 reply; 4+ messages in thread
From: Kalle Valo @ 2011-02-01 21:24 UTC (permalink / raw)
  To: David Gnedt
  Cc: John W. Linville, linux-wireless, Grazvydas Ignotas,
	Denis 'GNUtoo' Carikli

David Gnedt <david.gnedt@davizone.at> writes:

> With a dissacociated card I often encoutered very long scan delays.
>
> My guess is that it has something to do with the cards DTIM handling and
> another firmware bug mentioned in the TI WLAN driver, which is described as
> the card may never end scanning if the channel is overloaded because it
> can't send probe requests. I think the firmware somehow also tries to
> receive DTIM messages when the BSSID is not set. Therefore most of the time
> it waits for DTIM messages and can't do scanning work.
>
> Anyway we can workaround this misbehaviour by setting the HIGH_PRIORITY
> bit for scans in disassociated state.

Now that's a weird problem. I wonder this wasn't reported with the
fremantle kernels. How often did you see the problem?

> --- a/drivers/net/wireless/wl1251/cmd.c
> +++ b/drivers/net/wireless/wl1251/cmd.c
> @@ -419,7 +419,10 @@ int wl1251_cmd_scan(struct wl1251 *wl, u8 *ssid, size_t ssid_len,
>  	struct wl1251_cmd_scan *cmd;
>  	int i, ret = 0;
>  
> -	wl1251_debug(DEBUG_CMD, "cmd scan");
> +	wl1251_debug(DEBUG_CMD, "cmd scan channels %d ssid(%d) '%s'",
> +		     n_channels, ssid_len, ssid);

ssid is not a valid string and hence you cannot print it with %s.

> +	/*
> +	 * Use high priority scan when not associated to prevent fw issue
> +	 * causing never-ending scans (sometimes 20+ minutes).
> +	 * Note: This bug may be caused by the fw's DTIM handling.
> +	 */
> +	if (is_zero_ether_addr(wl->bssid))
> +		cmd->params.scan_options |= WL1251_SCAN_OPT_PRIORITY_HIGH;

Can you resend the patch with just this part and the accompanying
defines, please? It's better to have debug messages improvements in a
separate patch.

-- 
Kalle Valo

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

* Re: [PATCH 03/18] wl1251: fix scan behaviour while not associated
  2011-01-30 19:10 ` [PATCH 03/18] wl1251: fix scan behaviour while not associated David Gnedt
  2011-02-01 21:24   ` Kalle Valo
@ 2011-02-02 22:17   ` Grazvydas Ignotas
  1 sibling, 0 replies; 4+ messages in thread
From: Grazvydas Ignotas @ 2011-02-02 22:17 UTC (permalink / raw)
  To: David Gnedt
  Cc: John W. Linville, linux-wireless, Kalle Valo,
	Denis 'GNUtoo' Carikli

On Sun, Jan 30, 2011 at 9:10 PM, David Gnedt <david.gnedt@davizone.at> wrote:
> With a dissacociated card I often encoutered very long scan delays.
>
> My guess is that it has something to do with the cards DTIM handling and
> another firmware bug mentioned in the TI WLAN driver, which is described as
> the card may never end scanning if the channel is overloaded because it
> can't send probe requests. I think the firmware somehow also tries to
> receive DTIM messages when the BSSID is not set. Therefore most of the time
> it waits for DTIM messages and can't do scanning work.
>
> Anyway we can workaround this misbehaviour by setting the HIGH_PRIORITY
> bit for scans in disassociated state.
>
> Signed-off-by: David Gnedt <david.gnedt@davizone.at>
> ---
> Sorry for the partly broken patches, I thought I configured my client the
> right way. I tried to stop the mails at my mailserver, but it was mostly
> already too late.
> ---
>  drivers/net/wireless/wl1251/cmd.c  |   12 +++++++++++-
>  drivers/net/wireless/wl1251/cmd.h  |    5 +++++
>  drivers/net/wireless/wl1251/main.c |    1 +
>  3 files changed, 17 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/wireless/wl1251/cmd.c b/drivers/net/wireless/wl1251/cmd.c
> index 0ade4bd..4e4987d 100644
> --- a/drivers/net/wireless/wl1251/cmd.c
> +++ b/drivers/net/wireless/wl1251/cmd.c

<snip>

> +       /*
> +        * Use high priority scan when not associated to prevent fw issue
> +        * causing never-ending scans (sometimes 20+ minutes).
> +        * Note: This bug may be caused by the fw's DTIM handling.
> +        */
> +       if (is_zero_ether_addr(wl->bssid))
> +               cmd->params.scan_options |= WL1251_SCAN_OPT_PRIORITY_HIGH;

This seems to cause a build error (missing include?):
drivers/net/wireless/wl1251/cmd.c: In function 'wl1251_cmd_scan':
drivers/net/wireless/wl1251/cmd.c:455: error: implicit declaration of
function 'is_zero_ether_addr'

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

* Re: [PATCH 03/18] wl1251: fix scan behaviour while not associated
  2011-02-01 21:24   ` Kalle Valo
@ 2011-02-06 14:04     ` David Gnedt
  0 siblings, 0 replies; 4+ messages in thread
From: David Gnedt @ 2011-02-06 14:04 UTC (permalink / raw)
  To: Kalle Valo
  Cc: John W. Linville, linux-wireless, Grazvydas Ignotas,
	Denis 'GNUtoo' Carikli

Am 2011-02-01 22:24, schrieb Kalle Valo:
> Now that's a weird problem. I wonder this wasn't reported with the
> fremantle kernels. How often did you see the problem?

My guess is that it doesn't occur with the fremantle kernel because it only
uses the JOIN command when it really wants to associate. (It only does joins on
!is_zero_ether_addr(bssid))
The wireless-testing driver uses the JOIN command more often and doesn't check
for zero BSSID.

> Can you resend the patch with just this part and the accompanying
> defines, please? It's better to have debug messages improvements in a
> separate patch.

Yes, I will do that.

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

end of thread, other threads:[~2011-02-06 14:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4D45A598.20709@davizone.at>
2011-01-30 19:10 ` [PATCH 03/18] wl1251: fix scan behaviour while not associated David Gnedt
2011-02-01 21:24   ` Kalle Valo
2011-02-06 14:04     ` David Gnedt
2011-02-02 22:17   ` Grazvydas Ignotas

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.