From 731df269de896d4773f6004ed0b3195c06cd8394 Mon Sep 17 00:00:00 2001 From: Jyoti Kumari Date: Fri, 19 Nov 2021 18:29:46 +0530 Subject: [PATCH] qcacld-3.0: Cleanup SAP interface if start_bss is aborted Currently, SAP state machine is moved to INIT state when SAP start is aborted due to timeout or SSR. SAP is not cleaned up in such cases as eWNI_SME_STOP_BSS_REQ (which further issues vdev down and cleanup the peers properly) is not sent to below layers(firmware). Replace qdf_wait_for_event_completion to wait_for_completion_timeout in start_bss which will wait till the normal operation execute irrespective of firmware state/SSR. Change-Id: Ifff2ca9658769cb1145f1c5cb278cd7551cb8c00 CRs-Fixed: 3058550 --- core/hdd/src/wlan_hdd_hostapd.c | 5 +++-- core/hdd/src/wlan_hdd_main.c | 4 ++-- core/hdd/src/wlan_hdd_regulatory.c | 4 ++-- core/sap/src/sap_fsm.c | 10 ++++------ 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index ef76798f9c3f..ce36f71aff6a 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -5885,7 +5885,7 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, goto error; } - qdf_status = qdf_wait_for_event_completion(&hostapd_state->qdf_event, + qdf_status = qdf_wait_single_event(&hostapd_state->qdf_event, SME_CMD_START_BSS_TIMEOUT); wlansap_reset_sap_config_add_ie(config, eUPDATE_IE_ALL); @@ -5902,7 +5902,8 @@ int wlan_hdd_cfg80211_start_bss(struct hdd_adapter *adapter, hdd_set_connection_in_progress(false); sme_get_command_q_status(mac_handle); wlansap_stop_bss(WLAN_HDD_GET_SAP_CTX_PTR(adapter)); - QDF_ASSERT(0); + if (!cds_is_driver_recovering()) + QDF_ASSERT(0); ret = -EINVAL; goto error; } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 44873ffca6ef..5877b6be9a15 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -16292,7 +16292,7 @@ void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit) goto end; hdd_debug("Waiting for SAP to start"); - qdf_status = qdf_wait_for_event_completion(&hostapd_state->qdf_event, + qdf_status = qdf_wait_single_event(&hostapd_state->qdf_event, SME_CMD_START_BSS_TIMEOUT); if (!QDF_IS_STATUS_SUCCESS(qdf_status)) { hdd_err("SAP Start failed"); @@ -18542,7 +18542,7 @@ void hdd_restart_sap(struct hdd_adapter *ap_adapter) hdd_info("Waiting for SAP to start"); qdf_status = - qdf_wait_for_event_completion(&hostapd_state->qdf_event, + qdf_wait_single_event(&hostapd_state->qdf_event, SME_CMD_START_BSS_TIMEOUT); wlansap_reset_sap_config_add_ie(sap_config, eUPDATE_IE_ALL); diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 8d06b73de434..d8383f10b0a3 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -1533,8 +1533,8 @@ static void hdd_restart_sap_with_new_phymode(struct hdd_context *hdd_ctx, hdd_err("SAP Start Bss fail"); return; } - status = qdf_wait_for_event_completion(&hostapd_state->qdf_event, - SME_CMD_START_BSS_TIMEOUT); + status = qdf_wait_single_event(&hostapd_state->qdf_event, + SME_CMD_START_BSS_TIMEOUT); if (!QDF_IS_STATUS_SUCCESS(status)) { mutex_unlock(&hdd_ctx->sap_lock); hdd_err("SAP Start timeout"); diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index f7549900fd3f..a36f8514cab2 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -2433,7 +2433,7 @@ static QDF_STATUS sap_fsm_handle_radar_during_cac(struct sap_context *sap_ctx, } /** - * sap_fsm_handle_start_failure() - handle start failure or stop during cac wait + * sap_fsm_handle_start_failure() - handle sap start failure * @sap_ctx: SAP context * @msg: event msg * @mac_handle: Opaque handle to the global MAC context @@ -2446,13 +2446,11 @@ static QDF_STATUS sap_fsm_handle_start_failure(struct sap_context *sap_ctx, { QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; - if (msg == eSAP_HDD_STOP_INFRA_BSS && - (QDF_IS_STATUS_SUCCESS(wlan_vdev_is_dfs_cac_wait(sap_ctx->vdev)) || - QDF_IS_STATUS_SUCCESS( - wlan_vdev_is_restart_progress(sap_ctx->vdev)))) { + if (msg == eSAP_HDD_STOP_INFRA_BSS) { /* Transition from SAP_STARTING to SAP_STOPPING */ - sap_debug("In cac wait state from state %s => %s", + sap_debug("SAP start is in progress, state from state %s => %s", "SAP_STARTING", "SAP_STOPPING"); + /* * Stop the CAC timer only in following conditions * single AP: if there is a single AP then stop timer