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