qcacld-3.0: Move channel switch progress variable to ap context

The variable is used in SAP/P2P-GO modes, so move this variable
to ap_ctx.
Existing callers are moved to deflink pointer.

Change-Id: I9acc20d3fb397c241adaf85daecff099cc236897
CRs-Fixed: 3452166
This commit is contained in:
Vinod Kumar Pirla
2023-02-23 22:59:04 -08:00
committed by Rahul Choudhary
parent 529eb875d6
commit fe564c7440
4 changed files with 33 additions and 27 deletions

View File

@@ -807,6 +807,7 @@ struct hdd_fw_txrx_stats {
* @vendor_acs_timer_initialized: Is @vendor_acs_timer initialized? * @vendor_acs_timer_initialized: Is @vendor_acs_timer initialized?
* @bss_stop_reason: Reason why the BSS was stopped * @bss_stop_reason: Reason why the BSS was stopped
* @acs_in_progress: In progress acs flag for an adapter * @acs_in_progress: In progress acs flag for an adapter
* @ch_switch_in_progress: channel change in progress or not
* @client_count: client count per dot11_mode * @client_count: client count per dot11_mode
* @country_ie_updated: country ie is updated or not by hdd hostapd * @country_ie_updated: country ie is updated or not by hdd hostapd
* @during_auth_offload: auth mgmt frame is offloading to hostapd * @during_auth_offload: auth mgmt frame is offloading to hostapd
@@ -828,6 +829,7 @@ struct hdd_ap_ctx {
bool vendor_acs_timer_initialized; bool vendor_acs_timer_initialized;
enum bss_stop_reason bss_stop_reason; enum bss_stop_reason bss_stop_reason;
qdf_atomic_t acs_in_progress; qdf_atomic_t acs_in_progress;
qdf_atomic_t ch_switch_in_progress;
uint16_t client_count[QCA_WLAN_802_11_MODE_INVALID]; uint16_t client_count[QCA_WLAN_802_11_MODE_INVALID];
bool country_ie_updated; bool country_ie_updated;
bool during_auth_offload; bool during_auth_offload;
@@ -1092,7 +1094,6 @@ struct wlan_hdd_tx_power {
* @cache_sta_count: number of currently cached stations * @cache_sta_count: number of currently cached stations
* @wapi_info: * @wapi_info:
* @sap_stop_bss_work: * @sap_stop_bss_work:
* @ch_switch_in_progress:
* @tsf: structure containing tsf related information * @tsf: structure containing tsf related information
* @mc_addr_list: * @mc_addr_list:
* @addr_filter_pattern: * @addr_filter_pattern:
@@ -1241,8 +1242,6 @@ struct hdd_adapter {
struct work_struct sap_stop_bss_work; struct work_struct sap_stop_bss_work;
qdf_atomic_t ch_switch_in_progress;
#ifdef WLAN_FEATURE_TSF #ifdef WLAN_FEATURE_TSF
struct hdd_vdev_tsf tsf; struct hdd_vdev_tsf tsf;
#endif #endif

View File

@@ -2159,7 +2159,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
hostapd_state->qdf_status = hostapd_state->qdf_status =
sap_event->sapevt.sapStartBssCompleteEvent.status; sap_event->sapevt.sapStartBssCompleteEvent.status;
qdf_atomic_set(&adapter->ch_switch_in_progress, 0); qdf_atomic_set(&ap_ctx->ch_switch_in_progress, 0);
wlansap_get_dfs_ignore_cac(mac_handle, &ignoreCAC); wlansap_get_dfs_ignore_cac(mac_handle, &ignoreCAC);
if (!policy_mgr_get_dfs_master_dynamic_enabled( if (!policy_mgr_get_dfs_master_dynamic_enabled(
hdd_ctx->psoc, adapter->deflink->vdev_id)) hdd_ctx->psoc, adapter->deflink->vdev_id))
@@ -2394,7 +2394,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
hdd_debug("Sent CAC start to user space"); hdd_debug("Sent CAC start to user space");
} }
qdf_atomic_set(&adapter->ch_switch_in_progress, 0); qdf_atomic_set(&ap_ctx->ch_switch_in_progress, 0);
hdd_stop_tsf_sync(adapter); hdd_stop_tsf_sync(adapter);
break; break;
case eSAP_DFS_CAC_INTERRUPTED: case eSAP_DFS_CAC_INTERRUPTED:
@@ -3057,7 +3057,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(struct sap_event *sap_event,
* roaming once channel change process (success/failure) * roaming once channel change process (success/failure)
* is completed * is completed
*/ */
qdf_atomic_set(&adapter->ch_switch_in_progress, 0); qdf_atomic_set(&ap_ctx->ch_switch_in_progress, 0);
policy_mgr_set_chan_switch_complete_evt(hdd_ctx->psoc); policy_mgr_set_chan_switch_complete_evt(hdd_ctx->psoc);
wlan_hdd_enable_roaming(adapter, wlan_hdd_enable_roaming(adapter,
RSO_SAP_CHANNEL_CHANGE); RSO_SAP_CHANNEL_CHANGE);
@@ -3380,6 +3380,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq,
struct hdd_adapter *sta_adapter; struct hdd_adapter *sta_adapter;
struct hdd_station_ctx *sta_ctx; struct hdd_station_ctx *sta_ctx;
struct sap_context *sap_ctx; struct sap_context *sap_ctx;
struct hdd_ap_ctx *ap_ctx;
uint8_t conc_rule1 = 0; uint8_t conc_rule1 = 0;
uint8_t sta_sap_scc_on_dfs_chnl; uint8_t sta_sap_scc_on_dfs_chnl;
bool is_p2p_go_session = false; bool is_p2p_go_session = false;
@@ -3403,6 +3404,8 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq,
sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink); sap_ctx = WLAN_HDD_GET_SAP_CTX_PTR(adapter->deflink);
if (!sap_ctx) if (!sap_ctx)
return -EINVAL; return -EINVAL;
ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
/* /*
* If sta connection is in progress do not allow SAP channel change from * If sta connection is in progress do not allow SAP channel change from
* user space as it may change the HW mode requirement, for which sta is * user space as it may change the HW mode requirement, for which sta is
@@ -3509,7 +3512,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq,
* once the channel change is completed and SAP will * once the channel change is completed and SAP will
* post eSAP_START_BSS_EVENT success event to HDD. * post eSAP_START_BSS_EVENT success event to HDD.
*/ */
if (qdf_atomic_inc_return(&adapter->ch_switch_in_progress) > 1) { if (qdf_atomic_inc_return(&ap_ctx->ch_switch_in_progress) > 1) {
hdd_err("Channel switch in progress!!"); hdd_err("Channel switch in progress!!");
return -EBUSY; return -EBUSY;
} }
@@ -3537,7 +3540,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq,
forced, forced,
sap_ctx->csa_reason)) { sap_ctx->csa_reason)) {
hdd_err("Channel switch failed due to concurrency check failure"); hdd_err("Channel switch failed due to concurrency check failure");
qdf_atomic_set(&adapter->ch_switch_in_progress, 0); qdf_atomic_set(&ap_ctx->ch_switch_in_progress, 0);
return -EINVAL; return -EINVAL;
} }
@@ -3549,7 +3552,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq,
if (sme_is_any_session_in_middle_of_roaming(hdd_ctx->mac_handle) || if (sme_is_any_session_in_middle_of_roaming(hdd_ctx->mac_handle) ||
hdd_is_roaming_in_progress(hdd_ctx)) { hdd_is_roaming_in_progress(hdd_ctx)) {
hdd_info("Channel switch not allowed as reassoc in progress"); hdd_info("Channel switch not allowed as reassoc in progress");
qdf_atomic_set(&adapter->ch_switch_in_progress, 0); qdf_atomic_set(&ap_ctx->ch_switch_in_progress, 0);
return -EINVAL; return -EINVAL;
} }
/* Disable Roaming on all adapters before doing channel change */ /* Disable Roaming on all adapters before doing channel change */
@@ -3561,7 +3564,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq,
vdev = hdd_objmgr_get_vdev_by_user(adapter->deflink, WLAN_OSIF_ID); vdev = hdd_objmgr_get_vdev_by_user(adapter->deflink, WLAN_OSIF_ID);
if (!vdev) { if (!vdev) {
qdf_atomic_set(&adapter->ch_switch_in_progress, 0); qdf_atomic_set(&ap_ctx->ch_switch_in_progress, 0);
wlan_hdd_enable_roaming(adapter, RSO_SAP_CHANNEL_CHANGE); wlan_hdd_enable_roaming(adapter, RSO_SAP_CHANNEL_CHANGE);
return -EINVAL; return -EINVAL;
} }
@@ -3590,7 +3593,7 @@ int hdd_softap_set_channel_change(struct net_device *dev, int target_chan_freq,
* radar found flag and also restart the netif * radar found flag and also restart the netif
* queues. * queues.
*/ */
qdf_atomic_set(&adapter->ch_switch_in_progress, 0); qdf_atomic_set(&ap_ctx->ch_switch_in_progress, 0);
/* /*
* If Posting of the Channel Change request fails * If Posting of the Channel Change request fails
@@ -4393,15 +4396,18 @@ void hdd_deinit_ap_mode(struct hdd_context *hdd_ctx,
struct hdd_adapter *adapter, struct hdd_adapter *adapter,
bool rtnl_held) bool rtnl_held)
{ {
struct hdd_ap_ctx *ap_ctx;
hdd_enter_dev(adapter->dev); hdd_enter_dev(adapter->dev);
ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
if (test_bit(WMM_INIT_DONE, &adapter->event_flags)) { if (test_bit(WMM_INIT_DONE, &adapter->event_flags)) {
hdd_wmm_adapter_close(adapter); hdd_wmm_adapter_close(adapter);
clear_bit(WMM_INIT_DONE, &adapter->event_flags); clear_bit(WMM_INIT_DONE, &adapter->event_flags);
} }
qdf_atomic_set(&adapter->deflink->session.ap.acs_in_progress, 0); qdf_atomic_set(&ap_ctx->acs_in_progress, 0);
if (qdf_atomic_read(&adapter->ch_switch_in_progress)) { if (qdf_atomic_read(&ap_ctx->ch_switch_in_progress)) {
qdf_atomic_set(&adapter->ch_switch_in_progress, 0); qdf_atomic_set(&ap_ctx->ch_switch_in_progress, 0);
policy_mgr_set_chan_switch_complete_evt(hdd_ctx->psoc); policy_mgr_set_chan_switch_complete_evt(hdd_ctx->psoc);
/* Re-enable roaming on all connected STA vdev */ /* Re-enable roaming on all connected STA vdev */
@@ -4487,7 +4493,7 @@ struct hdd_adapter *hdd_wlan_create_ap_dev(struct hdd_context *hdd_ctx,
spin_lock_init(&adapter->pause_map_lock); spin_lock_init(&adapter->pause_map_lock);
adapter->start_time = adapter->last_time = qdf_system_ticks(); adapter->start_time = adapter->last_time = qdf_system_ticks();
qdf_atomic_init(&adapter->ch_switch_in_progress); qdf_atomic_init(&adapter->deflink->session.ap.ch_switch_in_progress);
return adapter; return adapter;
} }

