diff --git a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c index 2754cbb7309c..6611b7f98b58 100644 --- a/core/mac/src/pe/lim/lim_process_assoc_req_frame.c +++ b/core/mac/src/pe/lim/lim_process_assoc_req_frame.c @@ -26,15 +26,8 @@ */ /* - * This file lim_process_assoc_req_frame.cc contains the code + * This file lim_process_assoc_req_frame.c contains the code * for processing Re/Association Request Frame. - * Author: Chandra Modumudi - * Date: 03/18/02 - * History:- - * Date Modified by Modification Information - * -------------------------------------------------------------------- - * 05/26/10 js WPA handling in (Re)Assoc frames - * */ #include "cds_api.h" #include "ani_global.h" @@ -75,9 +68,9 @@ lim_convert_supported_channels(tpAniSirGlobal mac_ctx, tpLimMlmAssocInd assoc_ind, tSirAssocReq *assoc_req) { uint16_t i, j, index = 0; - uint8_t first_chn_no; + uint8_t first_ch_no; uint8_t chn_count; - uint8_t next_chn_no; + uint8_t next_ch_no; uint8_t channel_offset = 0; if (assoc_req->supportedChannels.length >= @@ -91,45 +84,42 @@ lim_convert_supported_channels(tpAniSirGlobal mac_ctx, for (i = 0; i < (assoc_req->supportedChannels.length); i++) { /* Get First Channel Number */ - first_chn_no = - assoc_req->supportedChannels.supportedChannels[i]; - assoc_ind->supportedChannels.channelList[index] = - first_chn_no; + first_ch_no = assoc_req->supportedChannels.supportedChannels[i]; + assoc_ind->supportedChannels.channelList[index] = first_ch_no; i++; index++; /* Get Number of Channels in a Subband */ - chn_count = - assoc_req->supportedChannels.supportedChannels[i]; - PELOG2(lim_log(mac_ctx, LOG2, + chn_count = assoc_req->supportedChannels.supportedChannels[i]; + lim_log(mac_ctx, LOG2, FL("Rcv assoc_req: chnl=%d, numOfChnl=%d "), - first_chn_no, chn_count);) + first_ch_no, chn_count); if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST) { - PELOG2(lim_log(mac_ctx, LOGW, - FL("Channel count is more than max supported =%d "), - chn_count);) + lim_log(mac_ctx, LOGW, + FL("Ch count > max supported =%d "), + chn_count); assoc_ind->supportedChannels.numChnl = 0; return; } if (chn_count <= 1) continue; - next_chn_no = first_chn_no; - if (SIR_BAND_5_GHZ == lim_get_rf_band(first_chn_no)) + next_ch_no = first_ch_no; + if (SIR_BAND_5_GHZ == lim_get_rf_band(first_ch_no)) channel_offset = SIR_11A_FREQUENCY_OFFSET; - else if (SIR_BAND_2_4_GHZ == lim_get_rf_band(first_chn_no)) + else if (SIR_BAND_2_4_GHZ == lim_get_rf_band(first_ch_no)) channel_offset = SIR_11B_FREQUENCY_OFFSET; else continue; for (j = 1; j < chn_count; j++) { - next_chn_no += channel_offset; + next_ch_no += channel_offset; assoc_ind->supportedChannels.channelList[index] - = next_chn_no; + = next_ch_no; index++; if (index >= SIR_MAX_SUPPORTED_CHANNEL_LIST) { - PELOG2(lim_log(mac_ctx, LOGW, - FL("Channel count is more than supported =%d "), - chn_count);) + lim_log(mac_ctx, LOGW, + FL("Ch count > supported =%d "), + chn_count); assoc_ind->supportedChannels.numChnl = 0; return; } @@ -137,135 +127,129 @@ lim_convert_supported_channels(tpAniSirGlobal mac_ctx, } assoc_ind->supportedChannels.numChnl = (uint8_t) index; - PELOG2(lim_log(mac_ctx, LOG2, + lim_log(mac_ctx, LOG2, FL("Send AssocInd to WSM: minPwr %d, maxPwr %d, numChnl %d"), assoc_ind->powerCap.minTxPower, assoc_ind->powerCap.maxTxPower, - assoc_ind->supportedChannels.numChnl);) + assoc_ind->supportedChannels.numChnl); } -/**--------------------------------------------------------------- - \fn lim_check_sta_in_pe_entries - \brief This function is called by lim_process_assoc_req_frame() - \ to check if STA entry already exists in any of the - \ PE entries of the AP. If it exists, deauth will be - \ sent on that session and the STA deletion will - \ happen. After this, the ASSOC request will be - \ processed - \ - \param pMac - A pointer to Global MAC structure - \param pHdr - A pointer to the MAC header - \return None - ------------------------------------------------------------------*/ -void lim_check_sta_in_pe_entries(tpAniSirGlobal pMac, tpSirMacMgmtHdr pHdr) +/** + * lim_check_sta_in_pe_entries() - checks if sta exists in any dph tables. + * @mac_ctx: Pointer to Global MAC structure + * @hdr: A pointer to the MAC header + * + * This function is called by lim_process_assoc_req_frame() to check if STA + * entry already exists in any of the PE entries of the AP. If it exists, deauth + * will be sent on that session and the STA deletion will happen. After this, + * the ASSOC request will be processed + * + * Return: void + */ +void lim_check_sta_in_pe_entries(tpAniSirGlobal mac_ctx, tpSirMacMgmtHdr hdr) { uint8_t i; - uint16_t assocId = 0; - tpDphHashNode pStaDs = NULL; - tpPESession psessionEntry = NULL; + uint16_t assoc_id = 0; + tpDphHashNode sta_ds = NULL; + tpPESession session = NULL; - for (i = 0; i < pMac->lim.maxBssId; i++) { - if ((&pMac->lim.gpSession[i] != NULL) && - (pMac->lim.gpSession[i].valid) && - (pMac->lim.gpSession[i].pePersona == QDF_SAP_MODE)) { - - psessionEntry = &pMac->lim.gpSession[i]; - pStaDs = dph_lookup_hash_entry(pMac, pHdr->sa, &assocId, - &psessionEntry->dph. - dphHashTable); - if (pStaDs + for (i = 0; i < mac_ctx->lim.maxBssId; i++) { + if ((&mac_ctx->lim.gpSession[i] != NULL) && + (mac_ctx->lim.gpSession[i].valid) && + (mac_ctx->lim.gpSession[i].pePersona == QDF_SAP_MODE)) { + session = &mac_ctx->lim.gpSession[i]; + sta_ds = dph_lookup_hash_entry(mac_ctx, hdr->sa, + &assoc_id, &session->dph.dphHashTable); + if (sta_ds #ifdef WLAN_FEATURE_11W - && !pStaDs->rmfEnabled + && !sta_ds->rmfEnabled #endif ) { - lim_log(pMac, LOGE, - FL - ("Sending Deauth and Deleting existing STA entry: " - MAC_ADDRESS_STR), - MAC_ADDR_ARRAY(psessionEntry-> - selfMacAddr)); - lim_send_deauth_mgmt_frame(pMac, - eSIR_MAC_UNSPEC_FAILURE_REASON, - (uint8_t *) pHdr->sa, - psessionEntry, false); - lim_trigger_sta_deletion(pMac, pStaDs, - psessionEntry); + lim_log(mac_ctx, LOGE, + FL("Sending Deauth and Deleting existing STA entry: " + MAC_ADDRESS_STR), + MAC_ADDR_ARRAY(session->selfMacAddr)); + lim_send_deauth_mgmt_frame(mac_ctx, + eSIR_MAC_UNSPEC_FAILURE_REASON, + (uint8_t *) hdr->sa, session, false); + lim_trigger_sta_deletion(mac_ctx, sta_ds, + session); break; } } } } -/**--------------------------------------------------------------- - \fn lim_process_assoc_req_frame - \brief This function is called by limProcessMessageQueue() - \ upon Re/Association Request frame reception in - \ BTAMP AP or Soft AP role. - \ - \param pMac - \param *pRxPacketInfo - A pointer to Buffer descriptor + associated PDUs - \param subType - Indicates whether it is Association Request(=0) - \ or Reassociation Request(=1) frame - \return None - ------------------------------------------------------------------*/ +/** + * lim_process_assoc_req_frame() - Process RE/ASSOC Request frame. + * @mac_ctx: Pointer to Global MAC structure + * @rx_pkt_info: A pointer to Buffer descriptor + associated PDUs + * @sub_type: Indicates whether it is Association Request(=0) + * or Reassociation Request(=1) frame + * @session: pe session entry + * + * This function is called to process RE/ASSOC Request frame. + * + * Return: void + */ void -lim_process_assoc_req_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, - uint8_t subType, tpPESession psessionEntry) +lim_process_assoc_req_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info, + uint8_t sub_type, tpPESession session) { - uint8_t updateContext; - uint8_t *pBody; - uint16_t peerIdx, temp; + uint8_t update_ctx; + uint8_t *frm_body; + uint16_t peer_idx, temp; uint32_t val; - int32_t framelen; + int32_t frame_len; tSirRetStatus status; - tpSirMacMgmtHdr pHdr; - struct tLimPreAuthNode *pStaPreAuthContext; - tAniAuthType authType; - tSirMacCapabilityInfo localCapabilities; - tpDphHashNode pStaDs = NULL; - tpSirAssocReq pAssocReq, pTempAssocReq; - tLimMlmStates mlmPrevState; - tDot11fIERSN Dot11fIERSN; - tDot11fIEWPA Dot11fIEWPA; - uint32_t phyMode; - tHalBitVal qosMode; - tHalBitVal wsmMode, wmeMode; - uint8_t *wpsIe = NULL; + tpSirMacMgmtHdr hdr; + struct tLimPreAuthNode *sta_pre_auth_ctx; + tAniAuthType auth_type; + tSirMacCapabilityInfo local_cap; + tpDphHashNode sta_ds = NULL; + tpSirAssocReq assoc_req, tmp_assoc_req; + tLimMlmStates mlm_prev_state; + tDot11fIERSN dot11f_ie_rsn; + tDot11fIEWPA dot11f_ie_wpa; + uint32_t phy_mode; + tHalBitVal qos_mode; + tHalBitVal wsm_mode, wme_mode; + uint8_t *wps_ie = NULL; uint8_t *ht_cap_ie = NULL; - tSirMacRateSet basicRates; + tSirMacRateSet basic_rates; uint8_t i = 0, j = 0; - bool pmfConnection = false; + bool pmf_connection = false; #ifdef WLAN_FEATURE_11W - tPmfSaQueryTimerId timerId; - uint32_t retryInterval; + tPmfSaQueryTimerId timer_id; + uint32_t retry_interval; #endif uint16_t assoc_id = 0; bool assoc_req_copied = false; - lim_get_phy_mode(pMac, &phyMode, psessionEntry); + lim_get_phy_mode(mac_ctx, &phy_mode, session); - limGetQosMode(psessionEntry, &qosMode); + limGetQosMode(session, &qos_mode); - pHdr = WMA_GET_RX_MAC_HEADER(pRxPacketInfo); - framelen = WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); + hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); + frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); - lim_log(pMac, LOG1, + lim_log(mac_ctx, LOG1, FL("Received %s Req Frame on sessionid: %d systemrole %d" " limMlmState %d from: " MAC_ADDRESS_STR), - (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", - psessionEntry->peSessionId, GET_LIM_SYSTEM_ROLE(psessionEntry), - psessionEntry->limMlmState, MAC_ADDR_ARRAY(pHdr->sa)); + (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", + session->peSessionId, GET_LIM_SYSTEM_ROLE(session), + session->limMlmState, MAC_ADDR_ARRAY(hdr->sa)); - if (LIM_IS_STA_ROLE(psessionEntry) || - LIM_IS_BT_AMP_STA_ROLE(psessionEntry)) { - lim_log(pMac, LOGE, + if (LIM_IS_STA_ROLE(session) || + LIM_IS_BT_AMP_STA_ROLE(session)) { + lim_log(mac_ctx, LOGE, FL("received unexpected ASSOC REQ on sessionid: %d " - "sys subType=%d for role=%d from: " MAC_ADDRESS_STR), - psessionEntry->peSessionId, subType, - GET_LIM_SYSTEM_ROLE(psessionEntry), - MAC_ADDR_ARRAY(pHdr->sa)); - sir_dump_buf(pMac, SIR_LIM_MODULE_ID, LOG3, - WMA_GET_RX_MPDU_DATA(pRxPacketInfo), framelen); + "sys sub_type=%d for role=%d from: " MAC_ADDRESS_STR), + session->peSessionId, sub_type, + GET_LIM_SYSTEM_ROLE(session), + MAC_ADDR_ARRAY(hdr->sa)); + sir_dump_buf(mac_ctx, SIR_LIM_MODULE_ID, LOG3, + WMA_GET_RX_MPDU_DATA(rx_pkt_info), frame_len); return; } @@ -278,154 +262,153 @@ lim_process_assoc_req_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, * does not process it once the entry for the STA is already * present in DPH. */ - pStaDs = dph_lookup_hash_entry(pMac, pHdr->sa, &assoc_id, - &psessionEntry->dph.dphHashTable); - if ((NULL != pStaDs)) { - if (pHdr->fc.retry > 0) { - lim_log(pMac, LOGE, + sta_ds = dph_lookup_hash_entry(mac_ctx, hdr->sa, &assoc_id, + &session->dph.dphHashTable); + if ((NULL != sta_ds)) { + if (hdr->fc.retry > 0) { + lim_log(mac_ctx, LOGE, FL("STA is initiating Assoc Req after ACK lost. Do not process" - " sessionid: %d sys subType=%d for role=%d from: " - MAC_ADDRESS_STR), psessionEntry->peSessionId, - subType, GET_LIM_SYSTEM_ROLE(psessionEntry), - MAC_ADDR_ARRAY(pHdr->sa)); - } else if (!pStaDs->rmfEnabled) { + " sessionid: %d sys sub_type=%d for role=%d from: " + MAC_ADDRESS_STR), session->peSessionId, + sub_type, GET_LIM_SYSTEM_ROLE(session), + MAC_ADDR_ARRAY(hdr->sa)); + } else if (!sta_ds->rmfEnabled) { /* Do this only for non PMF case. * * STA might have missed the assoc response, * so it is sending assoc request frame again. */ - lim_send_assoc_rsp_mgmt_frame(pMac, eSIR_SUCCESS, - pStaDs->assocId, pStaDs->staAddr, - pStaDs->mlmStaContext.subType, pStaDs, - psessionEntry); - lim_log(pMac, LOGE, + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_SUCCESS, + sta_ds->assocId, sta_ds->staAddr, + sta_ds->mlmStaContext.subType, sta_ds, + session); + lim_log(mac_ctx, LOGE, FL("DUT already received an assoc request frame " "and STA is sending another assoc req.So, do not " - "Process sessionid: %d sys subType=%d for role=%d " + "Process sessionid: %d sys sub_type=%d for role=%d " "from: "MAC_ADDRESS_STR), - psessionEntry->peSessionId, subType, - psessionEntry->limSystemRole, - MAC_ADDR_ARRAY(pHdr->sa)); + session->peSessionId, sub_type, + session->limSystemRole, + MAC_ADDR_ARRAY(hdr->sa)); } return; } - lim_check_sta_in_pe_entries(pMac, pHdr); + lim_check_sta_in_pe_entries(mac_ctx, hdr); /* Get pointer to Re/Association Request frame body */ - pBody = WMA_GET_RX_MPDU_DATA(pRxPacketInfo); + frm_body = WMA_GET_RX_MPDU_DATA(rx_pkt_info); - if (lim_is_group_addr(pHdr->sa)) { + if (lim_is_group_addr(hdr->sa)) { /* Received Re/Assoc Req frame from a BC/MC address */ /* Log error and ignore it */ - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("Received %s Req on sessionid: %d frame from a " "BC/MC address" MAC_ADDRESS_STR), - (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", - psessionEntry->peSessionId, MAC_ADDR_ARRAY(pHdr->sa)); + (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", + session->peSessionId, MAC_ADDR_ARRAY(hdr->sa)); return; } - sir_dump_buf(pMac, SIR_LIM_MODULE_ID, LOG2, (uint8_t *) pBody, framelen); + sir_dump_buf(mac_ctx, SIR_LIM_MODULE_ID, LOG2, (uint8_t *) frm_body, frame_len); - if (!qdf_mem_cmp((uint8_t *) pHdr->sa, (uint8_t *) pHdr->da, + if (!qdf_mem_cmp((uint8_t *) hdr->sa, (uint8_t *) hdr->da, (uint8_t) (sizeof(tSirMacAddr)))) { - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("Rejected Assoc Req frame Since same mac as" " SAP/GO")); - lim_send_assoc_rsp_mgmt_frame(pMac, eSIR_MAC_UNSPEC_FAILURE_STATUS, - 1, pHdr->sa, subType, 0, - psessionEntry); + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_UNSPEC_FAILURE_STATUS, + 1, hdr->sa, sub_type, 0, + session); return; } /* If TKIP counter measures active send Assoc Rsp frame to station with eSIR_MAC_MIC_FAILURE_REASON */ - if (psessionEntry->bTkipCntrMeasActive && - LIM_IS_AP_ROLE(psessionEntry)) { - lim_log(pMac, LOGE, FL("TKIP counter measure is active")); - lim_send_assoc_rsp_mgmt_frame(pMac, + if (session->bTkipCntrMeasActive && + LIM_IS_AP_ROLE(session)) { + lim_log(mac_ctx, LOGE, FL("TKIP counter measure is active")); + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_MIC_FAILURE_REASON, - 1, pHdr->sa, subType, - 0, psessionEntry); + 1, hdr->sa, sub_type, + 0, session); return; } /* Allocate memory for the Assoc Request frame */ - pAssocReq = qdf_mem_malloc(sizeof(*pAssocReq)); - if (NULL == pAssocReq) { - lim_log(pMac, LOGP, FL("Allocate Memory failed in assoc_req")); + assoc_req = qdf_mem_malloc(sizeof(*assoc_req)); + if (NULL == assoc_req) { + lim_log(mac_ctx, LOGP, FL("Allocate Memory failed in assoc_req")); return; } - qdf_mem_set((void *)pAssocReq, sizeof(*pAssocReq), 0); + qdf_mem_set((void *)assoc_req, sizeof(*assoc_req), 0); /* Parse Assoc Request frame */ - if (subType == LIM_ASSOC) + if (sub_type == LIM_ASSOC) status = - sir_convert_assoc_req_frame2_struct(pMac, pBody, framelen, - pAssocReq); + sir_convert_assoc_req_frame2_struct(mac_ctx, frm_body, frame_len, + assoc_req); else status = - sir_convert_reassoc_req_frame2_struct(pMac, pBody, framelen, - pAssocReq); + sir_convert_reassoc_req_frame2_struct(mac_ctx, frm_body, frame_len, + assoc_req); if (status != eSIR_SUCCESS) { - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("Parse error AssocRequest, length=%d from " - MAC_ADDRESS_STR), framelen, MAC_ADDR_ARRAY(pHdr->sa)); - lim_send_assoc_rsp_mgmt_frame(pMac, eSIR_MAC_UNSPEC_FAILURE_STATUS, - 1, pHdr->sa, subType, 0, - psessionEntry); + MAC_ADDRESS_STR), frame_len, MAC_ADDR_ARRAY(hdr->sa)); + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_UNSPEC_FAILURE_STATUS, + 1, hdr->sa, sub_type, 0, + session); goto error; } - pAssocReq->assocReqFrame = qdf_mem_malloc(framelen); - if (NULL == pAssocReq->assocReqFrame) { - lim_log(pMac, LOGE, + assoc_req->assocReqFrame = qdf_mem_malloc(frame_len); + if (NULL == assoc_req->assocReqFrame) { + lim_log(mac_ctx, LOGE, FL("Unable to allocate memory for the assoc req, " - "length=%d from "), framelen); + "length=%d from "), frame_len); goto error; } - qdf_mem_copy((uint8_t *) pAssocReq->assocReqFrame, - (uint8_t *) pBody, framelen); - pAssocReq->assocReqFrameLength = framelen; + qdf_mem_copy((uint8_t *) assoc_req->assocReqFrame, + (uint8_t *) frm_body, frame_len); + assoc_req->assocReqFrameLength = frame_len; - if (cfg_get_capability_info(pMac, &temp, psessionEntry) != eSIR_SUCCESS) { - lim_log(pMac, LOGP, FL("could not retrieve Capabilities")); + if (cfg_get_capability_info(mac_ctx, &temp, session) != eSIR_SUCCESS) { + lim_log(mac_ctx, LOGP, FL("could not retrieve Capabilities")); goto error; } - lim_copy_u16((uint8_t *) &localCapabilities, temp); + lim_copy_u16((uint8_t *) &local_cap, temp); - if (lim_compare_capabilities(pMac, pAssocReq, - &localCapabilities, psessionEntry) == - false) { - lim_log(pMac, LOGE, FL("local caps mismatch received caps")); - lim_log(pMac, LOGE, FL("Received %s Req with unsupported " + if (lim_compare_capabilities(mac_ctx, assoc_req, + &local_cap, session) == false) { + lim_log(mac_ctx, LOGE, FL("local caps mismatch received caps")); + lim_log(mac_ctx, LOGE, FL("Received %s Req with unsupported " "capabilities from" MAC_ADDRESS_STR), - (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", - MAC_ADDR_ARRAY(pHdr->sa)); + (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", + MAC_ADDR_ARRAY(hdr->sa)); /** * Capabilities of requesting STA does not match with * local capabilities. Respond with 'unsupported capabilities' * status code. */ - lim_send_assoc_rsp_mgmt_frame(pMac, + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, 1, - pHdr->sa, subType, 0, psessionEntry); + hdr->sa, sub_type, 0, session); goto error; } - updateContext = false; + update_ctx = false; - if (lim_cmp_ssid(&pAssocReq->ssId, psessionEntry) != false) { - lim_log(pMac, LOGE, + if (lim_cmp_ssid(&assoc_req->ssId, session) != false) { + lim_log(mac_ctx, LOGE, FL("Received %s Req with unmatched ssid ( Received" " SSID: %.*s current SSID: %.*s ) from " MAC_ADDRESS_STR), - (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", - pAssocReq->ssId.length, pAssocReq->ssId.ssId, - psessionEntry->ssId.length, psessionEntry->ssId.ssId, - MAC_ADDR_ARRAY(pHdr->sa)); + (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", + assoc_req->ssId.length, assoc_req->ssId.ssId, + session->ssId.length, session->ssId.ssId, + MAC_ADDR_ARRAY(hdr->sa)); /** * Received Re/Association Request with either @@ -433,10 +416,10 @@ lim_process_assoc_req_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, * match with local one. * Respond with unspecified status code. */ - lim_send_assoc_rsp_mgmt_frame(pMac, + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_UNSPEC_FAILURE_STATUS, 1, - pHdr->sa, subType, 0, psessionEntry); + hdr->sa, sub_type, 0, session); goto error; } @@ -446,137 +429,137 @@ lim_process_assoc_req_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, ** set or Extended rate set. Some APs are adding basic rates in ** Extended rateset IE ***************************************************************/ - basicRates.numRates = 0; + basic_rates.numRates = 0; for (i = 0; - i < pAssocReq->supportedRates.numRates + i < assoc_req->supportedRates.numRates && (i < SIR_MAC_RATESET_EID_MAX); i++) { - basicRates.rate[i] = pAssocReq->supportedRates.rate[i]; - basicRates.numRates++; + basic_rates.rate[i] = assoc_req->supportedRates.rate[i]; + basic_rates.numRates++; } for (j = 0; - (j < pAssocReq->extendedRates.numRates) + (j < assoc_req->extendedRates.numRates) && (i < SIR_MAC_RATESET_EID_MAX); i++, j++) { - basicRates.rate[i] = pAssocReq->extendedRates.rate[j]; - basicRates.numRates++; + basic_rates.rate[i] = assoc_req->extendedRates.rate[j]; + basic_rates.numRates++; } - if (lim_check_rx_basic_rates(pMac, basicRates, psessionEntry) == false) { - lim_log(pMac, LOGE, FL("Received %s Req with unsupported " + if (lim_check_rx_basic_rates(mac_ctx, basic_rates, session) == false) { + lim_log(mac_ctx, LOGE, FL("Received %s Req with unsupported " "rates from" MAC_ADDRESS_STR), - (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", - MAC_ADDR_ARRAY(pHdr->sa)); + (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", + MAC_ADDR_ARRAY(hdr->sa)); /** * Requesting STA does not support ALL BSS basic * rates. Respond with 'basic rates not supported' * status code. */ - lim_send_assoc_rsp_mgmt_frame(pMac, + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS, 1, - pHdr->sa, subType, 0, psessionEntry); + hdr->sa, sub_type, 0, session); goto error; } - if (LIM_IS_AP_ROLE(psessionEntry) && - (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11G_ONLY) && - (pAssocReq->HTCaps.present)) { - lim_log(pMac, LOGE, + if (LIM_IS_AP_ROLE(session) && + (session->dot11mode == WNI_CFG_DOT11_MODE_11G_ONLY) && + (assoc_req->HTCaps.present)) { + lim_log(mac_ctx, LOGE, FL("SOFTAP was in 11G only mode, rejecting legacy " - "STA : " MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa)); - lim_send_assoc_rsp_mgmt_frame(pMac, + "STA : " MAC_ADDRESS_STR), MAC_ADDR_ARRAY(hdr->sa)); + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, - 1, pHdr->sa, subType, 0, - psessionEntry); + 1, hdr->sa, sub_type, 0, + session); goto error; - } /* end if phyMode == 11G_only */ + } /* end if phy_mode == 11G_only */ - if (LIM_IS_AP_ROLE(psessionEntry) && - (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11N_ONLY) && - (!pAssocReq->HTCaps.present)) { - lim_log(pMac, LOGE, + if (LIM_IS_AP_ROLE(session) && + (session->dot11mode == WNI_CFG_DOT11_MODE_11N_ONLY) && + (!assoc_req->HTCaps.present)) { + lim_log(mac_ctx, LOGE, FL("SOFTAP was in 11N only mode, rejecting legacy " - "STA : " MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa)); - lim_send_assoc_rsp_mgmt_frame(pMac, + "STA : " MAC_ADDRESS_STR), MAC_ADDR_ARRAY(hdr->sa)); + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, - 1, pHdr->sa, subType, 0, - psessionEntry); + 1, hdr->sa, sub_type, 0, + session); goto error; } /* end if PhyMode == 11N_only */ - if (LIM_IS_AP_ROLE(psessionEntry) && - (psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11AC_ONLY) && - (!pAssocReq->VHTCaps.present)) { - lim_send_assoc_rsp_mgmt_frame(pMac, + if (LIM_IS_AP_ROLE(session) && + (session->dot11mode == WNI_CFG_DOT11_MODE_11AC_ONLY) && + (!assoc_req->VHTCaps.present)) { + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_CAPABILITIES_NOT_SUPPORTED_STATUS, - 1, pHdr->sa, subType, 0, - psessionEntry); - lim_log(pMac, LOGE, FL("SOFTAP was in 11AC only mode, reject")); + 1, hdr->sa, sub_type, 0, + session); + lim_log(mac_ctx, LOGE, FL("SOFTAP was in 11AC only mode, reject")); goto error; } /* end if PhyMode == 11AC_only */ /* Spectrum Management (11h) specific checks */ - if (localCapabilities.spectrumMgt) { + if (local_cap.spectrumMgt) { tSirRetStatus status = eSIR_SUCCESS; /* If station is 11h capable, then it SHOULD send all mandatory * IEs in assoc request frame. Let us verify that */ - if (pAssocReq->capabilityInfo.spectrumMgt) { + if (assoc_req->capabilityInfo.spectrumMgt) { if (! - ((pAssocReq->powerCapabilityPresent) - && (pAssocReq->supportedChannelsPresent))) { + ((assoc_req->powerCapabilityPresent) + && (assoc_req->supportedChannelsPresent))) { /* One or more required information elements are missing, log the peers error */ - if (!pAssocReq->powerCapabilityPresent) { - lim_log(pMac, LOG1, + if (!assoc_req->powerCapabilityPresent) { + lim_log(mac_ctx, LOG1, FL ("LIM Info: Missing Power capability " "IE in %s Req from " MAC_ADDRESS_STR), (LIM_ASSOC == - subType) ? "Assoc" : "ReAssoc", - MAC_ADDR_ARRAY(pHdr->sa)); + sub_type) ? "Assoc" : "ReAssoc", + MAC_ADDR_ARRAY(hdr->sa)); } - if (!pAssocReq->supportedChannelsPresent) { - lim_log(pMac, LOGW, + if (!assoc_req->supportedChannelsPresent) { + lim_log(mac_ctx, LOGW, FL ("LIM Info: Missing Supported channel " "IE in %s Req from " MAC_ADDRESS_STR), (LIM_ASSOC == - subType) ? "Assoc" : "ReAssoc", - MAC_ADDR_ARRAY(pHdr->sa)); + sub_type) ? "Assoc" : "ReAssoc", + MAC_ADDR_ARRAY(hdr->sa)); } } else { /* Assoc request has mandatory fields */ status = - lim_is_dot11h_power_capabilities_in_range(pMac, - pAssocReq, - psessionEntry); + lim_is_dot11h_power_capabilities_in_range(mac_ctx, + assoc_req, + session); if (eSIR_SUCCESS != status) { - lim_log(pMac, LOGW, + lim_log(mac_ctx, LOGW, FL("LIM Info: MinTxPower(STA) > " "MaxTxPower(AP) in %s Req from " MAC_ADDRESS_STR), (LIM_ASSOC == - subType) ? "Assoc" : "ReAssoc", - MAC_ADDR_ARRAY(pHdr->sa)); + sub_type) ? "Assoc" : "ReAssoc", + MAC_ADDR_ARRAY(hdr->sa)); } status = - lim_is_dot11h_supported_channels_valid(pMac, - pAssocReq); + lim_is_dot11h_supported_channels_valid(mac_ctx, + assoc_req); if (eSIR_SUCCESS != status) { - lim_log(pMac, LOGW, + lim_log(mac_ctx, LOGW, FL("LIM Info: wrong supported " "channels (STA) in %s Req from " MAC_ADDRESS_STR), (LIM_ASSOC == - subType) ? "Assoc" : "ReAssoc", - MAC_ADDR_ARRAY(pHdr->sa)); + sub_type) ? "Assoc" : "ReAssoc", + MAC_ADDR_ARRAY(hdr->sa)); } /* IEs are valid, use them if needed */ @@ -594,55 +577,55 @@ lim_process_assoc_req_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, } } /* end of spectrum management related processing */ - if ((pAssocReq->HTCaps.present) - && (lim_check_mcs_set(pMac, pAssocReq->HTCaps.supportedMCSSet) == + if ((assoc_req->HTCaps.present) + && (lim_check_mcs_set(mac_ctx, assoc_req->HTCaps.supportedMCSSet) == false)) { - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("received %s req with unsupported" "MCS Rate Set from " MAC_ADDRESS_STR), - (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", - MAC_ADDR_ARRAY(pHdr->sa)); + (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", + MAC_ADDR_ARRAY(hdr->sa)); /** * Requesting STA does not support ALL BSS MCS basic Rate set rates. * Spec does not define any status code for this scenario. */ - lim_send_assoc_rsp_mgmt_frame(pMac, + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_OUTSIDE_SCOPE_OF_SPEC_STATUS, 1, - pHdr->sa, subType, 0, psessionEntry); + hdr->sa, sub_type, 0, session); goto error; } - if (phyMode == WNI_CFG_PHY_MODE_11G) { + if (phy_mode == WNI_CFG_PHY_MODE_11G) { - if (wlan_cfg_get_int(pMac, WNI_CFG_11G_ONLY_POLICY, &val) != + if (wlan_cfg_get_int(mac_ctx, WNI_CFG_11G_ONLY_POLICY, &val) != eSIR_SUCCESS) { - lim_log(pMac, LOGP, + lim_log(mac_ctx, LOGP, FL("could not retrieve 11g-only flag")); goto error; } - if (!pAssocReq->extendedRatesPresent && val) { + if (!assoc_req->extendedRatesPresent && val) { /** * Received Re/Association Request from * 11b STA when 11g only policy option * is set. * Reject with unspecified status code. */ - lim_send_assoc_rsp_mgmt_frame(pMac, + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_BASIC_RATES_NOT_SUPPORTED_STATUS, 1, - pHdr->sa, - subType, 0, psessionEntry); + hdr->sa, + sub_type, 0, session); - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("Rejecting Re/Assoc req from 11b STA: ")); - lim_print_mac_addr(pMac, pHdr->sa, LOGW); + lim_print_mac_addr(mac_ctx, hdr->sa, LOGW); #ifdef WLAN_DEBUG - pMac->lim.gLim11bStaAssocRejectCount++; + mac_ctx->lim.gLim11bStaAssocRejectCount++; #endif goto error; } @@ -650,31 +633,31 @@ lim_process_assoc_req_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, /* Check for 802.11n HT caps compatibility; are HT Capabilities */ /* turned on in lim? */ - if (psessionEntry->htCapability) { + if (session->htCapability) { /* There are; are they turned on in the STA? */ - if (pAssocReq->HTCaps.present) { + if (assoc_req->HTCaps.present) { /* The station *does* support 802.11n HT capability... */ - lim_log(pMac, LOG1, FL("AdvCodingCap:%d ChaWidthSet:%d " + lim_log(mac_ctx, LOG1, FL("AdvCodingCap:%d ChaWidthSet:%d " "PowerSave:%d greenField:%d " "shortGI20:%d shortGI40:%d" "txSTBC:%d rxSTBC:%d delayBA:%d" "maxAMSDUsize:%d DSSS/CCK:%d " "PSMP:%d stbcCntl:%d lsigTXProt:%d"), - pAssocReq->HTCaps.advCodingCap, - pAssocReq->HTCaps.supportedChannelWidthSet, - pAssocReq->HTCaps.mimoPowerSave, - pAssocReq->HTCaps.greenField, - pAssocReq->HTCaps.shortGI20MHz, - pAssocReq->HTCaps.shortGI40MHz, - pAssocReq->HTCaps.txSTBC, - pAssocReq->HTCaps.rxSTBC, - pAssocReq->HTCaps.delayedBA, - pAssocReq->HTCaps.maximalAMSDUsize, - pAssocReq->HTCaps.dsssCckMode40MHz, - pAssocReq->HTCaps.psmp, - pAssocReq->HTCaps.stbcControlFrame, - pAssocReq->HTCaps.lsigTXOPProtection); + assoc_req->HTCaps.advCodingCap, + assoc_req->HTCaps.supportedChannelWidthSet, + assoc_req->HTCaps.mimoPowerSave, + assoc_req->HTCaps.greenField, + assoc_req->HTCaps.shortGI20MHz, + assoc_req->HTCaps.shortGI40MHz, + assoc_req->HTCaps.txSTBC, + assoc_req->HTCaps.rxSTBC, + assoc_req->HTCaps.delayedBA, + assoc_req->HTCaps.maximalAMSDUsize, + assoc_req->HTCaps.dsssCckMode40MHz, + assoc_req->HTCaps.psmp, + assoc_req->HTCaps.stbcControlFrame, + assoc_req->HTCaps.lsigTXOPProtection); /* Make sure the STA's caps are compatible with our own: */ /* 11.15.2 Support of DSSS/CCK in 40 MHz */ @@ -684,198 +667,200 @@ lim_process_assoc_req_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, } /* End if on HT caps turned on in lim. */ /* Clear the buffers so that frame parser knows that there isn't a previously decoded IE in these buffers */ - qdf_mem_set((uint8_t *) &Dot11fIERSN, sizeof(Dot11fIERSN), 0); - qdf_mem_set((uint8_t *) &Dot11fIEWPA, sizeof(Dot11fIEWPA), 0); + qdf_mem_set((uint8_t *) &dot11f_ie_rsn, sizeof(dot11f_ie_rsn), 0); + qdf_mem_set((uint8_t *) &dot11f_ie_wpa, sizeof(dot11f_ie_wpa), 0); /* if additional IE is present, check if it has WscIE */ - if (pAssocReq->addIEPresent && pAssocReq->addIE.length) - wpsIe = - limGetWscIEPtr(pMac, pAssocReq->addIE.addIEdata, - pAssocReq->addIE.length); + if (assoc_req->addIEPresent && assoc_req->addIE.length) + wps_ie = + limGetWscIEPtr(mac_ctx, assoc_req->addIE.addIEdata, + assoc_req->addIE.length); else { - lim_log(pMac, LOG1, FL("Assoc req addIEPresent = %d " + lim_log(mac_ctx, LOG1, FL("Assoc req addIEPresent = %d " "addIE length = %d"), - pAssocReq->addIEPresent, pAssocReq->addIE.length); + assoc_req->addIEPresent, assoc_req->addIE.length); } - /* when wpsIe is present, RSN/WPA IE is ignored */ - if (wpsIe == NULL) { + /* when wps_ie is present, RSN/WPA IE is ignored */ + if (wps_ie == NULL) { /** check whether as RSN IE is present */ - if (LIM_IS_AP_ROLE(psessionEntry) && - psessionEntry->pLimStartBssReq->privacy && - psessionEntry->pLimStartBssReq->rsnIE.length) { - lim_log(pMac, LOG1, + if (LIM_IS_AP_ROLE(session) && + session->pLimStartBssReq->privacy && + session->pLimStartBssReq->rsnIE.length) { + lim_log(mac_ctx, LOG1, FL("RSN enabled auth, Re/Assoc req from STA: " - MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->sa)); - if (pAssocReq->rsnPresent) { - if (pAssocReq->rsn.length) { + MAC_ADDRESS_STR), MAC_ADDR_ARRAY(hdr->sa)); + if (assoc_req->rsnPresent) { + if (assoc_req->rsn.length) { /* Unpack the RSN IE */ - dot11f_unpack_ie_rsn(pMac, - &pAssocReq->rsn. + dot11f_unpack_ie_rsn(mac_ctx, + &assoc_req->rsn. info[0], - pAssocReq->rsn.length, - &Dot11fIERSN); + assoc_req->rsn.length, + &dot11f_ie_rsn); /* Check RSN version is supported or not */ if (SIR_MAC_OUI_VERSION_1 == - Dot11fIERSN.version) { + dot11f_ie_rsn.version) { /* check the groupwise and pairwise cipher suites */ - status = lim_check_rx_rsn_ie_match(pMac, - Dot11fIERSN, - psessionEntry, - pAssocReq-> - HTCaps.present, - &pmfConnection); + status = lim_check_rx_rsn_ie_match(mac_ctx, + dot11f_ie_rsn, + session, + assoc_req-> + HTCaps. + present, + &pmf_connection); + if (eSIR_SUCCESS != status) { - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("RSN Mismatch." "Rejecting Re/Assoc req from " "STA: " MAC_ADDRESS_STR), MAC_ADDR_ARRAY - (pHdr->sa)); + (hdr->sa)); /* some IE is not properly sent */ /* received Association req frame with RSN IE but length is 0 */ lim_send_assoc_rsp_mgmt_frame - (pMac, status, 1, - pHdr->sa, subType, - 0, psessionEntry); + (mac_ctx, status, 1, + hdr->sa, sub_type, + 0, session); goto error; } } else { - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("RSN length not correct." "Rejecting Re/Assoc req from " "STA: " MAC_ADDRESS_STR), - MAC_ADDR_ARRAY(pHdr-> + MAC_ADDR_ARRAY(hdr-> sa)); /* received Association req frame with RSN IE version wrong */ - lim_send_assoc_rsp_mgmt_frame(pMac, + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_UNSUPPORTED_RSN_IE_VERSION_STATUS, 1, - pHdr-> + hdr-> sa, - subType, + sub_type, 0, - psessionEntry); + session); goto error; } } else { - lim_log(pMac, LOGW, + lim_log(mac_ctx, LOGW, FL ("Rejecting Re/Assoc req from STA:" MAC_ADDRESS_STR), - MAC_ADDR_ARRAY(pHdr->sa)); + MAC_ADDR_ARRAY(hdr->sa)); /* received Association req frame with RSN IE but length is 0 */ - lim_send_assoc_rsp_mgmt_frame(pMac, + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS, 1, - pHdr->sa, - subType, 0, - psessionEntry); + hdr->sa, + sub_type, 0, + session); goto error; } - } /* end - if(pAssocReq->rsnPresent) */ - if ((!pAssocReq->rsnPresent) && pAssocReq->wpaPresent) { + } /* end - if(assoc_req->rsnPresent) */ + if ((!assoc_req->rsnPresent) && assoc_req->wpaPresent) { /* Unpack the WPA IE */ - if (pAssocReq->wpa.length) { - dot11f_unpack_ie_wpa(pMac, &pAssocReq->wpa.info[4], /* OUI is not taken care */ - pAssocReq->wpa.length, - &Dot11fIEWPA); + if (assoc_req->wpa.length) { + dot11f_unpack_ie_wpa(mac_ctx, &assoc_req->wpa.info[4], /* OUI is not taken care */ + assoc_req->wpa.length, + &dot11f_ie_wpa); /* check the groupwise and pairwise cipher suites */ - status = lim_check_rx_wpa_ie_match(pMac, - Dot11fIEWPA, - psessionEntry, - pAssocReq-> + status = lim_check_rx_wpa_ie_match(mac_ctx, + dot11f_ie_wpa, + session, + assoc_req-> HTCaps. present); if (eSIR_SUCCESS != status) { - lim_log(pMac, LOGW, + lim_log(mac_ctx, LOGW, FL("WPA IE mismatch" "Rejecting Re/Assoc req from " "STA: " MAC_ADDRESS_STR), - MAC_ADDR_ARRAY(pHdr-> + MAC_ADDR_ARRAY(hdr-> sa)); /* received Association req frame with WPA IE but mismatch */ - lim_send_assoc_rsp_mgmt_frame(pMac, + lim_send_assoc_rsp_mgmt_frame(mac_ctx, status, 1, - pHdr-> + hdr-> sa, - subType, + sub_type, 0, - psessionEntry); + session); goto error; } } else { - lim_log(pMac, LOGW, + lim_log(mac_ctx, LOGW, FL("WPA len incorrect." "Rejecting Re/Assoc req from" "STA: "MAC_ADDRESS_STR), - MAC_ADDR_ARRAY(pHdr->sa)); + MAC_ADDR_ARRAY(hdr->sa)); /* received Association req frame with invalid WPA IE */ - lim_send_assoc_rsp_mgmt_frame(pMac, + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_INVALID_INFORMATION_ELEMENT_STATUS, 1, - pHdr->sa, - subType, 0, - psessionEntry); + hdr->sa, + sub_type, 0, + session); goto error; - } /* end - if(pAssocReq->wpa.length) */ - } /* end - if(pAssocReq->wpaPresent) */ + } /* end - if(assoc_req->wpa.length) */ + } /* end - if(assoc_req->wpaPresent) */ } - /* end of if(psessionEntry->pLimStartBssReq->privacy - && psessionEntry->pLimStartBssReq->rsnIE->length) */ - } /* end of if( ! pAssocReq->wscInfo.present ) */ + /* end of if(session->pLimStartBssReq->privacy + && session->pLimStartBssReq->rsnIE->length) */ + } /* end of if( ! assoc_req->wscInfo.present ) */ else { - lim_log(pMac, LOG1, FL("Assoc req WSE IE is present")); + lim_log(mac_ctx, LOG1, FL("Assoc req WSE IE is present")); } /** * Extract 'associated' context for STA, if any. * This is maintained by DPH and created by LIM. */ - pStaDs = - dph_lookup_hash_entry(pMac, pHdr->sa, &peerIdx, - &psessionEntry->dph.dphHashTable); + sta_ds = + dph_lookup_hash_entry(mac_ctx, hdr->sa, &peer_idx, + &session->dph.dphHashTable); /* / Extract pre-auth context for the STA, if any. */ - pStaPreAuthContext = lim_search_pre_auth_list(pMac, pHdr->sa); + sta_pre_auth_ctx = lim_search_pre_auth_list(mac_ctx, hdr->sa); - if (pStaDs == NULL) { + if (sta_ds == NULL) { /* / Requesting STA is not currently associated */ - if (pe_get_current_stas_count(pMac) == - pMac->lim.gLimAssocStaLimit) { + if (pe_get_current_stas_count(mac_ctx) == + mac_ctx->lim.gLimAssocStaLimit) { /** * Maximum number of STAs that AP can handle reached. * Send Association response to peer MAC entity */ - lim_log(pMac, LOGE, FL("Max Sta count reached : %d"), - pMac->lim.maxStation); - lim_reject_association(pMac, pHdr->sa, - subType, false, + lim_log(mac_ctx, LOGE, FL("Max Sta count reached : %d"), + mac_ctx->lim.maxStation); + lim_reject_association(mac_ctx, hdr->sa, + sub_type, false, (tAniAuthType) 0, 0, false, (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, - psessionEntry); + session); goto error; } /* / Check if STA is pre-authenticated. */ - if ((pStaPreAuthContext == NULL) || - (pStaPreAuthContext && - (pStaPreAuthContext->mlmState != + if ((sta_pre_auth_ctx == NULL) || + (sta_pre_auth_ctx && + (sta_pre_auth_ctx->mlmState != eLIM_MLM_AUTHENTICATED_STATE))) { /** * STA is not pre-authenticated yet requesting @@ -885,72 +870,72 @@ lim_process_assoc_req_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, * Send Deauthentication frame with 'prior * authentication required' reason code. */ - lim_send_deauth_mgmt_frame(pMac, eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON, /* =9 */ - pHdr->sa, psessionEntry, false); + lim_send_deauth_mgmt_frame(mac_ctx, eSIR_MAC_STA_NOT_PRE_AUTHENTICATED_REASON, /* =9 */ + hdr->sa, session, false); - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("received %s req on sessionid: %d from STA " "that does not have pre-auth context" MAC_ADDRESS_STR), - (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", - psessionEntry->peSessionId, - MAC_ADDR_ARRAY(pHdr->sa)); + (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", + session->peSessionId, + MAC_ADDR_ARRAY(hdr->sa)); goto error; } /* / Delete 'pre-auth' context of STA */ - authType = pStaPreAuthContext->authType; - lim_delete_pre_auth_node(pMac, pHdr->sa); + auth_type = sta_pre_auth_ctx->authType; + lim_delete_pre_auth_node(mac_ctx, hdr->sa); /* All is well. Assign AID (after else part) */ - } /* if (pStaDs == NULL) */ + } /* if (sta_ds == NULL) */ else { /* STA context does exist for this STA */ - if (pStaDs->mlmStaContext.mlmState != + if (sta_ds->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE) { /** * Requesting STA is in some 'transient' state? * Ignore the Re/Assoc Req frame by incrementing * debug counter & logging error. */ - if (subType == LIM_ASSOC) { + if (sub_type == LIM_ASSOC) { #ifdef WLAN_DEBUG - pMac->lim.gLimNumAssocReqDropInvldState++; + mac_ctx->lim.gLimNumAssocReqDropInvldState++; #endif - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("received Assoc req in state " "%X from "), - pStaDs->mlmStaContext.mlmState); + sta_ds->mlmStaContext.mlmState); } else { #ifdef WLAN_DEBUG - pMac->lim.gLimNumReassocReqDropInvldState++; + mac_ctx->lim.gLimNumReassocReqDropInvldState++; #endif - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("received ReAssoc req in state %X" " from "), - pStaDs->mlmStaContext.mlmState); + sta_ds->mlmStaContext.mlmState); } - lim_print_mac_addr(pMac, pHdr->sa, LOG1); - lim_print_mlm_state(pMac, LOG1, - (tLimMlmStates) pStaDs->mlmStaContext. + lim_print_mac_addr(mac_ctx, hdr->sa, LOG1); + lim_print_mlm_state(mac_ctx, LOG1, + (tLimMlmStates) sta_ds->mlmStaContext. mlmState); goto error; - } /* if (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE) */ + } /* if (sta_ds->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE) */ /* STA sent association Request frame while already in * 'associated' state */ #ifdef WLAN_FEATURE_11W - lim_log(pMac, LOG1, + lim_log(mac_ctx, LOG1, FL ("Re/Assoc request from station that is already associated")); - lim_log(pMac, LOG1, FL("PMF enabled %d, SA Query state %d"), - pStaDs->rmfEnabled, pStaDs->pmfSaQueryState); - if (pStaDs->rmfEnabled) { - switch (pStaDs->pmfSaQueryState) { + lim_log(mac_ctx, LOG1, FL("PMF enabled %d, SA Query state %d"), + sta_ds->rmfEnabled, sta_ds->pmfSaQueryState); + if (sta_ds->rmfEnabled) { + switch (sta_ds->pmfSaQueryState) { /* start SA Query procedure, respond to Association Request */ /* with try again later */ @@ -960,47 +945,47 @@ lim_process_assoc_req_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, * the SA query procedure, otherwise in next set of SA query * procedure we will end up using the stale value. */ - pStaDs->pmfSaQueryRetryCount = 0; - lim_send_assoc_rsp_mgmt_frame(pMac, + sta_ds->pmfSaQueryRetryCount = 0; + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_TRY_AGAIN_LATER, - 1, pHdr->sa, subType, - pStaDs, psessionEntry); - lim_send_sa_query_request_frame(pMac, + 1, hdr->sa, sub_type, + sta_ds, session); + lim_send_sa_query_request_frame(mac_ctx, (uint8_t *) & - (pStaDs-> + (sta_ds-> pmfSaQueryCurrentTransId), - pHdr->sa, - psessionEntry); - pStaDs->pmfSaQueryStartTransId = - pStaDs->pmfSaQueryCurrentTransId; - pStaDs->pmfSaQueryCurrentTransId++; + hdr->sa, + session); + sta_ds->pmfSaQueryStartTransId = + sta_ds->pmfSaQueryCurrentTransId; + sta_ds->pmfSaQueryCurrentTransId++; /* start timer for SA Query retry */ - if (tx_timer_activate(&pStaDs->pmfSaQueryTimer) + if (tx_timer_activate(&sta_ds->pmfSaQueryTimer) != TX_SUCCESS) { - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL ("PMF SA Query timer activation failed!")); goto error; } - pStaDs->pmfSaQueryState = + sta_ds->pmfSaQueryState = DPH_SA_QUERY_IN_PROGRESS; goto error; /* SA Query procedure still going, respond to Association */ /* Request with try again later */ case DPH_SA_QUERY_IN_PROGRESS: - lim_send_assoc_rsp_mgmt_frame(pMac, + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_TRY_AGAIN_LATER, - 1, pHdr->sa, subType, - 0, psessionEntry); + 1, hdr->sa, sub_type, + 0, session); goto error; /* SA Query procedure timed out, accept Association Request */ /* normally */ case DPH_SA_QUERY_TIMED_OUT: - pStaDs->pmfSaQueryState = + sta_ds->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS; break; } @@ -1008,14 +993,13 @@ lim_process_assoc_req_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, #endif /* no change in the capability so drop the frame */ - if ((true != - qdf_mem_cmp(&pStaDs->mlmStaContext.capabilityInfo, - &pAssocReq->capabilityInfo, - sizeof(tSirMacCapabilityInfo))) - && (subType == LIM_ASSOC)) { - lim_log(pMac, LOGE, + if ((true != qdf_mem_cmp(&sta_ds->mlmStaContext.capabilityInfo, + &assoc_req->capabilityInfo, + sizeof(tSirMacCapabilityInfo))) + && (sub_type == LIM_ASSOC)) { + lim_log(mac_ctx, LOGE, FL(" Received Assoc req in state %X STAid=%d"), - pStaDs->mlmStaContext.mlmState, peerIdx); + sta_ds->mlmStaContext.mlmState, peer_idx); goto error; } else { /** @@ -1023,27 +1007,27 @@ lim_process_assoc_req_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, * 'associated' state. Update STA capabilities and * send Association response frame with same AID */ - lim_log(pMac, LOG1, + lim_log(mac_ctx, LOG1, FL("Recved Assoc req from STA already connected" " UpdateConext")); - pStaDs->mlmStaContext.capabilityInfo = - pAssocReq->capabilityInfo; - if (pStaPreAuthContext - && (pStaPreAuthContext->mlmState == + sta_ds->mlmStaContext.capabilityInfo = + assoc_req->capabilityInfo; + if (sta_pre_auth_ctx + && (sta_pre_auth_ctx->mlmState == eLIM_MLM_AUTHENTICATED_STATE)) { /* / STA has triggered pre-auth again */ - authType = pStaPreAuthContext->authType; - lim_delete_pre_auth_node(pMac, pHdr->sa); + auth_type = sta_pre_auth_ctx->authType; + lim_delete_pre_auth_node(mac_ctx, hdr->sa); } else - authType = pStaDs->mlmStaContext.authType; + auth_type = sta_ds->mlmStaContext.authType; - updateContext = true; + update_ctx = true; if (dph_init_sta_state - (pMac, pHdr->sa, peerIdx, true, - &psessionEntry->dph.dphHashTable) + (mac_ctx, hdr->sa, peer_idx, true, + &session->dph.dphHashTable) == NULL) { - lim_log(pMac, LOGE, - FL("could not Init STAid=%d"), peerIdx); + lim_log(mac_ctx, LOGE, + FL("could not Init STAid=%d"), peer_idx); goto error; } } @@ -1051,52 +1035,52 @@ lim_process_assoc_req_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, } /* end if (lookup for STA in perStaDs fails) */ /* check if sta is allowed per QoS AC rules */ - limGetWmeMode(psessionEntry, &wmeMode); - if ((qosMode == eHAL_SET) || (wmeMode == eHAL_SET)) { + limGetWmeMode(session, &wme_mode); + if ((qos_mode == eHAL_SET) || (wme_mode == eHAL_SET)) { /* for a qsta, check if the requested Traffic spec */ /* is admissible */ /* for a non-qsta check if the sta can be admitted */ - if (pAssocReq->addtsPresent) { - uint8_t tspecIdx = 0; /* index in the sch tspec table. */ - if (lim_admit_control_add_ts - (pMac, pHdr->sa, &(pAssocReq->addtsReq), - &(pAssocReq->qosCapability), 0, false, NULL, - &tspecIdx, psessionEntry) != eSIR_SUCCESS) { - lim_log(pMac, LOGE, + if (assoc_req->addtsPresent) { + uint8_t tspec_idx = 0; /* index in the sch tspec table. */ + if (lim_admit_control_add_ts(mac_ctx, hdr->sa, + &(assoc_req->addtsReq), + &(assoc_req->qosCapability), 0, false, NULL, + &tspec_idx, session) != eSIR_SUCCESS) { + lim_log(mac_ctx, LOGE, FL("AdmitControl: TSPEC rejected")); - lim_send_assoc_rsp_mgmt_frame(pMac, + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_QAP_NO_BANDWIDTH_REASON, - 1, pHdr->sa, subType, - 0, psessionEntry); + 1, hdr->sa, sub_type, + 0, session); #ifdef WLAN_DEBUG - pMac->lim.gLimNumAssocReqDropACRejectTS++; + mac_ctx->lim.gLimNumAssocReqDropACRejectTS++; #endif goto error; } - } else if (lim_admit_control_add_sta(pMac, pHdr->sa, false) + } else if (lim_admit_control_add_sta(mac_ctx, hdr->sa, false) != eSIR_SUCCESS) { - lim_log(pMac, LOGE, FL("AdmitControl: Sta rejected")); - lim_send_assoc_rsp_mgmt_frame(pMac, + lim_log(mac_ctx, LOGE, FL("AdmitControl: Sta rejected")); + lim_send_assoc_rsp_mgmt_frame(mac_ctx, eSIR_MAC_QAP_NO_BANDWIDTH_REASON, 1, - pHdr->sa, - subType, 0, psessionEntry); + hdr->sa, + sub_type, 0, session); #ifdef WLAN_DEBUG - pMac->lim.gLimNumAssocReqDropACRejectSta++; + mac_ctx->lim.gLimNumAssocReqDropACRejectSta++; #endif goto error; } /* else all ok */ - lim_log(pMac, LOG1, FL("AdmitControl: Sta OK!")); + lim_log(mac_ctx, LOG1, FL("AdmitControl: Sta OK!")); } /** * STA is Associated ! */ - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("Received %s Req successful from " MAC_ADDRESS_STR), - (LIM_ASSOC == subType) ? "Assoc" : "ReAssoc", - MAC_ADDR_ARRAY(pHdr->sa)); + (LIM_ASSOC == sub_type) ? "Assoc" : "ReAssoc", + MAC_ADDR_ARRAY(hdr->sa)); /** * AID for this association will be same as the peer Index used in DPH table. @@ -1105,19 +1089,19 @@ lim_process_assoc_req_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, * between 1 - cfg_item(WNI_CFG_ASSOC_STA_LIMIT) */ - peerIdx = lim_assign_peer_idx(pMac, psessionEntry); + peer_idx = lim_assign_peer_idx(mac_ctx, session); - if (!peerIdx) { + if (!peer_idx) { /* Could not assign AID */ /* Reject association */ - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("PeerIdx not avaialble. Reject associaton")); - lim_reject_association(pMac, pHdr->sa, - subType, true, authType, - peerIdx, false, + lim_reject_association(mac_ctx, hdr->sa, + sub_type, true, auth_type, + peer_idx, false, (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, - psessionEntry); + session); goto error; } @@ -1126,24 +1110,24 @@ lim_process_assoc_req_frame(tpAniSirGlobal pMac, uint8_t *pRxPacketInfo, * Add an entry to hash table maintained by DPH module */ - pStaDs = - dph_add_hash_entry(pMac, pHdr->sa, peerIdx, - &psessionEntry->dph.dphHashTable); + sta_ds = + dph_add_hash_entry(mac_ctx, hdr->sa, peer_idx, + &session->dph.dphHashTable); - if (pStaDs == NULL) { + if (sta_ds == NULL) { /* Could not add hash table entry at DPH */ - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("could not add hash entry at DPH for aid=%d, MacAddr:" - MAC_ADDRESS_STR), peerIdx, MAC_ADDR_ARRAY(pHdr->sa)); + MAC_ADDRESS_STR), peer_idx, MAC_ADDR_ARRAY(hdr->sa)); /* Release AID */ - lim_release_peer_idx(pMac, peerIdx, psessionEntry); + lim_release_peer_idx(mac_ctx, peer_idx, session); - lim_reject_association(pMac, pHdr->sa, - subType, true, authType, peerIdx, false, + lim_reject_association(mac_ctx, hdr->sa, + sub_type, true, auth_type, peer_idx, false, (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, - psessionEntry); + session); goto error; } @@ -1152,47 +1136,47 @@ sendIndToSme: /* * check here if the parsedAssocReq already * pointing to the assoc_req and free it before - * assigning this new pAssocReq + * assigning this new assoc_req */ - if (psessionEntry->parsedAssocReq != NULL) { - pTempAssocReq = psessionEntry->parsedAssocReq[pStaDs->assocId]; - if (pTempAssocReq != NULL) { - if (pTempAssocReq->assocReqFrame) { - qdf_mem_free(pTempAssocReq->assocReqFrame); - pTempAssocReq->assocReqFrame = NULL; - pTempAssocReq->assocReqFrameLength = 0; + if (session->parsedAssocReq != NULL) { + tmp_assoc_req = session->parsedAssocReq[sta_ds->assocId]; + if (tmp_assoc_req != NULL) { + if (tmp_assoc_req->assocReqFrame) { + qdf_mem_free(tmp_assoc_req->assocReqFrame); + tmp_assoc_req->assocReqFrame = NULL; + tmp_assoc_req->assocReqFrameLength = 0; } - qdf_mem_free(pTempAssocReq); - pTempAssocReq = NULL; + qdf_mem_free(tmp_assoc_req); + tmp_assoc_req = NULL; } - psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq; + session->parsedAssocReq[sta_ds->assocId] = assoc_req; assoc_req_copied = true; } - pStaDs->mlmStaContext.htCapability = pAssocReq->HTCaps.present; + sta_ds->mlmStaContext.htCapability = assoc_req->HTCaps.present; #ifdef WLAN_FEATURE_11AC - pStaDs->mlmStaContext.vhtCapability = pAssocReq->VHTCaps.present; + sta_ds->mlmStaContext.vhtCapability = assoc_req->VHTCaps.present; #endif - pStaDs->qos.addtsPresent = - (pAssocReq->addtsPresent == 0) ? false : true; - pStaDs->qos.addts = pAssocReq->addtsReq; - pStaDs->qos.capability = pAssocReq->qosCapability; - pStaDs->versionPresent = 0; + sta_ds->qos.addtsPresent = + (assoc_req->addtsPresent == 0) ? false : true; + sta_ds->qos.addts = assoc_req->addtsReq; + sta_ds->qos.capability = assoc_req->qosCapability; + sta_ds->versionPresent = 0; /* short slot and short preamble should be updated before doing limaddsta */ - pStaDs->shortPreambleEnabled = - (uint8_t) pAssocReq->capabilityInfo.shortPreamble; - pStaDs->shortSlotTimeEnabled = - (uint8_t) pAssocReq->capabilityInfo.shortSlotTime; + sta_ds->shortPreambleEnabled = + (uint8_t) assoc_req->capabilityInfo.shortPreamble; + sta_ds->shortSlotTimeEnabled = + (uint8_t) assoc_req->capabilityInfo.shortSlotTime; - pStaDs->valid = 0; - pStaDs->mlmStaContext.authType = authType; - pStaDs->staType = STA_ENTRY_PEER; + sta_ds->valid = 0; + sta_ds->mlmStaContext.authType = auth_type; + sta_ds->staType = STA_ENTRY_PEER; /* TODO: If listen interval is more than certain limit, reject the association. */ /* Need to check customer requirements and then implement. */ - pStaDs->mlmStaContext.listenInterval = pAssocReq->listenInterval; - pStaDs->mlmStaContext.capabilityInfo = pAssocReq->capabilityInfo; + sta_ds->mlmStaContext.listenInterval = assoc_req->listenInterval; + sta_ds->mlmStaContext.capabilityInfo = assoc_req->capabilityInfo; /* The following count will be used to knock-off the station if it doesn't * come back to receive the buffered data. The AP will wait for numTimSent number @@ -1201,289 +1185,289 @@ sendIndToSme: */ /** timWaitCount is used by PMM for monitoring the STA's in PS for LINK*/ - pStaDs->timWaitCount = - (uint8_t) GET_TIM_WAIT_COUNT(pAssocReq->listenInterval); + sta_ds->timWaitCount = + (uint8_t) GET_TIM_WAIT_COUNT(assoc_req->listenInterval); /** Initialise the Current successful MPDU's tranfered to this STA count as 0 */ - pStaDs->curTxMpduCnt = 0; + sta_ds->curTxMpduCnt = 0; - if (IS_DOT11_MODE_HT(psessionEntry->dot11mode) && - pAssocReq->HTCaps.present && pAssocReq->wmeInfoPresent) { - pStaDs->htGreenfield = (uint8_t) pAssocReq->HTCaps.greenField; - pStaDs->htAMpduDensity = pAssocReq->HTCaps.mpduDensity; - pStaDs->htDsssCckRate40MHzSupport = - (uint8_t) pAssocReq->HTCaps.dsssCckMode40MHz; - pStaDs->htLsigTXOPProtection = - (uint8_t) pAssocReq->HTCaps.lsigTXOPProtection; - pStaDs->htMaxAmsduLength = - (uint8_t) pAssocReq->HTCaps.maximalAMSDUsize; - pStaDs->htMaxRxAMpduFactor = pAssocReq->HTCaps.maxRxAMPDUFactor; - pStaDs->htMIMOPSState = pAssocReq->HTCaps.mimoPowerSave; + if (IS_DOT11_MODE_HT(session->dot11mode) && + assoc_req->HTCaps.present && assoc_req->wmeInfoPresent) { + sta_ds->htGreenfield = (uint8_t) assoc_req->HTCaps.greenField; + sta_ds->htAMpduDensity = assoc_req->HTCaps.mpduDensity; + sta_ds->htDsssCckRate40MHzSupport = + (uint8_t) assoc_req->HTCaps.dsssCckMode40MHz; + sta_ds->htLsigTXOPProtection = + (uint8_t) assoc_req->HTCaps.lsigTXOPProtection; + sta_ds->htMaxAmsduLength = + (uint8_t) assoc_req->HTCaps.maximalAMSDUsize; + sta_ds->htMaxRxAMpduFactor = assoc_req->HTCaps.maxRxAMPDUFactor; + sta_ds->htMIMOPSState = assoc_req->HTCaps.mimoPowerSave; - /* pAssocReq will be copied to psessionEntry->parsedAssocReq + /* assoc_req will be copied to session->parsedAssocReq * later */ - ht_cap_ie = ((uint8_t *) &pAssocReq->HTCaps) + 1; + ht_cap_ie = ((uint8_t *) &assoc_req->HTCaps) + 1; /* check whether AP is enabled with shortGI */ - if (wlan_cfg_get_int(pMac, WNI_CFG_SHORT_GI_20MHZ, &val) != + if (wlan_cfg_get_int(mac_ctx, WNI_CFG_SHORT_GI_20MHZ, &val) != eSIR_SUCCESS) { - PELOGE(lim_log(pMac, LOGE, + PELOGE(lim_log(mac_ctx, LOGE, FL("could not retrieve shortGI 20Mhz CFG"));) goto error; } if (val) { - pStaDs->htShortGI20Mhz = - (uint8_t)pAssocReq->HTCaps.shortGI20MHz; + sta_ds->htShortGI20Mhz = + (uint8_t)assoc_req->HTCaps.shortGI20MHz; } else { /* Unset htShortGI20Mhz in ht_caps*/ *ht_cap_ie &= ~(1 << SIR_MAC_HT_CAP_SHORTGI20MHZ_S); - pStaDs->htShortGI20Mhz = 0; + sta_ds->htShortGI20Mhz = 0; } - if (wlan_cfg_get_int(pMac, WNI_CFG_SHORT_GI_40MHZ, &val) != + if (wlan_cfg_get_int(mac_ctx, WNI_CFG_SHORT_GI_40MHZ, &val) != eSIR_SUCCESS) { - PELOGE(lim_log(pMac, LOGE, + PELOGE(lim_log(mac_ctx, LOGE, FL("could not retrieve shortGI 40Mhz CFG"));) goto error; } if (val) { - pStaDs->htShortGI40Mhz = - (uint8_t)pAssocReq->HTCaps.shortGI40MHz; + sta_ds->htShortGI40Mhz = + (uint8_t)assoc_req->HTCaps.shortGI40MHz; } else { /* Unset htShortGI40Mhz in ht_caps */ *ht_cap_ie &= ~(1 << SIR_MAC_HT_CAP_SHORTGI40MHZ_S); - pStaDs->htShortGI40Mhz = 0; + sta_ds->htShortGI40Mhz = 0; } - pStaDs->htSupportedChannelWidthSet = - (uint8_t) pAssocReq->HTCaps.supportedChannelWidthSet; + sta_ds->htSupportedChannelWidthSet = + (uint8_t) assoc_req->HTCaps.supportedChannelWidthSet; /* * peer just follows AP; so when we are softAP/GO, * we just store our session entry's secondary channel offset * here in peer INFRA STA. However, if peer's 40MHz channel * width support is disabled then secondary channel will be zero */ - pStaDs->htSecondaryChannelOffset = - (pStaDs->htSupportedChannelWidthSet) ? psessionEntry-> + sta_ds->htSecondaryChannelOffset = + (sta_ds->htSupportedChannelWidthSet) ? session-> htSecondaryChannelOffset : 0; #ifdef WLAN_FEATURE_11AC - if (pAssocReq->operMode.present) { - pStaDs->vhtSupportedChannelWidthSet = - (uint8_t) ((pAssocReq->operMode.chanWidth == + if (assoc_req->operMode.present) { + sta_ds->vhtSupportedChannelWidthSet = + (uint8_t) ((assoc_req->operMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ) ? WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ : WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ); - pStaDs->htSupportedChannelWidthSet = - (uint8_t) (pAssocReq->operMode. + sta_ds->htSupportedChannelWidthSet = + (uint8_t) (assoc_req->operMode. chanWidth ? eHT_CHANNEL_WIDTH_40MHZ : eHT_CHANNEL_WIDTH_20MHZ); - } else if (pAssocReq->VHTCaps.present) { + } else if (assoc_req->VHTCaps.present) { /* Check if STA has enabled it's channel bonding mode. */ /* If channel bonding mode is enabled, we decide based on SAP's current configuration. */ /* else, we set it to VHT20. */ - pStaDs->vhtSupportedChannelWidthSet = - (uint8_t) ((pStaDs->htSupportedChannelWidthSet == + sta_ds->vhtSupportedChannelWidthSet = + (uint8_t) ((sta_ds->htSupportedChannelWidthSet == eHT_CHANNEL_WIDTH_20MHZ) ? WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ : - psessionEntry->ch_width - 1); - pStaDs->htMaxRxAMpduFactor = - pAssocReq->VHTCaps.maxAMPDULenExp; + session->ch_width - 1); + sta_ds->htMaxRxAMpduFactor = + assoc_req->VHTCaps.maxAMPDULenExp; } /* Lesser among the AP and STA bandwidth of operation. */ - pStaDs->htSupportedChannelWidthSet = - (pStaDs->htSupportedChannelWidthSet < - psessionEntry->htSupportedChannelWidthSet) ? - pStaDs->htSupportedChannelWidthSet : - psessionEntry->htSupportedChannelWidthSet; + sta_ds->htSupportedChannelWidthSet = + (sta_ds->htSupportedChannelWidthSet < + session->htSupportedChannelWidthSet) ? + sta_ds->htSupportedChannelWidthSet : + session->htSupportedChannelWidthSet; #endif - pStaDs->baPolicyFlag = 0xFF; - pStaDs->htLdpcCapable = - (uint8_t) pAssocReq->HTCaps.advCodingCap; + sta_ds->baPolicyFlag = 0xFF; + sta_ds->htLdpcCapable = + (uint8_t) assoc_req->HTCaps.advCodingCap; } - if (pAssocReq->VHTCaps.present && pAssocReq->wmeInfoPresent) { - pStaDs->vhtLdpcCapable = - (uint8_t) pAssocReq->VHTCaps.ldpcCodingCap; + if (assoc_req->VHTCaps.present && assoc_req->wmeInfoPresent) { + sta_ds->vhtLdpcCapable = + (uint8_t) assoc_req->VHTCaps.ldpcCodingCap; } - if (!pAssocReq->wmeInfoPresent) { - pStaDs->mlmStaContext.htCapability = 0; - pStaDs->mlmStaContext.vhtCapability = 0; + if (!assoc_req->wmeInfoPresent) { + sta_ds->mlmStaContext.htCapability = 0; + sta_ds->mlmStaContext.vhtCapability = 0; } - if (pStaDs->mlmStaContext.vhtCapability) { - if (psessionEntry->txBFIniFeatureEnabled && - pAssocReq->VHTCaps.suBeamFormerCap) - pStaDs->vhtBeamFormerCapable = 1; + if (sta_ds->mlmStaContext.vhtCapability) { + if (session->txBFIniFeatureEnabled && + assoc_req->VHTCaps.suBeamFormerCap) + sta_ds->vhtBeamFormerCapable = 1; else - pStaDs->vhtBeamFormerCapable = 0; - if (psessionEntry->enable_su_tx_bformer && - pAssocReq->VHTCaps.suBeamformeeCap) - pStaDs->vht_su_bfee_capable = 1; + sta_ds->vhtBeamFormerCapable = 0; + if (session->enable_su_tx_bformer && + assoc_req->VHTCaps.suBeamformeeCap) + sta_ds->vht_su_bfee_capable = 1; else - pStaDs->vht_su_bfee_capable = 0; + sta_ds->vht_su_bfee_capable = 0; } #ifdef WLAN_FEATURE_11AC - if (lim_populate_matching_rate_set(pMac, - pStaDs, - &(pAssocReq->supportedRates), - &(pAssocReq->extendedRates), - pAssocReq->HTCaps.supportedMCSSet, - psessionEntry, &pAssocReq->VHTCaps) + if (lim_populate_matching_rate_set(mac_ctx, + sta_ds, + &(assoc_req->supportedRates), + &(assoc_req->extendedRates), + assoc_req->HTCaps.supportedMCSSet, + session, &assoc_req->VHTCaps) != eSIR_SUCCESS) #else - if (lim_populate_matching_rate_set(pMac, - pStaDs, - &(pAssocReq->supportedRates), - &(pAssocReq->extendedRates), - pAssocReq->HTCaps.supportedMCSSet, - psessionEntry) != eSIR_SUCCESS) + if (lim_populate_matching_rate_set(mac_ctx, + sta_ds, + &(assoc_req->supportedRates), + &(assoc_req->extendedRates), + assoc_req->HTCaps.supportedMCSSet, + session) != eSIR_SUCCESS) #endif { /* Could not update hash table entry at DPH with rateset */ - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL ("could not update hash entry at DPH for aid=%d, MacAddr: " - MAC_ADDRESS_STR), peerIdx, MAC_ADDR_ARRAY(pHdr->sa)); + MAC_ADDRESS_STR), peer_idx, MAC_ADDR_ARRAY(hdr->sa)); /* Release AID */ - lim_release_peer_idx(pMac, peerIdx, psessionEntry); + lim_release_peer_idx(mac_ctx, peer_idx, session); - lim_reject_association(pMac, pHdr->sa, - subType, true, authType, peerIdx, true, + lim_reject_association(mac_ctx, hdr->sa, + sub_type, true, auth_type, peer_idx, true, (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, - psessionEntry); + session); - if (psessionEntry->parsedAssocReq) - pAssocReq = - psessionEntry->parsedAssocReq[pStaDs->assocId]; + if (session->parsedAssocReq) + assoc_req = + session->parsedAssocReq[sta_ds->assocId]; goto error; } #ifdef WLAN_FEATURE_11AC - if (pAssocReq->operMode.present) { - pStaDs->vhtSupportedRxNss = pAssocReq->operMode.rxNSS + 1; + if (assoc_req->operMode.present) { + sta_ds->vhtSupportedRxNss = assoc_req->operMode.rxNSS + 1; } else { - pStaDs->vhtSupportedRxNss = - ((pStaDs->supportedRates.vhtRxMCSMap & MCSMAPMASK2x2) + sta_ds->vhtSupportedRxNss = + ((sta_ds->supportedRates.vhtRxMCSMap & MCSMAPMASK2x2) == MCSMAPMASK2x2) ? 1 : 2; } #endif /* / Add STA context at MAC HW (BMU, RHP & TFP) */ - pStaDs->qosMode = false; - pStaDs->lleEnabled = false; - if (pAssocReq->capabilityInfo.qos && (qosMode == eHAL_SET)) { - pStaDs->lleEnabled = true; - pStaDs->qosMode = true; + sta_ds->qosMode = false; + sta_ds->lleEnabled = false; + if (assoc_req->capabilityInfo.qos && (qos_mode == eHAL_SET)) { + sta_ds->lleEnabled = true; + sta_ds->qosMode = true; } - pStaDs->wmeEnabled = false; - pStaDs->wsmEnabled = false; - limGetWmeMode(psessionEntry, &wmeMode); - if ((!pStaDs->lleEnabled) && pAssocReq->wmeInfoPresent - && (wmeMode == eHAL_SET)) { - pStaDs->wmeEnabled = true; - pStaDs->qosMode = true; - limGetWsmMode(psessionEntry, &wsmMode); + sta_ds->wmeEnabled = false; + sta_ds->wsmEnabled = false; + limGetWmeMode(session, &wme_mode); + if ((!sta_ds->lleEnabled) && assoc_req->wmeInfoPresent + && (wme_mode == eHAL_SET)) { + sta_ds->wmeEnabled = true; + sta_ds->qosMode = true; + limGetWsmMode(session, &wsm_mode); /* WMM_APSD - WMM_SA related processing should be separate; WMM_SA and WMM_APSD can coexist */ - if (pAssocReq->WMMInfoStation.present) { + if (assoc_req->WMMInfoStation.present) { /* check whether AP supports or not */ - if (LIM_IS_AP_ROLE(psessionEntry) && - (psessionEntry->apUapsdEnable == 0) && - (pAssocReq->WMMInfoStation.acbe_uapsd || - pAssocReq->WMMInfoStation.acbk_uapsd || - pAssocReq->WMMInfoStation.acvo_uapsd || - pAssocReq->WMMInfoStation.acvi_uapsd)) { + if (LIM_IS_AP_ROLE(session) && + (session->apUapsdEnable == 0) && + (assoc_req->WMMInfoStation.acbe_uapsd || + assoc_req->WMMInfoStation.acbk_uapsd || + assoc_req->WMMInfoStation.acvo_uapsd || + assoc_req->WMMInfoStation.acvi_uapsd)) { /** * Received Re/Association Request from * STA when UPASD is not supported. */ - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("AP do not support UAPSD so reply " "to STA accordingly")); /* update UAPSD and send it to LIM to add STA */ - pStaDs->qos.capability.qosInfo.acbe_uapsd = 0; - pStaDs->qos.capability.qosInfo.acbk_uapsd = 0; - pStaDs->qos.capability.qosInfo.acvo_uapsd = 0; - pStaDs->qos.capability.qosInfo.acvi_uapsd = 0; - pStaDs->qos.capability.qosInfo.maxSpLen = 0; + sta_ds->qos.capability.qosInfo.acbe_uapsd = 0; + sta_ds->qos.capability.qosInfo.acbk_uapsd = 0; + sta_ds->qos.capability.qosInfo.acvo_uapsd = 0; + sta_ds->qos.capability.qosInfo.acvi_uapsd = 0; + sta_ds->qos.capability.qosInfo.maxSpLen = 0; } else { /* update UAPSD and send it to LIM to add STA */ - pStaDs->qos.capability.qosInfo.acbe_uapsd = - pAssocReq->WMMInfoStation.acbe_uapsd; - pStaDs->qos.capability.qosInfo.acbk_uapsd = - pAssocReq->WMMInfoStation.acbk_uapsd; - pStaDs->qos.capability.qosInfo.acvo_uapsd = - pAssocReq->WMMInfoStation.acvo_uapsd; - pStaDs->qos.capability.qosInfo.acvi_uapsd = - pAssocReq->WMMInfoStation.acvi_uapsd; - pStaDs->qos.capability.qosInfo.maxSpLen = - pAssocReq->WMMInfoStation.max_sp_length; + sta_ds->qos.capability.qosInfo.acbe_uapsd = + assoc_req->WMMInfoStation.acbe_uapsd; + sta_ds->qos.capability.qosInfo.acbk_uapsd = + assoc_req->WMMInfoStation.acbk_uapsd; + sta_ds->qos.capability.qosInfo.acvo_uapsd = + assoc_req->WMMInfoStation.acvo_uapsd; + sta_ds->qos.capability.qosInfo.acvi_uapsd = + assoc_req->WMMInfoStation.acvi_uapsd; + sta_ds->qos.capability.qosInfo.maxSpLen = + assoc_req->WMMInfoStation.max_sp_length; } } - if (pAssocReq->wsmCapablePresent && (wsmMode == eHAL_SET)) - pStaDs->wsmEnabled = true; + if (assoc_req->wsmCapablePresent && (wsm_mode == eHAL_SET)) + sta_ds->wsmEnabled = true; } /* Re/Assoc Response frame to requesting STA */ - pStaDs->mlmStaContext.subType = subType; + sta_ds->mlmStaContext.subType = sub_type; #ifdef WLAN_FEATURE_11W - pStaDs->rmfEnabled = (pmfConnection) ? 1 : 0; - pStaDs->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS; - timerId.fields.sessionId = psessionEntry->peSessionId; - timerId.fields.peerIdx = peerIdx; - if (wlan_cfg_get_int(pMac, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL, - &retryInterval) != eSIR_SUCCESS) { - lim_log(pMac, LOGE, + sta_ds->rmfEnabled = (pmf_connection) ? 1 : 0; + sta_ds->pmfSaQueryState = DPH_SA_QUERY_NOT_IN_PROGRESS; + timer_id.fields.sessionId = session->peSessionId; + timer_id.fields.peerIdx = peer_idx; + if (wlan_cfg_get_int(mac_ctx, WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL, + &retry_interval) != eSIR_SUCCESS) { + lim_log(mac_ctx, LOGE, FL ("Could not retrieve PMF SA Query retry interval value")); - lim_reject_association(pMac, pHdr->sa, subType, true, authType, - peerIdx, false, + lim_reject_association(mac_ctx, hdr->sa, sub_type, true, auth_type, + peer_idx, false, (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, - psessionEntry); + session); goto error; } - if (WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STAMIN > retryInterval) { - retryInterval = WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STADEF; + if (WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STAMIN > retry_interval) { + retry_interval = WNI_CFG_PMF_SA_QUERY_RETRY_INTERVAL_STADEF; } - if (tx_timer_create(pMac, &pStaDs->pmfSaQueryTimer, "PMF SA Query timer", - lim_pmf_sa_query_timer_handler, timerId.value, - SYS_MS_TO_TICKS((retryInterval * 1024) / 1000), + if (tx_timer_create(mac_ctx, &sta_ds->pmfSaQueryTimer, "PMF SA Query timer", + lim_pmf_sa_query_timer_handler, timer_id.value, + SYS_MS_TO_TICKS((retry_interval * 1024) / 1000), 0, TX_NO_ACTIVATE) != TX_SUCCESS) { - lim_log(pMac, LOGE, FL("could not create PMF SA Query timer")); - lim_reject_association(pMac, pHdr->sa, - subType, true, authType, - peerIdx, false, + lim_log(mac_ctx, LOGE, FL("could not create PMF SA Query timer")); + lim_reject_association(mac_ctx, hdr->sa, + sub_type, true, auth_type, + peer_idx, false, (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, - psessionEntry); + session); goto error; } #endif - if (pAssocReq->ExtCap.present) { - lim_set_stads_rtt_cap(pStaDs, - (struct s_ext_cap *) pAssocReq->ExtCap.bytes, pMac); + if (assoc_req->ExtCap.present) { + lim_set_stads_rtt_cap(sta_ds, + (struct s_ext_cap *) assoc_req->ExtCap.bytes, mac_ctx); } else { - pStaDs->timingMeasCap = 0; - PELOG1(lim_log(pMac, LOG1, FL("ExtCap not present"));) + sta_ds->timingMeasCap = 0; + PELOG1(lim_log(mac_ctx, LOG1, FL("ExtCap not present"));) } - /* BTAMP: Storing the parsed assoc request in the psessionEntry array */ - if (psessionEntry->parsedAssocReq) - psessionEntry->parsedAssocReq[pStaDs->assocId] = pAssocReq; + /* BTAMP: Storing the parsed assoc request in the session array */ + if (session->parsedAssocReq) + session->parsedAssocReq[sta_ds->assocId] = assoc_req; assoc_req_copied = true; - /* BTAMP: If STA context already exist (ie. updateContext = 1) + /* BTAMP: If STA context already exist (ie. update_ctx = 1) * for this STA, then we should delete the old one, and add * the new STA. This is taken care of in the lim_del_sta() routine. * @@ -1493,88 +1477,88 @@ sendIndToSme: * BTAMP, we're directly adding station before waiting for * SME_ASSOC_CNF, so we can do this now. */ - if (!updateContext) { - pStaDs->mlmStaContext.updateContext = 0; + if (!update_ctx) { + sta_ds->mlmStaContext.updateContext = 0; /* BTAMP: Add STA context at HW - issue WMA_ADD_STA_REQ to HAL */ - if (lim_add_sta(pMac, pStaDs, false, psessionEntry) != + if (lim_add_sta(mac_ctx, sta_ds, false, session) != eSIR_SUCCESS) { - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("could not Add STA with assocId=%d"), - pStaDs->assocId); - lim_reject_association(pMac, pStaDs->staAddr, - pStaDs->mlmStaContext.subType, + sta_ds->assocId); + lim_reject_association(mac_ctx, sta_ds->staAddr, + sta_ds->mlmStaContext.subType, true, - pStaDs->mlmStaContext.authType, - pStaDs->assocId, true, + sta_ds->mlmStaContext.authType, + sta_ds->assocId, true, (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, - psessionEntry); + session); - if (psessionEntry->parsedAssocReq) - pAssocReq = psessionEntry->parsedAssocReq[ - pStaDs->assocId]; + if (session->parsedAssocReq) + assoc_req = session->parsedAssocReq[ + sta_ds->assocId]; goto error; } } else { - pStaDs->mlmStaContext.updateContext = 1; + sta_ds->mlmStaContext.updateContext = 1; - mlmPrevState = pStaDs->mlmStaContext.mlmState; + mlm_prev_state = sta_ds->mlmStaContext.mlmState; /* As per the HAL/FW needs the reassoc req need not be calling lim_del_sta */ - if (subType != LIM_REASSOC) { + if (sub_type != LIM_REASSOC) { /* we need to set the mlmState here in order differentiate in lim_del_sta. */ - pStaDs->mlmStaContext.mlmState = + sta_ds->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE; - if (lim_del_sta(pMac, pStaDs, true, psessionEntry) != + if (lim_del_sta(mac_ctx, sta_ds, true, session) != eSIR_SUCCESS) { - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL ("could not DEL STA with assocId=%d staId %d"), - pStaDs->assocId, pStaDs->staIndex); - lim_reject_association(pMac, pStaDs->staAddr, - pStaDs->mlmStaContext. + sta_ds->assocId, sta_ds->staIndex); + lim_reject_association(mac_ctx, sta_ds->staAddr, + sta_ds->mlmStaContext. subType, true, - pStaDs->mlmStaContext. - authType, pStaDs->assocId, + sta_ds->mlmStaContext. + authType, sta_ds->assocId, true, (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS, - psessionEntry); + session); /* Restoring the state back. */ - pStaDs->mlmStaContext.mlmState = mlmPrevState; - if (psessionEntry->parsedAssocReq) - pAssocReq = - psessionEntry->parsedAssocReq[ - pStaDs->assocId]; + sta_ds->mlmStaContext.mlmState = mlm_prev_state; + if (session->parsedAssocReq) + assoc_req = + session->parsedAssocReq[ + sta_ds->assocId]; goto error; } } else { /* mlmState is changed in lim_add_sta context */ /* use the same AID, already allocated */ - if (lim_add_sta(pMac, pStaDs, false, psessionEntry) != + if (lim_add_sta(mac_ctx, sta_ds, false, session) != eSIR_SUCCESS) { - lim_log(pMac, LOGE, + lim_log(mac_ctx, LOGE, FL("Could not AddSta with assocId= %d" "staId %d"), - pStaDs->assocId, pStaDs->staIndex); - lim_reject_association(pMac, pStaDs->staAddr, - pStaDs->mlmStaContext. + sta_ds->assocId, sta_ds->staIndex); + lim_reject_association(mac_ctx, sta_ds->staAddr, + sta_ds->mlmStaContext. subType, true, - pStaDs->mlmStaContext. - authType, pStaDs->assocId, + sta_ds->mlmStaContext. + authType, sta_ds->assocId, true, (tSirResultCodes) eSIR_MAC_WME_REFUSED_STATUS, - psessionEntry); + session); /* Restoring the state back. */ - pStaDs->mlmStaContext.mlmState = mlmPrevState; - if (psessionEntry->parsedAssocReq) - pAssocReq = - psessionEntry->parsedAssocReq[ - pStaDs->assocId]; + sta_ds->mlmStaContext.mlmState = mlm_prev_state; + if (session->parsedAssocReq) + assoc_req = + session->parsedAssocReq[ + sta_ds->assocId]; goto error; } @@ -1583,55 +1567,53 @@ sendIndToSme: } /* AddSta is sucess here */ - if (LIM_IS_AP_ROLE(psessionEntry) && - IS_DOT11_MODE_HT(psessionEntry->dot11mode) && - pAssocReq->HTCaps.present && pAssocReq->wmeInfoPresent) { + if (LIM_IS_AP_ROLE(session) && + IS_DOT11_MODE_HT(session->dot11mode) && + assoc_req->HTCaps.present && assoc_req->wmeInfoPresent) { /** Update in the HAL Station Table for the Update of the Protection Mode */ - lim_post_sm_state_update(pMac, pStaDs->staIndex, - pStaDs->htMIMOPSState, - pStaDs->staAddr, - psessionEntry->smeSessionId); + lim_post_sm_state_update(mac_ctx, sta_ds->staIndex, + sta_ds->htMIMOPSState, + sta_ds->staAddr, + session->smeSessionId); } return; error: - if (pAssocReq != NULL) { - if (pAssocReq->assocReqFrame) { - qdf_mem_free(pAssocReq->assocReqFrame); - pAssocReq->assocReqFrame = NULL; - pAssocReq->assocReqFrameLength = 0; + if (assoc_req != NULL) { + if (assoc_req->assocReqFrame) { + qdf_mem_free(assoc_req->assocReqFrame); + assoc_req->assocReqFrame = NULL; + assoc_req->assocReqFrameLength = 0; } - qdf_mem_free(pAssocReq); + qdf_mem_free(assoc_req); /* to avoid double free */ - if (assoc_req_copied && psessionEntry->parsedAssocReq) - psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL; + if (assoc_req_copied && session->parsedAssocReq) + session->parsedAssocReq[sta_ds->assocId] = NULL; } /* If it is not duplicate Assoc request then only make to Null */ - if ((pStaDs != NULL) && - (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE)) { - if (psessionEntry->parsedAssocReq != NULL) { - pTempAssocReq = - psessionEntry->parsedAssocReq[pStaDs->assocId]; - if (pTempAssocReq != NULL) { - if (pTempAssocReq->assocReqFrame) { - qdf_mem_free(pTempAssocReq-> + if ((sta_ds != NULL) && + (sta_ds->mlmStaContext.mlmState != eLIM_MLM_WT_ADD_STA_RSP_STATE)) { + if (session->parsedAssocReq != NULL) { + tmp_assoc_req = + session->parsedAssocReq[sta_ds->assocId]; + if (tmp_assoc_req != NULL) { + if (tmp_assoc_req->assocReqFrame) { + qdf_mem_free(tmp_assoc_req-> assocReqFrame); - pTempAssocReq->assocReqFrame = NULL; - pTempAssocReq->assocReqFrameLength = 0; + tmp_assoc_req->assocReqFrame = NULL; + tmp_assoc_req->assocReqFrameLength = 0; } - qdf_mem_free(pTempAssocReq); - psessionEntry-> - parsedAssocReq[pStaDs->assocId] = NULL; + qdf_mem_free(tmp_assoc_req); + session-> + parsedAssocReq[sta_ds->assocId] = NULL; } } } - return; - -} /*** end lim_process_assoc_req_frame() ***/ +} #ifdef FEATURE_WLAN_WAPI /**