From patchwork Mon Jul 9 04:55:43 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: 10513497 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 00352603D7 for ; Mon, 9 Jul 2018 04:56:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2D0B28A16 for ; Mon, 9 Jul 2018 04:56:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6E1228A21; Mon, 9 Jul 2018 04:56:27 +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 2245028A16 for ; Mon, 9 Jul 2018 04:56:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754395AbeGIE4Y (ORCPT ); Mon, 9 Jul 2018 00:56:24 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:41839 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754200AbeGIE4V (ORCPT ); Mon, 9 Jul 2018 00:56:21 -0400 Received: by mail-lj1-f195.google.com with SMTP id y17-v6so8270021ljy.8 for ; Sun, 08 Jul 2018 21:56:20 -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=dymwiR5Xk+c9jsbqfDNssKhRd9szof1jIHYtlhLi0dc=; b=fKQZqKGyrHRq3UPuxJohYqkmUz3TjBjg566HEFVrrbaO+fJAEBDHs5EwKOoZH2wo9p hWwoBL46Z03rIXSN6RzARZxW11/QBPCPlLoDVQ1AsFIACdpvYYQDDqvNkPs/zttB1IvC pp63FxJ+q3EXhZyvvSPBWXEuzbJClRg0Gb6rdT5Wpf4ngIVlrfG3YAi/MVZKV8ZVQanT xOgoo4VtaCA9hpQEEzPRjOvoTmJbDEnUD27F22r7ak/AV7rjAkYNNHmOc4VnRk8/j/xJ T+qYOcIrpiDt1xkIi64KkGLgnb86NdNh13hX3CE9AXxmSTdhDE9EiJDrYyLq+BBGHt11 1HIA== 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=dymwiR5Xk+c9jsbqfDNssKhRd9szof1jIHYtlhLi0dc=; b=NAMQ2tb6LKWD/yV2UeqmWq1rII2bJI3s75iWH8eOS11g+2zRyBjUv+Jfyh3AZnC72m 2vOtKbhhnbO1pLFZJVFeJ3yKiIALfWpp222E12fB2YCDLYwQWZuuS4HPHg470NNsYHAM fvgJj71nhyYh0XGApBCfNd/Xcy1EvRMI2guQHvVAu5WOoDt4fyXctYR/vTgq7U6qZY2Z arOTaYI3DpoXf745MHIZXd+M1Mdp4J+QXMmkOwx4Omvx0ZiL7R6nufmpFZ+vTZX7BAvT HU7H1SsKBBXGwFJy7U1v2B46JJsSd8g6Fb5bFdlC5xsZ9KJ+Fmjri8Dri2LPbBEmxEm4 3RHQ== X-Gm-Message-State: APt69E1smdTxbPvSGpHJUKWHJs8mPsDyzMtjSibkKWVpmYByQG9OhQC9 IhxthhfcBMlbzyws8h4w4sM= X-Google-Smtp-Source: AAOMgpcTPkom352rmzr2QkwrW1sTxB2qMpIaD5Svs7n9Bs1JYLcGsf/T2m5kHJyYKjb37OqfqXgrHQ== X-Received: by 2002:a2e:944e:: with SMTP id o14-v6mr12138478ljh.118.1531112179543; Sun, 08 Jul 2018 21:56:19 -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 q65-v6sm1303572lfb.80.2018.07.08.21.56.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 08 Jul 2018 21:56:18 -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 V2] brcmfmac: specify some features per firmware version Date: Mon, 9 Jul 2018 06:55:43 +0200 Message-Id: <20180709045543.15031-1-zajec5@gmail.com> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20180704203130.12086-1-zajec5@gmail.com> References: <20180704203130.12086-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 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. Most firmwares support monitor interface but only the latest ones /announce/ it with a "monitor" flag in the "cap" iovar. There isn't any reliable detection method for older firmwares (BRCMF_C_MONITOR was tried but "it only indicates the core part of the stack supports"). Similarly support for tagging monitor frames and building radiotap headers can't be reliably detected for all firmwares. This commit adds table that allows mapping features to firmware version. It adds mappings for 43602a1 and 4366b1 firmwares from linux-firmware.git. Both were confirmed to be passing monitor frames. Signed-off-by: Rafał Miłecki Reviewed-by: Arend van Spriel --- V2: Added "commit" word when specifying SHAs. Thanks Arend! --- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c index 4db4d444407a..8347da632a5b 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c @@ -93,6 +93,42 @@ 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[] = { + /* brcmfmac43602-pcie.ap.bin from linux-firmware.git commit ea1178515b88 */ + { "01-6cb8e269", BIT(BRCMF_FEAT_MONITOR) }, + /* brcmfmac4366b-pcie.bin from linux-firmware.git commit 52442afee990 */ + { "01-c47a91a4", BIT(BRCMF_FEAT_MONITOR) }, +}; + +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. * @@ -253,6 +289,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: