From 8b0ac900d2392c4dced4d3be05e779497d9351ee Mon Sep 17 00:00:00 2001 From: Utkarsh Bhatnagar Date: Thu, 15 Apr 2021 14:10:14 +0530 Subject: [PATCH] qcacld-3.0: Don't do CSA on DFS channel in Non-DBS HW In case of Non-DBS HW, don't allow channel to switch to DFS channel or 160 Mhz BW in 5 Ghz, if STA is not connected. This is done because in Non-DBS HW, Monitoring mode is disabled as sta_sap_scc_on_dfs_chnl is forced to 1. Change-Id: Ie30a38a6c5155ca2b6f11f602fb51a43ca2e323e CRs-Fixed: 2916799 --- core/hdd/src/wlan_hdd_hostapd.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 1128d8cf45f8..f7474c0672d7 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -2942,6 +2942,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq, bool is_p2p_go_session = false; struct wlan_objmgr_vdev *vdev; bool strict; + uint32_t sta_cnt = 0; hdd_ctx = WLAN_HDD_GET_CTX(adapter); ret = wlan_hdd_validate_context(hdd_ctx); @@ -2987,6 +2988,21 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq, } } + sta_cnt = policy_mgr_mode_specific_connection_count(hdd_ctx->psoc, + PM_STA_MODE, + NULL); + /* + * For non-dbs HW, don't allow Channel switch on DFS channel if STA is + * not connected. + */ + if (!sta_cnt && !policy_mgr_is_hw_dbs_capable(hdd_ctx->psoc) && + (wlan_reg_is_dfs_for_freq(hdd_ctx->pdev, target_chan_freq) || + (wlan_reg_is_5ghz_ch_freq(target_chan_freq) && + target_bw == CH_WIDTH_160MHZ))) { + hdd_debug("Channel switch not allowed for non-DBS HW on DFS channel %d width %d", target_chan_freq, target_bw); + return -EINVAL; + } + /* * Set the ch_switch_in_progress flag to mimic channel change * when a radar is found. This will enable synchronizing