Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
| 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. |
| 20 | */ |
| 21 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
| 41 | |
| 42 | /* |
| 43 | * Airgo Networks, Inc proprietary. All rights reserved. |
| 44 | * This file limScanResultUtils.cc contains the utility functions |
| 45 | * LIM uses for maintaining and accessing scan results on STA. |
| 46 | * Author: Chandra Modumudi |
| 47 | * Date: 02/13/02 |
| 48 | * History:- |
| 49 | * Date Modified by Modification Information |
| 50 | * -------------------------------------------------------------------- |
| 51 | */ |
| 52 | |
| 53 | #include "limTypes.h" |
| 54 | #include "limUtils.h" |
| 55 | #include "limSerDesUtils.h" |
| 56 | #include "limApi.h" |
| 57 | #include "limSession.h" |
| 58 | #if defined WLAN_FEATURE_VOWIFI |
| 59 | #include "rrmApi.h" |
| 60 | #endif |
| 61 | |
| 62 | |
| 63 | |
| 64 | /** |
| 65 | * limDeactiveMinChannelTimerDuringScan() |
| 66 | * |
| 67 | *FUNCTION: |
| 68 | * This function is called during scan upon receiving |
| 69 | * Beacon/Probe Response frame to deactivate MIN channel |
| 70 | * timer if running. |
| 71 | * |
| 72 | * This function should be called only when pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE |
| 73 | * |
| 74 | *LOGIC: |
| 75 | * |
| 76 | *ASSUMPTIONS: |
| 77 | * NA |
| 78 | * |
| 79 | *NOTE: |
| 80 | * NA |
| 81 | * |
| 82 | * @param pMac - Pointer to Global MAC structure |
| 83 | * |
| 84 | * @return eSIR_SUCCESS in case of success |
| 85 | */ |
| 86 | |
| 87 | tANI_U32 |
| 88 | limDeactivateMinChannelTimerDuringScan(tpAniSirGlobal pMac) |
| 89 | { |
| 90 | if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) && (pMac->lim.gLimHalScanState == eLIM_HAL_SCANNING_STATE)) |
| 91 | { |
| 92 | /** |
| 93 | * Beacon/Probe Response is received during active scanning. |
| 94 | * Deactivate MIN channel timer if running. |
| 95 | */ |
| 96 | |
| 97 | limDeactivateAndChangeTimer(pMac,eLIM_MIN_CHANNEL_TIMER); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 98 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_MAX_CHANNEL_TIMER)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 99 | if (tx_timer_activate(&pMac->lim.limTimers.gLimMaxChannelTimer) |
| 100 | == TX_TIMER_ERROR) |
| 101 | { |
| 102 | /// Could not activate max channel timer. |
| 103 | // Log error |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 104 | limLog(pMac,LOGP, FL("could not activate max channel timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 105 | |
| 106 | limCompleteMlmScan(pMac, eSIR_SME_RESOURCES_UNAVAILABLE); |
| 107 | return TX_TIMER_ERROR; |
| 108 | } |
| 109 | } |
| 110 | return eSIR_SUCCESS; |
| 111 | } /*** end limDeactivateMinChannelTimerDuringScan() ***/ |
| 112 | |
| 113 | |
| 114 | |
| 115 | /** |
| 116 | * limCollectBssDescription() |
| 117 | * |
| 118 | *FUNCTION: |
| 119 | * This function is called during scan upon receiving |
| 120 | * Beacon/Probe Response frame to check if the received |
| 121 | * frame matches scan criteria, collect BSS description |
| 122 | * and add it to cached scan results. |
| 123 | * |
| 124 | *LOGIC: |
| 125 | * |
| 126 | *ASSUMPTIONS: |
| 127 | * NA |
| 128 | * |
| 129 | *NOTE: |
| 130 | * NA |
| 131 | * |
| 132 | * @param pMac - Pointer to Global MAC structure |
| 133 | * @param pBPR - Pointer to parsed Beacon/Probe Response structure |
| 134 | * @param pRxPacketInfo - Pointer to Received frame's BD |
| 135 | * ---------if defined WLAN_FEATURE_VOWIFI------ |
| 136 | * @param fScanning - flag to indicate if it is during scan. |
| 137 | * --------------------------------------------- |
| 138 | * |
| 139 | * @return None |
| 140 | */ |
| 141 | #if defined WLAN_FEATURE_VOWIFI |
Kiet Lam | 623403f | 2013-10-21 20:29:40 +0530 | [diff] [blame] | 142 | eHalStatus |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 143 | limCollectBssDescription(tpAniSirGlobal pMac, |
| 144 | tSirBssDescription *pBssDescr, |
| 145 | tpSirProbeRespBeacon pBPR, |
| 146 | tANI_U8 *pRxPacketInfo, |
| 147 | tANI_U8 fScanning) |
| 148 | #else |
Kiet Lam | 623403f | 2013-10-21 20:29:40 +0530 | [diff] [blame] | 149 | eHalStatus |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 150 | limCollectBssDescription(tpAniSirGlobal pMac, |
| 151 | tSirBssDescription *pBssDescr, |
| 152 | tpSirProbeRespBeacon pBPR, |
| 153 | tANI_U8 *pRxPacketInfo) |
| 154 | #endif |
| 155 | { |
| 156 | tANI_U8 *pBody; |
| 157 | tANI_U32 ieLen = 0; |
| 158 | tpSirMacMgmtHdr pHdr; |
| 159 | tANI_U8 channelNum; |
| 160 | tANI_U8 rxChannel; |
Kiran Kumar Lokere | 79540f9 | 2013-04-25 17:32:16 -0700 | [diff] [blame] | 161 | tANI_U8 rfBand = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 162 | |
| 163 | pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo); |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 164 | VOS_ASSERT(WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo) >= SIR_MAC_B_PR_SSID_OFFSET); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 165 | ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo) - SIR_MAC_B_PR_SSID_OFFSET; |
| 166 | rxChannel = WDA_GET_RX_CH(pRxPacketInfo); |
| 167 | pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo); |
Kiran Kumar Lokere | 79540f9 | 2013-04-25 17:32:16 -0700 | [diff] [blame] | 168 | rfBand = WDA_GET_RX_RFBAND(pRxPacketInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 169 | |
Kiet Lam | 623403f | 2013-10-21 20:29:40 +0530 | [diff] [blame] | 170 | /** |
| 171 | * Drop all the beacons and probe response without P2P IE during P2P search |
| 172 | */ |
| 173 | if (NULL != pMac->lim.gpLimMlmScanReq && pMac->lim.gpLimMlmScanReq->p2pSearch) |
| 174 | { |
| 175 | if (NULL == limGetP2pIEPtr(pMac, (pBody + SIR_MAC_B_PR_SSID_OFFSET), ieLen)) |
| 176 | { |
| 177 | limLog( pMac, LOG3, MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pHdr->bssId)); |
| 178 | return eHAL_STATUS_FAILURE; |
| 179 | } |
| 180 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 181 | |
| 182 | /** |
| 183 | * Length of BSS desription is without length of |
| 184 | * length itself and length of pointer |
| 185 | * that holds the next BSS description |
| 186 | */ |
| 187 | pBssDescr->length = (tANI_U16)( |
| 188 | sizeof(tSirBssDescription) - sizeof(tANI_U16) - |
| 189 | sizeof(tANI_U32) + ieLen); |
| 190 | |
| 191 | // Copy BSS Id |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 192 | vos_mem_copy((tANI_U8 *) &pBssDescr->bssId, |
| 193 | (tANI_U8 *) pHdr->bssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 194 | sizeof(tSirMacAddr)); |
| 195 | |
| 196 | // Copy Timestamp, Beacon Interval and Capability Info |
| 197 | pBssDescr->scanSysTimeMsec = vos_timer_get_system_time(); |
| 198 | |
| 199 | pBssDescr->timeStamp[0] = pBPR->timeStamp[0]; |
| 200 | pBssDescr->timeStamp[1] = pBPR->timeStamp[1]; |
| 201 | pBssDescr->beaconInterval = pBPR->beaconInterval; |
| 202 | pBssDescr->capabilityInfo = limGetU16((tANI_U8 *) &pBPR->capabilityInfo); |
| 203 | |
| 204 | |
| 205 | /* |
| 206 | * There is a narrow window after Channel Switch msg is sent to HAL and before the AGC is shut |
| 207 | * down and beacons/Probe Rsps can trickle in and we may report the incorrect channel in 5Ghz |
| 208 | * band, so not relying on the 'last Scanned Channel' stored in LIM. |
| 209 | * Instead use the value returned by RXP in BD. This the the same value which HAL programs into |
| 210 | * RXP before every channel switch. |
| 211 | * Right now there is a problem in 5Ghz, where we are receiving beacons from a channel different from |
| 212 | * the currently scanned channel. so incorrect channel is reported to CSR and association does not happen. |
| 213 | * So for now we keep on looking for the channel info in the beacon (DSParamSet IE OR HT Info IE), and only if it |
| 214 | * is not present in the beacon, we go for the channel info present in RXP. |
| 215 | * This fix will work for 5Ghz 11n devices, but for 11a devices, we have to rely on RXP routing flag to get the correct channel. |
| 216 | * So The problem of incorrect channel reporting in 5Ghz will still remain for 11a devices. |
| 217 | */ |
| 218 | pBssDescr->channelId = limGetChannelFromBeacon(pMac, pBPR); |
| 219 | |
| 220 | if (pBssDescr->channelId == 0) |
Kiran Kumar Lokere | 79540f9 | 2013-04-25 17:32:16 -0700 | [diff] [blame] | 221 | { |
| 222 | /* If the channel Id is not retrieved from Beacon, extract the channel from BD */ |
| 223 | /* Unmapped the channel.This We have to do since we have done mapping in the hal to |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 224 | overcome the limitation of RXBD of not able to accomodate the bigger channel number.*/ |
Kiran Kumar Lokere | 79540f9 | 2013-04-25 17:32:16 -0700 | [diff] [blame] | 225 | if ((!rfBand) || IS_5G_BAND(rfBand)) |
| 226 | { |
| 227 | rxChannel = limUnmapChannel(rxChannel); |
| 228 | } |
| 229 | if (!rxChannel) |
| 230 | { |
| 231 | rxChannel = pMac->lim.gLimCurrentScanChannelId; |
| 232 | } |
| 233 | pBssDescr->channelId = rxChannel; |
| 234 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 235 | |
Gopichand Nakkala | d492d20 | 2013-05-10 02:50:47 +0530 | [diff] [blame] | 236 | pBssDescr->channelIdSelf = pBssDescr->channelId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 237 | //set the network type in bss description |
| 238 | channelNum = pBssDescr->channelId; |
| 239 | pBssDescr->nwType = limGetNwType(pMac, channelNum, SIR_MAC_MGMT_FRAME, pBPR); |
| 240 | |
| 241 | pBssDescr->aniIndicator = pBPR->propIEinfo.aniIndicator; |
| 242 | |
| 243 | // Copy RSSI & SINR from BD |
| 244 | |
| 245 | PELOG4(limLog(pMac, LOG4, "***********BSS Description for BSSID:*********** "); |
| 246 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG4, pBssDescr->bssId, 6 ); |
| 247 | sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG4, (tANI_U8*)pRxPacketInfo, 36 );) |
| 248 | |
| 249 | pBssDescr->rssi = (tANI_S8)WDA_GET_RX_RSSI_DB(pRxPacketInfo); |
| 250 | |
| 251 | //SINR no longer reported by HW |
| 252 | pBssDescr->sinr = 0; |
| 253 | |
| 254 | pBssDescr->nReceivedTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 255 | |
| 256 | #if defined WLAN_FEATURE_VOWIFI |
| 257 | if( fScanning ) |
| 258 | { |
| 259 | rrmGetStartTSF( pMac, pBssDescr->startTSF ); |
| 260 | pBssDescr->parentTSF = WDA_GET_RX_TIMESTAMP(pRxPacketInfo); |
| 261 | } |
| 262 | #endif |
| 263 | |
| 264 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 265 | // MobilityDomain |
| 266 | pBssDescr->mdie[0] = 0; |
| 267 | pBssDescr->mdie[1] = 0; |
| 268 | pBssDescr->mdie[2] = 0; |
| 269 | pBssDescr->mdiePresent = FALSE; |
| 270 | // If mdie is present in the probe resp we |
| 271 | // fill it in the bss description |
| 272 | if( pBPR->mdiePresent) |
| 273 | { |
| 274 | pBssDescr->mdiePresent = TRUE; |
| 275 | pBssDescr->mdie[0] = pBPR->mdie[0]; |
| 276 | pBssDescr->mdie[1] = pBPR->mdie[1]; |
| 277 | pBssDescr->mdie[2] = pBPR->mdie[2]; |
| 278 | } |
| 279 | #endif |
| 280 | |
| 281 | #ifdef FEATURE_WLAN_CCX |
| 282 | pBssDescr->QBSSLoad_present = FALSE; |
| 283 | pBssDescr->QBSSLoad_avail = 0; |
| 284 | if( pBPR->QBSSLoad.present) |
| 285 | { |
| 286 | pBssDescr->QBSSLoad_present = TRUE; |
| 287 | pBssDescr->QBSSLoad_avail = pBPR->QBSSLoad.avail; |
| 288 | } |
| 289 | #endif |
| 290 | // Copy IE fields |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 291 | vos_mem_copy((tANI_U8 *) &pBssDescr->ieFields, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 292 | pBody + SIR_MAC_B_PR_SSID_OFFSET, |
| 293 | ieLen); |
| 294 | |
| 295 | //sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOGW, (tANI_U8 *) pBssDescr, pBssDescr->length + 2 ); |
| 296 | limLog( pMac, LOG3, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 297 | FL("Collected BSS Description for Channel(%1d), length(%u), aniIndicator(%d), IE Fields(%u)"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 298 | pBssDescr->channelId, |
| 299 | pBssDescr->length, |
| 300 | pBssDescr->aniIndicator, |
| 301 | ieLen ); |
| 302 | |
Kiet Lam | 623403f | 2013-10-21 20:29:40 +0530 | [diff] [blame] | 303 | return eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 304 | } /*** end limCollectBssDescription() ***/ |
| 305 | |
| 306 | /** |
| 307 | * limIsScanRequestedSSID() |
| 308 | * |
| 309 | *FUNCTION: |
| 310 | * This function is called during scan upon receiving |
| 311 | * Beacon/Probe Response frame to check if the received |
| 312 | * SSID is present in the list of requested SSIDs in scan |
| 313 | * |
| 314 | *LOGIC: |
| 315 | * |
| 316 | *ASSUMPTIONS: |
| 317 | * NA |
| 318 | * |
| 319 | *NOTE: |
| 320 | * NA |
| 321 | * |
| 322 | * @param pMac - Pointer to Global MAC structure |
| 323 | * @param ssId - SSID Received in beacons/Probe responses that is compared against the |
| 324 | requeusted SSID in scan list |
| 325 | * --------------------------------------------- |
| 326 | * |
| 327 | * @return boolean - TRUE if SSID is present in requested list, FALSE otherwise |
| 328 | */ |
| 329 | |
| 330 | tANI_BOOLEAN limIsScanRequestedSSID(tpAniSirGlobal pMac, tSirMacSSid *ssId) |
| 331 | { |
| 332 | tANI_U8 i = 0; |
| 333 | |
| 334 | for (i = 0; i < pMac->lim.gpLimMlmScanReq->numSsid; i++) |
| 335 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 336 | if ( eANI_BOOLEAN_TRUE == vos_mem_compare((tANI_U8 *) ssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 337 | (tANI_U8 *) &pMac->lim.gpLimMlmScanReq->ssId[i], |
| 338 | (tANI_U8) (pMac->lim.gpLimMlmScanReq->ssId[i].length + 1))) |
| 339 | { |
| 340 | return eANI_BOOLEAN_TRUE; |
| 341 | } |
| 342 | } |
| 343 | return eANI_BOOLEAN_FALSE; |
| 344 | } |
| 345 | |
| 346 | /** |
| 347 | * limCheckAndAddBssDescription() |
| 348 | * |
| 349 | *FUNCTION: |
| 350 | * This function is called during scan upon receiving |
| 351 | * Beacon/Probe Response frame to check if the received |
| 352 | * frame matches scan criteria, collect BSS description |
| 353 | * and add it to cached scan results. |
| 354 | * |
| 355 | *LOGIC: |
| 356 | * |
| 357 | *ASSUMPTIONS: |
| 358 | * NA |
| 359 | * |
| 360 | *NOTE: |
| 361 | * NA |
| 362 | * |
| 363 | * @param pMac - Pointer to Global MAC structure |
| 364 | * @param pBPR - Pointer to parsed Beacon/Probe Response structure |
| 365 | * @param pRxPacketInfo - Pointer to Received frame's BD |
| 366 | * @param fScanning - boolean to indicate whether the BSS is from current scan or just happen to receive a beacon |
| 367 | * |
| 368 | * @return None |
| 369 | */ |
| 370 | |
| 371 | void |
| 372 | limCheckAndAddBssDescription(tpAniSirGlobal pMac, |
| 373 | tpSirProbeRespBeacon pBPR, |
| 374 | tANI_U8 *pRxPacketInfo, |
| 375 | tANI_BOOLEAN fScanning, |
| 376 | tANI_U8 fProbeRsp) |
| 377 | { |
| 378 | tLimScanResultNode *pBssDescr; |
| 379 | tANI_U32 frameLen, ieLen = 0; |
| 380 | tANI_U8 rxChannelInBeacon = 0; |
| 381 | eHalStatus status; |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 382 | tANI_U8 dontUpdateAll = 0; |
Leela Venkata Kiran Kumar Reddy Chirala | cdd1300 | 2013-10-16 15:43:47 -0700 | [diff] [blame^] | 383 | tANI_U8 rfBand = 0; |
| 384 | tANI_U8 rxChannelInBD = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 385 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 386 | tSirMacAddr bssid = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 387 | tANI_BOOLEAN fFound = FALSE; |
| 388 | tpSirMacDataHdr3a pHdr; |
| 389 | |
| 390 | pHdr = WDA_GET_RX_MPDUHEADER3A((tANI_U8 *)pRxPacketInfo); |
| 391 | |
| 392 | //Checking if scanning for a particular BSSID |
| 393 | if ((fScanning) && (pMac->lim.gpLimMlmScanReq)) |
| 394 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 395 | fFound = vos_mem_compare(pHdr->addr3, &pMac->lim.gpLimMlmScanReq->bssId, 6); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 396 | if (!fFound) |
| 397 | { |
| 398 | if ((pMac->lim.gpLimMlmScanReq->p2pSearch) && |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 399 | (vos_mem_compare(pBPR->P2PProbeRes.P2PDeviceInfo.P2PDeviceAddress, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 400 | &pMac->lim.gpLimMlmScanReq->bssId, 6))) |
| 401 | { |
| 402 | fFound = eANI_BOOLEAN_TRUE; |
| 403 | } |
| 404 | } |
| 405 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 406 | |
| 407 | /** |
| 408 | * Compare SSID with the one sent in |
| 409 | * Probe Request frame, if any. |
| 410 | * If they don't match, ignore the |
| 411 | * Beacon frame. |
| 412 | * pMac->lim.gLimMlmScanReq->ssId.length == 0 |
| 413 | * indicates Broadcast SSID. |
| 414 | * When gLimReturnAfterFirstMatch is set, it means the scan has to match |
| 415 | * a SSID (if it is also set). Ignore the other BSS in that case. |
| 416 | */ |
| 417 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 418 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 419 | if (!(WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo))) |
| 420 | { |
| 421 | #endif |
| 422 | if ((pMac->lim.gpLimMlmScanReq) && |
| 423 | (((fScanning) && |
| 424 | ( pMac->lim.gLimReturnAfterFirstMatch & 0x01 ) && |
| 425 | (pMac->lim.gpLimMlmScanReq->numSsid) && |
| 426 | !limIsScanRequestedSSID(pMac, &pBPR->ssId)) || |
| 427 | (!fFound && (pMac->lim.gpLimMlmScanReq && |
| 428 | pMac->lim.gpLimMlmScanReq->bssId) && |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 429 | !vos_mem_compare(bssid, |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 430 | &pMac->lim.gpLimMlmScanReq->bssId, 6)))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 431 | { |
| 432 | /** |
| 433 | * Received SSID does not match with |
| 434 | * the one we're scanning for. |
| 435 | * Ignore received Beacon frame |
| 436 | */ |
| 437 | |
| 438 | return; |
| 439 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 440 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 441 | } |
| 442 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 443 | |
| 444 | /* There is no point in caching & reporting the scan results for APs |
| 445 | * which are in the process of switching the channel. So, we are not |
| 446 | * caching the scan results for APs which are adverzing the channel-switch |
| 447 | * element in their beacons and probe responses. |
| 448 | */ |
| 449 | if(pBPR->channelSwitchPresent) |
| 450 | { |
| 451 | return; |
| 452 | } |
| 453 | |
| 454 | /* If beacon/probe resp DS param channel does not match with |
| 455 | * RX BD channel then don't save the results. It might be a beacon |
| 456 | * from another channel heard as noise on the current scanning channel |
| 457 | */ |
| 458 | |
Leela Venkata Kiran Kumar Reddy Chirala | cdd1300 | 2013-10-16 15:43:47 -0700 | [diff] [blame^] | 459 | if ((pBPR->dsParamsPresent) || (pBPR->HTInfo.present)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 460 | { |
| 461 | /* This means that we are in 2.4GHz mode or 5GHz 11n mode */ |
| 462 | rxChannelInBeacon = limGetChannelFromBeacon(pMac, pBPR); |
Leela Venkata Kiran Kumar Reddy Chirala | cdd1300 | 2013-10-16 15:43:47 -0700 | [diff] [blame^] | 463 | rfBand = WDA_GET_RX_RFBAND(pRxPacketInfo); |
| 464 | rxChannelInBD = WDA_GET_RX_CH(pRxPacketInfo); |
| 465 | |
| 466 | if ((!rfBand) || IS_5G_BAND(rfBand)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 467 | { |
Leela Venkata Kiran Kumar Reddy Chirala | cdd1300 | 2013-10-16 15:43:47 -0700 | [diff] [blame^] | 468 | rxChannelInBD = limUnmapChannel(rxChannelInBD); |
| 469 | } |
| 470 | |
| 471 | if(rxChannelInBD != rxChannelInBeacon) |
| 472 | { |
| 473 | /* BCAST Frame, if CH do not match, Drop */ |
| 474 | if(WDA_IS_RX_BCAST(pRxPacketInfo)) |
| 475 | { |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 476 | limLog(pMac, LOG3, FL("Beacon/Probe Rsp dropped. Channel in BD %d. " |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 477 | "Channel in beacon" " %d"), |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 478 | WDA_GET_RX_CH(pRxPacketInfo),limGetChannelFromBeacon(pMac, pBPR)); |
| 479 | return; |
Leela Venkata Kiran Kumar Reddy Chirala | cdd1300 | 2013-10-16 15:43:47 -0700 | [diff] [blame^] | 480 | } |
| 481 | /* Unit cast frame, Probe RSP, do not drop */ |
| 482 | else |
| 483 | { |
| 484 | dontUpdateAll = 1; |
| 485 | limLog(pMac, LOG3, FL("SSID %s, CH in ProbeRsp %d, CH in BD %d, miss-match, Do Not Drop"), |
| 486 | pBPR->ssId.ssId, |
| 487 | rxChannelInBeacon, |
| 488 | WDA_GET_RX_CH(pRxPacketInfo)); |
| 489 | WDA_GET_RX_CH(pRxPacketInfo) = rxChannelInBeacon; |
| 490 | } |
| 491 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 492 | } |
| 493 | |
| 494 | /** |
| 495 | * Allocate buffer to hold BSS description from |
| 496 | * received Beacon frame. |
| 497 | * Include size of fixed fields and IEs length |
| 498 | */ |
| 499 | |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 500 | ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 501 | if (ieLen <= SIR_MAC_B_PR_SSID_OFFSET) |
| 502 | { |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 503 | limLog(pMac, LOGP, |
| 504 | FL("RX packet has invalid length %d"), ieLen); |
| 505 | return; |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame] | 506 | } |
| 507 | |
| 508 | ieLen -= SIR_MAC_B_PR_SSID_OFFSET; |
| 509 | |
| 510 | frameLen = sizeof(tLimScanResultNode) + ieLen - sizeof(tANI_U32); //Sizeof(tANI_U32) is for ieFields[1] |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 511 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 512 | pBssDescr = vos_mem_malloc(frameLen); |
| 513 | if ( NULL == pBssDescr ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 514 | { |
| 515 | // Log error |
| 516 | limLog(pMac, LOGP, |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 517 | FL("call for AllocateMemory failed for storing BSS description")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 518 | |
| 519 | return; |
| 520 | } |
| 521 | |
| 522 | // In scan state, store scan result. |
| 523 | #if defined WLAN_FEATURE_VOWIFI |
Kiet Lam | 623403f | 2013-10-21 20:29:40 +0530 | [diff] [blame] | 524 | status = limCollectBssDescription(pMac, &pBssDescr->bssDescription, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 525 | pBPR, pRxPacketInfo, fScanning); |
Kiet Lam | 623403f | 2013-10-21 20:29:40 +0530 | [diff] [blame] | 526 | if (eHAL_STATUS_SUCCESS != status) |
| 527 | { |
| 528 | goto last; |
| 529 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 530 | #else |
Kiet Lam | 623403f | 2013-10-21 20:29:40 +0530 | [diff] [blame] | 531 | status = limCollectBssDescription(pMac, &pBssDescr->bssDescription, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 532 | pBPR, pRxPacketInfo); |
Kiet Lam | 623403f | 2013-10-21 20:29:40 +0530 | [diff] [blame] | 533 | if (eHAL_STATUS_SUCCESS != status) |
| 534 | { |
| 535 | goto last; |
| 536 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 537 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 538 | pBssDescr->bssDescription.fProbeRsp = fProbeRsp; |
| 539 | |
| 540 | pBssDescr->next = NULL; |
| 541 | |
| 542 | /** |
| 543 | * Depending on whether to store unique or all |
| 544 | * scan results, pass hash update/add parameter |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 545 | * For LFR candidates just add them on it's own cache |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 546 | */ |
| 547 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 548 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 549 | if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo)) |
| 550 | { |
| 551 | limLog(pMac, LOG2, FL(" pHdr->addr1:%02x:%02x:%02x:%02x:%02x:%02x\n"), |
| 552 | pHdr->addr1[0], |
| 553 | pHdr->addr1[1], |
| 554 | pHdr->addr1[2], |
| 555 | pHdr->addr1[3], |
| 556 | pHdr->addr1[4], |
| 557 | pHdr->addr1[5]); |
| 558 | limLog(pMac, LOG2, FL(" pHdr->addr2:%02x:%02x:%02x:%02x:%02x:%02x\n"), |
| 559 | pHdr->addr2[0], |
| 560 | pHdr->addr2[1], |
| 561 | pHdr->addr2[2], |
| 562 | pHdr->addr2[3], |
| 563 | pHdr->addr2[4], |
| 564 | pHdr->addr2[5]); |
| 565 | limLog(pMac, LOG2, FL(" pHdr->addr3:%02x:%02x:%02x:%02x:%02x:%02x\n"), |
| 566 | pHdr->addr3[0], |
| 567 | pHdr->addr3[1], |
| 568 | pHdr->addr3[2], |
| 569 | pHdr->addr3[3], |
| 570 | pHdr->addr3[4], |
| 571 | pHdr->addr3[5]); |
| 572 | limLog( pMac, LOG2, FL("Save this entry in LFR cache")); |
| 573 | status = limLookupNaddLfrHashEntry(pMac, pBssDescr, LIM_HASH_ADD, dontUpdateAll); |
| 574 | } |
| 575 | else |
| 576 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 577 | //If it is not scanning, only save unique results |
| 578 | if (pMac->lim.gLimReturnUniqueResults || (!fScanning)) |
| 579 | { |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 580 | status = limLookupNaddHashEntry(pMac, pBssDescr, LIM_HASH_UPDATE, dontUpdateAll); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 581 | } |
| 582 | else |
| 583 | { |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 584 | status = limLookupNaddHashEntry(pMac, pBssDescr, LIM_HASH_ADD, dontUpdateAll); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 585 | } |
| 586 | |
| 587 | if(fScanning) |
| 588 | { |
| 589 | if ((pBssDescr->bssDescription.channelId <= 14) && |
| 590 | (pMac->lim.gLimReturnAfterFirstMatch & 0x40) && |
| 591 | pBPR->countryInfoPresent) |
| 592 | pMac->lim.gLim24Band11dScanDone = 1; |
| 593 | |
| 594 | if ((pBssDescr->bssDescription.channelId > 14) && |
| 595 | (pMac->lim.gLimReturnAfterFirstMatch & 0x80) && |
| 596 | pBPR->countryInfoPresent) |
| 597 | pMac->lim.gLim50Band11dScanDone = 1; |
| 598 | |
| 599 | if ( ( pMac->lim.gLimReturnAfterFirstMatch & 0x01 ) || |
| 600 | ( pMac->lim.gLim24Band11dScanDone && ( pMac->lim.gLimReturnAfterFirstMatch & 0x40 ) ) || |
Gopichand Nakkala | 48b4d7e | 2013-03-06 23:34:16 +0530 | [diff] [blame] | 601 | ( pMac->lim.gLim50Band11dScanDone && ( pMac->lim.gLimReturnAfterFirstMatch & 0x80 ) ) || |
| 602 | fFound ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 603 | { |
| 604 | /** |
| 605 | * Stop scanning and return the BSS description(s) |
| 606 | * collected so far. |
| 607 | */ |
| 608 | limLog(pMac, |
| 609 | LOGW, |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 610 | FL("Completed scan: 24Band11dScan = %d, 50Band11dScan = %d BSS id"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 611 | pMac->lim.gLim24Band11dScanDone, |
| 612 | pMac->lim.gLim50Band11dScanDone); |
| 613 | |
| 614 | //Need to disable the timers. If they fire, they will send END_SCAN |
| 615 | //while we already send FINISH_SCAN here. This may mess up the gLimHalScanState |
| 616 | limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER); |
| 617 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
| 618 | //Set the resume channel to Any valid channel (invalid). |
| 619 | //This will instruct HAL to set it to any previous valid channel. |
| 620 | peSetResumeChannel(pMac, 0, 0); |
| 621 | limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE ); |
| 622 | //limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE ); |
| 623 | } |
| 624 | }//(eANI_BOOLEAN_TRUE == fScanning) |
| 625 | |
Kiet Lam | 623403f | 2013-10-21 20:29:40 +0530 | [diff] [blame] | 626 | last: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 627 | if( eHAL_STATUS_SUCCESS != status ) |
| 628 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 629 | vos_mem_free( pBssDescr ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 630 | } |
Kiet Lam | 623403f | 2013-10-21 20:29:40 +0530 | [diff] [blame] | 631 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 632 | } /****** end limCheckAndAddBssDescription() ******/ |
| 633 | |
| 634 | |
| 635 | |
| 636 | /** |
| 637 | * limScanHashFunction() |
| 638 | * |
| 639 | *FUNCTION: |
| 640 | * This function is called during scan hash entry operations |
| 641 | * |
| 642 | *LOGIC: |
| 643 | * |
| 644 | *ASSUMPTIONS: |
| 645 | * NA |
| 646 | * |
| 647 | *NOTE: |
| 648 | * NA |
| 649 | * |
| 650 | * @param bssId - Received BSSid |
| 651 | * |
| 652 | * @return Hash index |
| 653 | */ |
| 654 | |
| 655 | tANI_U8 |
| 656 | limScanHashFunction(tSirMacAddr bssId) |
| 657 | { |
| 658 | tANI_U16 i, hash = 0; |
| 659 | |
| 660 | for (i = 0; i < sizeof(tSirMacAddr); i++) |
| 661 | hash += bssId[i]; |
| 662 | |
| 663 | return hash % LIM_MAX_NUM_OF_SCAN_RESULTS; |
| 664 | } /****** end limScanHashFunction() ******/ |
| 665 | |
| 666 | |
| 667 | |
| 668 | /** |
| 669 | * limInitHashTable() |
| 670 | * |
| 671 | *FUNCTION: |
| 672 | * This function is called upon receiving SME_START_REQ |
| 673 | * to initialize global cached scan hash table |
| 674 | * |
| 675 | *LOGIC: |
| 676 | * |
| 677 | *ASSUMPTIONS: |
| 678 | * NA |
| 679 | * |
| 680 | *NOTE: |
| 681 | * NA |
| 682 | * |
| 683 | * @param pMac - Pointer to Global MAC structure |
| 684 | * @return None |
| 685 | */ |
| 686 | |
| 687 | void |
| 688 | limInitHashTable(tpAniSirGlobal pMac) |
| 689 | { |
| 690 | tANI_U16 i; |
| 691 | for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++) |
| 692 | pMac->lim.gLimCachedScanHashTable[i] = NULL; |
| 693 | } /****** end limInitHashTable() ******/ |
| 694 | |
| 695 | |
| 696 | |
| 697 | /** |
| 698 | * limLookupNaddHashEntry() |
| 699 | * |
| 700 | *FUNCTION: |
| 701 | * This function is called upon receiving a Beacon or |
| 702 | * Probe Response frame during scan phase to store |
| 703 | * received BSS description into scan result hash table. |
| 704 | * |
| 705 | *LOGIC: |
| 706 | * |
| 707 | *ASSUMPTIONS: |
| 708 | * NA |
| 709 | * |
| 710 | *NOTE: |
| 711 | * NA |
| 712 | * |
| 713 | * @param pMac - Pointer to Global MAC structure |
| 714 | * @param pBssDescr - Pointer to BSS description to be |
| 715 | * added to the scan result hash table. |
| 716 | * @param action - Indicates action to be performed |
| 717 | * when same BSS description is found. This is |
| 718 | * dependent on whether unique scan result to |
| 719 | * be stored or not. |
| 720 | * |
| 721 | * @return None |
| 722 | */ |
| 723 | |
| 724 | eHalStatus |
| 725 | limLookupNaddHashEntry(tpAniSirGlobal pMac, |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 726 | tLimScanResultNode *pBssDescr, tANI_U8 action, |
| 727 | tANI_U8 dontUpdateAll) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 728 | { |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 729 | tANI_U8 index, ssidLen = 0; |
| 730 | tANI_U8 found = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 731 | tLimScanResultNode *ptemp, *pprev; |
| 732 | tSirMacCapabilityInfo *pSirCap, *pSirCapTemp; |
| 733 | int idx, len; |
| 734 | tANI_U8 *pbIe; |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 735 | tANI_S8 rssi = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 736 | |
| 737 | index = limScanHashFunction(pBssDescr->bssDescription.bssId); |
| 738 | ptemp = pMac->lim.gLimCachedScanHashTable[index]; |
| 739 | |
| 740 | //ieFields start with TLV of SSID IE |
| 741 | ssidLen = * ((tANI_U8 *) &pBssDescr->bssDescription.ieFields + 1); |
| 742 | pSirCap = (tSirMacCapabilityInfo *)&pBssDescr->bssDescription.capabilityInfo; |
| 743 | |
| 744 | for (pprev = ptemp; ptemp; pprev = ptemp, ptemp = ptemp->next) |
| 745 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 746 | //For infrastructure, check BSSID and SSID. For IBSS, check more |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 747 | pSirCapTemp = (tSirMacCapabilityInfo *)&ptemp->bssDescription.capabilityInfo; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 748 | if ((pSirCapTemp->ess == pSirCap->ess) && //matching ESS type first |
| 749 | (vos_mem_compare( (tANI_U8 *) pBssDescr->bssDescription.bssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 750 | (tANI_U8 *) ptemp->bssDescription.bssId, |
| 751 | sizeof(tSirMacAddr))) && //matching BSSID |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 752 | (pBssDescr->bssDescription.channelId == |
| 753 | ptemp->bssDescription.channelId) && |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 754 | vos_mem_compare( ((tANI_U8 *) &pBssDescr->bssDescription.ieFields + 1), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 755 | ((tANI_U8 *) &ptemp->bssDescription.ieFields + 1), |
| 756 | (tANI_U8) (ssidLen + 1)) && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 757 | ((pSirCapTemp->ess) || //we are done for infrastructure |
| 758 | //For IBSS, nwType and channelId |
| 759 | (((pBssDescr->bssDescription.nwType == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 760 | ptemp->bssDescription.nwType) && |
| 761 | (pBssDescr->bssDescription.channelId == |
| 762 | ptemp->bssDescription.channelId)))) |
| 763 | ) |
| 764 | { |
| 765 | // Found the same BSS description |
| 766 | if (action == LIM_HASH_UPDATE) |
| 767 | { |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 768 | if(dontUpdateAll) |
| 769 | { |
| 770 | rssi = ptemp->bssDescription.rssi; |
| 771 | } |
| 772 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 773 | if(pBssDescr->bssDescription.fProbeRsp != ptemp->bssDescription.fProbeRsp) |
| 774 | { |
| 775 | //We get a different, save the old frame WSC IE if it is there |
| 776 | idx = 0; |
| 777 | len = ptemp->bssDescription.length - sizeof(tSirBssDescription) + |
| 778 | sizeof(tANI_U16) + sizeof(tANI_U32) - DOT11F_IE_WSCPROBERES_MIN_LEN - 2; |
| 779 | pbIe = (tANI_U8 *)ptemp->bssDescription.ieFields; |
| 780 | //Save WPS IE if it exists |
| 781 | pBssDescr->bssDescription.WscIeLen = 0; |
| 782 | while(idx < len) |
| 783 | { |
| 784 | if((DOT11F_EID_WSCPROBERES == pbIe[0]) && |
| 785 | (0x00 == pbIe[2]) && (0x50 == pbIe[3]) && (0xf2 == pbIe[4]) && (0x04 == pbIe[5])) |
| 786 | { |
| 787 | //Found it |
| 788 | if((DOT11F_IE_WSCPROBERES_MAX_LEN - 2) >= pbIe[1]) |
| 789 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 790 | vos_mem_copy(pBssDescr->bssDescription.WscIeProbeRsp, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 791 | pbIe, pbIe[1] + 2); |
| 792 | pBssDescr->bssDescription.WscIeLen = pbIe[1] + 2; |
| 793 | } |
| 794 | break; |
| 795 | } |
| 796 | idx += pbIe[1] + 2; |
| 797 | pbIe += pbIe[1] + 2; |
| 798 | } |
| 799 | } |
| 800 | |
| 801 | |
| 802 | if(NULL != pMac->lim.gpLimMlmScanReq) |
| 803 | { |
| 804 | if((pMac->lim.gpLimMlmScanReq->numSsid)&& |
| 805 | ( limIsNullSsid((tSirMacSSid *)((tANI_U8 *) |
| 806 | &pBssDescr->bssDescription.ieFields + 1)))) |
| 807 | return eHAL_STATUS_FAILURE; |
| 808 | } |
| 809 | |
| 810 | // Delete this entry |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 811 | if (ptemp == pMac->lim.gLimCachedScanHashTable[index]) |
| 812 | pprev = pMac->lim.gLimCachedScanHashTable[index] = ptemp->next; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 813 | else |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 814 | pprev->next = ptemp->next; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 815 | |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 816 | pMac->lim.gLimMlmScanResultLength -= |
| 817 | ptemp->bssDescription.length + sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 818 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 819 | vos_mem_free(ptemp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 820 | } |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 821 | found = true; |
| 822 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 823 | } |
| 824 | } |
| 825 | |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 826 | //for now, only rssi, we can add more if needed |
Madan Mohan Koyyalamudi | 3e9f202 | 2012-12-04 16:34:19 -0800 | [diff] [blame] | 827 | if ((action == LIM_HASH_UPDATE) && dontUpdateAll && rssi) |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 828 | { |
| 829 | pBssDescr->bssDescription.rssi = rssi; |
| 830 | } |
| 831 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 832 | // Add this BSS description at same index |
| 833 | if (pprev == pMac->lim.gLimCachedScanHashTable[index]) |
| 834 | { |
| 835 | pBssDescr->next = pMac->lim.gLimCachedScanHashTable[index]; |
| 836 | pMac->lim.gLimCachedScanHashTable[index] = pBssDescr; |
| 837 | } |
| 838 | else |
| 839 | { |
| 840 | pBssDescr->next = pprev->next; |
| 841 | pprev->next = pBssDescr; |
| 842 | } |
| 843 | pMac->lim.gLimMlmScanResultLength += |
| 844 | pBssDescr->bssDescription.length + sizeof(tANI_U16); |
| 845 | |
Kiran Kumar Lokere | 5be73a6 | 2013-04-01 18:40:00 -0700 | [diff] [blame] | 846 | PELOG2(limLog(pMac, LOG2, FL("Added new BSS description size %d TOT %d BSS id"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 847 | pBssDescr->bssDescription.length, |
| 848 | pMac->lim.gLimMlmScanResultLength); |
| 849 | limPrintMacAddr(pMac, pBssDescr->bssDescription.bssId, LOG2);) |
| 850 | |
| 851 | // Send new BSS found indication to HDD if CFG option is set |
| 852 | if (!found) limSendSmeNeighborBssInd(pMac, pBssDescr); |
| 853 | |
| 854 | // |
| 855 | // TODO: IF applicable, do we need to send: |
| 856 | // Mesg - eWNI_SME_WM_STATUS_CHANGE_NTF |
| 857 | // Status change code - eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP |
| 858 | // |
| 859 | return eHAL_STATUS_SUCCESS; |
| 860 | } |
| 861 | |
| 862 | |
| 863 | |
| 864 | /** |
| 865 | * limDeleteHashEntry() |
| 866 | * |
| 867 | *FUNCTION: |
| 868 | * This function is called upon to delete |
| 869 | * a BSS description from scan result hash table. |
| 870 | * |
| 871 | *LOGIC: |
| 872 | * |
| 873 | *ASSUMPTIONS: |
| 874 | * NA |
| 875 | * |
| 876 | *NOTE: |
| 877 | * Yet to find the utility of the function |
| 878 | * |
| 879 | * @param pBssDescr - Pointer to BSS description to be |
| 880 | * deleted from the scan result hash table. |
| 881 | * |
| 882 | * @return None |
| 883 | */ |
| 884 | |
| 885 | void limDeleteHashEntry(tLimScanResultNode *pBssDescr) |
| 886 | { |
| 887 | } /****** end limDeleteHashEntry() ******/ |
| 888 | |
| 889 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 890 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 891 | /** |
| 892 | * limInitLfrHashTable() |
| 893 | * |
| 894 | *FUNCTION: |
| 895 | * This function is called upon receiving SME_START_REQ |
| 896 | * to initialize global cached Lfr scan hash table |
| 897 | * |
| 898 | *LOGIC: |
| 899 | * |
| 900 | *ASSUMPTIONS: |
| 901 | * NA |
| 902 | * |
| 903 | *NOTE: |
| 904 | * NA |
| 905 | * |
| 906 | * @param pMac - Pointer to Global MAC structure |
| 907 | * @return None |
| 908 | */ |
| 909 | |
| 910 | void |
| 911 | limInitLfrHashTable(tpAniSirGlobal pMac) |
| 912 | { |
| 913 | tANI_U16 i; |
| 914 | for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++) |
| 915 | pMac->lim.gLimCachedLfrScanHashTable[i] = NULL; |
| 916 | } /****** end limInitLfrHashTable() ******/ |
| 917 | |
| 918 | |
| 919 | |
| 920 | /** |
| 921 | * limLookupNaddLfrHashEntry() |
| 922 | * |
| 923 | *FUNCTION: |
| 924 | * This function is called upon receiving a Beacon or |
| 925 | * Probe Response frame during Lfr scan phase from FW to store |
| 926 | * received BSS description into Lfr scan result hash table. |
| 927 | * |
| 928 | *LOGIC: |
| 929 | * |
| 930 | *ASSUMPTIONS: |
| 931 | * NA |
| 932 | * |
| 933 | *NOTE: |
| 934 | * NA |
| 935 | * |
| 936 | * @param pMac - Pointer to Global MAC structure |
| 937 | * @param pBssDescr - Pointer to BSS description to be |
| 938 | * added to the Lfr scan result hash table. |
| 939 | * @param action - Indicates action to be performed |
| 940 | * when same BSS description is found. This is |
| 941 | * dependent on whether unique scan result to |
| 942 | * be stored or not. |
| 943 | * |
| 944 | * @return None |
| 945 | */ |
| 946 | |
| 947 | eHalStatus |
| 948 | limLookupNaddLfrHashEntry(tpAniSirGlobal pMac, |
| 949 | tLimScanResultNode *pBssDescr, tANI_U8 action, |
| 950 | tANI_U8 dontUpdateAll) |
| 951 | { |
| 952 | tANI_U8 index, ssidLen = 0; |
| 953 | tLimScanResultNode *ptemp, *pprev; |
| 954 | tSirMacCapabilityInfo *pSirCap, *pSirCapTemp; |
| 955 | int idx, len; |
| 956 | tANI_U8 *pbIe; |
| 957 | tANI_S8 rssi = 0; |
| 958 | |
| 959 | index = limScanHashFunction(pBssDescr->bssDescription.bssId); |
| 960 | ptemp = pMac->lim.gLimCachedLfrScanHashTable[index]; |
| 961 | |
| 962 | //ieFields start with TLV of SSID IE |
| 963 | ssidLen = * ((tANI_U8 *) &pBssDescr->bssDescription.ieFields + 1); |
| 964 | pSirCap = (tSirMacCapabilityInfo *)&pBssDescr->bssDescription.capabilityInfo; |
| 965 | |
| 966 | for (pprev = ptemp; ptemp; pprev = ptemp, ptemp = ptemp->next) |
| 967 | { |
| 968 | //For infrastructure, check BSSID and SSID. For IBSS, check more |
| 969 | pSirCapTemp = (tSirMacCapabilityInfo *)&ptemp->bssDescription.capabilityInfo; |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 970 | if ((pSirCapTemp->ess == pSirCap->ess) && //matching ESS type first |
| 971 | (vos_mem_compare( (tANI_U8 *) pBssDescr->bssDescription.bssId, |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 972 | (tANI_U8 *) ptemp->bssDescription.bssId, |
| 973 | sizeof(tSirMacAddr))) && //matching BSSID |
| 974 | (pBssDescr->bssDescription.channelId == |
| 975 | ptemp->bssDescription.channelId) && |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 976 | vos_mem_compare( ((tANI_U8 *) &pBssDescr->bssDescription.ieFields + 1), |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 977 | ((tANI_U8 *) &ptemp->bssDescription.ieFields + 1), |
| 978 | (tANI_U8) (ssidLen + 1)) && |
| 979 | ((pSirCapTemp->ess) || //we are done for infrastructure |
| 980 | //For IBSS, nwType and channelId |
| 981 | (((pBssDescr->bssDescription.nwType == |
| 982 | ptemp->bssDescription.nwType) && |
| 983 | (pBssDescr->bssDescription.channelId == |
| 984 | ptemp->bssDescription.channelId)))) |
| 985 | ) |
| 986 | { |
| 987 | // Found the same BSS description |
| 988 | if (action == LIM_HASH_UPDATE) |
| 989 | { |
| 990 | if(dontUpdateAll) |
| 991 | { |
| 992 | rssi = ptemp->bssDescription.rssi; |
| 993 | } |
| 994 | |
| 995 | if(pBssDescr->bssDescription.fProbeRsp != ptemp->bssDescription.fProbeRsp) |
| 996 | { |
| 997 | //We get a different, save the old frame WSC IE if it is there |
| 998 | idx = 0; |
| 999 | len = ptemp->bssDescription.length - sizeof(tSirBssDescription) + |
| 1000 | sizeof(tANI_U16) + sizeof(tANI_U32) - DOT11F_IE_WSCPROBERES_MIN_LEN - 2; |
| 1001 | pbIe = (tANI_U8 *)ptemp->bssDescription.ieFields; |
| 1002 | //Save WPS IE if it exists |
| 1003 | pBssDescr->bssDescription.WscIeLen = 0; |
| 1004 | while(idx < len) |
| 1005 | { |
| 1006 | if((DOT11F_EID_WSCPROBERES == pbIe[0]) && |
| 1007 | (0x00 == pbIe[2]) && (0x50 == pbIe[3]) && |
| 1008 | (0xf2 == pbIe[4]) && (0x04 == pbIe[5])) |
| 1009 | { |
| 1010 | //Found it |
| 1011 | if((DOT11F_IE_WSCPROBERES_MAX_LEN - 2) >= pbIe[1]) |
| 1012 | { |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1013 | vos_mem_copy( pBssDescr->bssDescription.WscIeProbeRsp, |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1014 | pbIe, pbIe[1] + 2); |
| 1015 | pBssDescr->bssDescription.WscIeLen = pbIe[1] + 2; |
| 1016 | } |
| 1017 | break; |
| 1018 | } |
| 1019 | idx += pbIe[1] + 2; |
| 1020 | pbIe += pbIe[1] + 2; |
| 1021 | } |
| 1022 | } |
| 1023 | |
| 1024 | |
| 1025 | if(NULL != pMac->lim.gpLimMlmScanReq) |
| 1026 | { |
| 1027 | if((pMac->lim.gpLimMlmScanReq->numSsid)&& |
| 1028 | ( limIsNullSsid((tSirMacSSid *)((tANI_U8 *) |
| 1029 | &pBssDescr->bssDescription.ieFields + 1)))) |
| 1030 | return eHAL_STATUS_FAILURE; |
| 1031 | } |
| 1032 | |
| 1033 | // Delete this entry |
| 1034 | if (ptemp == pMac->lim.gLimCachedLfrScanHashTable[index]) |
| 1035 | pprev = pMac->lim.gLimCachedLfrScanHashTable[index] = ptemp->next; |
| 1036 | else |
| 1037 | pprev->next = ptemp->next; |
| 1038 | |
| 1039 | pMac->lim.gLimMlmLfrScanResultLength -= |
| 1040 | ptemp->bssDescription.length + sizeof(tANI_U16); |
| 1041 | |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1042 | vos_mem_free(ptemp); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1043 | } |
| 1044 | break; |
| 1045 | } |
| 1046 | } |
| 1047 | |
| 1048 | //for now, only rssi, we can add more if needed |
| 1049 | if ((action == LIM_HASH_UPDATE) && dontUpdateAll && rssi) |
| 1050 | { |
| 1051 | pBssDescr->bssDescription.rssi = rssi; |
| 1052 | } |
| 1053 | |
| 1054 | // Add this BSS description at same index |
| 1055 | if (pprev == pMac->lim.gLimCachedLfrScanHashTable[index]) |
| 1056 | { |
| 1057 | pBssDescr->next = pMac->lim.gLimCachedLfrScanHashTable[index]; |
| 1058 | pMac->lim.gLimCachedLfrScanHashTable[index] = pBssDescr; |
| 1059 | } |
| 1060 | else |
| 1061 | { |
| 1062 | pBssDescr->next = pprev->next; |
| 1063 | pprev->next = pBssDescr; |
| 1064 | } |
| 1065 | pMac->lim.gLimMlmLfrScanResultLength += |
| 1066 | pBssDescr->bssDescription.length + sizeof(tANI_U16); |
| 1067 | |
| 1068 | PELOG2(limLog(pMac, LOG2, FL("Added new BSS description size %d TOT %d BSS id\n"), |
| 1069 | pBssDescr->bssDescription.length, |
| 1070 | pMac->lim.gLimMlmLfrScanResultLength); |
| 1071 | limPrintMacAddr(pMac, pBssDescr->bssDescription.bssId, LOG2);) |
| 1072 | |
| 1073 | // |
| 1074 | // TODO: IF applicable, do we need to send: |
| 1075 | // Mesg - eWNI_SME_WM_STATUS_CHANGE_NTF |
| 1076 | // Status change code - eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP |
| 1077 | // |
| 1078 | return eHAL_STATUS_SUCCESS; |
| 1079 | } |
| 1080 | |
| 1081 | |
| 1082 | |
| 1083 | /** |
| 1084 | * limDeleteLfrHashEntry() |
| 1085 | * |
| 1086 | *FUNCTION: |
| 1087 | * This function is called upon to delete |
| 1088 | * a BSS description from LFR scan result hash table. |
| 1089 | * |
| 1090 | *LOGIC: |
| 1091 | * |
| 1092 | *ASSUMPTIONS: |
| 1093 | * NA |
| 1094 | * |
| 1095 | *NOTE: |
| 1096 | * Yet to find the utility of the function |
| 1097 | * |
| 1098 | * @param pBssDescr - Pointer to BSS description to be |
| 1099 | * deleted from the LFR scan result hash table. |
| 1100 | * |
| 1101 | * @return None |
| 1102 | */ |
| 1103 | |
| 1104 | void limDeleteLfrHashEntry(tLimScanResultNode *pBssDescr) |
| 1105 | { |
| 1106 | } /****** end limDeleteLfrHashEntry() ******/ |
| 1107 | |
| 1108 | #endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1109 | |
| 1110 | /** |
| 1111 | * limCopyScanResult() |
| 1112 | * |
| 1113 | *FUNCTION: |
| 1114 | * This function is called by limProcessSmeMessages() while |
| 1115 | * sending SME_SCAN_RSP with scan result to HDD. |
| 1116 | * |
| 1117 | *LOGIC: |
| 1118 | * This function traverses the scan list stored in scan hash table |
| 1119 | * |
| 1120 | *ASSUMPTIONS: |
| 1121 | * NA |
| 1122 | * |
| 1123 | *NOTE: |
| 1124 | * NA |
| 1125 | * |
| 1126 | * @param pMac - Pointer to Global MAC structure |
| 1127 | * @param pDest - Destination pointer |
| 1128 | * |
| 1129 | * @return None |
| 1130 | */ |
| 1131 | |
| 1132 | void |
| 1133 | limCopyScanResult(tpAniSirGlobal pMac, tANI_U8 *pDest) |
| 1134 | { |
| 1135 | tLimScanResultNode *ptemp; |
| 1136 | tANI_U16 i; |
| 1137 | for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++) |
| 1138 | { |
| 1139 | if ((ptemp = pMac->lim.gLimCachedScanHashTable[i]) != NULL) |
| 1140 | { |
| 1141 | while(ptemp) |
| 1142 | { |
| 1143 | /// Copy entire BSS description including length |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1144 | vos_mem_copy( pDest, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1145 | (tANI_U8 *) &ptemp->bssDescription, |
| 1146 | ptemp->bssDescription.length + 2); |
| 1147 | pDest += ptemp->bssDescription.length + 2; |
| 1148 | ptemp = ptemp->next; |
| 1149 | } |
| 1150 | } |
| 1151 | } |
| 1152 | } /****** end limCopyScanResult() ******/ |
| 1153 | |
| 1154 | |
| 1155 | |
| 1156 | /** |
| 1157 | * limDeleteCachedScanResults() |
| 1158 | * |
| 1159 | *FUNCTION: |
| 1160 | * This function is called by limProcessSmeMessages() upon receiving |
| 1161 | * SME_SCAN_REQ with fresh scan result flag set. |
| 1162 | * |
| 1163 | *LOGIC: |
| 1164 | * This function traverses the scan list stored in scan hash table |
| 1165 | * and deletes the entries if any |
| 1166 | * |
| 1167 | *ASSUMPTIONS: |
| 1168 | * NA |
| 1169 | * |
| 1170 | *NOTE: |
| 1171 | * NA |
| 1172 | * |
| 1173 | * @param pMac - Pointer to Global MAC structure |
| 1174 | * @return None |
| 1175 | */ |
| 1176 | |
| 1177 | void |
| 1178 | limDeleteCachedScanResults(tpAniSirGlobal pMac) |
| 1179 | { |
| 1180 | tLimScanResultNode *pNode, *pNextNode; |
| 1181 | tANI_U16 i; |
| 1182 | for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++) |
| 1183 | { |
| 1184 | if ((pNode = pMac->lim.gLimCachedScanHashTable[i]) != NULL) |
| 1185 | { |
| 1186 | while (pNode) |
| 1187 | { |
| 1188 | pNextNode = pNode->next; |
| 1189 | |
| 1190 | // Delete the current node |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1191 | vos_mem_free(pNode); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1192 | |
| 1193 | pNode = pNextNode; |
| 1194 | } |
| 1195 | } |
| 1196 | } |
| 1197 | |
| 1198 | pMac->lim.gLimSmeScanResultLength = 0; |
| 1199 | } /****** end limDeleteCachedScanResults() ******/ |
| 1200 | |
| 1201 | |
| 1202 | |
| 1203 | /** |
| 1204 | * limReInitScanResults() |
| 1205 | * |
| 1206 | *FUNCTION: |
| 1207 | * This function is called delete exisiting scan results |
| 1208 | * and initialize the scan hash table |
| 1209 | * |
| 1210 | *LOGIC: |
| 1211 | * |
| 1212 | *ASSUMPTIONS: |
| 1213 | * NA |
| 1214 | * |
| 1215 | *NOTE: |
| 1216 | * NA |
| 1217 | * |
| 1218 | * @param pMac - Pointer to Global MAC structure |
| 1219 | * @return None |
| 1220 | */ |
| 1221 | |
| 1222 | void |
| 1223 | limReInitScanResults(tpAniSirGlobal pMac) |
| 1224 | { |
| 1225 | limDeleteCachedScanResults(pMac); |
| 1226 | limInitHashTable(pMac); |
| 1227 | |
| 1228 | // !!LAC - need to clear out the global scan result length |
| 1229 | // since the list was just purged from the hash table. |
| 1230 | pMac->lim.gLimMlmScanResultLength = 0; |
| 1231 | |
| 1232 | } /****** end limReInitScanResults() ******/ |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1233 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1234 | /** |
| 1235 | * limDeleteCachedLfrScanResults() |
| 1236 | * |
| 1237 | *FUNCTION: |
| 1238 | * This function is called by limProcessSmeMessages() upon receiving |
| 1239 | * SME_SCAN_REQ with flush scan result flag set for LFR. |
| 1240 | * |
| 1241 | *LOGIC: |
| 1242 | * This function traverses the scan list stored in lfr scan hash |
| 1243 | * table and deletes the entries if any |
| 1244 | * |
| 1245 | *ASSUMPTIONS: |
| 1246 | * NA |
| 1247 | * |
| 1248 | *NOTE: |
| 1249 | * NA |
| 1250 | * |
| 1251 | * @param pMac - Pointer to Global MAC structure |
| 1252 | * @return None |
| 1253 | */ |
| 1254 | |
| 1255 | void |
| 1256 | limDeleteCachedLfrScanResults(tpAniSirGlobal pMac) |
| 1257 | { |
| 1258 | tLimScanResultNode *pNode, *pNextNode; |
| 1259 | tANI_U16 i; |
| 1260 | for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++) |
| 1261 | { |
| 1262 | if ((pNode = pMac->lim.gLimCachedLfrScanHashTable[i]) != NULL) |
| 1263 | { |
| 1264 | while (pNode) |
| 1265 | { |
| 1266 | pNextNode = pNode->next; |
| 1267 | |
| 1268 | // Delete the current node |
Bansidhar Gopalachari | 1273123 | 2013-07-11 10:56:36 +0530 | [diff] [blame] | 1269 | vos_mem_free(pNode); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1270 | |
| 1271 | pNode = pNextNode; |
| 1272 | } |
| 1273 | } |
| 1274 | } |
| 1275 | |
| 1276 | pMac->lim.gLimSmeLfrScanResultLength = 0; |
| 1277 | } /****** end limDeleteCachedLfrScanResults() ******/ |
| 1278 | |
| 1279 | |
| 1280 | |
| 1281 | /** |
| 1282 | * limReInitLfrScanResults() |
| 1283 | * |
| 1284 | *FUNCTION: |
| 1285 | * This function is called delete exisiting scan results |
| 1286 | * and initialize the lfr scan hash table |
| 1287 | * |
| 1288 | *LOGIC: |
| 1289 | * |
| 1290 | *ASSUMPTIONS: |
| 1291 | * NA |
| 1292 | * |
| 1293 | *NOTE: |
| 1294 | * NA |
| 1295 | * |
| 1296 | * @param pMac - Pointer to Global MAC structure |
| 1297 | * @return None |
| 1298 | */ |
| 1299 | |
| 1300 | void |
| 1301 | limReInitLfrScanResults(tpAniSirGlobal pMac) |
| 1302 | { |
| 1303 | limDeleteCachedLfrScanResults(pMac); |
| 1304 | limInitLfrHashTable(pMac); |
| 1305 | |
| 1306 | // !!LAC - need to clear out the global scan result length |
| 1307 | // since the list was just purged from the hash table. |
| 1308 | pMac->lim.gLimMlmLfrScanResultLength = 0; |
| 1309 | |
| 1310 | } /****** end limReInitLfrScanResults() ******/ |
| 1311 | #endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD |