aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ti/wl1251/cmd.c
diff options
context:
space:
mode:
authorDavid Gnedt <david.gnedt@davizone.at>2014-01-07 13:04:53 +0100
committerJohn W. Linville <linville@tuxdriver.com>2014-01-09 10:53:38 -0500
commit64322e28d3f91a196c0e86de2790cdd338a74c28 (patch)
tree5f4224b3ca1c51b67781f3198f8abbe57f54cde0 /drivers/net/wireless/ti/wl1251/cmd.c
parentMerge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next (diff)
downloadlinux-dev-64322e28d3f91a196c0e86de2790cdd338a74c28.tar.xz
linux-dev-64322e28d3f91a196c0e86de2790cdd338a74c28.zip
wl1251: fix scan behaviour while not associated
With a dissasociated 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> Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ti/wl1251/cmd.c')
-rw-r--r--drivers/net/wireless/ti/wl1251/cmd.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/net/wireless/ti/wl1251/cmd.c b/drivers/net/wireless/ti/wl1251/cmd.c
index 6822b845efc1..40f8d3e52a35 100644
--- a/drivers/net/wireless/ti/wl1251/cmd.c
+++ b/drivers/net/wireless/ti/wl1251/cmd.c
@@ -3,6 +3,7 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/crc7.h>
+#include <linux/etherdevice.h>
#include "wl1251.h"
#include "reg.h"
@@ -410,7 +411,9 @@ 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", n_channels);
+
+ WARN_ON(n_channels > SCAN_MAX_NUM_OF_CHANNELS);
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (!cmd)
@@ -421,6 +424,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 */