From patchwork Tue Jun 19 15:48:08 2018 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: 10474797 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 73708601D7 for ; Tue, 19 Jun 2018 15:50:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 641EE28F21 for ; Tue, 19 Jun 2018 15:50:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55CB728F4C; Tue, 19 Jun 2018 15:50:55 +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, FREEMAIL_FROM, 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 BE94528F63 for ; Tue, 19 Jun 2018 15:50:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966587AbeFSPux (ORCPT ); Tue, 19 Jun 2018 11:50:53 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:38252 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966469AbeFSPuw (ORCPT ); Tue, 19 Jun 2018 11:50:52 -0400 Received: by mail-lf0-f67.google.com with SMTP id i83-v6so246462lfh.5 for ; Tue, 19 Jun 2018 08:50:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nZYH+bZvCS1U9zxJ3otl/Y2rNaVv3KTJXX6WL+8VWWI=; b=cSZ6tyOKsgGpBv+gPBI7o0Knz/roiXEJrxA4EC4dwnwqYrPpE8+aA6ApijmeIBpuin qLNrBbejBWZh+2SFGmdPVw5zpzOeuTqxyVUMfgxn6z5sq98IbDk/zCGsUl+/nBJnEu0+ cuiD+6MCVeMsmIi7F/T3VhEXt/UTnRG31FCIyjs27TNsAXiUtWxuEO3Xexckb20aC6YV 5DfGyMoam0pklTFUWtnrOHEtfPb3tHJi9Z2nkOUr1Ox2WJmSozbmd0JIZNDqddJ/QTnT WpbVJc+TsyoUoqRLitbyrnl7N9P1WJXTYbNQSkKbraDuKnPxRyZIzUhnRNdpKs/8bqB7 SGBw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=nZYH+bZvCS1U9zxJ3otl/Y2rNaVv3KTJXX6WL+8VWWI=; b=pbs8bsEAmieq2N7Xx07tn8rvJPXPN2HAOA089AJ6QvYCdRCzZll/KLTwMP3KW6+fIM RaQcf/gEq3Fijs3A+wSB60S4yhw9KIQX3VbgNsz/6vFk3kVAj4pQpcrwt8NQzi/ktoi6 UxBcVy3QpERjn7XWRjHpEg3VfvSKipRlNYH4hj0gcesZGuSncUIU3Q8CHixz03i4FfdK mf4nohzVUvqI3hPoIqVUm+PnzE/w08pIWCbN7P7BY82t+/9qd6CXNn7lHGsWe4xSPx67 SWgOkGl8FQhzp4/Kp7za4nnNurkIVoAimsU/IpM8JiIVk12oeFADxZ0kS5XARxF1Hkjz s8AA== X-Gm-Message-State: APt69E3PKJHeDfRf2S48MG0UYi/f3bYMrrhljDbLfrBGhyjLyMLpZFXA Cr0gpQPsirKETPF2XHSzLPk= X-Google-Smtp-Source: ADUXVKLnRYlNwA5k3SK4MZSCmT2yoZI+ygZVBLAG/jR53SX9TDZPfXh8jR3Gsa0x7JhPeTWNNEJOIQ== X-Received: by 2002:a19:7b0c:: with SMTP id w12-v6mr10254860lfc.22.1529423450575; Tue, 19 Jun 2018 08:50:50 -0700 (PDT) Received: from linux-veee.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id 66-v6sm2014lfy.53.2018.06.19.08.50.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jun 2018 08:50:49 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Kalle Valo , Arend van Spriel Cc: Franky Lin , Hante Meuleman , Chi-Hsien Lin , Wright Feng , Pieter-Paul Giesberts , Chung-Hsien Hsu , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211-dev-list@cypress.com, =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH V3 1/2] brcmfmac: detect firmware support for monitor interface Date: Tue, 19 Jun 2018 17:48:08 +0200 Message-Id: <20180619154809.25698-2-zajec5@gmail.com> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20180619154809.25698-1-zajec5@gmail.com> References: <20180619154809.25698-1-zajec5@gmail.com> 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 Most of firmwares support creating monitor interface. The newest ones explicitly /announce/ it using a "monitor" entry in the list of capabilities. Check (and store) internally info about monitor mode support using a new feature flag. Once we sort out all details of handling monitor interface it will be used when reporting available interfaces to the cfg80211. Signed-off-by: Rafał Miłecki Acked-by: Arend van Spriel --- V3: Patch added to the series --- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 26 ++++++++++++++++++++++ .../wireless/broadcom/brcm80211/brcmfmac/feature.h | 4 +++- .../wireless/broadcom/brcm80211/brcmfmac/fwil.h | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c index 800a423c7bc2..48d7978497b5 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c @@ -48,6 +48,7 @@ static const struct brcmf_feat_fwcap brcmf_fwcap_map[] = { { BRCMF_FEAT_MBSS, "mbss" }, { BRCMF_FEAT_MCHAN, "mchan" }, { BRCMF_FEAT_P2P, "p2p" }, + { BRCMF_FEAT_MONITOR, "monitor" }, }; #ifdef DEBUG @@ -91,6 +92,26 @@ static int brcmf_feat_debugfs_read(struct seq_file *seq, void *data) } #endif /* DEBUG */ +static void brcmf_feat_cmd_int_get(struct brcmf_if *ifp, enum brcmf_feat_id id, + u32 cmd) +{ + u32 data; + int err; + + ifp->fwil_fwerr = true; + + err = brcmf_fil_cmd_int_get(ifp, cmd, &data); + if (err == 0) { + brcmf_dbg(INFO, "enabling feature: %s\n", brcmf_feat_names[id]); + ifp->drvr->feat_flags |= BIT(id); + } else { + brcmf_dbg(TRACE, "%s feature check failed: %d\n", + brcmf_feat_names[id], err); + } + + ifp->fwil_fwerr = false; +} + /** * brcmf_feat_iovar_int_get() - determine feature through iovar query. * @@ -251,6 +272,11 @@ void brcmf_feat_attach(struct brcmf_pub *drvr) } brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_FWSUP, "sup_wpa"); + /* Fallback detection for older firmwares */ + if (!brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MONITOR)) + brcmf_feat_cmd_int_get(ifp, BRCMF_FEAT_MONITOR, + BRCMF_C_GET_MONITOR); + /* set chip related quirks */ switch (drvr->bus_if->chip) { case BRCM_CC_43236_CHIP_ID: diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h index d1193825e559..6eddb19ca48d 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h @@ -33,6 +33,7 @@ * MFP: 802.11w Management Frame Protection. * GSCAN: enhanced scan offload feature. * FWSUP: Firmware supplicant. + * MONITOR: monitor interface */ #define BRCMF_FEAT_LIST \ BRCMF_FEAT_DEF(MBSS) \ @@ -48,7 +49,8 @@ BRCMF_FEAT_DEF(WOWL_ARP_ND) \ BRCMF_FEAT_DEF(MFP) \ BRCMF_FEAT_DEF(GSCAN) \ - BRCMF_FEAT_DEF(FWSUP) + BRCMF_FEAT_DEF(FWSUP) \ + BRCMF_FEAT_DEF(MONITOR) /* * Quirks: diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h index 63b1287e2e6d..0d9492fd758d 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h @@ -60,6 +60,8 @@ #define BRCMF_C_GET_PM 85 #define BRCMF_C_SET_PM 86 #define BRCMF_C_GET_REVINFO 98 +#define BRCMF_C_GET_MONITOR 107 +#define BRCMF_C_SET_MONITOR 108 #define BRCMF_C_GET_CURR_RATESET 114 #define BRCMF_C_GET_AP 117 #define BRCMF_C_SET_AP 118