View File

@@ -3812,20 +3812,25 @@ static bool hdd_is_chan_switch_in_progress(void)
struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
wlan_net_dev_ref_dbgid dbgid = wlan_net_dev_ref_dbgid dbgid =
NET_DEV_HOLD_IS_CHAN_SWITCH_IN_PROGRESS; NET_DEV_HOLD_IS_CHAN_SWITCH_IN_PROGRESS;
struct hdd_ap_ctx *ap_ctx;
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) { dbgid) {
if ((adapter->device_mode == QDF_SAP_MODE || if (!(adapter->device_mode == QDF_SAP_MODE ||
adapter->device_mode == QDF_P2P_GO_MODE) && adapter->device_mode == QDF_P2P_GO_MODE))
qdf_atomic_read(&adapter->ch_switch_in_progress)) { goto next_adapter;
ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter->deflink);
if (qdf_atomic_read(&ap_ctx->ch_switch_in_progress)) {
hdd_debug("channel switch progress for vdev_id %d", hdd_debug("channel switch progress for vdev_id %d",
adapter->deflink->vdev_id); adapter->deflink->vdev_id);
hdd_adapter_dev_put_debug(adapter, dbgid); hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter) if (next_adapter)
hdd_adapter_dev_put_debug(next_adapter, hdd_adapter_dev_put_debug(next_adapter, dbgid);
dbgid);
return true; return true;
} }
next_adapter:
hdd_adapter_dev_put_debug(adapter, dbgid); hdd_adapter_dev_put_debug(adapter, dbgid);
} }

View File

@@ -245,19 +245,15 @@ static int __wlan_hdd_request_pre_cac(struct hdd_context *hdd_ctx,
return -EINVAL; return -EINVAL;
} }
if (qdf_atomic_read(&ap_adapter->ch_switch_in_progress)) { hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(ap_adapter->deflink);
if (qdf_atomic_read(&hdd_ap_ctx->ch_switch_in_progress)) {
hdd_err("pre cac not allowed during CSA"); hdd_err("pre cac not allowed during CSA");
return -EINVAL; return -EINVAL;
} }
mac_handle = hdd_ctx->mac_handle; mac_handle = hdd_ctx->mac_handle;
hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(ap_adapter->deflink);
if (!hdd_ap_ctx) {
hdd_err("SAP context is NULL");
return -EINVAL;
}
if (wlan_reg_is_dfs_for_freq(hdd_ctx->pdev, if (wlan_reg_is_dfs_for_freq(hdd_ctx->pdev,
hdd_ap_ctx->operating_chan_freq)) { hdd_ap_ctx->operating_chan_freq)) {
hdd_err("SAP is already on DFS channel:%d", hdd_err("SAP is already on DFS channel:%d",