From patchwork Fri Jun 22 18:43:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend van Spriel X-Patchwork-Id: 10482831 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 8AE9C60383 for ; Fri, 22 Jun 2018 18:43:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8459828695 for ; Fri, 22 Jun 2018 18:43:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 790C8286A7; Fri, 22 Jun 2018 18:43:41 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 1452A28695 for ; Fri, 22 Jun 2018 18:43:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934344AbeFVSnf (ORCPT ); Fri, 22 Jun 2018 14:43:35 -0400 Received: from rnd-relay.smtp.broadcom.com ([192.19.229.170]:35530 "EHLO rnd-relay.smtp.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934307AbeFVSnd (ORCPT ); Fri, 22 Jun 2018 14:43:33 -0400 Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.224.233]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 8922B30C053; Fri, 22 Jun 2018 11:43:32 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 8922B30C053 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1529693012; bh=7F2osApoHAbYmejHzTLNKoUFZ/j/eh6y8I67JQrk1PE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bWsfmiChigzgUA3HUjlOyyydAuldqBhsUwK20LNgVR/bwf1sGOOzpUBiTQXrAcyIo m1mgtGr7j7kCpor88f+bfRxClGgryjRb8bUkSIqIY8QXQKYfFbyaqHLRYBfQwIOGrX A5YRzoP7RNYgfEovy53MAscXDxxtmjwBYk5On4as= Received: from bld-bun-01.bun.broadcom.com (bld-bun-01.bun.broadcom.com [10.176.128.83]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 2BDF581EC4; Fri, 22 Jun 2018 11:43:32 -0700 (PDT) Received: by bld-bun-01.bun.broadcom.com (Postfix, from userid 25152) id 823CEB00074; Fri, 22 Jun 2018 20:43:27 +0200 (CEST) From: Arend van Spriel To: Kalle Valo Cc: linux-wireless@vger.kernel.org, Arend van Spriel Subject: [PATCH 6/6] brcmfmac: fallback mechanism to determine monitor mode features Date: Fri, 22 Jun 2018 20:43:24 +0200 Message-Id: <1529693004-20569-7-git-send-email-arend.vanspriel@broadcom.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1529693004-20569-1-git-send-email-arend.vanspriel@broadcom.com> References: <1529693004-20569-1-git-send-email-arend.vanspriel@broadcom.com> 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 Firmwares may not provide all monitor mode features in the "cap" iovar. For those this fallback mechanism uses "sta_monitor" iovar. If firmware is compiled with stamon, this iovar will fail with BCME_NOTUP; Otherwise it fails with BCME_UNSUPPORTED. Reviewed-by: Hante Meuleman Reviewed-by: Pieter-Paul Giesberts Reviewed-by: Franky Lin Signed-off-by: Arend van Spriel --- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 15 +++++++++++++++ .../broadcom/brcm80211/brcmfmac/fwil_types.h | 21 +++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c index f70fec6..cb57a4a 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c @@ -207,6 +207,7 @@ void brcmf_feat_attach(struct brcmf_pub *drvr) struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0); struct brcmf_pno_macaddr_le pfn_mac; struct brcmf_gscan_config gscan_cfg; + struct brcmf_stamon_sta_config stamon_cfg; u32 wowl_cap; s32 err; @@ -217,6 +218,20 @@ void brcmf_feat_attach(struct brcmf_pub *drvr) brcmf_feat_iovar_data_set(ifp, BRCMF_FEAT_GSCAN, "pfn_gscan_cfg", &gscan_cfg, sizeof(gscan_cfg)); + + if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR) || + !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RADIOTAP)) { + ifp->fwil_fwerr = true; + memset(&stamon_cfg, 0, sizeof(stamon_cfg)); + /* fails either way as firmware stack is not up yet */ + err = brcmf_fil_iovar_data_set(ifp, "sta_monitor", &stamon_cfg, + sizeof(stamon_cfg)); + if (err != BRCMF_FW_UNSUPPORTED) { + ifp->drvr->feat_flags |= BIT(BRCMF_FEAT_MONITOR); + ifp->drvr->feat_flags |= BIT(BRCMF_FEAT_RADIOTAP); + } + ifp->fwil_fwerr = false; + } brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_PNO, "pfn"); if (drvr->bus_if->wowl_supported) brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_WOWL, "wowl"); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h index 4b29070..db56c81 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h @@ -963,4 +963,25 @@ struct brcmf_gscan_config { struct brcmf_gscan_bucket_config bucket[1]; }; +/** + * struct brcmf_stamon_sta_config - configuration data for sta monitor. + * + * @cmd: subcommand for this configuration. + * @mac: mac address of STA for which @cmd is intended. + * @version: version of this configuration structure. + * @length: number of bytes following this field. + * @chanspec: channel of the STA. + * @mon_time: time for which STA's are monitored (ms). + * @offchan_time: timer for which off-channel STA's are monitored. + */ +struct brcmf_stamon_sta_config { + __le32 cmd; + u8 mac[ETH_ALEN]; + __le16 version; + __le16 length; + __le16 chanspec; + __le32 monitor_time; + __le32 offchan_time; +}; + #endif /* FWIL_TYPES_H_ */