diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index b0b1e83f66..043f21cb5b 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -509,10 +509,45 @@ static void hdd_init_6ghz(struct hdd_context *hdd_ctx) hdd_exit(); } + +/** + * wlan_hdd_populate_6g_chan_info() - Populate 6 GHz chan info in hdd context + * @hdd_ctx: pointer to hdd context + * @index: 6 GHz channel beginning index in chan_info of @hdd_ctx + * + * Return: Number of 6 GHz channels populated + */ +static uint32_t +wlan_hdd_populate_6g_chan_info(struct hdd_context *hdd_ctx, uint32_t index) +{ + uint32_t num_6g, i; + struct scan_chan_info *chan_info; + + if (!hdd_ctx->wiphy->bands[HDD_NL80211_BAND_6GHZ] || + !hdd_ctx->wiphy->bands[HDD_NL80211_BAND_6GHZ]->n_channels) { + hdd_debug("6GHz channel list not populated to wiphy"); + return 0; + } + + num_6g = QDF_ARRAY_SIZE(hdd_channels_6_ghz); + chan_info = hdd_ctx->chan_info; + + for (i = 0; i < num_6g; i++) + chan_info[index + i].freq = hdd_channels_6_ghz[i].center_freq; + + return num_6g; +} + #else static void hdd_init_6ghz(struct hdd_context *hdd_ctx) { } + +static inline uint32_t +wlan_hdd_populate_6g_chan_info(struct hdd_context *hdd_ctx, uint32_t index) +{ + return 0; +} #endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0)) || \ @@ -25746,7 +25781,7 @@ static void wlan_hdd_fill_subband_scan_info(struct hdd_context *hdd_ctx, info->subband_info.vdev_id, info->freq, ch_width, start_freq, end_freq, freq_info_num); - for (idx = 0; idx < SIR_MAX_NUM_CHANNELS; idx++) { + for (idx = 0; idx < NUM_CHANNELS; idx++) { if (chan[idx].freq == 0) continue; @@ -25851,20 +25886,17 @@ void wlan_hdd_init_chan_info(struct hdd_context *hdd_ctx) } num_5g = QDF_ARRAY_SIZE(hdd_channels_5_ghz); - for (; (index - num_2g) < num_5g; index++) { - if (wlan_reg_is_dsrc_freq( - hdd_channels_5_ghz[index - num_2g].center_freq)) - continue; + for (; (index - num_2g) < num_5g; index++) hdd_ctx->chan_info[index].freq = hdd_channels_5_ghz[index - num_2g].center_freq; - } index = num_2g + num_5g; - index = wlan_hdd_populate_5dot9_chan_info(hdd_ctx, index); + index += wlan_hdd_populate_5dot9_chan_info(hdd_ctx, index); + index += wlan_hdd_populate_6g_chan_info(hdd_ctx, index); + hdd_debug("Number of channels populated : %d", index); mac_handle = hdd_ctx->mac_handle; - sme_set_chan_info_callback(mac_handle, - &wlan_hdd_chan_info_cb); + sme_set_chan_info_callback(mac_handle, &wlan_hdd_chan_info_cb); } /**