From ef22819b7f7e4bd682f1aca38e5dac84cf2a2559 Mon Sep 17 00:00:00 2001 From: Jianmin Zhu Date: Tue, 13 Aug 2019 15:04:23 +0800 Subject: [PATCH] qcacld-3.0: Refactor lim add bss rsp handler Replace lim functions parameter struct scheduler_msg with struct bss_params. Internal functions don't need param struct scheduler_msg, wma can call lim API: lim_handle_mlm_add_bss_rsp directly instead of post msg. Refactor struct bss_params memory free method. whether success or fail when handle lim add bss rsp, struct bss_params memory need free, it is simple and clear to free only in one place: end of lim_handle_mlm_add_bss_rsp. Change-Id: I2d5d647a6949b1e0bdfbbe9a4dfb390a362a75ee CRs-Fixed: 2508876 --- core/mac/src/pe/include/lim_ft.h | 20 ++- core/mac/src/pe/lim/lim_ibss_peer_mgmt.c | 6 +- core/mac/src/pe/lim/lim_ibss_peer_mgmt.h | 12 +- .../src/pe/lim/lim_process_mlm_host_roam.c | 46 ++--- .../src/pe/lim/lim_process_mlm_rsp_messages.c | 170 +++++++----------- core/mac/src/pe/lim/lim_types.h | 25 ++- core/mac/src/pe/nan/nan_datapath.c | 16 +- core/mac/src/pe/nan/nan_datapath.h | 17 +- 8 files changed, 149 insertions(+), 163 deletions(-) diff --git a/core/mac/src/pe/include/lim_ft.h b/core/mac/src/pe/include/lim_ft.h index 6ab207d257d2..cac0d1c9edfe 100644 --- a/core/mac/src/pe/include/lim_ft.h +++ b/core/mac/src/pe/include/lim_ft.h @@ -64,8 +64,20 @@ void lim_handle_ft_pre_auth_rsp(struct mac_context *mac, QDF_STATUS status, QDF_STATUS lim_ft_setup_auth_session(struct mac_context *mac, struct pe_session *pe_session); void lim_process_mlm_reassoc_cnf(struct mac_context *mac_ctx, uint32_t *msg); +/** + * lim_process_sta_mlm_add_bss_rsp_ft() - Handle ft add bss response + * @mac: Global MAC context + * @add_bss_params: Bss params including rsp data + * @pe_session: PE Session + * + * Function to handle fast roaming add bss response in FT reassoc state, + * send reassociation Request. + * + * Return: None + */ void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac, - struct scheduler_msg *limMsgQ, struct pe_session *pe_session); + struct bss_params *add_bss_params, + struct pe_session *pe_session); void lim_process_mlm_reassoc_req(struct mac_context *mac_ctx, tLimMlmReassocReq *reassoc_req); void lim_preauth_scan_event_handler(struct mac_context *mac_ctx, @@ -91,8 +103,10 @@ static inline void lim_handle_ft_pre_auth_rsp(struct mac_context *mac, static inline void lim_process_mlm_reassoc_cnf(struct mac_context *mac_ctx, uint32_t *msg) {} -static inline void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac, - struct scheduler_msg *limMsgQ, struct pe_session *pe_session) +static inline +void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac, + struct bss_params *add_bss_params, + struct pe_session *pe_session) {} static inline void lim_process_mlm_reassoc_req(struct mac_context *mac_ctx, tLimMlmReassocReq *reassoc_req) 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 4fdf329743e8..7d1254c72cbe 100644 --- a/core/mac/src/pe/lim/lim_ibss_peer_mgmt.c +++ b/core/mac/src/pe/lim/lim_ibss_peer_mgmt.c @@ -1230,12 +1230,12 @@ end: qdf_mem_free(pDelBss); } -void lim_ibss_add_bss_rsp_when_coalescing(struct mac_context *mac, void *msg, +void lim_ibss_add_bss_rsp_when_coalescing(struct mac_context *mac, + struct bss_params *bss_param, struct pe_session *pe_session) { uint8_t infoLen; struct new_bss_info newBssInfo; - struct bss_params *pAddBss = msg; tpSirMacMgmtHdr pHdr = mac->lim.ibss_info.mac_hdr; tpSchBeaconStruct pBeacon = mac->lim.ibss_info.beacon; @@ -1250,7 +1250,7 @@ void lim_ibss_add_bss_rsp_when_coalescing(struct mac_context *mac, void *msg, qdf_mem_zero((void *)&newBssInfo, sizeof(newBssInfo)); qdf_mem_copy(newBssInfo.bssId.bytes, pHdr->bssId, QDF_MAC_ADDR_SIZE); newBssInfo.freq = wlan_reg_chan_to_freq(mac->pdev, - pAddBss->currentOperChannel); + bss_param->currentOperChannel); qdf_mem_copy((uint8_t *) &newBssInfo.ssId, (uint8_t *) &pBeacon->ssId, pBeacon->ssId.length + 1); diff --git a/core/mac/src/pe/lim/lim_ibss_peer_mgmt.h b/core/mac/src/pe/lim/lim_ibss_peer_mgmt.h index d3f9241094fc..4950b963982e 100644 --- a/core/mac/src/pe/lim/lim_ibss_peer_mgmt.h +++ b/core/mac/src/pe/lim/lim_ibss_peer_mgmt.h @@ -92,7 +92,17 @@ void lim_process_ibss_del_sta_rsp(struct mac_context *mac_ctx, tLimIbssPeerNode *lim_ibss_peer_find(struct mac_context *mac, tSirMacAddr macAddr); void lim_ibss_del_bss_rsp(struct mac_context *, void *, struct pe_session *); void lim_ibss_del_bss_rsp_when_coalescing(struct mac_context *, void *, struct pe_session *); -void lim_ibss_add_bss_rsp_when_coalescing(struct mac_context *mac, void *msg, + +/** + * lim_ibss_add_bss_rsp_when_coalescing()- Handle ADD BSS rsp of IBSS coalescing + * @mac_ptr: Pointer to Global MAC structure + * @bss_params: Bss params including rsp data + * @pe_session: PE session pointer + * + * Return: None + */ +void lim_ibss_add_bss_rsp_when_coalescing(struct mac_context *mac, + struct bss_params *bss_param, struct pe_session *pe_session); void lim_ibss_decide_protection_on_delete(struct mac_context *mac, tpDphHashNode sta, tpUpdateBeaconParams pBeaconParams, diff --git a/core/mac/src/pe/lim/lim_process_mlm_host_roam.c b/core/mac/src/pe/lim/lim_process_mlm_host_roam.c index 812529720bf8..3161d4ca48ff 100644 --- a/core/mac/src/pe/lim/lim_process_mlm_host_roam.c +++ b/core/mac/src/pe/lim/lim_process_mlm_host_roam.c @@ -370,30 +370,19 @@ QDF_STATUS lim_sta_reassoc_error_handler(struct reassoc_params *param) return QDF_STATUS_SUCCESS; } -/** - * lim_process_sta_mlm_add_bss_rsp_ft() - Handle the ADD BSS response - * @mac: Global MAC context - * @limMsgQ: ADD BSS Parameters - * @pe_session: PE Session - * - * Function to handle WMA_ADD_BSS_RSP, in FT reassoc state. - * Send ReAssociation Request. - * - *Return: None - */ void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac, - struct scheduler_msg *limMsgQ, struct pe_session *pe_session) + struct bss_params *add_bss_params, + struct pe_session *pe_session) { tLimMlmReassocCnf mlmReassocCnf; /* keep sme */ tpDphHashNode sta = NULL; tpAddStaParams pAddStaParams = NULL; uint32_t listenInterval = MLME_CFG_LISTEN_INTERVAL; - struct bss_params *pAddBssParams = (struct bss_params *) limMsgQ->bodyptr; uint32_t selfStaDot11Mode = 0; /* Sanity Checks */ - if (!pAddBssParams) { + if (!add_bss_params) { pe_err("Invalid parameters"); goto end; } @@ -402,13 +391,13 @@ void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac, goto end; } - sta = dph_add_hash_entry(mac, pAddBssParams->bssId, - DPH_STA_HASH_INDEX_PEER, - &pe_session->dph.dphHashTable); + sta = dph_add_hash_entry(mac, add_bss_params->bssId, + DPH_STA_HASH_INDEX_PEER, + &pe_session->dph.dphHashTable); if (!sta) { /* Could not add hash table entry */ pe_err("could not add hash entry at DPH for"); - lim_print_mac_addr(mac, pAddBssParams->staContext.staMac, + lim_print_mac_addr(mac, add_bss_params->staContext.staMac, LOGE); goto end; } @@ -467,15 +456,15 @@ void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac, pe_debug("Set the mlm state: %d session: %d", pe_session->limMlmState, pe_session->peSessionId); - pe_session->bss_idx = (uint8_t)pAddBssParams->bss_idx; + pe_session->bss_idx = (uint8_t)add_bss_params->bss_idx; /* Success, handle below */ - sta->bssId = pAddBssParams->bss_idx; + sta->bssId = add_bss_params->bss_idx; /* STA Index(genr by HAL) for the BSS entry is stored here */ - sta->staIndex = pAddBssParams->staContext.staIdx; + sta->staIndex = add_bss_params->staContext.staIdx; - rrm_cache_mgmt_tx_power(mac, pAddBssParams->txMgmtPower, - pe_session); + rrm_cache_mgmt_tx_power(mac, add_bss_params->txMgmtPower, + pe_session); pAddStaParams = qdf_mem_malloc(sizeof(tAddStaParams)); if (!pAddStaParams) @@ -558,11 +547,6 @@ void lim_process_sta_mlm_add_bss_rsp_ft(struct mac_context *mac, /* Lets save this for when we receive the Reassoc Rsp */ pe_session->ftPEContext.pAddStaReq = pAddStaParams; - if (pAddBssParams) { - qdf_mem_free(pAddBssParams); - pAddBssParams = NULL; - limMsgQ->bodyptr = NULL; - } #ifdef WLAN_FEATURE_ROAM_OFFLOAD if (pe_session->bRoamSynchInProgress) { pe_debug("LFR3:Prep and save AddStaReq for post-assoc-rsp"); @@ -580,12 +564,6 @@ end: pe_session->pLimMlmReassocReq = NULL; } - if (pAddBssParams) { - qdf_mem_free(pAddBssParams); - pAddBssParams = NULL; - limMsgQ->bodyptr = NULL; - } - mlmReassocCnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; /* Update PE session Id */ 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 37af1d162090..d2d02974fe20 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 @@ -2001,6 +2001,8 @@ end: /** * lim_process_ap_mlm_add_bss_rsp() + * @mac: Pointer to Global MAC structure + * @pAddBssParams: Bss params including rsp data * ***FUNCTION: * This function is called to process a WMA_ADD_BSS_RSP from HAL. @@ -2026,35 +2028,24 @@ end: * lim_process_mlm_start_req * struct scheduler_msg.body will now be freed by this routine * - ***NOTE: - * - * @param mac Pointer to Global MAC structure - * @param struct scheduler_msg The MsgQ header, which contains - * the response buffer - * * @return None */ static void lim_process_ap_mlm_add_bss_rsp(struct mac_context *mac, - struct scheduler_msg *limMsgQ) + struct bss_params *pAddBssParams) { tLimMlmStartCnf mlmStartCnf; struct pe_session *pe_session; uint8_t isWepEnabled = false; - struct bss_params *pAddBssParams = (struct bss_params *) limMsgQ->bodyptr; if (!pAddBssParams) { pe_err("Encountered NULL Pointer"); - goto end; + return; } /* TBD: free the memory before returning, do it for all places where lookup fails. */ pe_session = pe_find_session_by_session_id(mac, pAddBssParams->sessionId); if (!pe_session) { pe_err("session does not exist for given sessionId"); - if (pAddBssParams) { - qdf_mem_free(pAddBssParams); - limMsgQ->bodyptr = NULL; - } return; } /* Update PE session Id */ @@ -2065,7 +2056,7 @@ static void lim_process_ap_mlm_add_bss_rsp(struct mac_context *mac, (mac, eSIR_LINK_AP_STATE, pe_session->bssId, pe_session->self_mac_addr, NULL, NULL) != QDF_STATUS_SUCCESS) - goto end; + return; /* Set MLME state */ pe_session->limMlmState = eLIM_MLM_BSS_STARTED_STATE; pe_session->chainMask = pAddBssParams->chainMask; @@ -2138,15 +2129,12 @@ static void lim_process_ap_mlm_add_bss_rsp(struct mac_context *mac, } lim_send_start_bss_confirm(mac, &mlmStartCnf); -end: - if (0 != limMsgQ->bodyptr) { - qdf_mem_free(pAddBssParams); - limMsgQ->bodyptr = NULL; - } } /** * lim_process_ibss_mlm_add_bss_rsp() + * @mac: Pointer to Global MAC structure + * @pAddBssParams: Bss params including rsp data * ***FUNCTION: * This function is called to process a WMA_ADD_BSS_RSP from HAL. @@ -2167,30 +2155,18 @@ end: * MLME responds with LIM_MLM_START_CNF to LIM * LIM responds with eWNI_SME_START_BSS_RSP to SME * - ***ASSUMPTIONS: - * struct scheduler_msg.body is allocated by MLME during - * lim_process_mlm_start_req - * struct scheduler_msg.body will now be freed by this routine - * - ***NOTE: - * - * @param mac Pointer to Global MAC structure - * @param struct scheduler_msg The MsgQ header, which contains - * the response buffer - * * @return None */ static void lim_process_ibss_mlm_add_bss_rsp(struct mac_context *mac, - struct scheduler_msg *limMsgQ, + struct bss_params *pAddBssParams, struct pe_session *pe_session) { tLimMlmStartCnf mlmStartCnf; - struct bss_params *pAddBssParams = (struct bss_params *) limMsgQ->bodyptr; if (!pAddBssParams) { pe_err("Invalid body pointer in message"); - goto end; + return; } if (QDF_STATUS_SUCCESS == pAddBssParams->status) { pe_debug("WMA_ADD_BSS_RSP returned with QDF_STATUS_SUCCESS"); @@ -2199,7 +2175,7 @@ lim_process_ibss_mlm_add_bss_rsp(struct mac_context *mac, (mac, eSIR_LINK_IBSS_STATE, pe_session->bssId, pe_session->self_mac_addr, NULL, NULL) != QDF_STATUS_SUCCESS) - goto end; + return; /* Set MLME state */ pe_session->limMlmState = eLIM_MLM_BSS_STARTED_STATE; MTRACE(mac_trace @@ -2224,9 +2200,9 @@ lim_process_ibss_mlm_add_bss_rsp(struct mac_context *mac, mlmStartCnf.resultCode = eSIR_SME_SUCCESS; /* If ADD BSS was issued as part of IBSS coalescing, don't send the message to SME, as that is internal to LIM */ if (true == mac->lim.gLimIbssCoalescingHappened) { - lim_ibss_add_bss_rsp_when_coalescing(mac, limMsgQ->bodyptr, + lim_ibss_add_bss_rsp_when_coalescing(mac, pAddBssParams, pe_session); - goto end; + return; } } else { pe_err("WMA_ADD_BSS_REQ failed with status %d", @@ -2238,11 +2214,6 @@ lim_process_ibss_mlm_add_bss_rsp(struct mac_context *mac, /* Update PE session Id */ mlmStartCnf.sessionId = pe_session->peSessionId; lim_send_start_bss_confirm(mac, &mlmStartCnf); -end: - if (0 != limMsgQ->bodyptr) { - qdf_mem_free(pAddBssParams); - limMsgQ->bodyptr = NULL; - } } #ifdef WLAN_FEATURE_FILS_SK @@ -2271,7 +2242,7 @@ static void lim_update_fils_auth_mode(struct pe_session *session_entry, /** * csr_neighbor_roam_handoff_req_hdlr - Processes handoff request * @mac_ctx: Pointer to mac context - * @msg: message sent to HDD + * @pAddBssParams: Bss params including rsp data * @session_entry: PE session handle * * This function is called to process a WMA_ADD_BSS_RSP from HAL. @@ -2281,9 +2252,9 @@ static void lim_update_fils_auth_mode(struct pe_session *session_entry, */ static void lim_process_sta_add_bss_rsp_pre_assoc(struct mac_context *mac_ctx, - struct scheduler_msg *msg, struct pe_session *session_entry) + struct bss_params *add_bss_params, struct pe_session *session_entry) { - struct bss_params *pAddBssParams = (struct bss_params *) msg->bodyptr; + struct bss_params *pAddBssParams = add_bss_params; tAniAuthType cfgAuthType, authMode; tLimMlmAuthReq *pMlmAuthReq; tpDphHashNode sta = NULL; @@ -2366,7 +2337,7 @@ joinFailure: /** * lim_process_sta_mlm_add_bss_rsp() - Process ADD BSS response * @mac_ctx: Pointer to Global MAC structure - * @msg: The MsgQ header, which contains the response buffer + * @add_bss_params: Bss params including rsp data * * This function is called to process a WMA_ADD_BSS_RSP from HAL. * Upon receipt of this message from HAL, MLME - @@ -2376,18 +2347,13 @@ joinFailure: * MLME had sent WMA_ADD_BSS_REQ to HAL * HAL responded with WMA_ADD_BSS_RSP to MLME * MLME now sends WMA_ADD_STA_REQ to HAL - * ASSUMPTIONS: - * struct scheduler_msg.body is allocated by MLME during - * lim_process_mlm_join_req - * struct scheduler_msg.body will now be freed by this routine * * Return: None */ -static void -lim_process_sta_mlm_add_bss_rsp(struct mac_context *mac_ctx, - struct scheduler_msg *msg, struct pe_session *session_entry) +static void lim_process_sta_mlm_add_bss_rsp(struct mac_context *mac_ctx, + struct bss_params *add_bss_params, + struct pe_session *session_entry) { - struct bss_params *add_bss_params = (struct bss_params *) msg->bodyptr; tLimMlmAssocCnf mlm_assoc_cnf; uint32_t msg_type = LIM_MLM_ASSOC_CNF; uint32_t sub_type = LIM_ASSOC; @@ -2401,9 +2367,10 @@ lim_process_sta_mlm_add_bss_rsp(struct mac_context *mac_ctx, session_entry->limMlmState) { pe_debug("SessionId: %d lim_process_sta_add_bss_rsp_pre_assoc", session_entry->peSessionId); - lim_process_sta_add_bss_rsp_pre_assoc(mac_ctx, msg, - session_entry); - goto end; + lim_process_sta_add_bss_rsp_pre_assoc(mac_ctx, + add_bss_params, + session_entry); + return; } if (eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE == session_entry->limMlmState || (eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == @@ -2427,16 +2394,17 @@ lim_process_sta_mlm_add_bss_rsp(struct mac_context *mac_ctx, } if (add_bss_params == 0) - goto end; + return; if (QDF_STATUS_SUCCESS == add_bss_params->status) { if (eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE == session_entry->limMlmState) { pe_debug("Mlm=%d %d", session_entry->limMlmState, eLIM_MLM_WT_ADD_BSS_RSP_REASSOC_STATE); - lim_process_sta_mlm_add_bss_rsp_ft(mac_ctx, msg, - session_entry); - goto end; + lim_process_sta_mlm_add_bss_rsp_ft(mac_ctx, + add_bss_params, + session_entry); + return; } /* Set MLME state */ @@ -2512,40 +2480,32 @@ lim_process_sta_mlm_add_bss_rsp(struct mac_context *mac_ctx, lim_post_sme_message(mac_ctx, msg_type, (uint32_t *) &mlm_assoc_cnf); } -end: - if (0 != msg->bodyptr) { - qdf_mem_free(add_bss_params); - msg->bodyptr = NULL; - } } -/** - * lim_process_mlm_add_bss_rsp() - Processes ADD BSS Response - * - * @mac_ctx - Pointer to Global MAC structure - * @msg - The MsgQ header, which contains the response buffer - * - * This function is called to process a WMA_ADD_BSS_RSP from HAL. - * Upon receipt of this message from HAL, MLME - - * Determines the "state" in which this message was received - * Forwards it to the appropriate callback - * - *LOGIC: - * WMA_ADD_BSS_RSP can be received by MLME while the LIM is - * in the following two states: - * 1) As AP, LIM state = eLIM_SME_WT_START_BSS_STATE - * 2) As STA, LIM state = eLIM_SME_WT_JOIN_STATE - * Based on these two states, this API will determine where to - * route the message to - * - * Return None - */ void lim_process_mlm_add_bss_rsp(struct mac_context *mac_ctx, - struct scheduler_msg *msg) + struct scheduler_msg *msg) +{ + if (!msg) { + pe_err("Encountered NULL Pointer"); + return; + } + lim_handle_mlm_add_bss_rsp(mac_ctx, msg->bodyptr); + msg->bodyptr = NULL; +} + +/* + *LOGIC: Based on bss type and state, this API will route the message to + *different functions. + * 1) eSIR_IBSS_MODE: handled in lim_process_ibss_mlm_add_bss_rsp. + * 2) eSIR_NDI_MODE: handled in lim_process_ndi_mlm_add_bss_rsp. + * 3) SAP mode: handled in lim_process_ap_mlm_add_bss_rsp. + * 4) STA mode: handled in lim_process_sta_mlm_add_bss_rsp. + */ +void lim_handle_mlm_add_bss_rsp(struct mac_context *mac_ctx, + struct bss_params *add_bss_param) { tLimMlmStartCnf mlm_start_cnf; struct pe_session *session_entry; - struct bss_params *add_bss_param = (struct bss_params *) (msg->bodyptr); enum bss_type bss_type; if (!add_bss_param) { @@ -2567,20 +2527,20 @@ void lim_process_mlm_add_bss_rsp(struct mac_context *mac_ctx, if (!session_entry) { pe_err("SessionId:%d Session Doesn't exist", add_bss_param->sessionId); - if (add_bss_param) { - qdf_mem_free(add_bss_param); - msg->bodyptr = NULL; - } - return; + goto err; } bss_type = session_entry->bssType; /* update PE session Id */ mlm_start_cnf.sessionId = session_entry->peSessionId; if (eSIR_IBSS_MODE == bss_type) { - lim_process_ibss_mlm_add_bss_rsp(mac_ctx, msg, session_entry); + lim_process_ibss_mlm_add_bss_rsp(mac_ctx, + add_bss_param, + session_entry); } else if (eSIR_NDI_MODE == session_entry->bssType) { - lim_process_ndi_mlm_add_bss_rsp(mac_ctx, msg, session_entry); + lim_process_ndi_mlm_add_bss_rsp(mac_ctx, + add_bss_param, + session_entry); } else { if (eLIM_SME_WT_START_BSS_STATE == session_entry->limSmeState) { if (eLIM_MLM_WT_ADD_BSS_RSP_STATE != @@ -2591,18 +2551,16 @@ void lim_process_mlm_add_bss_rsp(struct mac_context *mac_ctx, session_entry->limMlmState); mlm_start_cnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED; - if (0 != msg->bodyptr) { - qdf_mem_free(add_bss_param); - msg->bodyptr = NULL; - } lim_send_start_bss_confirm(mac_ctx, &mlm_start_cnf); - } else - lim_process_ap_mlm_add_bss_rsp(mac_ctx, msg); + } + lim_process_ap_mlm_add_bss_rsp(mac_ctx, + add_bss_param); } else { /* Called while processing assoc response */ - lim_process_sta_mlm_add_bss_rsp(mac_ctx, msg, - session_entry); + lim_process_sta_mlm_add_bss_rsp(mac_ctx, + add_bss_param, + session_entry); } } @@ -2615,6 +2573,12 @@ void lim_process_mlm_add_bss_rsp(struct mac_context *mac_ctx, } } #endif +err: + /* + * lim_handle_mlm_add_bss_rsp is entry to handle all types of add + * bss response, only need free bss params buffer here + */ + qdf_mem_free(add_bss_param); } void lim_process_mlm_update_hidden_ssid_rsp(struct mac_context *mac_ctx, diff --git a/core/mac/src/pe/lim/lim_types.h b/core/mac/src/pe/lim/lim_types.h index 866f06a08795..d2cb5881ad1e 100644 --- a/core/mac/src/pe/lim/lim_types.h +++ b/core/mac/src/pe/lim/lim_types.h @@ -723,9 +723,32 @@ QDF_STATUS lim_send_tpc_report_frame(struct mac_context *, tpSirMacTpcReqActionF tSirMacAddr, struct pe_session *pe_session); #endif -/* Function(s) to handle responses received from HAL */ +/** + * lim_process_mlm_add_bss_rsp() - Processes ADD BSS Response + * @mac_ctx: Pointer to Global MAC structure + * @msg: The MsgQ header, which contains the response buffer + * + * This function is called to process a WMA_ADD_BSS_RSP from HAL. + * Upon receipt of this message from HAL. + * + * Return None + */ void lim_process_mlm_add_bss_rsp(struct mac_context *mac, struct scheduler_msg *limMsgQ); + +/** + * lim_handle_mlm_add_bss_rsp() - Handle add bss response + * @mac_ctx: mac context + * @add_bss_param: add bss parameters + * + * This function is called to handle all types of add bss rsp from HAL. + * It will free memory of add_bss_param in the end after rsp is handled. + * + * Return: None + */ +void lim_handle_mlm_add_bss_rsp(struct mac_context *mac_ctx, + struct bss_params *add_bss_param); + void lim_process_mlm_add_sta_rsp(struct mac_context *mac, struct scheduler_msg *limMsgQt, struct pe_session *pe_session); diff --git a/core/mac/src/pe/nan/nan_datapath.c b/core/mac/src/pe/nan/nan_datapath.c index ee443dd7e80b..3505a4d179d9 100644 --- a/core/mac/src/pe/nan/nan_datapath.c +++ b/core/mac/src/pe/nan/nan_datapath.c @@ -337,24 +337,15 @@ skip_event: lim_msg->bodyptr = NULL; } -/** - * lim_process_ndi_mlm_add_bss_rsp() - Process ADD_BSS response for NDI - * @mac_ctx: Pointer to Global MAC structure - * @lim_msgq: The MsgQ header, which contains the response buffer - * @session_entry: PE session - * - * Return: None - */ void lim_process_ndi_mlm_add_bss_rsp(struct mac_context *mac_ctx, - struct scheduler_msg *lim_msgq, + struct bss_params *add_bss_params, struct pe_session *session_entry) { tLimMlmStartCnf mlm_start_cnf; - struct bss_params *add_bss_params = (struct bss_params *) lim_msgq->bodyptr; if (!add_bss_params) { pe_err("Invalid body pointer in message"); - goto end; + return; } pe_debug("Status %d", add_bss_params->status); if (QDF_STATUS_SUCCESS == add_bss_params->status) { @@ -380,9 +371,6 @@ void lim_process_ndi_mlm_add_bss_rsp(struct mac_context *mac_ctx, } mlm_start_cnf.sessionId = session_entry->peSessionId; lim_send_start_bss_confirm(mac_ctx, &mlm_start_cnf); -end: - qdf_mem_free(lim_msgq->bodyptr); - lim_msgq->bodyptr = NULL; } /** diff --git a/core/mac/src/pe/nan/nan_datapath.h b/core/mac/src/pe/nan/nan_datapath.h index fbd130050dbc..85083298ad1a 100644 --- a/core/mac/src/pe/nan/nan_datapath.h +++ b/core/mac/src/pe/nan/nan_datapath.h @@ -33,8 +33,16 @@ struct peer_nan_datapath_map; +/** + * lim_process_ndi_mlm_add_bss_rsp() - Process ADD_BSS response for NDI + * @mac_ctx: Pointer to Global MAC structure + * @add_bss_params: Bss params including rsp data + * @session_entry: PE session + * + * Return: None + */ void lim_process_ndi_mlm_add_bss_rsp(struct mac_context *mac_ctx, - struct scheduler_msg *lim_msg_q, + struct bss_params *add_bss_params, struct pe_session *session_entry); /* Handler for DEL BSS resp for NDI interface */ void lim_ndi_del_bss_rsp(struct mac_context * mac_ctx, @@ -57,9 +65,10 @@ void lim_ndp_delete_peers_by_addr_converged(uint8_t vdev_id, struct qdf_mac_addr peer_ndi_mac_addr); #else -static inline void lim_process_ndi_mlm_add_bss_rsp(struct mac_context *mac_ctx, - struct scheduler_msg *lim_msg_q, - struct pe_session *session_entry) +static inline +void lim_process_ndi_mlm_add_bss_rsp(struct mac_context *mac_ctx, + struct bss_params *add_bss_params, + struct pe_session *session_entry) { } static inline void lim_ndi_del_bss_rsp(struct mac_context *mac_ctx,