From patchwork Tue Dec 31 09:44:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 3421621 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8517B9F295 for ; Tue, 31 Dec 2013 09:44:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9812920115 for ; Tue, 31 Dec 2013 09:44:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 81BC7200F0 for ; Tue, 31 Dec 2013 09:44:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752468Ab3LaJoQ (ORCPT ); Tue, 31 Dec 2013 04:44:16 -0500 Received: from mail-bk0-f49.google.com ([209.85.214.49]:56880 "EHLO mail-bk0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752261Ab3LaJoO (ORCPT ); Tue, 31 Dec 2013 04:44:14 -0500 Received: by mail-bk0-f49.google.com with SMTP id my13so3920571bkb.8 for ; Tue, 31 Dec 2013 01:44:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:user-agent:cc:references:in-reply-to :mime-version:content-type:content-transfer-encoding:message-id; bh=HB1wF9AMRpPfq0vKDcPnYghpLovuz7SfkapUR5QatQo=; b=EJVSrJevL/vuORdiGre2cAz2oSwTpTq3TdWBZu+R5yye22T4tbuunNLsp8f/isE/5H /Ww3RgkHOSWmMFWkV7LCa5E3BZUzzEsA1haytDIhMsb8peSiriHmbNuTWkWTR+7ofg75 dmtb3ftXdWT+J7KfKYnQw+l1TrvqEnF0yqwNIKrLlx8+KhhXlueqCUDh/e28E22h+OA0 Kw0s6QQpNZ3DbEVcknnlvla7SJUkTcn0GNaJ4QffMkvwKOVyBuZDCFzbRLudmbBKwZnl kkGLSRcpMg9pxfpvI/oBV1qBXcn0MEOlh5rXMYREVwqNCoCB2HjdS3bFUIksBhTb8NZC yeIg== X-Received: by 10.204.253.140 with SMTP id na12mr1579660bkb.74.1388483053147; Tue, 31 Dec 2013 01:44:13 -0800 (PST) Received: from izba.localnet ([2a02:130:501:7:a10e:5ae4:7f51:e2c0]) by mx.google.com with ESMTPSA id it12sm37151190bkb.12.2013.12.31.01.44.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 31 Dec 2013 01:44:11 -0800 (PST) From: Pali =?utf-8?q?Roh=C3=A1r?= To: Pavel Machek Subject: Re: [PATCH v2 01/16] wl1251: fix scan behaviour while not associated Date: Tue, 31 Dec 2013 10:44:01 +0100 User-Agent: KMail/1.13.7 (Linux/3.11.0-15-generic; KDE/4.12.0; x86_64; ; ) Cc: Luciano Coelho , "John W. Linville" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, freemangordon@abv.bg, aaro.koskinen@iki.fi, sre@ring0.de, joni.lapilainen@gmail.com, Johannes Berg , Felipe Contreras , David Gnedt References: <1382819655-30430-1-git-send-email-pali.rohar@gmail.com> <1386494714-21070-2-git-send-email-pali.rohar@gmail.com> <20131210092114.GB22756@amd.pavel.ucw.cz> In-Reply-To: <20131210092114.GB22756@amd.pavel.ucw.cz> MIME-Version: 1.0 Message-Id: <201312311044.09284@pali> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Tuesday 10 December 2013 10:21:14 Pavel Machek wrote: > Hi! > > > diff --git a/drivers/net/wireless/ti/wl1251/cmd.c > > b/drivers/net/wireless/ti/wl1251/cmd.c index > > 6822b84..16b6479 100644 > > --- a/drivers/net/wireless/ti/wl1251/cmd.c > > +++ b/drivers/net/wireless/ti/wl1251/cmd.c > > @@ -410,7 +411,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, (int)ssid_len, ssid); > > + > > + WARN_ON(n_channels > SCAN_MAX_NUM_OF_CHANNELS); > > ssids can have \0s in them... and what is worse, they may not > be 0 terminated AFAICT. > > Potential solution is at > http://www.spinics.net/lists/linux-wireless/msg98640.html . > > Thanks, > Pavel Ok. To prevent other problems in future, I removed printing ssid and len params from debug output. I think it is not needed... Here is updated patch: From: =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH v2 01/16] wl1251: fix scan behaviour while not associated Date: Sun, 8 Dec 2013 10:24:59 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: David Gnedt 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 Signed-off-by: Pali Rohár --- drivers/net/wireless/ti/wl1251/cmd.c | 13 ++++++++++++- drivers/net/wireless/ti/wl1251/cmd.h | 5 +++++ drivers/net/wireless/ti/wl1251/main.c | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ti/wl1251/cmd.c b/drivers/net/wireless/ti/wl1251/cmd.c index 6822b84..16b6479 100644 --- a/drivers/net/wireless/ti/wl1251/cmd.c +++ b/drivers/net/wireless/ti/wl1251/cmd.c @@ -3,6 +3,7 @@ #include #include #include +#include #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 +425,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/ti/wl1251/cmd.h b/drivers/net/wireless/ti/wl1251/cmd.h index ee4f2b3..126f273 100644 --- a/drivers/net/wireless/ti/wl1251/cmd.h +++ b/drivers/net/wireless/ti/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/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c index 3291ffa..4d89ac8 100644 --- a/drivers/net/wireless/ti/wl1251/main.c +++ b/drivers/net/wireless/ti/wl1251/main.c @@ -930,6 +930,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_idle; }