From patchwork Wed Jul 4 20:31:30 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: 10507599 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 01EA26028F for ; Wed, 4 Jul 2018 20:31:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1A3B27F91 for ; Wed, 4 Jul 2018 20:31:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D32D428477; Wed, 4 Jul 2018 20:31:53 +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 6BF7A27F91 for ; Wed, 4 Jul 2018 20:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752684AbeGDUbv (ORCPT ); Wed, 4 Jul 2018 16:31:51 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:42064 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752619AbeGDUbu (ORCPT ); Wed, 4 Jul 2018 16:31:50 -0400 Received: by mail-lf0-f65.google.com with SMTP id u202-v6so5192105lff.9 for ; Wed, 04 Jul 2018 13:31:49 -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=8w/bHCtee2K4Owbi3qyyFWx5tUG3sYS0nvGNl/aRsW0=; b=FCbD0YN4CGxOtCpLD2THoL27yiws43xMeAtYEYtbPgjz3d/MGfz7R+4VmdQoAIuGlt xgWgWiLtZooRHpD0+ikFgUofRBaVuIIH27AJg+EuY/zGq/Lr2l6oQ0JFTGDUc18uu4Vr +kmVYkXs08/Fwrp/8ReR8w6RkJU0pJ4C4AAzruCqVrK9Pgv7VRBB5JjqT0AeNyGHr8qM z5IJDq9ovbPK5lA98Q08prZ03qLUN9cwzVZ6NLOCmYpgr0XguXiZKE1Y9Bzv/xdwCnFj /o20mkKleuV2Vvbkjx2b8ZSAw50rRP2XCOkhA2yPCJPJU5DUH0xU8IWzBRPxQb6rJebT h4Kg== 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=8w/bHCtee2K4Owbi3qyyFWx5tUG3sYS0nvGNl/aRsW0=; b=stOB1talugWtjSwWDw0e7ITLlZJ85s12Q5W7O4sBZZ9+zN3NVRg34rSOHFzr9bwvNH OuWBIJAKSg7xTQeDzboUfQ8w8B+qYU2luLA6fodXJ5KdR7ahB9N35emi+K3T+qJU2AAq 4LSgcvA/LvWj3qcYtzVcj75xESYvlCYk6S93FoHK7Alw4/LVqEK2B+TSR9ozFVJt95FO ZQol4Gg9tW3rph9mMg4jLI4s2d+AWpgKu8qBrS91dHIMUQBI7nDqg9xEgq8iv8sFupqV 8Zrhlx6vgemuWCI3NtRW3W4/2XEyPvoE8LyfFi9kSQ9XzS81qCXjxZSXAfVqmxR2YQJG yUXg== X-Gm-Message-State: APt69E1PqZgUGDKCEwQM/EcgICct7IHvjsf+uubHv7Exuar/wqvdV4aA Ljhjo9Ok5k/ZV8mhvgHP8do= X-Google-Smtp-Source: AAOMgpevDAEC4MVSV8GynTI/j891rkOL/wNwGWOHTwqA6uj85RQbp0YiC6yo64ZHqpTrplh4E78K4A== X-Received: by 2002:a19:1f4b:: with SMTP id f72-v6mr2434971lff.42.1530736308580; Wed, 04 Jul 2018 13:31:48 -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 n19-v6sm713144lja.87.2018.07.04.13.31.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Jul 2018 13:31:47 -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] brcmfmac: specify some features per firmware version Date: Wed, 4 Jul 2018 22:31:30 +0200 Message-Id: <20180704203130.12086-1-zajec5@gmail.com> X-Mailer: git-send-email 2.13.7 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 --- .../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..ab1d9eb1e9dc 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 ea1178515b88 */ + { "01-6cb8e269", BIT(BRCMF_FEAT_MONITOR) }, + /* brcmfmac4366b-pcie.bin from linux-firmware.git 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: