From patchwork Wed May 30 20:12:59 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: 10439817 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 6BF52602BD for ; Wed, 30 May 2018 20:15:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54C4E26D08 for ; Wed, 30 May 2018 20:15:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4979428DC9; Wed, 30 May 2018 20:15:45 +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 C88E026D08 for ; Wed, 30 May 2018 20:15:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932237AbeE3UPm (ORCPT ); Wed, 30 May 2018 16:15:42 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:45510 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932226AbeE3UPl (ORCPT ); Wed, 30 May 2018 16:15:41 -0400 Received: by mail-lf0-f68.google.com with SMTP id n3-v6so6255094lfe.12 for ; Wed, 30 May 2018 13:15:40 -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:mime-version :content-transfer-encoding; bh=9PwxYqd8yIY4qPAESlbc/keSuNaMjymThoTfMB/Wdi4=; b=SQpz01JAFxjfJFKdPvFh2ffuo9T78lTBZBkG3z2ZLWrKEMyGxM6CTEx9bwqSQmRaHJ 8+WzD4PD10bqz9SszAC6gN9HtBaRj8TQvK5Tx6YL2cQw+5Fr2Lo76ARAXPS+UkdxCI/s thSR4VdLAGQ/wcM7zIHfBICU8iwsa8CM/PEn/fj48fobMlUB76qDzwz3T6iV0lImvQt6 b3Z2OOZrnR32fLbgLsdMp0AZWuIOoU3edY1U9cwdadHca/Ti/4o4k6MDeNonVAjWNR96 gfLexSM6BI+jdOBF9ub2R1RANYFcX37WyzBbOgZNwtNv/R0OK3jdJ/61maFf/Xp+i/3K Vlkw== 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=9PwxYqd8yIY4qPAESlbc/keSuNaMjymThoTfMB/Wdi4=; b=pfnseIX9Uu47j2Cee4Ripu/EJXCLAMWIgC5RanDXUz8bXgw9spDSctyp9+l0owddSL EVtN0ob3AzimqYw3tHXSSh9JLN8iVZgIvCYp3ip/rBUF09f9fYWun/EBhOyotYkQtdtT wApxyTNq9Dfy1FM90p8tegIeSJ2fD3U7Dy1+DFPZnW7pviRVvXyKE4q/c/tytFqWLUh0 dE6o1hSBQthY+O/B3XRD9FPCMyELeCImL/If0eltJZnpWJ5fIyfS+2/nFgwok3tsOTj+ 2ZGPG1e34jRM3RpGJIQVM3BeavuzsVLmWCkBXWNdgujwCQ7mGO5RaJjVW6wVWgxKEqXA 9Pqg== X-Gm-Message-State: ALKqPwdcbVPLNH/7n/Np9zsw9civOlWyArh8kC9bsbdyD7GKPUeVKmiU LHdn3kRdzLMe7RCTe05EYwo= X-Google-Smtp-Source: ADUXVKLD93JU+1XwkhhbTab6n3R/TwIpkrLezumBZZMGPXITqeQL40dGwbeZOASBnNR7yIi0IZdPjg== X-Received: by 2002:a19:1204:: with SMTP id h4-v6mr2485679lfi.12.1527711339729; Wed, 30 May 2018 13:15:39 -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 v79-v6sm2784180lfd.32.2018.05.30.13.15.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 May 2018 13:15:38 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: Kalle Valo Cc: Arend van Spriel , 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 V2 1/3] brcmfmac: allow specifying features per firmware version Date: Wed, 30 May 2018 22:12:59 +0200 Message-Id: <20180530201301.4648-1-zajec5@gmail.com> X-Mailer: git-send-email 2.13.6 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 Some features supported by firmware aren't advertised and there is no way for a driver to query them. This includes e.g. monitor mode details. Some firmwares support tagging monitor frames, some build radiotap header but there is no way to detect it. Such features often depend on used firmware compilation options. This commit adds table that will allow specifying features like: { "01-abcdef01", BIT(BRCMF_FEAT_FOO) } Signed-off-by: Rafał Miłecki --- V2: Rename struct field to "feat_flags" Rename function to the brcmf_feat_firmware_overrides() Print enabled features Rename variable to "drv" Update commit message body (mention compilation time options) --- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c index 800a423c7bc2..2712bfcb2864 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c @@ -91,6 +91,38 @@ static int brcmf_feat_debugfs_read(struct seq_file *seq, void *data) } #endif /* DEBUG */ +struct brcmf_feat_fwfeat { + const char * const fwid; + u32 feat_flags; +}; + +static const struct brcmf_feat_fwfeat brcmf_feat_fwfeat_map[] = { +}; + +static void brcmf_feat_firmware_overrides(struct brcmf_pub *drv) +{ + const struct brcmf_feat_fwfeat *e; + u32 feat_flags = 0; + int i; + + for (i = 0; i < ARRAY_SIZE(brcmf_feat_fwfeat_map); i++) { + e = &brcmf_feat_fwfeat_map[i]; + if (!strcmp(e->fwid, drv->fwver)) { + feat_flags = e->feat_flags; + break; + } + } + + if (!feat_flags) + return; + + for (i = 0; i < BRCMF_FEAT_LAST; i++) + if (feat_flags & BIT(i)) + brcmf_dbg(INFO, "enabling firmware feature: %s\n", + brcmf_feat_names[i]); + drv->feat_flags |= feat_flags; +} + /** * brcmf_feat_iovar_int_get() - determine feature through iovar query. * @@ -251,6 +283,8 @@ void brcmf_feat_attach(struct brcmf_pub *drvr) } brcmf_feat_iovar_int_get(ifp, BRCMF_FEAT_FWSUP, "sup_wpa"); + brcmf_feat_firmware_overrides(drvr); + /* set chip related quirks */ switch (drvr->bus_if->chip) { case BRCM_CC_43236_CHIP_ID: