From ccbf7d5494900a0a34c026dbd6351d45a4a23678 Mon Sep 17 00:00:00 2001 From: Sachin Ahuja Date: Tue, 15 Jun 2021 16:38:34 +0530 Subject: [PATCH] qcacld-3.0: Check band caps before initializing wiphy band Currently driver initializes the wiphy 6ghz band without checking the band capability. If FW does not support 6Ghz then wiphy register is failed as wiphy 6ghz band is initialized by driver. To fix this, initialize the wiphy 6ghz band only when host driver and FW both supports 6Ghz band. CRs-Fixed: 2968968 Change-Id: I28d660f515d16d0eb4245311b42c69308576ac62 --- core/hdd/src/wlan_hdd_cfg80211.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 0fd1ab3e7671..94591acf3da2 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -426,6 +426,21 @@ static void hdd_init_6ghz(struct hdd_context *hdd_ctx) struct ieee80211_channel *chlist = hdd_channels_6_ghz; uint32_t num = ARRAY_SIZE(hdd_channels_6_ghz); uint16_t base_freq; + QDF_STATUS status; + uint32_t band_capability; + + hdd_enter(); + + status = ucfg_mlme_get_band_capability(hdd_ctx->psoc, &band_capability); + if (QDF_IS_STATUS_ERROR(status)) { + hdd_err("Failed to get MLME Band Capability"); + return; + } + + if (!(band_capability & (BIT(REG_BAND_6G)))) { + hdd_debug("6ghz band not enabled"); + return; + } qdf_mem_zero(chlist, sizeof(*chlist) * num); base_freq = wlan_reg_min_6ghz_chan_freq(); @@ -439,6 +454,8 @@ static void hdd_init_6ghz(struct hdd_context *hdd_ctx) wiphy->bands[HDD_NL80211_BAND_6GHZ] = &wlan_hdd_band_6_ghz; wiphy->bands[HDD_NL80211_BAND_6GHZ]->channels = chlist; wiphy->bands[HDD_NL80211_BAND_6GHZ]->n_channels = num; + + hdd_exit(); } #else static void hdd_init_6ghz(struct hdd_context *hdd_ctx)