From fadae4a93ed81e171b8cf8e7b42e696ab9ffaa84 Mon Sep 17 00:00:00 2001 From: Gokul Sivakumar Date: Thu, 13 Oct 2022 04:41:42 -0500 Subject: [PATCH 120/296] brcmfmac: introduce a module parameter to disable the 6GHz Operation Add a kernel module parameter "disable_6ghz" to disable the operation of the STA and SoftAP in the 6GHz band. By default, this module parameter will be set to zero, so 6GHz operation will be disabled during kernel module load only when explicity setting "disable_6ghz=1". Signed-off-by: Gokul Sivakumar --- .../net/wireless/broadcom/brcm80211/brcmfmac/common.c | 5 +++++ .../net/wireless/broadcom/brcm80211/brcmfmac/common.h | 2 ++ .../net/wireless/broadcom/brcm80211/brcmfmac/feature.c | 5 +++++ .../net/wireless/broadcom/brcm80211/brcmfmac/feature.h | 9 +++++++++ 4 files changed, 21 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c index cc94ec948549..223263d902c5 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c @@ -92,6 +92,10 @@ static int brcmf_fw_ap_select; module_param_named(fw_ap_select, brcmf_fw_ap_select, int, 0400); MODULE_PARM_DESC(fw_ap_select, "Allow FW for AP selection"); +static int brcmf_disable_6ghz; +module_param_named(disable_6ghz, brcmf_disable_6ghz, int, 0400); +MODULE_PARM_DESC(disable_6ghz, "Disable 6GHz Operation"); + static struct brcmfmac_platform_data *brcmfmac_pdata; struct brcmf_mp_global_t brcmf_mp_global; @@ -612,6 +616,7 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev, settings->ignore_probe_fail = !!brcmf_ignore_probe_fail; #endif settings->fw_ap_select = !!brcmf_fw_ap_select; + settings->disable_6ghz = !!brcmf_disable_6ghz; if (bus_type == BRCMF_BUSTYPE_SDIO) settings->bus.sdio.txglomsz = brcmf_sdiod_txglomsz; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h index 098d41d17e59..9246c105242e 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h @@ -42,6 +42,7 @@ extern struct brcmf_mp_global_t brcmf_mp_global; * @ignore_probe_fail: Ignore probe failure. * @trivial_ccode_map: Assume firmware uses ISO3166 country codes with rev 0 * @fw_ap_select: Allow FW to select AP. + * @disable_6ghz: Disable 6GHz operation * @country_codes: If available, pointer to struct for translating country codes * @bus: Bus specific platform data. Only SDIO at the mmoment. */ @@ -56,6 +57,7 @@ struct brcmf_mp_device { bool ignore_probe_fail; bool trivial_ccode_map; bool fw_ap_select; + bool disable_6ghz; struct brcmfmac_pd_cc *country_codes; const char *board_type; unsigned char mac[ETH_ALEN]; diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c index c14bf4d9158d..9776ceb81457 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.c @@ -382,3 +382,8 @@ bool brcmf_feat_is_quirk_enabled(struct brcmf_if *ifp, { return (ifp->drvr->chip_quirks & BIT(quirk)); } + +bool brcmf_feat_is_6ghz_enabled(struct brcmf_if *ifp) +{ + return (!ifp->drvr->settings->disable_6ghz); +} diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h index 3039d82efa8d..9922d3b7f9c3 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/feature.h @@ -132,4 +132,13 @@ bool brcmf_feat_is_enabled(struct brcmf_if *ifp, enum brcmf_feat_id id); bool brcmf_feat_is_quirk_enabled(struct brcmf_if *ifp, enum brcmf_feat_quirk quirk); +/** + * brcmf_feat_is_6ghz_enabled() - Find if 6GHZ Operation is allowed + * + * @ifp: interface instance. + * + * Return: true if 6GHz operation is allowed; otherwise false. + */ +bool brcmf_feat_is_6ghz_enabled(struct brcmf_if *ifp); + #endif /* _BRCMF_FEATURE_H */ -- 2.25.1