From 3d47803b3033ecb669b8f4d0757c648254d3c65d Mon Sep 17 00:00:00 2001 From: Vignesh Viswanathan Date: Thu, 2 Aug 2018 20:18:53 +0530 Subject: [PATCH] qcacld-3.0: Stop Roaming before handing CSA for STA Currently if the FW sends a Roam Start while the host is handling the CSA Offload event and triggering a vdev_restart, the FW asserts when the it receives the vdev_restart as it has already started the Roam. Disable roaming by sending RSO Stop when the CSA offload event is received from the FW and restart RSO when channel switch is complete. Change-ID: I33e9ce6307bc36994eb5f4a99434cb76ce5d3184 CRs-Fixed: 2289047 --- core/hdd/src/wlan_hdd_assoc.c | 6 ++++++ core/mac/inc/ani_global.h | 2 ++ core/mac/inc/sir_api.h | 1 + .../src/pe/lim/lim_process_sme_req_messages.c | 1 + .../mac/src/pe/lim/lim_send_sme_rsp_messages.c | 6 ++++++ core/sme/src/common/sme_api.c | 4 +++- core/sme/src/csr/csr_api_roam.c | 18 +++++++++--------- 7 files changed, 28 insertions(+), 10 deletions(-) diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 08c6a25c1a54..a389031ea759 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -4485,10 +4485,16 @@ static void hdd_roam_channel_switch_handler(struct hdd_adapter *adapter, struct wiphy *wiphy = wdev->wiphy; QDF_STATUS status; struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + mac_handle_t mac_handle = hdd_adapter_get_mac_handle(adapter); hdd_debug("channel switch for session:%d to channel:%d", adapter->session_id, roam_info->chan_info.chan_id); + /* Enable Roaming on STA interface which was disabled before CSA */ + if (adapter->device_mode == QDF_STA_MODE) + sme_start_roaming(mac_handle, adapter->session_id, + REASON_DRIVER_ENABLED); + chan_change.chan = roam_info->chan_info.chan_id; chan_change.chan_params.ch_width = roam_info->chan_info.ch_width; diff --git a/core/mac/inc/ani_global.h b/core/mac/inc/ani_global.h index f3f94781fd33..e1e648f5c494 100644 --- a/core/mac/inc/ani_global.h +++ b/core/mac/inc/ani_global.h @@ -759,6 +759,8 @@ typedef struct sAniSirLim { uint8_t gLimDfsTargetChanNum; QDF_STATUS(*sme_msg_callback) (tpAniSirGlobal mac, struct scheduler_msg *msg); + QDF_STATUS(*stop_roaming_callback) + (tpAniSirGlobal mac, uint8_t session_id, uint8_t reason); uint8_t retry_packet_cnt; uint8_t beacon_probe_rsp_cnt_per_scan; wlan_scan_requester req_id; diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 9a83acfb6e72..7509ed7be6ce 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -416,6 +416,7 @@ typedef struct sSirSmeReadyReq { uint16_t transactionId; void *csr_roam_synch_cb; void *pe_roam_synch_cb; + void *stop_roaming_cb; QDF_STATUS (*sme_msg_cb)(tpAniSirGlobal mac, struct scheduler_msg *msg); } tSirSmeReadyReq, *tpSirSmeReadyReq; diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c index 3a276814535f..19b6bd0fbd13 100644 --- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c @@ -469,6 +469,7 @@ static bool __lim_process_sme_sys_ready_ind(tpAniSirGlobal pMac, uint32_t *pMsgB pe_register_mgmt_rx_frm_callback(pMac); pe_register_callbacks_with_wma(pMac, ready_req); pMac->lim.sme_msg_callback = ready_req->sme_msg_cb; + pMac->lim.stop_roaming_callback = ready_req->stop_roaming_cb; } pe_debug("sending WMA_SYS_READY_IND msg to HAL"); 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 5b37358454b7..a0bf50aef6ee 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 @@ -2167,6 +2167,12 @@ void lim_handle_csa_offload_msg(tpAniSirGlobal mac_ctx, (session_entry->dot11mode == WNI_CFG_DOT11_MODE_11G_ONLY))) session_entry->dot11mode = WNI_CFG_DOT11_MODE_11A; + /* Send RSO Stop to FW before triggering the vdev restart for CSA */ + if (mac_ctx->lim.stop_roaming_callback) + mac_ctx->lim.stop_roaming_callback(mac_ctx, + session_entry->smeSessionId, + ecsr_driver_disabled); + lim_prepare_for11h_channel_switch(mac_ctx, session_entry); csa_offload_ind->mesgType = eWNI_SME_CSA_OFFLOAD_EVENT; diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 7facf77fc483..8d374a177b3b 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -1166,6 +1166,7 @@ QDF_STATUS sme_hdd_ready_ind(tHalHandle hHal) msg->length = sizeof(*msg); msg->csr_roam_synch_cb = csr_roam_synch_callback; msg->sme_msg_cb = sme_process_msg_callback; + msg->stop_roaming_cb = sme_stop_roaming; status = u_mac_post_ctrl_msg(hHal, (tSirMbMsg *)msg); if (QDF_IS_STATUS_ERROR(status)) { @@ -6883,7 +6884,8 @@ QDF_STATUS sme_stop_roaming(tHalHandle hal, uint8_t session_id, uint8_t reason) * is not enabled on this session so that roam start requests for * this session can be blocked until driver enables roaming */ - if (reason == ecsr_driver_disabled && session->pCurRoamProfile) { + if (reason == ecsr_driver_disabled && session->pCurRoamProfile && + session->pCurRoamProfile->csrPersona == QDF_STA_MODE) { session->pCurRoamProfile->driver_disabled_roaming = true; sme_debug("driver_disabled_roaming set for session %d", session_id); diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 849077a83da3..5415d86571b2 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -19852,14 +19852,6 @@ csr_roam_offload_scan(tpAniSirGlobal mac_ctx, uint8_t session_id, return QDF_STATUS_E_FAILURE; } - if ((ROAM_SCAN_OFFLOAD_START == command && - REASON_CTX_INIT != reason) && - (session->pCurRoamProfile && - session->pCurRoamProfile->supplicant_disabled_roaming)) { - sme_debug("Supplicant disabled driver roaming"); - return QDF_STATUS_E_FAILURE; - } - if (command == ROAM_SCAN_OFFLOAD_START && (session->pCurRoamProfile && session->pCurRoamProfile->driver_disabled_roaming)) { @@ -19875,6 +19867,14 @@ csr_roam_offload_scan(tpAniSirGlobal mac_ctx, uint8_t session_id, } } + if ((ROAM_SCAN_OFFLOAD_START == command && + REASON_CTX_INIT != reason) && + (session->pCurRoamProfile && + session->pCurRoamProfile->supplicant_disabled_roaming)) { + sme_debug("Supplicant disabled driver roaming"); + return QDF_STATUS_E_FAILURE; + } + if (0 == csr_roam_is_roam_offload_scan_enabled(mac_ctx)) { sme_err("isRoamOffloadScanEnabled not set"); return QDF_STATUS_E_FAILURE; @@ -19896,7 +19896,7 @@ csr_roam_offload_scan(tpAniSirGlobal mac_ctx, uint8_t session_id, /* Roaming is not supported currently for FILS akm */ if (session->pCurRoamProfile && CSR_IS_AUTH_TYPE_FILS( session->pCurRoamProfile->AuthType.authType[0]) && - !mac_ctx->is_fils_roaming_supported) { + !mac_ctx->is_fils_roaming_supported) { sme_info("FILS Roaming not suppprted by fw"); return QDF_STATUS_SUCCESS; }