From 2e155a88b8f70f98c478259b15367649a55f7d5a Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Fri, 4 Jun 2021 19:00:12 +0530 Subject: [PATCH] qcacld-3.0: Replace channel num with freq in wlan_hdd_set_channel api Currently api wlan_hdd_set_channel is using channel number to validate requested frequency, this function converts center frequency to channel number and again converts this channel number to frequency to validate this channel, which may cause issues when 6GHz SAP tries to come up. For example if center freq is 6015 and current country is set to US, with current logic first this frequency is converted to channel number which comes to be channel number 13 and then this channel number is converted back to freq and gets validated. As channel 13 is invalid in US this validation fails even though freq 6015 is valid frequency in US. TO address above issue, remove this converion of center freq to chan num and chan num to freq, instead used center frequency directly for any kind of validatoin. Change-Id: Iec86c7f42e3f7e786f89df28f53ca71f67defc24 CRs-Fixed: 2970037 --- core/hdd/src/wlan_hdd_hostapd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 7bf068cce956..a9b3084ca2d2 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -3861,7 +3861,6 @@ int wlan_hdd_set_channel(struct wiphy *wiphy, { struct hdd_adapter *adapter = NULL; uint32_t num_ch = 0; - int channel = 0; int channel_seg2 = 0; struct hdd_context *hdd_ctx; int status; @@ -3900,7 +3899,6 @@ int wlan_hdd_set_channel(struct wiphy *wiphy, return -EINVAL; } - channel = ieee80211_frequency_to_channel(chandef->chan->center_freq); if (NL80211_CHAN_WIDTH_80P80 == chandef->width) { if ((wlan_reg_min_chan_freq() > chandef->center_freq2) || @@ -3920,8 +3918,8 @@ int wlan_hdd_set_channel(struct wiphy *wiphy, num_ch = CFG_VALID_CHANNEL_LIST_LEN; if (QDF_STATUS_SUCCESS != wlan_hdd_validate_operation_channel( - adapter, wlan_reg_chan_to_freq(hdd_ctx->pdev, channel))) { - hdd_err("Invalid Channel: %d", channel); + adapter, chandef->chan->center_freq)) { + hdd_err("Invalid freq: %d", chandef->chan->center_freq); return -EINVAL; }