From patchwork Tue Jul 19 12:15:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 591858 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D8BDCCA47F for ; Tue, 19 Jul 2022 12:40:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241206AbiGSMkS (ORCPT ); Tue, 19 Jul 2022 08:40:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241526AbiGSMjs (ORCPT ); Tue, 19 Jul 2022 08:39:48 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A9655FAD1 for ; Tue, 19 Jul 2022 05:16:05 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id j29-20020a05600c1c1d00b003a2fdafdefbso9052758wms.2 for ; Tue, 19 Jul 2022 05:16:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jUzNsdnhvD/VjMTY/eS2UapJiTD9Uag6zWMc8hGErxY=; b=tFLikhLUmmmFwY1EqjHYL9BHWYhUQuRbGcS5/BeDHGexLBwVgO64iPXflIOf8cgbUX Ag6a/FL7jY77bhVRCIhn+eIZ1qV7TT6N7RWK6A2Hs8Pmlr8sWcuD9xGzRqrYUjluYSiA yM1YG+kdnP0Z5+QkNCzuXdul0LR3gLRfEKQnfZetvcvjJAB5Zgo0FOmCFYgvkB7HI6/9 KHWwXJyxv+aieQV5jwxksDXULuenYR0WFWNeXNKsN9M137bWQ2SSmeh6XQoSrFABfcn6 f2NyWxmekRlR2t07kzSrbo6h+gVi+jYnSHy4SjSIBZzfqiJ18u/4CYl72S/8VDJROwXr Mwvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jUzNsdnhvD/VjMTY/eS2UapJiTD9Uag6zWMc8hGErxY=; b=uLuj5rCAsgImfX8PEJuE4HjQ7jLPah6xPnl4Eu1ojw7cBYSFuG1FFbYXv2iP8gJajj 6toWFzh/GjDAbnVMI8IejskSOBczJO79DKJw76iW0XV/86j+ya8YfBRfamiSF+G2Mhqf awgFU3JOpgxcE1HqoVdb/SFHtPyOVHs32A4JXOIPO9MNSy06hYQSKs863g+nPMcAFq7U aJXXc2cSFpfHZqDIlGrpvNcJmznXt1DyVN45Y4Gr+vkAt92yUGWYBQNyQQjU6qHFR7s2 CObS5MTP6ys07nWzlZgxQ2rMCJ9Bz2elpfnbPk+Nlkofhppe+OAHm9o9IA97waJ5hX4f E0nA== X-Gm-Message-State: AJIora80Ys4Gnr+/G/zACHMcA0ufIiYzQfHWipBxzCosgK73bcyvTL7i kbkb77cez+F+AsKZtmlq/UjBRQ== X-Google-Smtp-Source: AGRyM1t0Sg7QNT07MTv5TipgUyeCoKHdQDcO7qU98Wz4I2f2qxfuFGxN5vcTKI5CEek753oIReH4Hw== X-Received: by 2002:a7b:ce0a:0:b0:3a3:1adf:af34 with SMTP id m10-20020a7bce0a000000b003a31adfaf34mr9026119wmc.127.1658232963931; Tue, 19 Jul 2022 05:16:03 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id d16-20020a05600c34d000b0039c5642e430sm14423812wmq.20.2022.07.19.05.16.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 05:16:03 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@kernel.org, loic.poulain@linaro.org Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, bryan.odonoghue@linaro.org Subject: [PATCH 1/4] wcn36xx: Rename clunky firmware feature bit enum Date: Tue, 19 Jul 2022 13:15:57 +0100 Message-Id: <20220719121600.1847440-2-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220719121600.1847440-1-bryan.odonoghue@linaro.org> References: <20220719121600.1847440-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The enum name "place_holder_in_cap_bitmap" is self descriptively asking to be changed to something else. Rename place_holder_in_cap_bitmap to wcn36xx_firmware_feat_caps so that the contents and intent of the enum is obvious. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/hal.h | 2 +- drivers/net/wireless/ath/wcn36xx/main.c | 2 +- drivers/net/wireless/ath/wcn36xx/smd.c | 6 +++--- drivers/net/wireless/ath/wcn36xx/smd.h | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index 46a49f0a51b3..5e48c97682c2 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -4760,7 +4760,7 @@ struct wcn36xx_hal_set_power_params_resp { /* Capability bitmap exchange definitions and macros starts */ -enum place_holder_in_cap_bitmap { +enum wcn36xx_firmware_feat_caps { MCC = 0, P2P = 1, DOT11AC = 2, diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index e34d3d0b7082..efd776b20e60 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -260,7 +260,7 @@ static const char * const wcn36xx_caps_names[] = { #undef DEFINE -static const char *wcn36xx_get_cap_name(enum place_holder_in_cap_bitmap x) +static const char *wcn36xx_get_cap_name(enum wcn36xx_firmware_feat_caps x) { if (x >= ARRAY_SIZE(wcn36xx_caps_names)) return "UNKNOWN"; diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 7ac9a1e6f768..88ee92be8562 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2431,7 +2431,7 @@ int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2, return ret; } -void set_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap) +void set_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap) { int arr_idx, bit_idx; @@ -2445,7 +2445,7 @@ void set_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap) bitmap[arr_idx] |= (1 << bit_idx); } -int get_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap) +int get_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap) { int arr_idx, bit_idx; @@ -2460,7 +2460,7 @@ int get_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap) return (bitmap[arr_idx] & (1 << bit_idx)) ? 1 : 0; } -void clear_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap) +void clear_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap) { int arr_idx, bit_idx; diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index 3fd598ac2a27..186dad4fe80e 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -125,9 +125,9 @@ int wcn36xx_smd_keep_alive_req(struct wcn36xx *wcn, int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5); int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn); -void set_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap); -int get_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap); -void clear_feat_caps(u32 *bitmap, enum place_holder_in_cap_bitmap cap); +void set_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); +int get_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); +void clear_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); int wcn36xx_smd_add_ba_session(struct wcn36xx *wcn, struct ieee80211_sta *sta, From patchwork Tue Jul 19 12:15:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 592121 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0CD7CCA481 for ; Tue, 19 Jul 2022 12:40:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241234AbiGSMkW (ORCPT ); Tue, 19 Jul 2022 08:40:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241538AbiGSMjt (ORCPT ); Tue, 19 Jul 2022 08:39:49 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EDC27C19B for ; Tue, 19 Jul 2022 05:16:07 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id z13so1736066wro.13 for ; Tue, 19 Jul 2022 05:16:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Bc2l7EXm9CohmPqFMrp+QrnDMQVxo4kH+cDeaAaNMb8=; b=DaIOfNcZXvEhYukWgG5uK7EUL+QKV+D6X4iyk0h60z91M6InQKJOpRa0UBM/Pirvzj V6DHyMjONHfhMKmsKrbgHkq2Ih3pp8y52wEVePoh1U1sTg0nOiek+t5ldJ0p32s73lnl XuzK8zd8zGkP5sCmUC3yu06vpEXNzZpobGFhWUTnnre2ZlhjtSuaH2Wme5QSQyu4MA58 ZsD+05eDj8/a31Tq9YQlB98Tr99ebwRqJHEoFt9CYUPnk42XKKOFt2YsuN97aimRU3K4 W/v4RLCkRbFmPc5IhZ2+rCL1YSgiKsAALTYVPzeet6oRxw52n6o9iug6hOB1KfnC0rN6 BcdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Bc2l7EXm9CohmPqFMrp+QrnDMQVxo4kH+cDeaAaNMb8=; b=eff6fGYs2ENjreoXqgtNQYcxDQUtSttQgKh8jKLHbC93/HORK08+oEZO4DB3YGpqeG 1G8qZa7HKwix6g7/nObaradY59pxHwq4KAOSNNxaiqzTkQ9q7AbHnhNEr7Vo0YsVtzd9 QikL4/VjFydSIarR5sa/ex9H04VncrH7V31YnqPIJBuqB6CXlQRHuW+kNEUq/7kNO6/E qapayscy90pN6Sp/A39jdyESURIzMdbe13DQyAnsHT10J6wGh+YcbR+/VG2s//7zMs49 FoP2b6RwZCO0rK/sgsK1pJM6IZGV2jOc1qSPPQ1JL3/UdZxfYbW+uQvbFtLGFk4xQoXD 2Biw== X-Gm-Message-State: AJIora9INTybBpvAt8/6kLPHekYaeBy29I0gZCt7Xju9kJTO8WWKAukX KuEMWjfZCK6KveNGCdGRgcQGvg== X-Google-Smtp-Source: AGRyM1tzB4qdwqiuGrT2BHfoUHwOhUsWZP1eZeNrhR3+C/xaC7vqODNApOuq1sB4a6e8jt/UccuUdA== X-Received: by 2002:a5d:4529:0:b0:21d:ce8e:7888 with SMTP id j9-20020a5d4529000000b0021dce8e7888mr17122097wra.705.1658232965395; Tue, 19 Jul 2022 05:16:05 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id d16-20020a05600c34d000b0039c5642e430sm14423812wmq.20.2022.07.19.05.16.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 05:16:04 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@kernel.org, loic.poulain@linaro.org Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, bryan.odonoghue@linaro.org Subject: [PATCH 2/4] wcn36xx: Move firmware feature bit storage to dedicated firmware.c file Date: Tue, 19 Jul 2022 13:15:58 +0100 Message-Id: <20220719121600.1847440-3-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220719121600.1847440-1-bryan.odonoghue@linaro.org> References: <20220719121600.1847440-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The naming of the get/set/clear firmware feature capability bits doesn't really follow the established namespace pattern of wcn36xx_logicalblock_do_something(); The feature bits are accessed by smd.c and main.c. It would be nice to display the found feature bits in debugfs. To do so though we should tidy up the namespace a bit. Move the firmware feature exchange API to its own file - firmware.c giving us the opportunity to functionally decompose other firmware related accessors as appropriate in future. Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/Makefile | 3 +- drivers/net/wireless/ath/wcn36xx/firmware.c | 50 +++++++++++++ drivers/net/wireless/ath/wcn36xx/firmware.h | 82 +++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/hal.h | 68 ----------------- drivers/net/wireless/ath/wcn36xx/main.c | 7 +- drivers/net/wireless/ath/wcn36xx/smd.c | 57 ++------------ drivers/net/wireless/ath/wcn36xx/smd.h | 3 - 7 files changed, 146 insertions(+), 124 deletions(-) create mode 100644 drivers/net/wireless/ath/wcn36xx/firmware.c create mode 100644 drivers/net/wireless/ath/wcn36xx/firmware.h diff --git a/drivers/net/wireless/ath/wcn36xx/Makefile b/drivers/net/wireless/ath/wcn36xx/Makefile index 27413703ad69..26bec795b372 100644 --- a/drivers/net/wireless/ath/wcn36xx/Makefile +++ b/drivers/net/wireless/ath/wcn36xx/Makefile @@ -5,6 +5,7 @@ wcn36xx-y += main.o \ txrx.o \ smd.o \ pmc.o \ - debug.o + debug.o \ + firmware.o wcn36xx-$(CONFIG_NL80211_TESTMODE) += testmode.o diff --git a/drivers/net/wireless/ath/wcn36xx/firmware.c b/drivers/net/wireless/ath/wcn36xx/firmware.c new file mode 100644 index 000000000000..03b93d2bdcf9 --- /dev/null +++ b/drivers/net/wireless/ath/wcn36xx/firmware.c @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: GPL-2.0-only + +#include "wcn36xx.h" +#include "firmware.h" + +void wcn36xx_firmware_set_feat_caps(u32 *bitmap, + enum wcn36xx_firmware_feat_caps cap) +{ + int arr_idx, bit_idx; + + if (cap < 0 || cap > 127) { + wcn36xx_warn("error cap idx %d\n", cap); + return; + } + + arr_idx = cap / 32; + bit_idx = cap % 32; + bitmap[arr_idx] |= (1 << bit_idx); +} + +int wcn36xx_firmware_get_feat_caps(u32 *bitmap, + enum wcn36xx_firmware_feat_caps cap) +{ + int arr_idx, bit_idx; + + if (cap < 0 || cap > 127) { + wcn36xx_warn("error cap idx %d\n", cap); + return -EINVAL; + } + + arr_idx = cap / 32; + bit_idx = cap % 32; + + return (bitmap[arr_idx] & (1 << bit_idx)) ? 1 : 0; +} + +void wcn36xx_firmware_clear_feat_caps(u32 *bitmap, + enum wcn36xx_firmware_feat_caps cap) +{ + int arr_idx, bit_idx; + + if (cap < 0 || cap > 127) { + wcn36xx_warn("error cap idx %d\n", cap); + return; + } + + arr_idx = cap / 32; + bit_idx = cap % 32; + bitmap[arr_idx] &= ~(1 << bit_idx); +} diff --git a/drivers/net/wireless/ath/wcn36xx/firmware.h b/drivers/net/wireless/ath/wcn36xx/firmware.h new file mode 100644 index 000000000000..552c0e9325e1 --- /dev/null +++ b/drivers/net/wireless/ath/wcn36xx/firmware.h @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _FIRMWARE_H_ +#define _FIRMWARE_H_ + +/* Capability bitmap exchange definitions and macros starts */ + +enum wcn36xx_firmware_feat_caps { + MCC = 0, + P2P = 1, + DOT11AC = 2, + SLM_SESSIONIZATION = 3, + DOT11AC_OPMODE = 4, + SAP32STA = 5, + TDLS = 6, + P2P_GO_NOA_DECOUPLE_INIT_SCAN = 7, + WLANACTIVE_OFFLOAD = 8, + BEACON_OFFLOAD = 9, + SCAN_OFFLOAD = 10, + ROAM_OFFLOAD = 11, + BCN_MISS_OFFLOAD = 12, + STA_POWERSAVE = 13, + STA_ADVANCED_PWRSAVE = 14, + AP_UAPSD = 15, + AP_DFS = 16, + BLOCKACK = 17, + PHY_ERR = 18, + BCN_FILTER = 19, + RTT = 20, + RATECTRL = 21, + WOW = 22, + WLAN_ROAM_SCAN_OFFLOAD = 23, + SPECULATIVE_PS_POLL = 24, + SCAN_SCH = 25, + IBSS_HEARTBEAT_OFFLOAD = 26, + WLAN_SCAN_OFFLOAD = 27, + WLAN_PERIODIC_TX_PTRN = 28, + ADVANCE_TDLS = 29, + BATCH_SCAN = 30, + FW_IN_TX_PATH = 31, + EXTENDED_NSOFFLOAD_SLOT = 32, + CH_SWITCH_V1 = 33, + HT40_OBSS_SCAN = 34, + UPDATE_CHANNEL_LIST = 35, + WLAN_MCADDR_FLT = 36, + WLAN_CH144 = 37, + NAN = 38, + TDLS_SCAN_COEXISTENCE = 39, + LINK_LAYER_STATS_MEAS = 40, + MU_MIMO = 41, + EXTENDED_SCAN = 42, + DYNAMIC_WMM_PS = 43, + MAC_SPOOFED_SCAN = 44, + BMU_ERROR_GENERIC_RECOVERY = 45, + DISA = 46, + FW_STATS = 47, + WPS_PRBRSP_TMPL = 48, + BCN_IE_FLT_DELTA = 49, + TDLS_OFF_CHANNEL = 51, + RTT3 = 52, + MGMT_FRAME_LOGGING = 53, + ENHANCED_TXBD_COMPLETION = 54, + LOGGING_ENHANCEMENT = 55, + EXT_SCAN_ENHANCED = 56, + MEMORY_DUMP_SUPPORTED = 57, + PER_PKT_STATS_SUPPORTED = 58, + EXT_LL_STAT = 60, + WIFI_CONFIG = 61, + ANTENNA_DIVERSITY_SELECTION = 62, + + MAX_FEATURE_SUPPORTED = 128, +}; + +void wcn36xx_firmware_set_feat_caps(u32 *bitmap, + enum wcn36xx_firmware_feat_caps cap); +int wcn36xx_firmware_get_feat_caps(u32 *bitmap, + enum wcn36xx_firmware_feat_caps cap); +void wcn36xx_firmware_clear_feat_caps(u32 *bitmap, + enum wcn36xx_firmware_feat_caps cap); + +#endif /* _FIRMWARE_H_ */ + diff --git a/drivers/net/wireless/ath/wcn36xx/hal.h b/drivers/net/wireless/ath/wcn36xx/hal.h index 5e48c97682c2..5c45b23c7880 100644 --- a/drivers/net/wireless/ath/wcn36xx/hal.h +++ b/drivers/net/wireless/ath/wcn36xx/hal.h @@ -4758,74 +4758,6 @@ struct wcn36xx_hal_set_power_params_resp { u32 status; } __packed; -/* Capability bitmap exchange definitions and macros starts */ - -enum wcn36xx_firmware_feat_caps { - MCC = 0, - P2P = 1, - DOT11AC = 2, - SLM_SESSIONIZATION = 3, - DOT11AC_OPMODE = 4, - SAP32STA = 5, - TDLS = 6, - P2P_GO_NOA_DECOUPLE_INIT_SCAN = 7, - WLANACTIVE_OFFLOAD = 8, - BEACON_OFFLOAD = 9, - SCAN_OFFLOAD = 10, - ROAM_OFFLOAD = 11, - BCN_MISS_OFFLOAD = 12, - STA_POWERSAVE = 13, - STA_ADVANCED_PWRSAVE = 14, - AP_UAPSD = 15, - AP_DFS = 16, - BLOCKACK = 17, - PHY_ERR = 18, - BCN_FILTER = 19, - RTT = 20, - RATECTRL = 21, - WOW = 22, - WLAN_ROAM_SCAN_OFFLOAD = 23, - SPECULATIVE_PS_POLL = 24, - SCAN_SCH = 25, - IBSS_HEARTBEAT_OFFLOAD = 26, - WLAN_SCAN_OFFLOAD = 27, - WLAN_PERIODIC_TX_PTRN = 28, - ADVANCE_TDLS = 29, - BATCH_SCAN = 30, - FW_IN_TX_PATH = 31, - EXTENDED_NSOFFLOAD_SLOT = 32, - CH_SWITCH_V1 = 33, - HT40_OBSS_SCAN = 34, - UPDATE_CHANNEL_LIST = 35, - WLAN_MCADDR_FLT = 36, - WLAN_CH144 = 37, - NAN = 38, - TDLS_SCAN_COEXISTENCE = 39, - LINK_LAYER_STATS_MEAS = 40, - MU_MIMO = 41, - EXTENDED_SCAN = 42, - DYNAMIC_WMM_PS = 43, - MAC_SPOOFED_SCAN = 44, - BMU_ERROR_GENERIC_RECOVERY = 45, - DISA = 46, - FW_STATS = 47, - WPS_PRBRSP_TMPL = 48, - BCN_IE_FLT_DELTA = 49, - TDLS_OFF_CHANNEL = 51, - RTT3 = 52, - MGMT_FRAME_LOGGING = 53, - ENHANCED_TXBD_COMPLETION = 54, - LOGGING_ENHANCEMENT = 55, - EXT_SCAN_ENHANCED = 56, - MEMORY_DUMP_SUPPORTED = 57, - PER_PKT_STATS_SUPPORTED = 58, - EXT_LL_STAT = 60, - WIFI_CONFIG = 61, - ANTENNA_DIVERSITY_SELECTION = 62, - - MAX_FEATURE_SUPPORTED = 128, -}; - #define WCN36XX_HAL_CAPS_SIZE 4 struct wcn36xx_hal_feat_caps_msg { diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index efd776b20e60..af62911a4659 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -28,6 +28,7 @@ #include #include "wcn36xx.h" #include "testmode.h" +#include "firmware.h" unsigned int wcn36xx_dbg_mask; module_param_named(debug_mask, wcn36xx_dbg_mask, uint, 0644); @@ -272,7 +273,7 @@ static void wcn36xx_feat_caps_info(struct wcn36xx *wcn) int i; for (i = 0; i < MAX_FEATURE_SUPPORTED; i++) { - if (get_feat_caps(wcn->fw_feat_caps, i)) + if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, i)) wcn36xx_dbg(WCN36XX_DBG_MAC, "FW Cap %s\n", wcn36xx_get_cap_name(i)); } } @@ -705,7 +706,7 @@ static int wcn36xx_hw_scan(struct ieee80211_hw *hw, { struct wcn36xx *wcn = hw->priv; - if (!get_feat_caps(wcn->fw_feat_caps, SCAN_OFFLOAD)) { + if (!wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, SCAN_OFFLOAD)) { /* fallback to mac80211 software scan */ return 1; } @@ -743,7 +744,7 @@ static void wcn36xx_cancel_hw_scan(struct ieee80211_hw *hw, wcn->scan_aborted = true; mutex_unlock(&wcn->scan_lock); - if (get_feat_caps(wcn->fw_feat_caps, SCAN_OFFLOAD)) { + if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, SCAN_OFFLOAD)) { /* ieee80211_scan_completed will be called on FW scan * indication */ wcn36xx_smd_stop_hw_scan(wcn); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 88ee92be8562..d2a994fee812 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -22,6 +22,7 @@ #include #include #include "smd.h" +#include "firmware.h" struct wcn36xx_cfg_val { u32 cfg_id; @@ -295,7 +296,7 @@ static void wcn36xx_smd_set_sta_vht_params(struct wcn36xx *wcn, sta_params->vht_capable = sta->deflink.vht_cap.vht_supported; sta_params->vht_ldpc_enabled = is_cap_supported(caps, IEEE80211_VHT_CAP_RXLDPC); - if (get_feat_caps(wcn->fw_feat_caps, MU_MIMO)) { + if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, MU_MIMO)) { sta_params->vht_tx_mu_beamformee_capable = is_cap_supported(caps, IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE); if (sta_params->vht_tx_mu_beamformee_capable) @@ -2431,49 +2432,6 @@ int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2, return ret; } -void set_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap) -{ - int arr_idx, bit_idx; - - if (cap < 0 || cap > 127) { - wcn36xx_warn("error cap idx %d\n", cap); - return; - } - - arr_idx = cap / 32; - bit_idx = cap % 32; - bitmap[arr_idx] |= (1 << bit_idx); -} - -int get_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap) -{ - int arr_idx, bit_idx; - - if (cap < 0 || cap > 127) { - wcn36xx_warn("error cap idx %d\n", cap); - return -EINVAL; - } - - arr_idx = cap / 32; - bit_idx = cap % 32; - - return (bitmap[arr_idx] & (1 << bit_idx)) ? 1 : 0; -} - -void clear_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap) -{ - int arr_idx, bit_idx; - - if (cap < 0 || cap > 127) { - wcn36xx_warn("error cap idx %d\n", cap); - return; - } - - arr_idx = cap / 32; - bit_idx = cap % 32; - bitmap[arr_idx] &= ~(1 << bit_idx); -} - int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn) { struct wcn36xx_hal_feat_caps_msg msg_body, *rsp; @@ -2482,11 +2440,12 @@ int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn) mutex_lock(&wcn->hal_mutex); INIT_HAL_MSG(msg_body, WCN36XX_HAL_FEATURE_CAPS_EXCHANGE_REQ); - set_feat_caps(msg_body.feat_caps, STA_POWERSAVE); + wcn36xx_firmware_set_feat_caps(msg_body.feat_caps, STA_POWERSAVE); if (wcn->rf_id == RF_IRIS_WCN3680) { - set_feat_caps(msg_body.feat_caps, DOT11AC); - set_feat_caps(msg_body.feat_caps, WLAN_CH144); - set_feat_caps(msg_body.feat_caps, ANTENNA_DIVERSITY_SELECTION); + wcn36xx_firmware_set_feat_caps(msg_body.feat_caps, DOT11AC); + wcn36xx_firmware_set_feat_caps(msg_body.feat_caps, WLAN_CH144); + wcn36xx_firmware_set_feat_caps(msg_body.feat_caps, + ANTENNA_DIVERSITY_SELECTION); } PREPARE_HAL_BUF(wcn->hal_buf, msg_body); @@ -3300,7 +3259,7 @@ int wcn36xx_smd_add_beacon_filter(struct wcn36xx *wcn, size_t payload_size; int ret; - if (!get_feat_caps(wcn->fw_feat_caps, BCN_FILTER)) + if (!wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, BCN_FILTER)) return -EOPNOTSUPP; mutex_lock(&wcn->hal_mutex); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.h b/drivers/net/wireless/ath/wcn36xx/smd.h index 186dad4fe80e..cf15cde2a364 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.h +++ b/drivers/net/wireless/ath/wcn36xx/smd.h @@ -125,9 +125,6 @@ int wcn36xx_smd_keep_alive_req(struct wcn36xx *wcn, int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5); int wcn36xx_smd_feature_caps_exchange(struct wcn36xx *wcn); -void set_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); -int get_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); -void clear_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); int wcn36xx_smd_add_ba_session(struct wcn36xx *wcn, struct ieee80211_sta *sta, From patchwork Tue Jul 19 12:15:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 591857 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74315C433EF for ; Tue, 19 Jul 2022 12:41:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241307AbiGSMlh (ORCPT ); Tue, 19 Jul 2022 08:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241583AbiGSMjz (ORCPT ); Tue, 19 Jul 2022 08:39:55 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7736B7CB7D for ; Tue, 19 Jul 2022 05:16:10 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id a5so21290527wrx.12 for ; Tue, 19 Jul 2022 05:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1htt3sRateXvcU1ylDQghkW6+6TpG01zPBq1kp3I6v0=; b=TbpsTJnC4c04TmS6K0aLQnFEGRIxb7jDLtd+6Zj3EiLaSQH6HTw/fkaVI2KD/Tczj3 /Sg+GGwqe6MxLUEYFwYUt4UkGCHRoquTXcfvB8wbsa1DVK9T4huF+WCrLzqSDOLNkTcu qE+Q5+ilIasAMSG39iPOz87krb6l7vI0D87GgAThWDbSu/dAWlswoyP3rnqBwtw0n+6U ygwctALhdFqctpZBUDuKFbz54H2B100mEkcI8+bG4ahJI7nwO25pD56SvwQMroJvcsvo 7PFZqOymFOzWOTEo051ax4ZJV3JdpmpwiZCMBN/pY8DvuIhOezvdG9hrq79itCI+Qjd3 13gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1htt3sRateXvcU1ylDQghkW6+6TpG01zPBq1kp3I6v0=; b=oe4weRAgw+02QW9oT+TAbpKQNNITRF0R2H3iQIueedFVbP/mntOv+oJ1OCJqIiIpBb nuVfumGOGM/qgBqruOZ5tgXzegvvVffhuryvyu2tpm0toZIbBSMPuKblH5LiXE/dJ5d4 W7UJvVnlDmzSDZUVQEG21dpXvgxKDUfHvNAaT224lXKIurhMyCcTbX+KTDMAFRtCtliP uCuuXsxJI36RzUt6IRuM1/lvc8uD+kAfmuUmc9xkjNuzqh8Hk55hYAg9QJVmrQtFKWMp gDjgGp/rZ1t+nX06W9XAy7clkvhTuoeDvAbxNlr/eDSqlXcvD76jyEg3MGPBgjYDqdTU siZw== X-Gm-Message-State: AJIora+uFw+op/kExRImBj5dkChyKLHVsd0uZzMFWIyBCymPc6TqA6/b rlg2ggYUVzPSnwOIQ3T7NI8GOQ== X-Google-Smtp-Source: AGRyM1sA0rGJKj6MgQ0kiYF11W0LSXa0VE7FhKJSu4CkDmEfDtMZFSVXvILM4r4n/vPKfhIF9RTiTQ== X-Received: by 2002:a05:6000:104c:b0:21d:87bf:63a2 with SMTP id c12-20020a056000104c00b0021d87bf63a2mr26171589wrx.461.1658232966465; Tue, 19 Jul 2022 05:16:06 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id d16-20020a05600c34d000b0039c5642e430sm14423812wmq.20.2022.07.19.05.16.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 05:16:05 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@kernel.org, loic.poulain@linaro.org Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, bryan.odonoghue@linaro.org Subject: [PATCH 3/4] wcn36xx: Move capability bitmap to string translation function to firmware.c Date: Tue, 19 Jul 2022 13:15:59 +0100 Message-Id: <20220719121600.1847440-4-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220719121600.1847440-1-bryan.odonoghue@linaro.org> References: <20220719121600.1847440-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Move wcn36xx_get_cap_name() function in main.c into firmware.c as wcn36xx_firmware_get_cap_name(). Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/firmware.c | 75 +++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/firmware.h | 2 + drivers/net/wireless/ath/wcn36xx/main.c | 81 +-------------------- 3 files changed, 81 insertions(+), 77 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/firmware.c b/drivers/net/wireless/ath/wcn36xx/firmware.c index 03b93d2bdcf9..4b7f439e4db5 100644 --- a/drivers/net/wireless/ath/wcn36xx/firmware.c +++ b/drivers/net/wireless/ath/wcn36xx/firmware.c @@ -3,6 +3,81 @@ #include "wcn36xx.h" #include "firmware.h" +#define DEFINE(s)[s] = #s + +static const char * const wcn36xx_firmware_caps_names[] = { + DEFINE(MCC), + DEFINE(P2P), + DEFINE(DOT11AC), + DEFINE(SLM_SESSIONIZATION), + DEFINE(DOT11AC_OPMODE), + DEFINE(SAP32STA), + DEFINE(TDLS), + DEFINE(P2P_GO_NOA_DECOUPLE_INIT_SCAN), + DEFINE(WLANACTIVE_OFFLOAD), + DEFINE(BEACON_OFFLOAD), + DEFINE(SCAN_OFFLOAD), + DEFINE(ROAM_OFFLOAD), + DEFINE(BCN_MISS_OFFLOAD), + DEFINE(STA_POWERSAVE), + DEFINE(STA_ADVANCED_PWRSAVE), + DEFINE(AP_UAPSD), + DEFINE(AP_DFS), + DEFINE(BLOCKACK), + DEFINE(PHY_ERR), + DEFINE(BCN_FILTER), + DEFINE(RTT), + DEFINE(RATECTRL), + DEFINE(WOW), + DEFINE(WLAN_ROAM_SCAN_OFFLOAD), + DEFINE(SPECULATIVE_PS_POLL), + DEFINE(SCAN_SCH), + DEFINE(IBSS_HEARTBEAT_OFFLOAD), + DEFINE(WLAN_SCAN_OFFLOAD), + DEFINE(WLAN_PERIODIC_TX_PTRN), + DEFINE(ADVANCE_TDLS), + DEFINE(BATCH_SCAN), + DEFINE(FW_IN_TX_PATH), + DEFINE(EXTENDED_NSOFFLOAD_SLOT), + DEFINE(CH_SWITCH_V1), + DEFINE(HT40_OBSS_SCAN), + DEFINE(UPDATE_CHANNEL_LIST), + DEFINE(WLAN_MCADDR_FLT), + DEFINE(WLAN_CH144), + DEFINE(NAN), + DEFINE(TDLS_SCAN_COEXISTENCE), + DEFINE(LINK_LAYER_STATS_MEAS), + DEFINE(MU_MIMO), + DEFINE(EXTENDED_SCAN), + DEFINE(DYNAMIC_WMM_PS), + DEFINE(MAC_SPOOFED_SCAN), + DEFINE(BMU_ERROR_GENERIC_RECOVERY), + DEFINE(DISA), + DEFINE(FW_STATS), + DEFINE(WPS_PRBRSP_TMPL), + DEFINE(BCN_IE_FLT_DELTA), + DEFINE(TDLS_OFF_CHANNEL), + DEFINE(RTT3), + DEFINE(MGMT_FRAME_LOGGING), + DEFINE(ENHANCED_TXBD_COMPLETION), + DEFINE(LOGGING_ENHANCEMENT), + DEFINE(EXT_SCAN_ENHANCED), + DEFINE(MEMORY_DUMP_SUPPORTED), + DEFINE(PER_PKT_STATS_SUPPORTED), + DEFINE(EXT_LL_STAT), + DEFINE(WIFI_CONFIG), + DEFINE(ANTENNA_DIVERSITY_SELECTION), +}; + +#undef DEFINE + +const char *wcn36xx_firmware_get_cap_name(enum wcn36xx_firmware_feat_caps x) +{ + if (x >= ARRAY_SIZE(wcn36xx_firmware_caps_names)) + return "UNKNOWN"; + return wcn36xx_firmware_caps_names[x]; +} + void wcn36xx_firmware_set_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap) { diff --git a/drivers/net/wireless/ath/wcn36xx/firmware.h b/drivers/net/wireless/ath/wcn36xx/firmware.h index 552c0e9325e1..f991cf959f82 100644 --- a/drivers/net/wireless/ath/wcn36xx/firmware.h +++ b/drivers/net/wireless/ath/wcn36xx/firmware.h @@ -78,5 +78,7 @@ int wcn36xx_firmware_get_feat_caps(u32 *bitmap, void wcn36xx_firmware_clear_feat_caps(u32 *bitmap, enum wcn36xx_firmware_feat_caps cap); +const char *wcn36xx_firmware_get_cap_name(enum wcn36xx_firmware_feat_caps x); + #endif /* _FIRMWARE_H_ */ diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index af62911a4659..fec85e89a02f 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -193,88 +193,15 @@ static inline u8 get_sta_index(struct ieee80211_vif *vif, sta_priv->sta_index; } -#define DEFINE(s) [s] = #s - -static const char * const wcn36xx_caps_names[] = { - DEFINE(MCC), - DEFINE(P2P), - DEFINE(DOT11AC), - DEFINE(SLM_SESSIONIZATION), - DEFINE(DOT11AC_OPMODE), - DEFINE(SAP32STA), - DEFINE(TDLS), - DEFINE(P2P_GO_NOA_DECOUPLE_INIT_SCAN), - DEFINE(WLANACTIVE_OFFLOAD), - DEFINE(BEACON_OFFLOAD), - DEFINE(SCAN_OFFLOAD), - DEFINE(ROAM_OFFLOAD), - DEFINE(BCN_MISS_OFFLOAD), - DEFINE(STA_POWERSAVE), - DEFINE(STA_ADVANCED_PWRSAVE), - DEFINE(AP_UAPSD), - DEFINE(AP_DFS), - DEFINE(BLOCKACK), - DEFINE(PHY_ERR), - DEFINE(BCN_FILTER), - DEFINE(RTT), - DEFINE(RATECTRL), - DEFINE(WOW), - DEFINE(WLAN_ROAM_SCAN_OFFLOAD), - DEFINE(SPECULATIVE_PS_POLL), - DEFINE(SCAN_SCH), - DEFINE(IBSS_HEARTBEAT_OFFLOAD), - DEFINE(WLAN_SCAN_OFFLOAD), - DEFINE(WLAN_PERIODIC_TX_PTRN), - DEFINE(ADVANCE_TDLS), - DEFINE(BATCH_SCAN), - DEFINE(FW_IN_TX_PATH), - DEFINE(EXTENDED_NSOFFLOAD_SLOT), - DEFINE(CH_SWITCH_V1), - DEFINE(HT40_OBSS_SCAN), - DEFINE(UPDATE_CHANNEL_LIST), - DEFINE(WLAN_MCADDR_FLT), - DEFINE(WLAN_CH144), - DEFINE(NAN), - DEFINE(TDLS_SCAN_COEXISTENCE), - DEFINE(LINK_LAYER_STATS_MEAS), - DEFINE(MU_MIMO), - DEFINE(EXTENDED_SCAN), - DEFINE(DYNAMIC_WMM_PS), - DEFINE(MAC_SPOOFED_SCAN), - DEFINE(BMU_ERROR_GENERIC_RECOVERY), - DEFINE(DISA), - DEFINE(FW_STATS), - DEFINE(WPS_PRBRSP_TMPL), - DEFINE(BCN_IE_FLT_DELTA), - DEFINE(TDLS_OFF_CHANNEL), - DEFINE(RTT3), - DEFINE(MGMT_FRAME_LOGGING), - DEFINE(ENHANCED_TXBD_COMPLETION), - DEFINE(LOGGING_ENHANCEMENT), - DEFINE(EXT_SCAN_ENHANCED), - DEFINE(MEMORY_DUMP_SUPPORTED), - DEFINE(PER_PKT_STATS_SUPPORTED), - DEFINE(EXT_LL_STAT), - DEFINE(WIFI_CONFIG), - DEFINE(ANTENNA_DIVERSITY_SELECTION), -}; - -#undef DEFINE - -static const char *wcn36xx_get_cap_name(enum wcn36xx_firmware_feat_caps x) -{ - if (x >= ARRAY_SIZE(wcn36xx_caps_names)) - return "UNKNOWN"; - return wcn36xx_caps_names[x]; -} - static void wcn36xx_feat_caps_info(struct wcn36xx *wcn) { int i; for (i = 0; i < MAX_FEATURE_SUPPORTED; i++) { - if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, i)) - wcn36xx_dbg(WCN36XX_DBG_MAC, "FW Cap %s\n", wcn36xx_get_cap_name(i)); + if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, i)) { + wcn36xx_dbg(WCN36XX_DBG_MAC, "FW Cap %s\n", + wcn36xx_firmware_get_cap_name(i)); + } } } From patchwork Tue Jul 19 12:16:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 592120 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61E70C43334 for ; Tue, 19 Jul 2022 12:41:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241261AbiGSMl5 (ORCPT ); Tue, 19 Jul 2022 08:41:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240945AbiGSMkG (ORCPT ); Tue, 19 Jul 2022 08:40:06 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E2827D1E2 for ; Tue, 19 Jul 2022 05:16:13 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id a11so2718875wmq.3 for ; Tue, 19 Jul 2022 05:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TjIe9OOGpwDnNhvL/YIzxOaQKCsr8adQ/Od7/da9He4=; b=gh88/L0EF0d7WK8EgA4uY51kb2W0GEteDnRLto/5sHATRc09yqXU5W3trIQPLJ4ooU 0+y8u/iJRaz29fNC5utxkCxePKodAH3dBp62k70Jhaui4a6ZCtA1AMqXS6kZkjB7EnAA FK+OpHLm8DLUCW3RmItzx2aUuGMszsH7hchvCjd9b7F+QDA/WBFbcxBs+uVKYan8nmTL hlcG9XDKK+2C06E3kleaeIq5FMp0Q5DZ+bT/Yb+JxD8gxiRd6dc9bh/XCKGxg9nf8wCs 9EOuWX00WhSE6uw0KeOyvq5Lyt3HMXPB+xIUcDpdLT7HIMgstCueMcs+q8OPtsJjrHqU og9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TjIe9OOGpwDnNhvL/YIzxOaQKCsr8adQ/Od7/da9He4=; b=Xi43/VOXqJ4rVYd29t1ozGbdk3J5PglFgowIN+VWDS02DqP54ZO+30RoYVMjFhv70Q EOnOkooNU3y1OmtKyFWKV4SxV+BeAs1ZbquJA/QMVTY3y1dFvCoEd3+Vc/SsPWsG07EM 7NdD54OmLlE6GSFZpgL72dzw2mHeriX0Ffq9mskbssjNZebRHpw5N8d1UawCgpcGynUE WXHNXJJdLknF85qFzPK2u3Ecwe1eafCU2wOMxc9OKt8t+VOS1M7eEipgWEKKBm3oNP0Z EGWCj/wuFjnqDgQHmMiv7cKjjVU15Zt6Ljm4JA0RrDj7jGipWjYsu5JQUm0jBPsh+hal LZcg== X-Gm-Message-State: AJIora8Mq3Q+RCzXWEyp8UCK0UqQdBvKcK2WoQQr8K1L0SA131HLg+TR A2LujtQzXRCoLRzf0VqMaMVPLw== X-Google-Smtp-Source: AGRyM1sVHgREOggQFPUAmM2U+cJS6ZgOZoqiUR/RGhevO/uH/w4XJ7EqiPa9v7Klu6WZZREBAuvPdA== X-Received: by 2002:a7b:cc14:0:b0:3a3:2213:e653 with SMTP id f20-20020a7bcc14000000b003a32213e653mr3259901wmh.52.1658232967477; Tue, 19 Jul 2022 05:16:07 -0700 (PDT) Received: from sagittarius-a.chello.ie (188-141-3-169.dynamic.upc.ie. [188.141.3.169]) by smtp.gmail.com with ESMTPSA id d16-20020a05600c34d000b0039c5642e430sm14423812wmq.20.2022.07.19.05.16.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jul 2022 05:16:07 -0700 (PDT) From: Bryan O'Donoghue To: kvalo@kernel.org, loic.poulain@linaro.org Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, bryan.odonoghue@linaro.org Subject: [PATCH 4/4] wcn36xx: Add debugfs entry to read firmware feature strings Date: Tue, 19 Jul 2022 13:16:00 +0100 Message-Id: <20220719121600.1847440-5-bryan.odonoghue@linaro.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220719121600.1847440-1-bryan.odonoghue@linaro.org> References: <20220719121600.1847440-1-bryan.odonoghue@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Add in the ability to easily find the firmware feature bits reported in the get feature exchange without having to compile-in debug prints. root@linaro-alip:~# cat /sys/kernel/debug/ieee80211/phy0/wcn36xx/firmware_feat_caps FW Cap = MCC FW Cap = P2P FW Cap = DOT11AC FW Cap = SLM_SESSIONIZATION FW Cap = DOT11AC_OPMODE FW Cap = SAP32STA FW Cap = TDLS FW Cap = P2P_GO_NOA_DECOUPLE_INIT_SCAN FW Cap = WLANACTIVE_OFFLOAD FW Cap = BEACON_OFFLOAD FW Cap = SCAN_OFFLOAD FW Cap = BCN_MISS_OFFLOAD FW Cap = STA_POWERSAVE FW Cap = STA_ADVANCED_PWRSAVE FW Cap = BCN_FILTER FW Cap = RTT FW Cap = RATECTRL FW Cap = WOW FW Cap = WLAN_ROAM_SCAN_OFFLOAD FW Cap = SPECULATIVE_PS_POLL FW Cap = IBSS_HEARTBEAT_OFFLOAD FW Cap = WLAN_SCAN_OFFLOAD FW Cap = WLAN_PERIODIC_TX_PTRN FW Cap = ADVANCE_TDLS FW Cap = BATCH_SCAN FW Cap = FW_IN_TX_PATH FW Cap = EXTENDED_NSOFFLOAD_SLOT FW Cap = CH_SWITCH_V1 FW Cap = HT40_OBSS_SCAN FW Cap = UPDATE_CHANNEL_LIST FW Cap = WLAN_MCADDR_FLT FW Cap = WLAN_CH144 FW Cap = TDLS_SCAN_COEXISTENCE FW Cap = LINK_LAYER_STATS_MEAS FW Cap = MU_MIMO FW Cap = EXTENDED_SCAN FW Cap = DYNAMIC_WMM_PS FW Cap = MAC_SPOOFED_SCAN FW Cap = FW_STATS FW Cap = WPS_PRBRSP_TMPL FW Cap = BCN_IE_FLT_DELTA Signed-off-by: Bryan O'Donoghue --- drivers/net/wireless/ath/wcn36xx/debug.c | 37 ++++++++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/debug.h | 1 + 2 files changed, 38 insertions(+) diff --git a/drivers/net/wireless/ath/wcn36xx/debug.c b/drivers/net/wireless/ath/wcn36xx/debug.c index 6af306ae41ad..ca6f22a00f75 100644 --- a/drivers/net/wireless/ath/wcn36xx/debug.c +++ b/drivers/net/wireless/ath/wcn36xx/debug.c @@ -21,6 +21,7 @@ #include "wcn36xx.h" #include "debug.h" #include "pmc.h" +#include "firmware.h" #ifdef CONFIG_WCN36XX_DEBUGFS @@ -136,6 +137,40 @@ static const struct file_operations fops_wcn36xx_dump = { .write = write_file_dump, }; +static ssize_t read_file_firmware_feature_caps(struct file *file, + char __user *user_buf, + size_t count, loff_t *ppos) +{ + struct wcn36xx *wcn = file->private_data; + unsigned long page = get_zeroed_page(GFP_KERNEL); + char *p = (char *)page; + int i; + int ret; + + if (!p) + return -ENOMEM; + + mutex_lock(&wcn->hal_mutex); + for (i = 0; i < MAX_FEATURE_SUPPORTED; i++) { + if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, i)) { + p += sprintf(p, "FW Cap = %s\n", + wcn36xx_firmware_get_cap_name(i)); + } + } + mutex_unlock(&wcn->hal_mutex); + + ret = simple_read_from_buffer(user_buf, count, ppos, (char *)page, + (unsigned long)p - page); + + free_page(page); + return ret; +} + +static const struct file_operations fops_wcn36xx_firmware_feat_caps = { + .open = simple_open, + .read = read_file_firmware_feature_caps, +}; + #define ADD_FILE(name, mode, fop, priv_data) \ do { \ struct dentry *d; \ @@ -163,6 +198,8 @@ void wcn36xx_debugfs_init(struct wcn36xx *wcn) ADD_FILE(bmps_switcher, 0600, &fops_wcn36xx_bmps, wcn); ADD_FILE(dump, 0200, &fops_wcn36xx_dump, wcn); + ADD_FILE(firmware_feat_caps, 0200, + &fops_wcn36xx_firmware_feat_caps, wcn); } void wcn36xx_debugfs_exit(struct wcn36xx *wcn) diff --git a/drivers/net/wireless/ath/wcn36xx/debug.h b/drivers/net/wireless/ath/wcn36xx/debug.h index 46307aa562d3..7116d96e0543 100644 --- a/drivers/net/wireless/ath/wcn36xx/debug.h +++ b/drivers/net/wireless/ath/wcn36xx/debug.h @@ -31,6 +31,7 @@ struct wcn36xx_dfs_entry { struct dentry *rootdir; struct wcn36xx_dfs_file file_bmps_switcher; struct wcn36xx_dfs_file file_dump; + struct wcn36xx_dfs_file file_firmware_feat_caps; }; void wcn36xx_debugfs_init(struct wcn36xx *wcn);