diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 95e992a931..d9abb77b02 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -364,18 +364,21 @@ hdd_hostapd_deinit_sap_session(struct wlan_hdd_link_info *link_info) * Called when, 1. bss stopped, 2. channel switch * * @adapter: pointer to hdd adapter - * @chan_freq: current channel frequency + * @chan_freq: channel frequency + * @ch_params: channel params * * Return: None */ static void hdd_hostapd_channel_allow_suspend(struct hdd_adapter *adapter, - uint32_t chan_freq) + uint32_t chan_freq, + struct ch_params *ch_params) { struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); struct hdd_hostapd_state *hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink); struct sap_context *sap_ctx; + bool is_dfs; hdd_debug("bss_state: %d, chan_freq: %d, dfs_ref_cnt: %d", hostapd_state->bss_state, chan_freq, @@ -391,9 +394,10 @@ static void hdd_hostapd_channel_allow_suspend(struct hdd_adapter *adapter, return; } - if (!sap_chan_bond_dfs_sub_chan(sap_ctx, - chan_freq, - PHY_CHANNEL_BONDING_STATE_MAX)) + is_dfs = wlan_mlme_check_chan_param_has_dfs(hdd_ctx->pdev, + ch_params, + chan_freq); + if (!is_dfs) return; /* Release wakelock when no more DFS channels are used */ @@ -411,17 +415,20 @@ static void hdd_hostapd_channel_allow_suspend(struct hdd_adapter *adapter, * Called when, 1. bss started, 2. channel switch * * @adapter: pointer to hdd adapter - * @chan_freq: current channel frequency + * @chan_freq: channel frequency + * @ch_params: channel params * * Return - None */ static void hdd_hostapd_channel_prevent_suspend(struct hdd_adapter *adapter, - uint32_t chan_freq) + uint32_t chan_freq, + struct ch_params *ch_params) { struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); struct hdd_hostapd_state *hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(adapter->deflink); struct sap_context *sap_ctx; + bool is_dfs; hdd_debug("bss_state: %d, chan_freq: %d, dfs_ref_cnt: %d", hostapd_state->bss_state, chan_freq, @@ -437,9 +444,10 @@ static void hdd_hostapd_channel_prevent_suspend(struct hdd_adapter *adapter, return; } - if (!sap_chan_bond_dfs_sub_chan(sap_ctx, - chan_freq, - PHY_CHANNEL_BONDING_STATE_MAX)) + is_dfs = wlan_mlme_check_chan_param_has_dfs(hdd_ctx->pdev, + &sap_ctx->ch_params, + chan_freq); + if (!is_dfs) return; /* Acquire wakelock if we have at least one DFS channel in use */ @@ -2353,7 +2361,8 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event, wlan_hdd_auto_shutdown_enable(hdd_ctx, true); #endif hdd_hostapd_channel_prevent_suspend(adapter, - ap_ctx->operating_chan_freq); + ap_ctx->operating_chan_freq, + &sap_config->ch_params); hostapd_state->bss_state = BSS_START; vdev = hdd_objmgr_get_vdev_by_user(link_info, WLAN_DP_ID); @@ -2428,7 +2437,8 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event, status ? "eSAP_STATUS_FAILURE" : "eSAP_STATUS_SUCCESS"); hdd_hostapd_channel_allow_suspend(adapter, - ap_ctx->operating_chan_freq); + ap_ctx->operating_chan_freq, + &ap_ctx->sap_context->ch_params); /* Invalidate the channel info. */ ap_ctx->operating_chan_freq = 0; @@ -3017,10 +3027,12 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event, if (hostapd_state->bss_state != BSS_STOP) { /* Allow suspend for old channel */ hdd_hostapd_channel_allow_suspend(adapter, - ap_ctx->sap_context->freq_before_ch_switch); + ap_ctx->sap_context->freq_before_ch_switch, + &ap_ctx->sap_context->ch_params_before_ch_switch); /* Prevent suspend for new channel */ hdd_hostapd_channel_prevent_suspend(adapter, - sap_event->sapevt.sap_ch_selected.pri_ch_freq); + sap_event->sapevt.sap_ch_selected.pri_ch_freq, + &ap_ctx->sap_context->ch_params); } /* SME/PE is already updated for new operation * channel. So update HDD layer also here. This diff --git a/core/sap/src/sap_internal.h b/core/sap/src/sap_internal.h index 34a04bd2a5..6a3d06f16b 100644 --- a/core/sap/src/sap_internal.h +++ b/core/sap/src/sap_internal.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved. - * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -235,6 +235,7 @@ struct sap_context { qdf_list_t ft_pending_assoc_ind_list; qdf_event_t ft_pending_event; uint32_t freq_before_ch_switch; + struct ch_params ch_params_before_ch_switch; #ifdef WLAN_FEATURE_P2P_P2P_STA /* *This param is used for GO+GO force scc logic where after diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index 50a9aa4964..aef39f5e48 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -2025,11 +2025,12 @@ QDF_STATUS wlansap_channel_change_request(struct sap_context *sap_ctx, wlan_reg_set_channel_params_for_pwrmode(mac_ctx->pdev, target_chan_freq, 0, ch_params, REG_CURRENT_PWR_MODE); - sap_ctx->ch_params = *ch_params; + sap_ctx->ch_params_before_ch_switch = sap_ctx->ch_params; sap_ctx->freq_before_ch_switch = sap_ctx->chan_freq; /* Update the channel as this will be used to * send event to supplicant */ + sap_ctx->ch_params = *ch_params; sap_ctx->chan_freq = target_chan_freq; wlansap_get_sec_channel(ch_params->sec_ch_offset, sap_ctx->chan_freq, &sap_ctx->sec_ch_freq);