From 9a3263f9a95ae4c5f3a8def9743c8f4a060be1f5 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Fri, 30 Apr 2021 00:20:25 +0530 Subject: [PATCH] qcacld-3.0: Add support to accept frequency for ch switch command Currently channel switch command accepts only channel number as parameter but with 6GHz changes channel switch can come for the 6GHz channel as well and to support 6GHz channel switch frequency needs to be accepted as parameter. To address above issue add support to accept frequency as parameter for channel switch command. Change-Id: I38978348c0d70e3e860d4644b4664f8775ecb777 CRs-Fixed: 2931485 --- core/hdd/src/wlan_hdd_hostapd_wext.c | 11 ++++++++--- core/hdd/src/wlan_hdd_ioctl.c | 9 ++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd_wext.c b/core/hdd/src/wlan_hdd_hostapd_wext.c index 70e09bf55738..89bb5de70db3 100644 --- a/core/hdd/src/wlan_hdd_hostapd_wext.c +++ b/core/hdd/src/wlan_hdd_hostapd_wext.c @@ -404,9 +404,14 @@ static __iw_softap_setparam(struct net_device *dev, CSA_REASON_USER_INITIATED); hdd_debug("SET Channel Change to new channel= %d", set_value); - ret = hdd_softap_set_channel_change(dev, - wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev, set_value), - CH_WIDTH_MAX, false); + if (set_value <= wlan_reg_max_5ghz_ch_num()) + set_value = wlan_reg_legacy_chan_to_freq( + hdd_ctx->pdev, + set_value); + + ret = hdd_softap_set_channel_change(dev, set_value, + CH_WIDTH_MAX, + false); } else { hdd_err("Channel Change Failed, Device in test mode"); ret = -EINVAL; diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index c799d77dd5a6..82098e67c45b 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -6493,9 +6493,12 @@ static int drv_cmd_set_channel_switch(struct hdd_adapter *adapter, wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc, adapter->vdev_id, CSA_REASON_USER_INITIATED); - status = hdd_softap_set_channel_change(dev, - wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev, chan_number), - width, true); + + if (chan_number <= wlan_reg_max_5ghz_ch_num()) + chan_number = wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev, + chan_number); + + status = hdd_softap_set_channel_change(dev, chan_number, width, true); if (status) { hdd_err("Set channel change fail"); return status;