diff options
| author | Yeshwanth Sriram Guntuka <ysriramg@codeaurora.org> | 2018-12-20 20:17:38 +0530 |
|---|---|---|
| committer | Abhinav Kumar <abhikuma@codeaurora.org> | 2018-12-26 18:19:43 +0530 |
| commit | cd0525b6e2f436b8aa1b56faf4b0ec73fdc98130 (patch) | |
| tree | 8c4d56d5df7c531ddbb3ec00b1bb7f632d97cd03 | |
| parent | 60eb9268737b5c8340f41659e8fe29a323652af5 (diff) | |
qcacld-3.0: Fix e_sme_command_nss_update stuck issue
Update NSS command is remove once driver receive the tx completion
event for the beacon. If SAP is in CAC wait state driver will not
get the tx completion for the beacon and the update NSS will timeout
after 30 sec and the serialization cmds queues will get stuck.
To avoid this remove the update NSS command from active queue as
soon as beacon is sent to firmware
Change-Id: I6f5b6bce91bdfacd4621020f313be25f74696b9d
CRs-Fixed: 2332302
| -rw-r--r-- | core/mac/inc/sir_api.h | 32 | ||||
| -rw-r--r-- | core/mac/src/include/sir_params.h | 1 | ||||
| -rw-r--r-- | core/mac/src/pe/include/sch_api.h | 28 | ||||
| -rw-r--r-- | core/mac/src/pe/lim/lim_ibss_peer_mgmt.c | 4 | ||||
| -rw-r--r-- | core/mac/src/pe/lim/lim_process_message_queue.c | 8 | ||||
| -rw-r--r-- | core/mac/src/pe/lim/lim_process_mlm_rsp_messages.c | 19 | ||||
| -rw-r--r-- | core/mac/src/pe/lim/lim_process_sme_req_messages.c | 90 | ||||
| -rw-r--r-- | core/mac/src/pe/lim/lim_send_messages.c | 2 | ||||
| -rw-r--r-- | core/mac/src/pe/lim/lim_send_sme_rsp_messages.c | 29 | ||||
| -rw-r--r-- | core/mac/src/pe/lim/lim_types.h | 28 | ||||
| -rw-r--r-- | core/mac/src/pe/lim/lim_utils.c | 5 | ||||
| -rw-r--r-- | core/mac/src/pe/sch/sch_api.c | 25 | ||||
| -rw-r--r-- | core/mac/src/pe/sch/sch_beacon_gen.c | 86 | ||||
| -rw-r--r-- | core/sme/src/common/sme_api.c | 12 | ||||
| -rw-r--r-- | core/sme/src/csr/csr_api_roam.c | 14 | ||||
| -rw-r--r-- | core/wma/inc/wma_if.h | 6 | ||||
| -rw-r--r-- | core/wma/inc/wma_types.h | 1 | ||||
| -rw-r--r-- | core/wma/src/wma_main.c | 1 | ||||
| -rw-r--r-- | core/wma/src/wma_mgmt.c | 17 |
19 files changed, 261 insertions, 147 deletions
diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index c4795c1f745f..e31fbd8ea88c 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -6807,14 +6807,34 @@ struct sir_nss_update_request { }; /** - * struct sir_beacon_tx_complete_rsp + * enum sir_bcn_update_reason: bcn update reason + * @REASON_DEFAULT: reason default + * @REASON_NSS_UPDATE: If NSS is updated + * @REASON_CONFIG_UPDATE: Config update + * @REASON_SET_HT2040: HT2040 update + * @REASON_COLOR_CHANGE: Color change + * @REASON_CHANNEL_SWITCH: channel switch + */ +enum sir_bcn_update_reason { + REASON_DEFAULT = 0, + REASON_NSS_UPDATE = 1, + REASON_CONFIG_UPDATE = 2, + REASON_SET_HT2040 = 3, + REASON_COLOR_CHANGE = 4, + REASON_CHANNEL_SWITCH = 5, +}; + +/** + * struct sir_bcn_update_rsp * - * @session_id: session for which beacon update happened - * @tx_status: status of the beacon tx from FW + * @vdev_id: session for which bcn was updated + * @reason: bcn update reason + * @status: status of the beacon sent to FW */ -struct sir_beacon_tx_complete_rsp { - uint8_t session_id; - uint8_t tx_status; +struct sir_bcn_update_rsp { + uint8_t vdev_id; + enum sir_bcn_update_reason reason; + QDF_STATUS status; }; typedef void (*nss_update_cb)(void *context, uint8_t tx_status, uint8_t vdev_id, diff --git a/core/mac/src/include/sir_params.h b/core/mac/src/include/sir_params.h index 228a67d0faa7..e6845a39b9a9 100644 --- a/core/mac/src/include/sir_params.h +++ b/core/mac/src/include/sir_params.h @@ -704,6 +704,7 @@ struct sir_mgmt_msg { #define SIR_HAL_INVOKE_NEIGHBOR_REPORT (SIR_HAL_ITC_MSG_TYPES_BEGIN + 391) #define SIR_HAL_NDP_SCH_UPDATE_IND (SIR_HAL_ITC_MSG_TYPES_BEGIN + 392) #define SIR_HAL_GET_ROAM_SCAN_STATS (SIR_HAL_ITC_MSG_TYPES_BEGIN + 393) +#define SIR_HAL_SEND_BCN_RSP (SIR_HAL_ITC_MSG_TYPES_BEGIN + 394) #define SIR_HAL_MSG_TYPES_END (SIR_HAL_MSG_TYPES_BEGIN + 0x1FF) /* CFG message types */ diff --git a/core/mac/src/pe/include/sch_api.h b/core/mac/src/pe/include/sch_api.h index e23b49c91a3b..8923a471238f 100644 --- a/core/mac/src/pe/include/sch_api.h +++ b/core/mac/src/pe/include/sch_api.h @@ -68,8 +68,17 @@ extern void sch_initializeCfEndTemplate(tpAniSirGlobal pMac); /* / Process the scheduler messages */ extern void sch_process_message(tpAniSirGlobal pMac, tpSirMsgQ pSchMsg); -/* / The beacon Indication handler function */ -extern void sch_process_pre_beacon_ind(tpAniSirGlobal pMac, tpSirMsgQ limMsg); +/** + * sch_process_pre_beacon_ind() - Process the PreBeacon Indication from the Lim + * @pMac: pointer to mac structure + * @limMsg: Lim Msg + * @reason: beaon update reason + * + * return: success: QDF_STATUS_SUCCESS failure: QDF_STATUS_E_FAILURE + */ +extern QDF_STATUS sch_process_pre_beacon_ind(tpAniSirGlobal pMac, + tpSirMsgQ limMsg, + enum sir_bcn_update_reason reason); /* / Post a message to the scheduler message queue */ extern tSirRetStatus sch_post_message(tpAniSirGlobal pMac, tpSirMsgQ pMsg); @@ -85,8 +94,19 @@ void sch_generate_tim(tpAniSirGlobal, uint8_t **, uint16_t *, uint8_t); void sch_set_beacon_interval(tpAniSirGlobal pMac, tpPESession psessionEntry); -tSirRetStatus sch_send_beacon_req(tpAniSirGlobal, uint8_t *, uint16_t, - tpPESession psessionEntry); +/** + * sch_send_beacon_req() - send beacon update req to wma + * @mac_ctx: pointer to mac structure + * @bcn_payload: beacon payload + * @size: beacon size + * @session:pe session + * @reason: beaon update reason + * + * return: success: QDF_STATUS_SUCCESS failure: QDF_STATUS_E_FAILURE + */ +QDF_STATUS sch_send_beacon_req(tpAniSirGlobal mac_ctx, uint8_t *bcn_payload, + uint16_t size, tpPESession session, + enum sir_bcn_update_reason reason); tSirRetStatus lim_update_probe_rsp_template_ie_bitmap_beacon1(tpAniSirGlobal, tDot11fBeacon1 *, diff --git a/core/mac/src/pe/lim/lim_ibss_peer_mgmt.c b/core/mac/src/pe/lim/lim_ibss_peer_mgmt.c index 4f2de438aa69..c5f797c15556 100644 --- a/core/mac/src/pe/lim/lim_ibss_peer_mgmt.c +++ b/core/mac/src/pe/lim/lim_ibss_peer_mgmt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -1277,7 +1277,7 @@ void lim_ibss_add_bss_rsp_when_coalescing(tpAniSirGlobal pMac, void *msg, infoLen, pSessionEntry->smeSessionId); { /* Configure beacon and send beacons to HAL */ - lim_send_beacon_ind(pMac, pSessionEntry); + lim_send_beacon_ind(pMac, pSessionEntry, REASON_DEFAULT); } end: diff --git a/core/mac/src/pe/lim/lim_process_message_queue.c b/core/mac/src/pe/lim/lim_process_message_queue.c index 789906a30ba8..09aba231e74e 100644 --- a/core/mac/src/pe/lim/lim_process_message_queue.c +++ b/core/mac/src/pe/lim/lim_process_message_queue.c @@ -1699,7 +1699,8 @@ static void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) break; case SIR_LIM_BEACON_GEN_IND: if (mac_ctx->lim.gLimSystemRole != eLIM_AP_ROLE) - sch_process_pre_beacon_ind(mac_ctx, msg); + sch_process_pre_beacon_ind(mac_ctx, + msg, REASON_DEFAULT); break; case SIR_LIM_DELETE_STA_CONTEXT_IND: lim_delete_sta_context(mac_ctx, msg); @@ -2040,6 +2041,11 @@ static void lim_process_messages(tpAniSirGlobal mac_ctx, tpSirMsgQ msg) qdf_mem_free((void *)msg->bodyptr); msg->bodyptr = NULL; break; + case WMA_SEND_BCN_RSP: + lim_send_bcn_rsp(mac_ctx, (tpSendbeaconParams)msg->bodyptr); + qdf_mem_free((void *)msg->bodyptr); + msg->bodyptr = NULL; + break; default: qdf_mem_free((void *)msg->bodyptr); msg->bodyptr = NULL; 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 dc457fa318a8..4a2e54ae2aa0 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 @@ -244,7 +244,8 @@ void lim_process_mlm_start_cnf(tpAniSirGlobal pMac, uint32_t *pMsgBuf) FL("Start Beacon with ssid %s Ch %d"), psessionEntry->ssId.ssId, psessionEntry->currentOperChannel); - lim_send_beacon_ind(pMac, psessionEntry); + lim_send_beacon_ind(pMac, psessionEntry, + REASON_DEFAULT); } } } @@ -2658,7 +2659,7 @@ void lim_process_mlm_update_hidden_ssid_rsp(tpAniSirGlobal mac_ctx, } /* Update beacon */ sch_set_fixed_beacon_fields(mac_ctx, session_entry); - lim_send_beacon_ind(mac_ctx, session_entry); + lim_send_beacon_ind(mac_ctx, session_entry, REASON_CONFIG_UPDATE); free_req: if (NULL != hidden_ssid_vdev_restart) { @@ -3190,25 +3191,25 @@ free: qdf_mem_free(body); } -void lim_send_beacon_ind(tpAniSirGlobal pMac, tpPESession psessionEntry) +QDF_STATUS lim_send_beacon_ind(tpAniSirGlobal pMac, tpPESession psessionEntry, + enum sir_bcn_update_reason reason) { tBeaconGenParams *pBeaconGenParams = NULL; tSirMsgQ limMsg; /** Allocate the Memory for Beacon Pre Message and for Stations in PoweSave*/ - if (psessionEntry == NULL) { + if (!psessionEntry) { pe_err("Error:Unable to get the PESessionEntry"); - return; + return QDF_STATUS_E_INVAL; } pBeaconGenParams = qdf_mem_malloc(sizeof(*pBeaconGenParams)); - if (NULL == pBeaconGenParams) { + if (!pBeaconGenParams) { pe_err("Unable to allocate memory during sending beaconPreMessage"); - return; + return QDF_STATUS_E_NOMEM; } qdf_mem_copy((void *)pBeaconGenParams->bssId, (void *)psessionEntry->bssId, QDF_MAC_ADDR_SIZE); limMsg.bodyptr = pBeaconGenParams; - sch_process_pre_beacon_ind(pMac, &limMsg); - return; + return sch_process_pre_beacon_ind(pMac, &limMsg, reason); } #ifdef FEATURE_WLAN_SCAN_PNO 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 0a984d5edaff..23cb94ad3491 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 @@ -4029,7 +4029,7 @@ __lim_process_sme_update_apwpsi_es(tpAniSirGlobal pMac, uint32_t *pMsgBuf) sizeof(tSirAPWPSIEs)); sch_set_fixed_beacon_fields(pMac, psessionEntry); - lim_send_beacon_ind(pMac, psessionEntry); + lim_send_beacon_ind(pMac, psessionEntry, REASON_CONFIG_UPDATE); end: qdf_mem_free(pUpdateAPWPSIEsReq); @@ -4074,7 +4074,7 @@ static void lim_process_sme_update_config(tpAniSirGlobal mac_ctx, if (LIM_IS_AP_ROLE(pe_session)) { sch_set_fixed_beacon_fields(mac_ctx, pe_session); - lim_send_beacon_ind(mac_ctx, pe_session); + lim_send_beacon_ind(mac_ctx, pe_session, REASON_CONFIG_UPDATE); } } @@ -4278,7 +4278,7 @@ static void __lim_process_sme_set_wparsni_es(tpAniSirGlobal pMac, uint32_t *pMsg psessionEntry->privacy = 1; sch_set_fixed_beacon_fields(pMac, psessionEntry); - lim_send_beacon_ind(pMac, psessionEntry); + lim_send_beacon_ind(pMac, psessionEntry, REASON_CONFIG_UPDATE); end: qdf_mem_free(pUpdateAPWPARSNIEsReq); @@ -4407,7 +4407,7 @@ static void __lim_process_sme_set_ht2040_mode(tpAniSirGlobal pMac, /* Update beacon */ sch_set_fixed_beacon_fields(pMac, psessionEntry); - lim_send_beacon_ind(pMac, psessionEntry); + lim_send_beacon_ind(pMac, psessionEntry, REASON_SET_HT2040); /* update OP Mode for each associated peer */ for (staId = 0; staId < psessionEntry->dph.dphHashTable.size; staId++) { @@ -5448,7 +5448,7 @@ static void lim_process_sme_start_beacon_req(tpAniSirGlobal pMac, uint32_t *pMsg FL("Start Beacon with ssid %s Ch %d"), psessionEntry->ssId.ssId, psessionEntry->currentOperChannel); - lim_send_beacon_ind(pMac, psessionEntry); + lim_send_beacon_ind(pMac, psessionEntry, REASON_DEFAULT); } else { pe_err("Invalid Beacon Start Indication"); return; @@ -6185,6 +6185,55 @@ static void lim_process_ext_change_channel(tpAniSirGlobal mac_ctx, } /** + * lim_nss_update_rsp() - send NSS update response to SME + * @mac_ctx Pointer to Global MAC structure + * @vdev_id: vdev id + * @status: nss update status + * + * Return: None + */ +static void lim_nss_update_rsp(tpAniSirGlobal mac_ctx, + uint8_t vdev_id, QDF_STATUS status) +{ + cds_msg_t msg = {0}; + struct sir_bcn_update_rsp *nss_rsp; + QDF_STATUS qdf_status; + + nss_rsp = qdf_mem_malloc(sizeof(*nss_rsp)); + if (!nss_rsp) { + pe_err("AllocateMemory failed for nss_rsp"); + return; + } + + nss_rsp->vdev_id = vdev_id; + nss_rsp->status = status; + nss_rsp->reason = REASON_NSS_UPDATE; + + msg.type = eWNI_SME_NSS_UPDATE_RSP; + msg.bodyptr = nss_rsp; + msg.bodyval = 0; + qdf_status = cds_mq_post_message(QDF_MODULE_ID_SME, &msg); + if (QDF_IS_STATUS_ERROR(qdf_status)) { + pe_err("Failed to post eWNI_SME_NSS_UPDATE_RSP"); + qdf_mem_free(nss_rsp); + } +} + +void lim_send_bcn_rsp(tpAniSirGlobal mac_ctx, tpSendbeaconParams rsp) +{ + if (!rsp) { + pe_err("rsp is NULL"); + return; + } + + pe_debug("Send beacon resp status %d for reason %d", + rsp->status, rsp->reason); + + if (rsp->reason == REASON_NSS_UPDATE) + lim_nss_update_rsp(mac_ctx, rsp->vdev_id, rsp->status); +} + +/** * lim_process_nss_update_request() - process sme nss update req * * @mac_ctx: Pointer to Global MAC structure @@ -6200,25 +6249,28 @@ static void lim_process_nss_update_request(tpAniSirGlobal mac_ctx, { struct sir_nss_update_request *nss_update_req_ptr; tpPESession session_entry = NULL; + QDF_STATUS status = QDF_STATUS_E_FAILURE; + uint8_t vdev_id; - if (msg_buf == NULL) { + if (!msg_buf) { pe_err("Buffer is Pointing to NULL"); return; } nss_update_req_ptr = (struct sir_nss_update_request *)msg_buf; + vdev_id = nss_update_req_ptr->vdev_id; session_entry = pe_find_session_by_sme_session_id(mac_ctx, nss_update_req_ptr->vdev_id); - if (session_entry == NULL) { + if (!session_entry) { pe_err("Session not found for given session_id %d", nss_update_req_ptr->vdev_id); - return; + goto end; } if (session_entry->valid && !LIM_IS_AP_ROLE(session_entry)) { pe_err("Invalid SystemRole %d", GET_LIM_SYSTEM_ROLE(session_entry)); - return; + goto end; } /* populate nss field in the beacon */ @@ -6230,16 +6282,28 @@ static void lim_process_nss_update_request(tpAniSirGlobal mac_ctx, (session_entry->ch_width > CH_WIDTH_80MHZ)) session_entry->gLimOperatingMode.chanWidth = CH_WIDTH_80MHZ; - pe_debug("ch width %hu", session_entry->gLimOperatingMode.chanWidth); + pe_debug("ch width %d Rx NSS %d", + session_entry->gLimOperatingMode.chanWidth, + session_entry->gLimOperatingMode.rxNSS); /* Send nss update request from here */ if (sch_set_fixed_beacon_fields(mac_ctx, session_entry) != - eSIR_SUCCESS) { + eSIR_SUCCESS) { pe_err("Unable to set op mode IE in beacon"); - return; + goto end; } - lim_send_beacon_ind(mac_ctx, session_entry); + status = lim_send_beacon_ind(mac_ctx, session_entry, REASON_NSS_UPDATE); + if (QDF_IS_STATUS_SUCCESS(status)) + return; + + pe_err("Unable to send beacon"); +end: + /* + * send resp only in case of failure, + * success case response will be from wma. + */ + lim_nss_update_rsp(mac_ctx, vdev_id, status); } /** diff --git a/core/mac/src/pe/lim/lim_send_messages.c b/core/mac/src/pe/lim/lim_send_messages.c index 52a2766569c2..665a30a72c76 100644 --- a/core/mac/src/pe/lim/lim_send_messages.c +++ b/core/mac/src/pe/lim/lim_send_messages.c @@ -110,7 +110,7 @@ tSirRetStatus lim_send_beacon_params(tpAniSirGlobal pMac, pe_err("Posting WMA_UPDATE_BEACON_IND, reason=%X", retCode); } - lim_send_beacon_ind(pMac, psessionEntry); + lim_send_beacon_ind(pMac, psessionEntry, REASON_DEFAULT); return retCode; } 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 f359621f24dd..915db70b4be6 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 @@ -2568,7 +2568,8 @@ lim_send_sme_ap_channel_switch_resp(tpAniSirGlobal pMac, if (!is_ch_dfs) { if (channelId == psessionEntry->currentOperChannel) { lim_apply_configuration(pMac, psessionEntry); - lim_send_beacon_ind(pMac, psessionEntry); + lim_send_beacon_ind(pMac, psessionEntry, + REASON_CONFIG_UPDATE); } else { pe_debug("Failed to Transmit Beacons on channel: %d after AP channel change response", psessionEntry->bcnLen); @@ -2581,11 +2582,8 @@ void lim_process_beacon_tx_success_ind(tpAniSirGlobal mac_ctx, uint16_t msg_type, void *event) { tpPESession session; - cds_msg_t msg = {0}; - struct sir_beacon_tx_complete_rsp *bcn_tx_comp_rsp; tpSirFirstBeaconTxCompleteInd bcn_ind = (tSirFirstBeaconTxCompleteInd *) event; - QDF_STATUS status; session = pe_find_session_by_bss_idx(mac_ctx, bcn_ind->bssIdx); if (session == NULL) { @@ -2607,24 +2605,9 @@ void lim_process_beacon_tx_success_ind(tpAniSirGlobal mac_ctx, mac_ctx->sap.SapDfsInfo.sap_ch_switch_beacon_cnt)) lim_process_ap_ecsa_timeout(session); - if (session->gLimOperatingMode.present) { - /* Done with nss update, send response back to SME */ + if (session->gLimOperatingMode.present) + /* Done with nss update */ session->gLimOperatingMode.present = 0; - bcn_tx_comp_rsp = (struct sir_beacon_tx_complete_rsp *) - qdf_mem_malloc(sizeof(*bcn_tx_comp_rsp)); - if (NULL == bcn_tx_comp_rsp) { - pe_err("AllocateMemory failed for bcn_tx_comp_rsp"); - return; - } - bcn_tx_comp_rsp->session_id = session->smeSessionId; - bcn_tx_comp_rsp->tx_status = QDF_STATUS_SUCCESS; - msg.type = eWNI_SME_NSS_UPDATE_RSP; - msg.bodyptr = bcn_tx_comp_rsp; - - status = cds_mq_post_message(QDF_MODULE_ID_SME, &msg); - if (QDF_IS_STATUS_ERROR(status)) { - sme_err("Failed to post eWNI_SME_NSS_UPDATE_RSP"); - qdf_mem_free(bcn_tx_comp_rsp); - } - } + + return; } diff --git a/core/mac/src/pe/lim/lim_types.h b/core/mac/src/pe/lim/lim_types.h index 63d03060b192..688a10d5613f 100644 --- a/core/mac/src/pe/lim/lim_types.h +++ b/core/mac/src/pe/lim/lim_types.h @@ -876,20 +876,15 @@ lim_get_ielen_from_bss_description(tpSirBssDescription pBssDescr) } /*** end lim_get_ielen_from_bss_description() ***/ /** - * lim_send_beacon_ind() + * lim_send_beacon_ind() - send the beacon indication + * @mac_ctx: pointer to mac structure + * @session: pe session + * @reason: beacon update reason * - ***FUNCTION: - * This function is called to send the beacon indication - * number being scanned. - * - ***PARAMS: - * - ***LOGIC: - * - ***ASSUMPTIONS: + * return: success: QDF_STATUS_SUCCESS failure: QDF_STATUS_E_FAILURE */ - -void lim_send_beacon_ind(tpAniSirGlobal pMac, tpPESession psessionEntry); +QDF_STATUS lim_send_beacon_ind(tpAniSirGlobal mac_ctx, tpPESession session, + enum sir_bcn_update_reason reason); void lim_send_vdev_restart(tpAniSirGlobal pMac, tpPESession psessionEntry, @@ -954,6 +949,15 @@ tSirRetStatus lim_process_sme_del_all_tdls_peers(tpAniSirGlobal p_mac, #endif /** + * lim_send_bcn_rsp() - handle beacon send response + * @mac_ctx Pointer to Global MAC structure + * @rsp: beacon send response + * + * Return: None + */ +void lim_send_bcn_rsp(tpAniSirGlobal mac_ctx, tpSendbeaconParams rsp); + +/** * lim_process_rx_channel_status_event() - processes * event WDA_RX_CHN_STATUS_EVENT * @mac_ctx Pointer to Global MAC structure diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index f2464cbdae66..b981f7b54f27 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -5513,7 +5513,8 @@ void lim_update_beacon(tpAniSirGlobal mac_ctx) if (false == mac_ctx->sap.SapDfsInfo. is_dfs_cac_timer_running) lim_send_beacon_ind(mac_ctx, - &mac_ctx->lim.gpSession[i]); + &mac_ctx->lim.gpSession[i], + REASON_DEFAULT); } } } @@ -7472,7 +7473,7 @@ lim_send_dfs_chan_sw_ie_update(tpAniSirGlobal mac_ctx, tpPESession session) } /* Send update beacon template message */ - lim_send_beacon_ind(mac_ctx, session); + lim_send_beacon_ind(mac_ctx, session, REASON_CHANNEL_SWITCH); pe_debug("Updated CSA IE, IE COUNT: %d", session->gLimChannelSwitch.switchCount); } diff --git a/core/mac/src/pe/sch/sch_api.c b/core/mac/src/pe/sch/sch_api.c index e82d6d9d32a7..cbc8c3414d53 100644 --- a/core/mac/src/pe/sch/sch_api.c +++ b/core/mac/src/pe/sch/sch_api.c @@ -178,12 +178,14 @@ void sch_send_start_scan_rsp(tpAniSirGlobal pMac) * * @return QDF_STATUS */ -tSirRetStatus sch_send_beacon_req(tpAniSirGlobal pMac, uint8_t *beaconPayload, - uint16_t size, tpPESession psessionEntry) +QDF_STATUS sch_send_beacon_req(tpAniSirGlobal pMac, uint8_t *beaconPayload, + uint16_t size, tpPESession psessionEntry, + enum sir_bcn_update_reason reason) { tSirMsgQ msgQ; tpSendbeaconParams beaconParams = NULL; tSirRetStatus retCode; + QDF_STATUS status = QDF_STATUS_SUCCESS; if (LIM_IS_AP_ROLE(psessionEntry) && (pMac->sch.schObject.fBeaconChanged)) { @@ -199,7 +201,7 @@ tSirRetStatus sch_send_beacon_req(tpAniSirGlobal pMac, uint8_t *beaconPayload, } beaconParams = qdf_mem_malloc(sizeof(tSendbeaconParams)); if (NULL == beaconParams) - return eSIR_MEM_ALLOC_FAILED; + return QDF_STATUS_E_NOMEM; msgQ.type = WMA_SEND_BEACON_REQ; @@ -225,6 +227,9 @@ tSirRetStatus sch_send_beacon_req(tpAniSirGlobal pMac, uint8_t *beaconPayload, } } + beaconParams->vdev_id = psessionEntry->smeSessionId; + beaconParams->reason = reason; + /* p2pIeOffset should be atleast greater than timIeOffset */ if ((pMac->sch.schObject.p2pIeOffset != 0) && (pMac->sch.schObject.p2pIeOffset < @@ -233,7 +238,7 @@ tSirRetStatus sch_send_beacon_req(tpAniSirGlobal pMac, uint8_t *beaconPayload, pMac->sch.schObject.p2pIeOffset); QDF_ASSERT(0); qdf_mem_free(beaconParams); - return eSIR_FAILURE; + return QDF_STATUS_E_FAILURE; } beaconParams->p2pIeOffset = pMac->sch.schObject.p2pIeOffset; #ifdef WLAN_SOFTAP_FW_BEACON_TX_PRNT_LOG @@ -243,9 +248,9 @@ tSirRetStatus sch_send_beacon_req(tpAniSirGlobal pMac, uint8_t *beaconPayload, if (size >= SIR_MAX_BEACON_SIZE) { pe_err("beacon size (%d) exceed host limit %d", size, SIR_MAX_BEACON_SIZE); - QDF_ASSERT(0); - qdf_mem_free(beaconParams); - return eSIR_FAILURE; + QDF_ASSERT(0); + qdf_mem_free(beaconParams); + return QDF_STATUS_E_FAILURE; } qdf_mem_copy(beaconParams->beacon, beaconPayload, size); @@ -271,11 +276,13 @@ tSirRetStatus sch_send_beacon_req(tpAniSirGlobal pMac, uint8_t *beaconPayload, MTRACE(mac_trace_msg_tx(pMac, psessionEntry->peSessionId, msgQ.type)); retCode = wma_post_ctrl_msg(pMac, &msgQ); - if (eSIR_SUCCESS != retCode) + if (eSIR_SUCCESS != retCode) { + status = QDF_STATUS_E_FAILURE; pe_err("Posting SEND_BEACON_REQ to HAL failed, reason=%X", retCode); + } - return retCode; + return status; } static uint32_t lim_remove_p2p_ie_from_add_ie(tpAniSirGlobal pMac, diff --git a/core/mac/src/pe/sch/sch_beacon_gen.c b/core/mac/src/pe/sch/sch_beacon_gen.c index 4d96187c839d..f4ea26b5d5de 100644 --- a/core/mac/src/pe/sch/sch_beacon_gen.c +++ b/core/mac/src/pe/sch/sch_beacon_gen.c @@ -861,29 +861,24 @@ void set_probe_rsp_ie_bitmap(uint32_t *IeBitmap, uint32_t pos) IeBitmap[index] = temp; } -/* -------------------------------------------------------------------- */ /** - * write_beacon_to_memory + * write_beacon_to_memory() - send the beacon to the wma + * @pMac: pointer to mac structure + * @size: Size of the beacon to write to memory + * @length: Length field of the beacon to write to memory + * @psessionEntry: pe session + * @reason: beacon update reason * - * FUNCTION: - * - * LOGIC: - * - * ASSUMPTIONS: - * - * NOTE: - * - * @param None - * @param size Size of the beacon to write to memory - * @param length Length field of the beacon to write to memory - * @return None + * return: success: QDF_STATUS_SUCCESS failure: QDF_STATUS_E_FAILURE */ - -static void write_beacon_to_memory(tpAniSirGlobal pMac, uint16_t size, - uint16_t length, tpPESession psessionEntry) +static QDF_STATUS write_beacon_to_memory(tpAniSirGlobal pMac, uint16_t size, + uint16_t length, + tpPESession psessionEntry, + enum sir_bcn_update_reason reason) { uint16_t i; tpAniBeaconStruct pBeacon; + QDF_STATUS status = QDF_STATUS_SUCCESS; /* copy end of beacon only if length > 0 */ if (length > 0) { @@ -902,7 +897,7 @@ static void write_beacon_to_memory(tpAniSirGlobal pMac, uint16_t size, pBeacon->beaconLength = (uint32_t) size - sizeof(uint32_t); if (!pMac->sch.schObject.fBeaconChanged) - return; + return QDF_STATUS_E_FAILURE; pMac->sch.gSchGenBeacon = 1; if (pMac->sch.gSchGenBeacon) { @@ -914,16 +909,20 @@ static void write_beacon_to_memory(tpAniSirGlobal pMac, uint16_t size, /* */ size = (size + 3) & (~3); - if (eSIR_SUCCESS != + if (QDF_STATUS_SUCCESS != sch_send_beacon_req(pMac, psessionEntry->pSchBeaconFrameBegin, - size, psessionEntry)) + size, psessionEntry, reason)) { + status = QDF_STATUS_E_FAILURE; pe_err("sch_send_beacon_req() returned an error (zsize %d)", size); - else { - pMac->sch.gSchBeaconsWritten++; - } + } else { + pMac->sch.gSchBeaconsWritten++; + } } + pMac->sch.schObject.fBeaconChanged = 0; + + return status; } /** @@ -979,30 +978,18 @@ void sch_generate_tim(tpAniSirGlobal pMac, uint8_t **pPtr, uint16_t *timLength, *pPtr = ptr; } -/* -------------------------------------------------------------------- */ -/** - * @function: SchProcessPreBeaconInd - * - * @brief : Process the PreBeacon Indication from the Lim - * - * ASSUMPTIONS: - * - * NOTE: - * - * @param : pMac - tpAniSirGlobal - * - * @return None - */ -void sch_process_pre_beacon_ind(tpAniSirGlobal pMac, tpSirMsgQ limMsg) +QDF_STATUS sch_process_pre_beacon_ind(tpAniSirGlobal pMac, tpSirMsgQ limMsg, + enum sir_bcn_update_reason reason) { tpBeaconGenParams pMsg = (tpBeaconGenParams) limMsg->bodyptr; uint32_t beaconSize; tpPESession psessionEntry; uint8_t sessionId; + QDF_STATUS status = QDF_STATUS_E_FAILURE; psessionEntry = pe_find_session_by_bssid(pMac, pMsg->bssId, &sessionId); - if (psessionEntry == NULL) { + if (!psessionEntry) { pe_err("session lookup fails"); goto end; } @@ -1021,12 +1008,13 @@ void sch_process_pre_beacon_ind(tpAniSirGlobal pMac, tpSirMsgQ limMsg) case eLIM_STA_IN_IBSS_ROLE: /* generate IBSS parameter set */ if (psessionEntry->statypeForBss == STA_ENTRY_SELF) - write_beacon_to_memory(pMac, (uint16_t) beaconSize, - (uint16_t) beaconSize, - psessionEntry); + status = + write_beacon_to_memory(pMac, (uint16_t) beaconSize, + (uint16_t) beaconSize, + psessionEntry, reason); else pe_err("can not send beacon for PEER session entry"); - break; + break; case eLIM_AP_ROLE: { uint8_t *ptr = @@ -1038,9 +1026,10 @@ void sch_process_pre_beacon_ind(tpAniSirGlobal pMac, tpSirMsgQ limMsg) sch_generate_tim(pMac, &ptr, &timLength, psessionEntry->dtimPeriod); beaconSize += 2 + timLength; - write_beacon_to_memory(pMac, (uint16_t) beaconSize, - (uint16_t) beaconSize, - psessionEntry); + status = + write_beacon_to_memory(pMac, (uint16_t) beaconSize, + (uint16_t) beaconSize, + psessionEntry, reason); } else pe_err("can not send beacon for PEER session entry"); } @@ -1052,6 +1041,7 @@ void sch_process_pre_beacon_ind(tpAniSirGlobal pMac, tpSirMsgQ limMsg) } end: - qdf_mem_free(pMsg); + qdf_mem_free(pMsg); - } + return status; +} diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index bbbdcda092b9..b3c52f578262 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -3089,15 +3089,19 @@ static QDF_STATUS sme_process_nss_update_resp(tpAniSirGlobal mac, uint8_t *msg) tSmeCmd *command = NULL; bool found; nss_update_cb callback = NULL; - struct sir_beacon_tx_complete_rsp *param; + struct sir_bcn_update_rsp *param; - param = (struct sir_beacon_tx_complete_rsp *)msg; + param = (struct sir_bcn_update_rsp *)msg; if (!param) sme_err("nss update resp param is NULL"); /* Not returning. Need to check if active command list * needs to be freed */ + if (param && param->reason != REASON_NSS_UPDATE) { + sme_err("reason not NSS update"); + return QDF_STATUS_E_INVAL; + } entry = csr_ll_peek_head(&mac->sme.smeCmdActiveList, LL_ACCESS_LOCK); if (!entry) { @@ -3122,8 +3126,8 @@ static QDF_STATUS sme_process_nss_update_resp(tpAniSirGlobal mac, uint8_t *msg) sme_err("Callback failed since nss update params is NULL"); else callback(command->u.nss_update_cmd.context, - param->tx_status, - param->session_id, + param->status, + param->vdev_id, command->u.nss_update_cmd.next_action, command->u.nss_update_cmd.reason); } else diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 175d4ae9b3ad..c738adf5e6bd 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -22534,7 +22534,7 @@ void csr_process_nss_update_req(tpAniSirGlobal mac, tSmeCmd *command) struct sir_nss_update_request *msg; QDF_STATUS status; tSirMsgQ msg_return; - struct sir_beacon_tx_complete_rsp *param; + struct sir_bcn_update_rsp *param; tCsrRoamSession *session; @@ -22563,11 +22563,10 @@ void csr_process_nss_update_req(tpAniSirGlobal mac, tSmeCmd *command) sme_debug("Posting eWNI_SME_NSS_UPDATE_REQ to PE"); status = cds_send_mb_message_to_mac(msg); - if (QDF_STATUS_SUCCESS != status) { - sme_err("Posting to PE failed"); + if (QDF_IS_STATUS_SUCCESS(status)) return; - } - return; + + sme_err("Posting to PE failed"); fail: param = qdf_mem_malloc(sizeof(*param)); if (!param) { @@ -22576,8 +22575,9 @@ fail: return; } sme_err("Sending nss update fail response to SME"); - param->tx_status = QDF_STATUS_E_FAILURE; - param->session_id = command->u.nss_update_cmd.session_id; + param->status = QDF_STATUS_E_FAILURE; + param->vdev_id = command->u.nss_update_cmd.session_id; + param->reason = REASON_NSS_UPDATE; msg_return.type = eWNI_SME_NSS_UPDATE_RSP; msg_return.bodyptr = param; msg_return.bodyval = 0; diff --git a/core/wma/inc/wma_if.h b/core/wma/inc/wma_if.h index 11c681cd9b50..81b75f0e59d9 100644 --- a/core/wma/inc/wma_if.h +++ b/core/wma/inc/wma_if.h @@ -709,6 +709,7 @@ typedef struct sBeaconGenParams { /** * struct tSendbeaconParams - send beacon parameters + * vdev_id: vdev id * @bssId: BSSID mac address * @beacon: beacon data * @beaconLength: beacon length of template @@ -716,8 +717,11 @@ typedef struct sBeaconGenParams { * @p2pIeOffset: P2P IE offset * @csa_count_offset: Offset of Switch count field in CSA IE * @ecsa_count_offset: Offset of Switch count field in ECSA IE + * @reason: bcn update reason + * @status: beacon send status */ typedef struct { + uint8_t vdev_id; tSirMacAddr bssId; uint8_t beacon[SIR_MAX_BEACON_SIZE]; uint32_t beaconLength; @@ -725,6 +729,8 @@ typedef struct { uint16_t p2pIeOffset; uint32_t csa_count_offset; uint32_t ecsa_count_offset; + enum sir_bcn_update_reason reason; + QDF_STATUS status; } tSendbeaconParams, *tpSendbeaconParams; /** diff --git a/core/wma/inc/wma_types.h b/core/wma/inc/wma_types.h index 30c1a12446b5..745d1adafc08 100644 --- a/core/wma/inc/wma_types.h +++ b/core/wma/inc/wma_types.h @@ -151,6 +151,7 @@ #define WMA_DELETE_BSS_RSP SIR_HAL_DELETE_BSS_RSP #define WMA_DELETE_BSS_HO_FAIL_RSP SIR_HAL_DELETE_BSS_HO_FAIL_RSP #define WMA_SEND_BEACON_REQ SIR_HAL_SEND_BEACON_REQ +#define WMA_SEND_BCN_RSP SIR_HAL_SEND_BCN_RSP #define WMA_SEND_PROBE_RSP_TMPL SIR_HAL_SEND_PROBE_RSP_TMPL #define WMA_SET_BSSKEY_REQ SIR_HAL_SET_BSSKEY_REQ diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 5b20a609c21e..f15e175e59d1 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -7541,7 +7541,6 @@ QDF_STATUS wma_mc_process_msg(void *cds_context, cds_msg_t *msg) break; case WMA_SEND_BEACON_REQ: wma_send_beacon(wma_handle, (tpSendbeaconParams) msg->bodyptr); - qdf_mem_free(msg->bodyptr); break; case WMA_SEND_PROBE_RSP_TMPL: wma_send_probe_rsp_tmpl(wma_handle, diff --git a/core/wma/src/wma_mgmt.c b/core/wma/src/wma_mgmt.c index 8888794e78a9..1dafa8ed0b2c 100644 --- a/core/wma/src/wma_mgmt.c +++ b/core/wma/src/wma_mgmt.c @@ -2634,11 +2634,13 @@ void wma_send_beacon(tp_wma_handle wma, tpSendbeaconParams bcn_info) struct sAniBeaconStruct *beacon; struct vdev_up_params param = {0}; + WMA_LOGD("Beacon update reason %d", bcn_info->reason); beacon = (struct sAniBeaconStruct *) (bcn_info->beacon); vdev = wma_find_vdev_by_addr(wma, beacon->macHdr.sa, &vdev_id); if (!vdev) { WMA_LOGE("%s : failed to get vdev handle", __func__); - return; + status = QDF_STATUS_E_INVAL; + goto send_rsp; } if (WMI_SERVICE_IS_ENABLED(wma->wmi_service_bitmap, @@ -2648,7 +2650,7 @@ void wma_send_beacon(tp_wma_handle wma, tpSendbeaconParams bcn_info) if (QDF_IS_STATUS_ERROR(status)) { WMA_LOGE("%s : wmi_unified_bcn_tmpl_send Failed ", __func__); - return; + goto send_rsp; } if (bcn_info->p2pIeOffset) { @@ -2659,14 +2661,15 @@ void wma_send_beacon(tp_wma_handle wma, tpSendbeaconParams bcn_info) p2p_ie) < 0) { WMA_LOGE("%s : wmi_unified_bcn_tmpl_send Failed ", __func__); - return; + status = QDF_STATUS_E_INVAL; + goto send_rsp; } } } status = wma_store_bcn_tmpl(wma, vdev_id, bcn_info); if (status != QDF_STATUS_SUCCESS) { WMA_LOGE("%s : wma_store_bcn_tmpl Failed", __func__); - return; + goto send_rsp; } if (!((qdf_atomic_read( &wma->interfaces[vdev_id].vdev_restart_params. @@ -2680,7 +2683,7 @@ void wma_send_beacon(tp_wma_handle wma, tpSendbeaconParams bcn_info) if (QDF_IS_STATUS_ERROR(status)) { WMA_LOGE(FL("failed to send vdev up")); cds_set_do_hw_mode_change_flag(false); - return; + goto send_rsp; } wma->interfaces[vdev_id].vdev_up = true; WMA_LOGD(FL("Setting vdev_up flag to true")); @@ -2688,6 +2691,10 @@ void wma_send_beacon(tp_wma_handle wma, tpSendbeaconParams bcn_info) wma_set_vdev_mgmt_rate(wma, vdev_id); } } + +send_rsp: + bcn_info->status = status; + wma_send_msg(wma, WMA_SEND_BCN_RSP, (void *)bcn_info, 0); } /** |
