From patchwork Fri Feb 24 16:32:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 9590763 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 592B26020A for ; Fri, 24 Feb 2017 16:33:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C81520265 for ; Fri, 24 Feb 2017 16:33:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 210BC28752; Fri, 24 Feb 2017 16:33:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C1A020265 for ; Fri, 24 Feb 2017 16:33:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751338AbdBXQdT (ORCPT ); Fri, 24 Feb 2017 11:33:19 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:35454 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751314AbdBXQdR (ORCPT ); Fri, 24 Feb 2017 11:33:17 -0500 Received: by mail-lf0-f66.google.com with SMTP id z127so1814705lfa.2 for ; Fri, 24 Feb 2017 08:33:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Rnl4gOcpiqnD4N+v+PGXdFTrDf5xCLyNLeyU0RWxT7E=; b=ehdxVZqvRgDFQqyDttRanXa+0ww3J3FQSWaG4/hzCMJ5vRzw95xhDLYTDllmwLj1lf sxX6Vp25ufIoZA6NprCLQsZMB3xrGhjUpGQ/QQty+3nLZeWhds4LYwuUGTX0VmwjEmOw 90fNv+wwguTOWZf+w3GqQPx4kEHQsP0WPH4ps8kGOF0WVFPLzj5dfnGf7WIgyTdCks7c 5V72SSiv0FAVgpWnxoNZUg6qVUQDBORgHk+5VdkO8q6y95idCnkA/s6LWIzqc8nuaUIJ lI7RLWRFATf2RrVvEqiFXHIfz7vPkZ5HcTs27MoAqtFMAaV7sDCmPUkEKRJwZo455lWi XuZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Rnl4gOcpiqnD4N+v+PGXdFTrDf5xCLyNLeyU0RWxT7E=; b=Yvao3hjXmvmWObcUpalsqb761GKQNiw4DMA4okTVonxz2cFae5FNzGlWGDsOvivwNF jDvHfi2L8TCY6cswYsJeUeSIiCOZC8L93aGnjiB/04sknWzDJdvCvoklvcSrjcYnqseR YLXI8Jl0muhfdMw9DZtufWXyQDZED93mkPqCfcfFNU5V5YuPoDyIaFVTJqN5+h9zFv1D PCigSsQgHwD6EyU2UnG6HpcFNEpA8uiYce2hoW6RnCT9++7uADfvvRAioXBeZVuhh5xH H8SxzIIK8UemWJJwTuJkE9lwuRZDeClJw4YXms1BNELfjAh5qx9btvBj4W2sGgAouICz pZfw== X-Gm-Message-State: AMke39kYr3GSJM0ho574VXn67g9oLN9PaiWpWLf/zUZPjQux30HOlUbWz9IJW/wdBsNrOg== X-Received: by 10.25.130.147 with SMTP id e141mr1167069lfd.44.1487953994942; Fri, 24 Feb 2017 08:33:14 -0800 (PST) Received: from linux-samsung.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id m18sm2093882lfe.45.2017.02.24.08.33.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2017 08:33:13 -0800 (PST) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Kalle Valo Cc: Arend van Spriel , Franky Lin , Hante Meuleman , Pieter-Paul Giesberts , Franky Lin , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH] brcmfmac: always print error when PSM's watchdog fires Date: Fri, 24 Feb 2017 17:32:46 +0100 Message-Id: <20170224163246.7748-1-zajec5@gmail.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rafał Miłecki So far we were attaching BRCMF_E_PSM_WATCHDOG event listener in brcmf_debug_attach which gets compiled only with CONFIG_BRCMDBG. This event means something went wrong and firmware / hardware usually can't be expected to work (reliably). Such a problem is significant for user experience so I believe we should print an error unconditionally (even with debugging disabled). What can be indeed optional is dumping bus memory as this is clearly part of debugging process. In the future we may also try to extend this listener by trying to recover from the error or at least signal it to the cfg80211. Signed-off-by: Rafał Miłecki --- .../wireless/broadcom/brcm80211/brcmfmac/core.c | 22 ++++++++++++++++++ .../wireless/broadcom/brcm80211/brcmfmac/debug.c | 26 +++------------------- .../wireless/broadcom/brcm80211/brcmfmac/debug.h | 9 ++++++++ 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index 60da86a8d95b..2f2f3a5ad86a 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -738,6 +738,24 @@ void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked) brcmf_del_if(ifp->drvr, ifp->bsscfgidx, rtnl_locked); } +static int brcmf_psm_watchdog_notify(struct brcmf_if *ifp, + const struct brcmf_event_msg *evtmsg, + void *data) +{ + int err; + + brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx); + + brcmf_err("PSM's watchdog has fired!\n"); + + err = brcmf_debug_create_memdump(ifp->drvr->bus_if, data, + evtmsg->datalen); + if (err) + brcmf_err("Failed to get memory dump, %d\n", err); + + return err; +} + #ifdef CONFIG_INET #define ARPOL_MAX_ENTRIES 8 static int brcmf_inetaddr_changed(struct notifier_block *nb, @@ -917,6 +935,10 @@ int brcmf_attach(struct device *dev, struct brcmf_mp_device *settings) goto fail; } + /* Attach to events important for core code */ + brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG, + brcmf_psm_watchdog_notify); + /* attach firmware event handler */ brcmf_fweh_attach(drvr); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c index f4644cf371c7..1447a8352383 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.c @@ -27,8 +27,8 @@ static struct dentry *root_folder; -static int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, - size_t len) +int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, + size_t len) { void *dump; size_t ramsize; @@ -54,24 +54,6 @@ static int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, return 0; } -static int brcmf_debug_psm_watchdog_notify(struct brcmf_if *ifp, - const struct brcmf_event_msg *evtmsg, - void *data) -{ - int err; - - brcmf_dbg(TRACE, "enter: bsscfgidx=%d\n", ifp->bsscfgidx); - - brcmf_err("PSM's watchdog has fired!\n"); - - err = brcmf_debug_create_memdump(ifp->drvr->bus_if, data, - evtmsg->datalen); - if (err) - brcmf_err("Failed to get memory dump, %d\n", err); - - return err; -} - void brcmf_debugfs_init(void) { root_folder = debugfs_create_dir(KBUILD_MODNAME, NULL); @@ -99,9 +81,7 @@ int brcmf_debug_attach(struct brcmf_pub *drvr) if (IS_ERR(drvr->dbgfs_dir)) return PTR_ERR(drvr->dbgfs_dir); - - return brcmf_fweh_register(drvr, BRCMF_E_PSM_WATCHDOG, - brcmf_debug_psm_watchdog_notify); + return 0; } void brcmf_debug_detach(struct brcmf_pub *drvr) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h index 066126123e96..389166abb520 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/debug.h @@ -99,6 +99,7 @@ do { \ extern int brcmf_msg_level; +struct brcmf_bus; struct brcmf_pub; #ifdef DEBUG void brcmf_debugfs_init(void); @@ -108,6 +109,8 @@ void brcmf_debug_detach(struct brcmf_pub *drvr); struct dentry *brcmf_debugfs_get_devdir(struct brcmf_pub *drvr); int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, int (*read_fn)(struct seq_file *seq, void *data)); +int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, + size_t len); #else static inline void brcmf_debugfs_init(void) { @@ -128,6 +131,12 @@ int brcmf_debugfs_add_entry(struct brcmf_pub *drvr, const char *fn, { return 0; } +static inline +int brcmf_debug_create_memdump(struct brcmf_bus *bus, const void *data, + size_t len) +{ + return 0; +} #endif #endif /* BRCMFMAC_DEBUG_H */