qcacld-3.0: Fix sap_dfs_wakelock not released when SAP stop

When SAP start as pri freq: 5180, 160M,  pri freq isn’t DFS freq, but
bonded freqs are DFS freq, so sap_dfs_wakelock is held.
After SAP restart as pri freq: 5180, 80M, pri freq and bonded freqs are
not DFS freq, so sap_dfs_wakelock isn’t released.

To fix it, add ch_params_before_ch_switch in sap_context, which includes
ch_width/ccfs0/ccfs1, can get all bonded sub channel info.
Add ch_params parameter in API hdd_hostapd_channel_allow_suspend and
hdd_hostapd_channel_prevent_suspend.

Call wlan_mlme_check_chan_param_has_dfs in them instead of
sap_chan_bond_dfs_sub_chan with

CRs-Fixed: 3777779
Change-Id: I7e32317b2ffab6f8de5990aeed68e7bd02527d6f
This commit is contained in:
Jianmin Zhu
2024-04-06 18:03:42 +08:00
zatwierdzone przez Ravindra Konda
rodzic a1fa06e4d6
commit 4f3d9a269a
3 zmienionych plików z 30 dodań i 16 usunięć

Wyświetl plik

@@ -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

Wyświetl plik

@@ -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

Wyświetl plik

@@ -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);