From patchwork Mon Jun 16 05:49:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Zhonghui" X-Patchwork-Id: 4356531 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 7B2AF9F1C4 for ; Mon, 16 Jun 2014 05:49:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9EBE42026C for ; Mon, 16 Jun 2014 05:49:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A8B2F2025A for ; Mon, 16 Jun 2014 05:49:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753821AbaFPFtc (ORCPT ); Mon, 16 Jun 2014 01:49:32 -0400 Received: from mga01.intel.com ([192.55.52.88]:50084 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753659AbaFPFta (ORCPT ); Mon, 16 Jun 2014 01:49:30 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 15 Jun 2014 22:49:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,484,1400050800"; d="scan'208,223";a="548460948" Received: from zhonghui-mobl.ccr.corp.intel.com (HELO [10.238.157.51]) ([10.238.157.51]) by fmsmga001.fm.intel.com with ESMTP; 15 Jun 2014 22:49:13 -0700 Message-ID: <539E8559.3010601@linux.intel.com> Date: Mon, 16 Jun 2014 13:49:13 +0800 From: "Fu, Zhonghui" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: brudley@broadcom.com, arend@broadcom.com, frankyl@broadcom.com, meuleman@broadcom.com, linville@tuxdriver.com, pieterpg@broadcom.com, dekim@broadcom.com, mcgrof@do-not-panic.com, antonio@open-mesh.com, johannes.berg@intel.com CC: linux-wireless@vger.kernel.org, brcm80211-dev-list@broadcom.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] brcmfmac: prevent watchdog from interfering with scanning and connecting Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 From 14485894add32aedacb3e486ebb2cc2b73861abf Mon Sep 17 00:00:00 2001 From: Fu zhonghui Date: Wed, 11 Jun 2014 11:06:55 +0800 Subject: [PATCH] brcmfmac: prevent watchdog from interfering with scanning and connecting Watchdog in brcmfmac driver may make WiFi chip enter sleep mode before completion of scanning or connecting. This will lead to scanning or connecting failure. Increasing temporarily idle-time threshold during scanning or connecting can ensure scanning or connecting success without watchdog interference. Signed-off-by: Fu zhonghui --- drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c | 18 ++++++++++++++++-- .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 3 ++- 2 files changed, 18 insertions(+), 3 deletions(-) -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c index 13c89a0..729deab 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -43,6 +44,10 @@ #include "sdio_host.h" #include "chip.h" #include "nvram.h" +#include "dhd.h" +#include "fwil_types.h" +#include "p2p.h" +#include "wl_cfg80211.h" #define DCMD_RESP_TIMEOUT 2000 /* In milli second */ @@ -307,6 +312,7 @@ struct rte_console { * when idle */ #define BRCMF_IDLE_INTERVAL 1 +#define BRCMF_IDLE_INTERVAL_SCANNING_CONNECTING 100 #define KSO_WAIT_US 50 #define MAX_KSO_ATTEMPTS (PMU_MAX_TRANSITION_DLY/KSO_WAIT_US) @@ -3613,9 +3619,9 @@ void brcmf_sdio_isr(struct brcmf_sdio *bus) static bool brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus) { -#ifdef DEBUG struct brcmf_bus *bus_if = dev_get_drvdata(bus->sdiodev->dev); -#endif /* DEBUG */ + struct brcmf_cfg80211_info *cfg = bus_if->drvr->config; + struct brcmf_if *ifp = cfg->pub->iflist[0]; brcmf_dbg(TIMER, "Enter\n"); @@ -3678,6 +3684,14 @@ static bool brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus) /* On idle timeout clear activity flag and/or turn off clock */ if ((bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) { + + if (test_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status) || + test_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state)) { + bus->idletime = BRCMF_IDLE_INTERVAL_SCANNING_CONNECTING; + } else { + bus->idletime = BRCMF_IDLE_INTERVAL; + } + if (++bus->idlecount >= bus->idletime) { bus->idlecount = 0; if (bus->activity) { diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index be19852..e76517e 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c @@ -913,6 +913,8 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct brcmf_cfg80211_vif *vif, return -EAGAIN; } + set_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); + /* If scan req comes for p2p0, send it over primary I/F */ if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE].vif) vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif; @@ -933,7 +935,6 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct brcmf_cfg80211_vif *vif, } cfg->scan_request = request; - set_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status); if (escan_req) { cfg->escan_info.run = brcmf_run_escan; err = brcmf_p2p_scan_prep(wiphy, request, vif);