From patchwork Fri May 11 10:15:26 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: 10393853 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 4D46560153 for ; Fri, 11 May 2018 10:17:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 086D428173 for ; Fri, 11 May 2018 10:17:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F15CB28DDC; Fri, 11 May 2018 10:17:05 +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 6E25328173 for ; Fri, 11 May 2018 10:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752482AbeEKKRE (ORCPT ); Fri, 11 May 2018 06:17:04 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:43891 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750852AbeEKKRC (ORCPT ); Fri, 11 May 2018 06:17:02 -0400 Received: by mail-lf0-f68.google.com with SMTP id n18-v6so701147lfh.10 for ; Fri, 11 May 2018 03:17:02 -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=ROhOmjZhyOnlSQF1Lm9nIPugLVkvkQUZPLCpAMSqGXo=; b=mx2R+KfLY2Ma4Zyuvns6NIJ3HsH2kNdoPxjb+6Uv7p9TGKb0PTdqLTsIaoO90cdLlW Y/CTWO3rqc0lUyQ6JWqI67jhP9+2zNMSfniXOHwtBKMhM7mwUJisa2CSBziFLnoE/Gja K8GB+et8v9w9oXFc06tcnA/VakdLlpGkgzu2eumB6FMKXfeubhYWGQQpDV3iAyW40x7e RU9Bexmma3/Mi9ewo+1IADD5X/qoUUOVlCv0VPTk6MPL1GsLvKWSm0iwEjN4b9zQOYg1 JnmMLqsZKkqWztIXD6fiaBI9xo+z8yOnnz1QSdtbfa5RJT498mkHurnhlKBLKgRIlwyY sS4Q== 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=ROhOmjZhyOnlSQF1Lm9nIPugLVkvkQUZPLCpAMSqGXo=; b=Fr/N1y54oMG4ZWf/jDFvJgr5oGrnYrwiUnSM3za2cKsrfnVQMiqwp4ZP0rgqTGW+Oz NJrDvKW//Bm2tXZWYGcsqsMw/HU68MmDMTF6GKaV6rx+85/LlbkObZbcIvlse1kDttHg FePG0tUgyLFeR/hdmMubT1ovVg/mpSAGl9XkFotXoW2/wCUy5i+a2tCQymIKNYb48SDv 9F7sCCZPNqHY17+nqapYMAeULH7qx6imp+Mm9w/SekEHi7Txli5GsK06gluSTS3/dMNk tDoZViH4oLcFkLBHh8IICE6LG5bgITNaVbBXyaxyi9t8HERGiVhQ4u41yoNL5tl8fuNu aY7w== X-Gm-Message-State: ALKqPwf8UI5yQrycL57+5Kn1yGgNTKfBnMe3Tu5An7DSIPB+WrxNxoXN V0zbYo8FI07EWN2slJwGQaA= X-Google-Smtp-Source: AB8JxZqzoYckj1IYkQ0rPyTyjs7IqPPTK6/oq/vL2IKmMEZuhD72Wf7/njo9ykxnHtZ/4r7pVvO//Q== X-Received: by 2002:a2e:300c:: with SMTP id w12-v6mr3808218ljw.98.1526033821474; Fri, 11 May 2018 03:17:01 -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 k76-v6sm581187lje.13.2018.05.11.03.17.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 May 2018 03:17:00 -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 , 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: add debugfs entry for reading firmware capabilities Date: Fri, 11 May 2018 12:15:26 +0200 Message-Id: <20180511101526.10734-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 This allows reading all capabilities as reported by a firmware. They are printed using native (raw) names, just like developers like it the most. It's how firmware reports support for various features, e.g. supported modes, supported standards, power saving details, max BSS-es. Access to all that info is useful for trying new firmwares, comparing them and debugging features AKA bugs. Signed-off-by: Rafał Miłecki Reviewed-by: Arend van Spriel --- .../wireless/broadcom/brcm80211/brcmfmac/feature.c | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c index 876731c57bf5..782121cb9399 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c @@ -165,6 +165,41 @@ static void brcmf_feat_firmware_capabilities(struct brcmf_if *ifp) } } +/** + * brcmf_cap_read() - expose firmware capabilities to debugfs. + * + * @seq: sequence for debugfs entry. + * @data: raw data pointer. + */ +static int brcmf_cap_read(struct seq_file *seq, void *data) +{ + struct brcmf_bus *bus_if = dev_get_drvdata(seq->private); + struct brcmf_if *ifp = brcmf_get_ifp(bus_if->drvr, 0); + char caps[MAX_CAPS_BUFFER_SIZE + 1] = { }; + char *tmp; + int err; + + err = brcmf_fil_iovar_data_get(ifp, "cap", caps, sizeof(caps)); + if (err) { + brcmf_err("could not get firmware cap (%d)\n", err); + return err; + } + + /* Put every capability in a new line */ + for (tmp = caps; *tmp; tmp++) { + if (*tmp == ' ') + *tmp = '\n'; + } + + /* Usually there is a space at the end of capabilities string */ + seq_printf(seq, "%s", caps); + /* So make sure we don't print two line breaks */ + if (tmp > caps && *(tmp - 1) != '\n') + seq_printf(seq, "\n"); + + return 0; +} + void brcmf_feat_attach(struct brcmf_pub *drvr) { struct brcmf_if *ifp = brcmf_get_ifp(drvr, 0); @@ -233,6 +268,7 @@ void brcmf_feat_attach(struct brcmf_pub *drvr) void brcmf_feat_debugfs_create(struct brcmf_pub *drvr) { brcmf_debugfs_add_entry(drvr, "features", brcmf_feat_debugfs_read); + brcmf_debugfs_add_entry(drvr, "cap", brcmf_cap_read); } bool brcmf_feat_is_enabled(struct brcmf_if *ifp, enum brcmf_feat_id id)