From ace2c3c6a4e34d73187911745141cdf4876ccec2 Mon Sep 17 00:00:00 2001 From: Jingxiang Ge Date: Mon, 5 Aug 2019 16:05:31 +0800 Subject: [PATCH] qcacld-3.0: Move vdev to DFS CAC state if channel is dfs After got restart channel rsp from fw, vdev state will change as: ST-RESTART_PROG->ST-CONN_PROG. In lim_send_sme_ap_channel_switch_resp, if channel is non-dfs, vdev state will change to up; if dfs channel, later it will change to DFS CAC when starting cac timer. Current issue is if there is ap stop after restart channel rsp, while processing WLAN_VDEV_SM_EV_DOWN, there is no hanler in ST-CONN_PROG > ST-DISCONN_PROG. From design perspective, In SAP, ST_CONN_PROG is a dummy state, ideally, SAP state should change as below without preemption : RESTART_PROGRESS->CONN_PROGRESS->UP RESTART_PROGRESS->CONN_PROGRESS->DFS_CAC_WAIT To fix issue, change vdev state to DFS_CAC_WAIT in lim_send_sme_ap_channel_switch_resp; So WLAN_VDEV_SM_EV_DOWN will be handled in DFS_CAC_WAIT state. At the same time, set DFS_CAC_WAIT when starting SAP, and clear sap_move_to_cac_wait_state in sap state machine. Change-Id: Iee89521471e456a553f40577da6d1e69aef3b803 CRs-Fixed: 2501339 --- .../src/pe/lim/lim_process_mlm_rsp_messages.c | 2 ++ .../src/pe/lim/lim_send_sme_rsp_messages.c | 10 ++++++- core/mac/src/pe/lim/lim_utils.c | 11 ++++++++ core/mac/src/pe/lim/lim_utils.h | 8 ++++++ core/sap/src/sap_fsm.c | 27 +------------------ 5 files changed, 31 insertions(+), 27 deletions(-) diff --git a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c index a46bdbc16831..161cb2a33862 100644 --- a/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c +++ b/core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c @@ -242,6 +242,8 @@ void lim_process_mlm_start_cnf(struct mac_context *mac, uint32_t *msg_buf) lim_enable_obss_detection_config(mac, pe_session); lim_send_obss_color_collision_cfg(mac, pe_session, OBSS_COLOR_COLLISION_DETECTION); + } else { + lim_sap_move_to_cac_wait_state(pe_session); } } } diff --git a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c index 76f8de048442..6663cc575602 100644 --- a/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c +++ b/core/mac/src/pe/lim/lim_send_sme_rsp_messages.c @@ -1962,6 +1962,11 @@ lim_send_sme_ap_channel_switch_resp(struct mac_context *mac, mmhMsg.bodyval = 0; lim_sys_process_mmh_msg_api(mac, &mmhMsg); + if (QDF_IS_STATUS_ERROR(pChnlParams->status)) { + pe_err("failed to change sap channel to %u", channelId); + return; + } + /* * We should start beacon transmission only if the new * channel after channel change is Non-DFS. For a DFS @@ -1985,7 +1990,10 @@ lim_send_sme_ap_channel_switch_resp(struct mac_context *mac, is_ch_dfs = true; } - if (!is_ch_dfs) { + if (is_ch_dfs) { + lim_sap_move_to_cac_wait_state(pe_session); + + } else { if (channelId == wlan_reg_freq_to_chan( mac->pdev, pe_session->curr_op_freq)) { lim_apply_configuration(mac, pe_session); diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 210650d67a47..f0f0d492717b 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -8013,6 +8013,17 @@ void lim_ndi_mlme_vdev_up_transition(struct pe_session *session) sizeof(*session), session); } +QDF_STATUS lim_sap_move_to_cac_wait_state(struct pe_session *session) +{ + QDF_STATUS status; + + status = + wlan_vdev_mlme_sm_deliver_evt(session->vdev, + WLAN_VDEV_SM_EV_DFS_CAC_WAIT, + sizeof(*session), session); + return status; +} + QDF_STATUS lim_ap_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme, uint16_t data_len, void *data) { diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h index 77bc75e3fa0d..9c0f053606a4 100644 --- a/core/mac/src/pe/lim/lim_utils.h +++ b/core/mac/src/pe/lim/lim_utils.h @@ -1530,6 +1530,14 @@ void lim_send_beacon(struct mac_context *mac_ctx, struct pe_session *session); */ void lim_ndi_mlme_vdev_up_transition(struct pe_session *session); +/** + * lim_sap_move_to_cac_wait_state() - move to cac wait state + * @sap_ctx: SAP context + * + * Return: QDF_STATUS + */ +QDF_STATUS lim_sap_move_to_cac_wait_state(struct pe_session *session); + /** * lim_disconnect_complete - Deliver vdev disconnect complete event or * STA send deleting bss diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 52194e3cd7ee..828373b859fb 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -2321,23 +2321,6 @@ static QDF_STATUS sap_goto_starting(struct sap_context *sap_ctx, return qdf_status; } -/** - * sap_move_to_cac_wait_state() - move to cac wait state - * @sap_ctx: SAP context - * - * Return: QDF_STATUS - */ -static QDF_STATUS sap_move_to_cac_wait_state(struct sap_context *sap_ctx) -{ - QDF_STATUS status; - - status = - wlan_vdev_mlme_sm_deliver_evt(sap_ctx->vdev, - WLAN_VDEV_SM_EV_DFS_CAC_WAIT, - 0, NULL); - return status; -} - /** * sap_fsm_cac_start() - start cac wait timer * @sap_ctx: SAP context @@ -2359,8 +2342,6 @@ static QDF_STATUS sap_fsm_cac_start(struct sap_context *sap_ctx, FL("sapdfs: starting dfs cac timer on sapctx[%pK]"), sap_ctx); sap_start_dfs_cac_timer(sap_ctx); - } else { - sap_move_to_cac_wait_state(sap_ctx); } return sap_cac_start_notify(mac_handle); @@ -3690,8 +3671,6 @@ static int sap_start_dfs_cac_timer(struct sap_context *sap_ctx) QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_DEBUG, "%s: cac timer offloaded to firmware", __func__); mac->sap.SapDfsInfo.is_dfs_cac_timer_running = true; - sap_move_to_cac_wait_state(sap_ctx); - return 1; } @@ -3720,11 +3699,7 @@ static int sap_start_dfs_cac_timer(struct sap_context *sap_ctx) } mac->sap.SapDfsInfo.is_dfs_cac_timer_running = true; - status = sap_move_to_cac_wait_state(sap_ctx); - if (QDF_IS_STATUS_ERROR(status)) { - qdf_mc_timer_stop(&mac->sap.SapDfsInfo.sap_dfs_cac_timer); - goto destroy_timer; - } + return 0; destroy_timer: