From 4e8524a35d5c783dd2388283d930e7ad24bcc1b9 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Thu, 20 Jun 2019 09:59:58 +0530 Subject: [PATCH] qcacld-3.0: Handle vdev start resp failure in monitor mode In monitor mode even if vdev start fails, vdev up is sent, which leads to assert. Fix is to move the vdev state machine to init state on vdev start failure and not to send vdev up. Change-Id: I89e6294329ba0541d0d86c5728ce36898a199659 CRs-Fixed: 2475370 --- .../src/pe/lim/lim_process_mlm_rsp_messages.c | 31 +++++++++++++++++-- .../src/pe/lim/lim_process_sme_req_messages.c | 2 +- core/mac/src/pe/lim/lim_types.h | 18 ++++++++--- core/wma/src/wma_dev_if.c | 3 +- core/wma/src/wma_utils.c | 15 ++++----- 5 files changed, 52 insertions(+), 17 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 47769c1a5122..fefc06c515ce 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 @@ -3121,6 +3121,24 @@ error: lim_post_sme_message(mac_ctx, LIM_MLM_JOIN_CNF, (uint32_t *)&join_cnf); } +static void lim_handle_mon_switch_channel_rsp(struct pe_session *session, + QDF_STATUS status) +{ + if (session->bssType != eSIR_MONITOR_MODE) + return; + + if (QDF_IS_STATUS_ERROR(status)) { + pe_err("Set channel failed for monitor mode"); + wlan_vdev_mlme_sm_deliver_evt(session->vdev, + WLAN_VDEV_SM_EV_START_REQ_FAIL, + 0, NULL); + return; + } + + wlan_vdev_mlme_sm_deliver_evt(session->vdev, + WLAN_VDEV_SM_EV_START_SUCCESS, 0, NULL); +} + /** * lim_process_switch_channel_rsp() * @@ -3204,7 +3222,6 @@ void lim_process_switch_channel_rsp(struct mac_context *mac, void *body) } break; case LIM_SWITCH_CHANNEL_SAP_DFS: - { /* Note: This event code specific to SAP mode * When SAP session issues channel change as performing * DFS, we will come here. Other sessions, for e.g. P2P @@ -3221,8 +3238,16 @@ void lim_process_switch_channel_rsp(struct mac_context *mac, void *body) policy_mgr_update_connection_info(mac->psoc, pe_session->smeSessionId); policy_mgr_set_do_hw_mode_change_flag(mac->psoc, true); - } - break; + break; + case LIM_SWITCH_CHANNEL_MONITOR: + lim_handle_mon_switch_channel_rsp(pe_session, status); + /* + * If MCC upgrade/DBS downgrade happended during channel switch, + * the policy manager connection table needs to be updated. + */ + policy_mgr_update_connection_info(mac->psoc, + pe_session->smeSessionId); + break; default: break; } 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 b2da3afeb8ad..3136aef895a0 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 @@ -5093,7 +5093,7 @@ static void lim_process_sme_channel_change_request(struct mac_context *mac_ctx, LIM_SWITCH_CHANNEL_SAP_DFS; else session_entry->channelChangeReasonCode = - LIM_SWITCH_CHANNEL_OPERATION; + LIM_SWITCH_CHANNEL_MONITOR; pe_debug("switch old chnl %d to new chnl %d, ch_bw %d, nw_type %d, dot11mode %d", session_entry->currentOperChannel, diff --git a/core/mac/src/pe/lim/lim_types.h b/core/mac/src/pe/lim/lim_types.h index 5634b23b4959..7f8e48e0a0e8 100644 --- a/core/mac/src/pe/lim/lim_types.h +++ b/core/mac/src/pe/lim/lim_types.h @@ -131,15 +131,23 @@ enum eLimDisassocTrigger { eLIM_DUPLICATE_ENTRY }; -/* Reason code to determine the channel change context while sending - * WMA_CHNL_SWITCH_REQ message to HAL +/** + * enum eChannelChangeReasonCodes - Reason code to determine the channel change + * reason + * @LIM_SWITCH_CHANNEL_REASSOC: channel switch to reassoc + * @LIM_SWITCH_CHANNEL_JOIN: switch for connect req + * @LIM_SWITCH_CHANNEL_OPERATION: Generic change channel for STA + * @LIM_SWITCH_CHANNEL_SAP_DFS: SAP channel change req + * @LIM_SWITCH_CHANNEL_HT_WIDTH: HT channel width change reg + * @LIM_SWITCH_CHANNEL_MONITOR: Monitor mode channel change req */ enum eChannelChangeReasonCodes { LIM_SWITCH_CHANNEL_REASSOC, LIM_SWITCH_CHANNEL_JOIN, - LIM_SWITCH_CHANNEL_OPERATION, /* Generic change channel */ - LIM_SWITCH_CHANNEL_SAP_DFS, /* DFS channel change */ - LIM_SWITCH_CHANNEL_HT_WIDTH /* HT channel width change */ + LIM_SWITCH_CHANNEL_OPERATION, + LIM_SWITCH_CHANNEL_SAP_DFS, + LIM_SWITCH_CHANNEL_HT_WIDTH, + LIM_SWITCH_CHANNEL_MONITOR, }; typedef struct sLimMlmStartReq { diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index e5b8dfdfb4c0..8760d6f00ece 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -1283,7 +1283,8 @@ wma_handle_channel_switch_resp(tp_wma_handle wma, /* Indicate channel switch failure to LIM */ if (QDF_IS_STATUS_ERROR(params->status) && - (wma_is_vdev_in_ap_mode(wma, resp_event->vdev_id) || + (iface->type == WMI_VDEV_TYPE_MONITOR || + wma_is_vdev_in_ap_mode(wma, resp_event->vdev_id) || mlme_is_chan_switch_in_progress(iface->vdev))) { mlme_set_chan_switch_in_progress(iface->vdev, false); wma_send_msg_high_priority(wma, WMA_SWITCH_CHANNEL_RSP, diff --git a/core/wma/src/wma_utils.c b/core/wma/src/wma_utils.c index 393b4e72bafb..60fd27539d2a 100644 --- a/core/wma/src/wma_utils.c +++ b/core/wma/src/wma_utils.c @@ -5067,13 +5067,17 @@ QDF_STATUS wma_ap_mlme_vdev_stop_start_send(struct vdev_mlme_obj *vdev_mlme, QDF_STATUS wma_mon_mlme_vdev_start_continue(struct vdev_mlme_obj *vdev_mlme, uint16_t data_len, void *data) { + tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA); + + if (!wma) { + WMA_LOGE("%s wma handle is NULL", __func__); + return QDF_STATUS_E_INVAL; + } + if (mlme_is_chan_switch_in_progress(vdev_mlme->vdev)) mlme_set_chan_switch_in_progress(vdev_mlme->vdev, false); - wlan_vdev_mlme_sm_deliver_evt(vdev_mlme->vdev, - WLAN_VDEV_SM_EV_START_SUCCESS, - data_len, - data); + wma_send_msg_high_priority(wma, WMA_SWITCH_CHANNEL_RSP, data, 0); return QDF_STATUS_SUCCESS; } @@ -5101,9 +5105,6 @@ QDF_STATUS wma_mon_mlme_vdev_up_send(struct vdev_mlme_obj *vdev_mlme, WMA_LOGE("%s: Failed to send vdev up cmd: vdev %d bssid %pM", __func__, vdev_id, iface->bssid); - wma_send_msg_high_priority(wma, WMA_SWITCH_CHANNEL_RSP, - data, 0); - return status; }