Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Abhishek Singh | 39ae47e | 2017-10-30 17:39:50 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2015, 2017 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 21 | |
| 22 | /* |
| 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 28 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 29 | * |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 30 | * This file limProcessProbeRspFrame.cc contains the code |
| 31 | * for processing Probe Response Frame. |
| 32 | * Author: Chandra Modumudi |
| 33 | * Date: 03/01/02 |
| 34 | * History:- |
| 35 | * Date Modified by Modification Information |
| 36 | * -------------------------------------------------------------------- |
| 37 | * |
| 38 | */ |
| 39 | |
| 40 | #include "wniApi.h" |
Satyanarayana Dash | 6f43827 | 2015-03-03 18:01:06 +0530 | [diff] [blame] | 41 | #include "wniCfg.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 42 | #include "aniGlobal.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 43 | #include "schApi.h" |
| 44 | #include "utilsApi.h" |
| 45 | #include "limApi.h" |
| 46 | #include "limTypes.h" |
| 47 | #include "limUtils.h" |
| 48 | #include "limAssocUtils.h" |
| 49 | #include "limPropExtsUtils.h" |
| 50 | #include "limSerDesUtils.h" |
| 51 | #include "limSendMessages.h" |
| 52 | |
| 53 | #include "parserApi.h" |
| 54 | |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 55 | tSirRetStatus |
Rashmi Ramanna | 2b55dc1 | 2014-06-10 22:56:20 +0530 | [diff] [blame] | 56 | limValidateIEInformationInProbeRspFrame (tpAniSirGlobal pMac, |
| 57 | tANI_U8 *pRxPacketInfo) |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 58 | { |
| 59 | tSirRetStatus status = eSIR_SUCCESS; |
Rashmi Ramanna | 2b55dc1 | 2014-06-10 22:56:20 +0530 | [diff] [blame] | 60 | tANI_U8 *pFrame; |
| 61 | tANI_U32 nFrame; |
| 62 | tANI_U32 nMissingRsnBytes; |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 63 | |
Rashmi Ramanna | 2b55dc1 | 2014-06-10 22:56:20 +0530 | [diff] [blame] | 64 | /* Validate a Probe response frame for malformed frame. |
| 65 | * If the frame is malformed then do not consider as it |
| 66 | * may cause problem fetching wrong IE values |
| 67 | */ |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 68 | if (WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo) < (SIR_MAC_B_PR_SSID_OFFSET + SIR_MAC_MIN_IE_LEN)) |
| 69 | { |
Rashmi Ramanna | 2b55dc1 | 2014-06-10 22:56:20 +0530 | [diff] [blame] | 70 | return eSIR_FAILURE; |
| 71 | } |
| 72 | |
| 73 | pFrame = WDA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 74 | nFrame = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 75 | nMissingRsnBytes = 0; |
| 76 | |
| 77 | status = ValidateAndRectifyIEs(pMac, pFrame, nFrame, &nMissingRsnBytes); |
| 78 | if ( status == eSIR_SUCCESS ) |
| 79 | { |
| 80 | WDA_GET_RX_MPDU_LEN(pRxPacketInfo) += nMissingRsnBytes; |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | return status; |
| 84 | } |
| 85 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 86 | /** |
| 87 | * limProcessProbeRspFrame |
| 88 | * |
| 89 | *FUNCTION: |
| 90 | * This function is called by limProcessMessageQueue() upon |
| 91 | * Probe Response frame reception. |
| 92 | * |
| 93 | *LOGIC: |
| 94 | * This function processes received Probe Response frame. |
| 95 | * |
| 96 | *ASSUMPTIONS: |
| 97 | * |
| 98 | *NOTE: |
| 99 | * 1. Frames with out-of-order IEs are dropped. |
| 100 | * 2. In case of IBSS, join 'success' makes MLM state machine |
| 101 | * transition into 'BSS started' state. This may have to change |
| 102 | * depending on supporting what kinda Authentication in IBSS. |
| 103 | * |
| 104 | * @param pMac Pointer to Global MAC structure |
| 105 | * @param *pRxPacketInfo A pointer to Buffer descriptor + associated PDUs |
| 106 | * @return None |
| 107 | */ |
| 108 | |
| 109 | |
| 110 | void |
| 111 | limProcessProbeRspFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry) |
| 112 | { |
| 113 | tANI_U8 *pBody; |
| 114 | tANI_U32 frameLen = 0; |
| 115 | tSirMacAddr currentBssId; |
| 116 | tpSirMacMgmtHdr pHdr; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 117 | tSirProbeRespBeacon *pProbeRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 118 | tANI_U8 qosEnabled = false; |
| 119 | tANI_U8 wmeEnabled = false; |
| 120 | |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 121 | if (!psessionEntry) |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 122 | { |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 123 | limLog(pMac, LOGE, FL("psessionEntry is NULL") ); |
| 124 | return; |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 125 | } |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 126 | limLog(pMac,LOG1,"SessionId:%d ProbeRsp Frame is received", |
| 127 | psessionEntry->peSessionId); |
| 128 | |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 129 | |
Abhishek Singh | c75726d | 2015-04-13 14:44:14 +0530 | [diff] [blame] | 130 | pProbeRsp = vos_mem_vmalloc(sizeof(tSirProbeRespBeacon)); |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 131 | if ( NULL == pProbeRsp ) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 132 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 133 | limLog(pMac, LOGE, FL("Unable to allocate memory in limProcessProbeRspFrame") ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 134 | return; |
| 135 | } |
| 136 | |
| 137 | pProbeRsp->ssId.length = 0; |
| 138 | pProbeRsp->wpa.length = 0; |
| 139 | pProbeRsp->propIEinfo.apName.length = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 140 | |
| 141 | |
| 142 | pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 143 | |
| 144 | |
Abhishek Singh | 525045c | 2014-12-15 17:18:45 +0530 | [diff] [blame] | 145 | limLog(pMac, LOG2, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 146 | FL("Received Probe Response frame with length=%d from "), |
| 147 | WDA_GET_RX_MPDU_LEN(pRxPacketInfo)); |
Abhishek Singh | 525045c | 2014-12-15 17:18:45 +0530 | [diff] [blame] | 148 | limPrintMacAddr(pMac, pHdr->sa, LOG2); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 149 | |
Gopichand Nakkala | 2c231c8 | 2013-06-11 17:49:16 +0530 | [diff] [blame] | 150 | if (!pMac->fScanOffload) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 151 | { |
Gopichand Nakkala | 2c231c8 | 2013-06-11 17:49:16 +0530 | [diff] [blame] | 152 | if (limDeactivateMinChannelTimerDuringScan(pMac) != eSIR_SUCCESS) |
| 153 | { |
Abhishek Singh | c75726d | 2015-04-13 14:44:14 +0530 | [diff] [blame] | 154 | vos_mem_vfree(pProbeRsp); |
Gopichand Nakkala | 2c231c8 | 2013-06-11 17:49:16 +0530 | [diff] [blame] | 155 | return; |
| 156 | } |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 157 | } |
Gopichand Nakkala | 2c231c8 | 2013-06-11 17:49:16 +0530 | [diff] [blame] | 158 | |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 159 | // Validate IE information before processing Probe Response Frame |
Rashmi Ramanna | 2b55dc1 | 2014-06-10 22:56:20 +0530 | [diff] [blame] | 160 | if (limValidateIEInformationInProbeRspFrame(pMac, pRxPacketInfo) |
| 161 | != eSIR_SUCCESS) |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 162 | { |
| 163 | PELOG1(limLog(pMac, LOG1, |
| 164 | FL("Parse error ProbeResponse, length=%d"), frameLen);) |
Abhishek Singh | c75726d | 2015-04-13 14:44:14 +0530 | [diff] [blame] | 165 | vos_mem_vfree(pProbeRsp); |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 166 | return; |
| 167 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 168 | |
| 169 | /** |
| 170 | * Expect Probe Response only when |
| 171 | * 1. STA is in scan mode waiting for Beacon/Probe response or |
| 172 | * 2. STA is waiting for Beacon/Probe Response to announce |
| 173 | * join success or |
| 174 | * 3. STA is in IBSS mode in BSS started state or |
| 175 | * 4. STA/AP is in learn mode |
| 176 | * 5. STA in link established state. In this state, the probe response is |
| 177 | * expected for two scenarios: |
| 178 | * -- As part of heart beat mechanism, probe req is sent out |
| 179 | * -- If QoS Info IE in beacon has a different count for EDCA Params, |
| 180 | * and EDCA IE is not present in beacon, |
| 181 | * then probe req is sent out to get the EDCA params. |
| 182 | * |
| 183 | * Ignore Probe Response frame in all other states |
| 184 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 185 | |
Gopichand Nakkala | 2c231c8 | 2013-06-11 17:49:16 +0530 | [diff] [blame] | 186 | // TO SUPPORT BT-AMP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 187 | if (((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) || //mlm state check should be global - 18th oct |
| 188 | (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) || //mlm state check should be global - 18th oct |
| 189 | (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE) || //mlm state check should be global - 18th oct |
| 190 | (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE) || |
| 191 | (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) )|| |
| 192 | ((GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_STA_IN_IBSS_ROLE) && |
Gopichand Nakkala | 2c231c8 | 2013-06-11 17:49:16 +0530 | [diff] [blame] | 193 | (psessionEntry->limMlmState == eLIM_MLM_BSS_STARTED_STATE)) || |
| 194 | pMac->fScanOffload) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 195 | { |
| 196 | frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 197 | |
Chet Lanctot | c6fbce7 | 2013-05-20 17:52:15 -0700 | [diff] [blame] | 198 | if (pMac->lim.gLimBackgroundScanMode == eSIR_ROAMING_SCAN) |
| 199 | { |
| 200 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 201 | FL("Probe Resp Frame Received: BSSID " MAC_ADDRESS_STR " (RSSI %d)"), |
| 202 | MAC_ADDR_ARRAY(pHdr->bssId), |
| 203 | (uint)abs((tANI_S8)WDA_GET_RX_RSSI_DB(pRxPacketInfo))); |
| 204 | } |
| 205 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 206 | // Get pointer to Probe Response frame body |
| 207 | pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 208 | |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 209 | if (sirConvertProbeFrame2Struct(pMac, pBody, frameLen, pProbeRsp) == eSIR_FAILURE || |
| 210 | !pProbeRsp->ssidPresent) // Enforce Mandatory IEs |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 211 | { |
| 212 | PELOG1(limLog(pMac, LOG1, |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 213 | FL("Parse error ProbeResponse, length=%d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 214 | frameLen);) |
Abhishek Singh | c75726d | 2015-04-13 14:44:14 +0530 | [diff] [blame] | 215 | vos_mem_vfree(pProbeRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 216 | return; |
| 217 | } |
Gopichand Nakkala | 2c231c8 | 2013-06-11 17:49:16 +0530 | [diff] [blame] | 218 | |
| 219 | if (pMac->fScanOffload) |
| 220 | { |
| 221 | limCheckAndAddBssDescription(pMac, pProbeRsp, pRxPacketInfo, |
| 222 | eANI_BOOLEAN_FALSE, eANI_BOOLEAN_TRUE); |
| 223 | } |
| 224 | |
| 225 | //To Support BT-AMP |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 226 | if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) || //mlm state check should be global - 18th oct |
| 227 | (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 228 | limCheckAndAddBssDescription(pMac, pProbeRsp, pRxPacketInfo, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 229 | ((pMac->lim.gLimHalScanState == eLIM_HAL_SCANNING_STATE) ? eANI_BOOLEAN_TRUE : eANI_BOOLEAN_FALSE), eANI_BOOLEAN_TRUE); |
| 230 | else if (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE) //mlm state check should be global - 18th oct |
| 231 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 232 | } |
| 233 | else if (psessionEntry->limMlmState == |
| 234 | eLIM_MLM_WT_JOIN_BEACON_STATE) |
| 235 | { |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 236 | if( psessionEntry->beacon != NULL )//Either Beacon/probe response is required. Hence store it in same buffer. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 237 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 238 | vos_mem_free(psessionEntry->beacon); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 239 | psessionEntry->beacon = NULL; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 240 | } |
| 241 | psessionEntry->bcnLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 242 | |
| 243 | psessionEntry->beacon = vos_mem_malloc(psessionEntry->bcnLen); |
| 244 | if ( NULL == psessionEntry->beacon ) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 245 | { |
| 246 | PELOGE(limLog(pMac, LOGE, |
| 247 | FL("Unable to allocate memory to store beacon"));) |
| 248 | } |
| 249 | else |
| 250 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 251 | //Store the Beacon/ProbeRsp. This is sent to csr/hdd in join cnf response. |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 252 | vos_mem_copy(psessionEntry->beacon, |
| 253 | WDA_GET_RX_MPDU_DATA(pRxPacketInfo), |
| 254 | psessionEntry->bcnLen); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 255 | } |
| 256 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 257 | // STA in WT_JOIN_BEACON_STATE |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 258 | limCheckAndAnnounceJoinSuccess(pMac, pProbeRsp, pHdr, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 259 | } |
| 260 | else if(psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) |
| 261 | { |
| 262 | tpDphHashNode pStaDs = NULL; |
| 263 | /** |
| 264 | * Check if this Probe Response is for |
| 265 | * our Probe Request sent upon reaching |
| 266 | * heart beat threshold |
| 267 | */ |
| 268 | #if 0 |
| 269 | if (wlan_cfgGetStr(pMac, |
| 270 | WNI_CFG_BSSID, |
| 271 | currentBssId, |
| 272 | &cfg) != eSIR_SUCCESS) |
| 273 | { |
| 274 | /// Could not get BSSID from CFG. Log error. |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 275 | limLog(pMac, LOGP, FL("could not retrieve BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 276 | } |
| 277 | #endif //TO SUPPORT BT-AMP |
| 278 | sirCopyMacAddr(currentBssId,psessionEntry->bssId); |
| 279 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 280 | if ( !vos_mem_compare(currentBssId, pHdr->bssId, sizeof(tSirMacAddr)) ) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 281 | { |
Abhishek Singh | c75726d | 2015-04-13 14:44:14 +0530 | [diff] [blame] | 282 | vos_mem_vfree(pProbeRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 283 | return; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 284 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 285 | |
| 286 | if (!LIM_IS_CONNECTION_ACTIVE(psessionEntry)) |
| 287 | { |
| 288 | limLog(pMac, LOGW, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 289 | FL("Received Probe Resp from AP. So it is alive!!")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 290 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 291 | if (pProbeRsp->HTInfo.present) |
| 292 | limReceivedHBHandler(pMac, (tANI_U8)pProbeRsp->HTInfo.primaryChannel, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 293 | else |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 294 | limReceivedHBHandler(pMac, (tANI_U8)pProbeRsp->channelNumber, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 295 | } |
| 296 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 297 | |
| 298 | if (psessionEntry->limSystemRole == eLIM_STA_ROLE) |
| 299 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 300 | if (pProbeRsp->channelSwitchPresent || |
Abhishek Singh | 39ae47e | 2017-10-30 17:39:50 +0530 | [diff] [blame] | 301 | pProbeRsp->propIEinfo.propChannelSwitchPresent || |
| 302 | pProbeRsp->ecsa_present) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 303 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 304 | limUpdateChannelSwitch(pMac, pProbeRsp, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 305 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 306 | else if (psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 307 | { |
| 308 | limCancelDot11hChannelSwitch(pMac, psessionEntry); |
| 309 | } |
| 310 | } |
| 311 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 312 | |
| 313 | /** |
| 314 | * Now Process EDCA Parameters, if EDCAParamSet count is different. |
| 315 | * -- While processing beacons in link established state if it is determined that |
| 316 | * QoS Info IE has a different count for EDCA Params, |
| 317 | * and EDCA IE is not present in beacon, |
| 318 | * then probe req is sent out to get the EDCA params. |
| 319 | */ |
| 320 | |
| 321 | pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 322 | |
| 323 | limGetQosMode(psessionEntry, &qosEnabled); |
| 324 | limGetWmeMode(psessionEntry, &wmeEnabled); |
| 325 | PELOG2(limLog(pMac, LOG2, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 326 | FL("wmeEdcaPresent: %d wmeEnabled: %d, edcaPresent: %d, qosEnabled: %d, edcaParams.qosInfo.count: %d schObject.gLimEdcaParamSetCount: %d"), |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 327 | pProbeRsp->wmeEdcaPresent, wmeEnabled, pProbeRsp->edcaPresent, qosEnabled, |
| 328 | pProbeRsp->edcaParams.qosInfo.count, psessionEntry->gLimEdcaParamSetCount);) |
| 329 | if (((pProbeRsp->wmeEdcaPresent && wmeEnabled) || |
| 330 | (pProbeRsp->edcaPresent && qosEnabled)) && |
| 331 | (pProbeRsp->edcaParams.qosInfo.count != psessionEntry->gLimEdcaParamSetCount)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 332 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 333 | if (schBeaconEdcaProcess(pMac, &pProbeRsp->edcaParams, psessionEntry) != eSIR_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 334 | PELOGE(limLog(pMac, LOGE, FL("EDCA parameter processing error"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 335 | else if (pStaDs != NULL) |
| 336 | { |
| 337 | // If needed, downgrade the EDCA parameters |
| 338 | limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry); |
| 339 | |
| 340 | if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE) |
| 341 | limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE); |
| 342 | else |
| 343 | limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE); |
| 344 | } |
| 345 | else |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 346 | PELOGE(limLog(pMac, LOGE, FL("Self Entry missing in Hash Table"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 347 | |
| 348 | } |
Gopichand Nakkala | be8653b | 2013-04-10 08:16:05 +0530 | [diff] [blame] | 349 | |
| 350 | if (psessionEntry->fWaitForProbeRsp == true) |
| 351 | { |
| 352 | limLog(pMac, LOGW, FL("Checking probe response for capability change\n") ); |
| 353 | limDetectChangeInApCapabilities(pMac, pProbeRsp, psessionEntry); |
| 354 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 355 | } |
| 356 | else if ((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) && |
| 357 | (psessionEntry->limMlmState == eLIM_MLM_BSS_STARTED_STATE)) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 358 | limHandleIBSScoalescing(pMac, pProbeRsp, pRxPacketInfo,psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 359 | } // if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) || ... |
| 360 | |
Abhishek Singh | c75726d | 2015-04-13 14:44:14 +0530 | [diff] [blame] | 361 | vos_mem_vfree(pProbeRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 362 | // Ignore Probe Response frame in all other states |
| 363 | return; |
| 364 | } /*** end limProcessProbeRspFrame() ***/ |
| 365 | |
| 366 | |
| 367 | void |
| 368 | limProcessProbeRspFrameNoSession(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo) |
| 369 | { |
| 370 | tANI_U8 *pBody; |
| 371 | tANI_U32 frameLen = 0; |
| 372 | tpSirMacMgmtHdr pHdr; |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 373 | tSirProbeRespBeacon *pProbeRsp; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 374 | |
Abhishek Singh | c75726d | 2015-04-13 14:44:14 +0530 | [diff] [blame] | 375 | pProbeRsp = vos_mem_vmalloc(sizeof(tSirProbeRespBeacon)); |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 376 | if ( NULL == pProbeRsp ) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 377 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 378 | limLog(pMac, LOGE, FL("Unable to allocate memory in limProcessProbeRspFrameNoSession") ); |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 379 | return; |
| 380 | } |
| 381 | |
| 382 | pProbeRsp->ssId.length = 0; |
| 383 | pProbeRsp->wpa.length = 0; |
| 384 | pProbeRsp->propIEinfo.apName.length = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 385 | |
| 386 | |
| 387 | pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo); |
| 388 | |
| 389 | |
| 390 | limLog(pMac, LOG2, |
| 391 | FL("Received Probe Response frame with length=%d from "), |
| 392 | WDA_GET_RX_MPDU_LEN(pRxPacketInfo)); |
| 393 | limPrintMacAddr(pMac, pHdr->sa, LOG2); |
| 394 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 395 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 396 | if (!(WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo) || |
| 397 | WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 398 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 399 | #endif |
Gopichand Nakkala | 2c231c8 | 2013-06-11 17:49:16 +0530 | [diff] [blame] | 400 | if (!pMac->fScanOffload) |
| 401 | { |
| 402 | if (limDeactivateMinChannelTimerDuringScan(pMac) != eSIR_SUCCESS) |
| 403 | { |
Abhishek Singh | c75726d | 2015-04-13 14:44:14 +0530 | [diff] [blame] | 404 | vos_mem_vfree(pProbeRsp); |
Gopichand Nakkala | 2c231c8 | 2013-06-11 17:49:16 +0530 | [diff] [blame] | 405 | return; |
| 406 | } |
| 407 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 408 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 409 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 410 | #endif |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 411 | // Validate IE information before processing Probe Response Frame |
Rashmi Ramanna | 2b55dc1 | 2014-06-10 22:56:20 +0530 | [diff] [blame] | 412 | if (limValidateIEInformationInProbeRspFrame(pMac, pRxPacketInfo) |
| 413 | != eSIR_SUCCESS) |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 414 | { |
| 415 | PELOG1(limLog(pMac, LOG1,FL("Parse error ProbeResponse, length=%d"), |
| 416 | frameLen);) |
Abhishek Singh | c75726d | 2015-04-13 14:44:14 +0530 | [diff] [blame] | 417 | vos_mem_vfree(pProbeRsp); |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 418 | return; |
| 419 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 420 | /* Since there is no psessionEntry, PE cannot be in the following states: |
| 421 | * - eLIM_MLM_WT_JOIN_BEACON_STATE |
| 422 | * - eLIM_MLM_LINK_ESTABLISHED_STATE |
| 423 | * - eLIM_MLM_BSS_STARTED_STATE |
| 424 | * Hence, expect Probe Response only when |
| 425 | * 1. STA is in scan mode waiting for Beacon/Probe response |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 426 | * 2. LFR logic in FW sends up candidate frames |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 427 | * |
| 428 | * Ignore Probe Response frame in all other states |
| 429 | */ |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 430 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 431 | if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo)) |
| 432 | { |
| 433 | frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 434 | |
Chet Lanctot | c6fbce7 | 2013-05-20 17:52:15 -0700 | [diff] [blame] | 435 | if (pMac->lim.gLimBackgroundScanMode == eSIR_ROAMING_SCAN) |
| 436 | { |
| 437 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 438 | FL("Probe Resp Frame Received: BSSID " MAC_ADDRESS_STR " (RSSI %d)"), |
| 439 | MAC_ADDR_ARRAY(pHdr->bssId), |
| 440 | (uint)abs((tANI_S8)WDA_GET_RX_RSSI_DB(pRxPacketInfo))); |
| 441 | } |
| 442 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 443 | // Get pointer to Probe Response frame body |
| 444 | pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 445 | |
| 446 | if (sirConvertProbeFrame2Struct(pMac, pBody, frameLen, pProbeRsp) == eSIR_FAILURE) |
| 447 | { |
| 448 | limLog(pMac, LOG1, FL("Parse error ProbeResponse, length=%d\n"), frameLen); |
Abhishek Singh | c75726d | 2015-04-13 14:44:14 +0530 | [diff] [blame] | 449 | vos_mem_vfree(pProbeRsp); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 450 | return; |
| 451 | } |
| 452 | limLog( pMac, LOG2, FL("Save this probe rsp in LFR cache")); |
| 453 | limCheckAndAddBssDescription(pMac, pProbeRsp, pRxPacketInfo, |
| 454 | eANI_BOOLEAN_FALSE, eANI_BOOLEAN_TRUE); |
| 455 | } |
| 456 | else |
| 457 | #endif |
Gopichand Nakkala | 2c231c8 | 2013-06-11 17:49:16 +0530 | [diff] [blame] | 458 | if (pMac->fScanOffload) |
| 459 | { |
| 460 | frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 461 | |
| 462 | // Get pointer to Probe Response frame body |
| 463 | pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 464 | |
| 465 | if (sirConvertProbeFrame2Struct(pMac, pBody, frameLen, pProbeRsp) |
| 466 | == eSIR_FAILURE) |
| 467 | { |
| 468 | limLog(pMac, LOG1, |
| 469 | FL("Parse error ProbeResponse, length=%d\n"), frameLen); |
Abhishek Singh | c75726d | 2015-04-13 14:44:14 +0530 | [diff] [blame] | 470 | vos_mem_vfree(pProbeRsp); |
Gopichand Nakkala | 2c231c8 | 2013-06-11 17:49:16 +0530 | [diff] [blame] | 471 | return; |
| 472 | } |
| 473 | limCheckAndAddBssDescription(pMac, pProbeRsp, pRxPacketInfo, |
| 474 | eANI_BOOLEAN_FALSE, eANI_BOOLEAN_TRUE); |
| 475 | } |
| 476 | else if( (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 477 | (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) || //mlm state check should be global - 18th oct |
| 478 | (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE) ) |
| 479 | { |
| 480 | frameLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 481 | |
Chet Lanctot | c6fbce7 | 2013-05-20 17:52:15 -0700 | [diff] [blame] | 482 | if (pMac->lim.gLimBackgroundScanMode == eSIR_ROAMING_SCAN) |
| 483 | { |
| 484 | VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 485 | FL("Probe Resp Frame Received: BSSID " MAC_ADDRESS_STR " (RSSI %d)"), |
| 486 | MAC_ADDR_ARRAY(pHdr->bssId), |
| 487 | (uint)abs((tANI_S8)WDA_GET_RX_RSSI_DB(pRxPacketInfo))); |
| 488 | } |
| 489 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 490 | // Get pointer to Probe Response frame body |
| 491 | pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 492 | |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 493 | if (sirConvertProbeFrame2Struct(pMac, pBody, frameLen, pProbeRsp) == eSIR_FAILURE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 494 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 495 | limLog(pMac, LOG1, FL("Parse error ProbeResponse, length=%d"), frameLen); |
Abhishek Singh | c75726d | 2015-04-13 14:44:14 +0530 | [diff] [blame] | 496 | vos_mem_vfree(pProbeRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 497 | return; |
| 498 | } |
| 499 | |
| 500 | if( (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) || |
| 501 | (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) ) |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 502 | limCheckAndAddBssDescription(pMac, pProbeRsp, pRxPacketInfo, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 503 | else if (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE) |
| 504 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 505 | } |
| 506 | } |
Abhishek Singh | c75726d | 2015-04-13 14:44:14 +0530 | [diff] [blame] | 507 | vos_mem_vfree(pProbeRsp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 508 | return; |
| 509 | } /*** end limProcessProbeRspFrameNew() ***/ |