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 |
| 104 | limLog(pMac,LOGP, FL("could not activate max channel timer\n")); |
| 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 |
| 142 | void |
| 143 | limCollectBssDescription(tpAniSirGlobal pMac, |
| 144 | tSirBssDescription *pBssDescr, |
| 145 | tpSirProbeRespBeacon pBPR, |
| 146 | tANI_U8 *pRxPacketInfo, |
| 147 | tANI_U8 fScanning) |
| 148 | #else |
| 149 | void |
| 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; |
| 161 | |
| 162 | pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo); |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame^] | 163 | 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] | 164 | ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo) - SIR_MAC_B_PR_SSID_OFFSET; |
| 165 | rxChannel = WDA_GET_RX_CH(pRxPacketInfo); |
| 166 | pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo); |
| 167 | |
| 168 | |
| 169 | /** |
| 170 | * Length of BSS desription is without length of |
| 171 | * length itself and length of pointer |
| 172 | * that holds the next BSS description |
| 173 | */ |
| 174 | pBssDescr->length = (tANI_U16)( |
| 175 | sizeof(tSirBssDescription) - sizeof(tANI_U16) - |
| 176 | sizeof(tANI_U32) + ieLen); |
| 177 | |
| 178 | // Copy BSS Id |
| 179 | palCopyMemory( pMac->hHdd, (tANI_U8 *) &pBssDescr->bssId, |
| 180 | (tANI_U8 *) pHdr->bssId, |
| 181 | sizeof(tSirMacAddr)); |
| 182 | |
| 183 | // Copy Timestamp, Beacon Interval and Capability Info |
| 184 | pBssDescr->scanSysTimeMsec = vos_timer_get_system_time(); |
| 185 | |
| 186 | pBssDescr->timeStamp[0] = pBPR->timeStamp[0]; |
| 187 | pBssDescr->timeStamp[1] = pBPR->timeStamp[1]; |
| 188 | pBssDescr->beaconInterval = pBPR->beaconInterval; |
| 189 | pBssDescr->capabilityInfo = limGetU16((tANI_U8 *) &pBPR->capabilityInfo); |
| 190 | |
| 191 | |
| 192 | /* |
| 193 | * There is a narrow window after Channel Switch msg is sent to HAL and before the AGC is shut |
| 194 | * down and beacons/Probe Rsps can trickle in and we may report the incorrect channel in 5Ghz |
| 195 | * band, so not relying on the 'last Scanned Channel' stored in LIM. |
| 196 | * Instead use the value returned by RXP in BD. This the the same value which HAL programs into |
| 197 | * RXP before every channel switch. |
| 198 | * Right now there is a problem in 5Ghz, where we are receiving beacons from a channel different from |
| 199 | * the currently scanned channel. so incorrect channel is reported to CSR and association does not happen. |
| 200 | * So for now we keep on looking for the channel info in the beacon (DSParamSet IE OR HT Info IE), and only if it |
| 201 | * is not present in the beacon, we go for the channel info present in RXP. |
| 202 | * 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. |
| 203 | * So The problem of incorrect channel reporting in 5Ghz will still remain for 11a devices. |
| 204 | */ |
| 205 | pBssDescr->channelId = limGetChannelFromBeacon(pMac, pBPR); |
| 206 | |
| 207 | if (pBssDescr->channelId == 0) |
| 208 | { |
| 209 | /* If the channel Id is not retrieved from Beacon, extract the channel from BD */ |
| 210 | /* Unmapped the channel.This We have to do since we have done mapping in the hal to |
| 211 | overcome the limitation of RXBD of not able to accomodate the bigger channel number.*/ |
| 212 | if (!( rxChannel = limUnmapChannel(rxChannel))) |
| 213 | { |
| 214 | rxChannel = pMac->lim.gLimCurrentScanChannelId; |
| 215 | } |
| 216 | pBssDescr->channelId = rxChannel; |
| 217 | } |
| 218 | |
| 219 | pBssDescr->channelIdSelf = rxChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 220 | //set the network type in bss description |
| 221 | channelNum = pBssDescr->channelId; |
| 222 | pBssDescr->nwType = limGetNwType(pMac, channelNum, SIR_MAC_MGMT_FRAME, pBPR); |
| 223 | |
| 224 | pBssDescr->aniIndicator = pBPR->propIEinfo.aniIndicator; |
| 225 | |
| 226 | // Copy RSSI & SINR from BD |
| 227 | |
| 228 | PELOG4(limLog(pMac, LOG4, "***********BSS Description for BSSID:*********** "); |
| 229 | sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG4, pBssDescr->bssId, 6 ); |
| 230 | sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG4, (tANI_U8*)pRxPacketInfo, 36 );) |
| 231 | |
| 232 | pBssDescr->rssi = (tANI_S8)WDA_GET_RX_RSSI_DB(pRxPacketInfo); |
| 233 | |
| 234 | //SINR no longer reported by HW |
| 235 | pBssDescr->sinr = 0; |
| 236 | |
| 237 | pBssDescr->nReceivedTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 238 | |
| 239 | #if defined WLAN_FEATURE_VOWIFI |
| 240 | if( fScanning ) |
| 241 | { |
| 242 | rrmGetStartTSF( pMac, pBssDescr->startTSF ); |
| 243 | pBssDescr->parentTSF = WDA_GET_RX_TIMESTAMP(pRxPacketInfo); |
| 244 | } |
| 245 | #endif |
| 246 | |
| 247 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 248 | // MobilityDomain |
| 249 | pBssDescr->mdie[0] = 0; |
| 250 | pBssDescr->mdie[1] = 0; |
| 251 | pBssDescr->mdie[2] = 0; |
| 252 | pBssDescr->mdiePresent = FALSE; |
| 253 | // If mdie is present in the probe resp we |
| 254 | // fill it in the bss description |
| 255 | if( pBPR->mdiePresent) |
| 256 | { |
| 257 | pBssDescr->mdiePresent = TRUE; |
| 258 | pBssDescr->mdie[0] = pBPR->mdie[0]; |
| 259 | pBssDescr->mdie[1] = pBPR->mdie[1]; |
| 260 | pBssDescr->mdie[2] = pBPR->mdie[2]; |
| 261 | } |
| 262 | #endif |
| 263 | |
| 264 | #ifdef FEATURE_WLAN_CCX |
| 265 | pBssDescr->QBSSLoad_present = FALSE; |
| 266 | pBssDescr->QBSSLoad_avail = 0; |
| 267 | if( pBPR->QBSSLoad.present) |
| 268 | { |
| 269 | pBssDescr->QBSSLoad_present = TRUE; |
| 270 | pBssDescr->QBSSLoad_avail = pBPR->QBSSLoad.avail; |
| 271 | } |
| 272 | #endif |
| 273 | // Copy IE fields |
| 274 | palCopyMemory( pMac->hHdd, (tANI_U8 *) &pBssDescr->ieFields, |
| 275 | pBody + SIR_MAC_B_PR_SSID_OFFSET, |
| 276 | ieLen); |
| 277 | |
| 278 | //sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOGW, (tANI_U8 *) pBssDescr, pBssDescr->length + 2 ); |
| 279 | limLog( pMac, LOG3, |
| 280 | FL("Collected BSS Description for Channel(%1d), length(%u), aniIndicator(%d), IE Fields(%u)\n"), |
| 281 | pBssDescr->channelId, |
| 282 | pBssDescr->length, |
| 283 | pBssDescr->aniIndicator, |
| 284 | ieLen ); |
| 285 | |
| 286 | return; |
| 287 | } /*** end limCollectBssDescription() ***/ |
| 288 | |
| 289 | /** |
| 290 | * limIsScanRequestedSSID() |
| 291 | * |
| 292 | *FUNCTION: |
| 293 | * This function is called during scan upon receiving |
| 294 | * Beacon/Probe Response frame to check if the received |
| 295 | * SSID is present in the list of requested SSIDs in scan |
| 296 | * |
| 297 | *LOGIC: |
| 298 | * |
| 299 | *ASSUMPTIONS: |
| 300 | * NA |
| 301 | * |
| 302 | *NOTE: |
| 303 | * NA |
| 304 | * |
| 305 | * @param pMac - Pointer to Global MAC structure |
| 306 | * @param ssId - SSID Received in beacons/Probe responses that is compared against the |
| 307 | requeusted SSID in scan list |
| 308 | * --------------------------------------------- |
| 309 | * |
| 310 | * @return boolean - TRUE if SSID is present in requested list, FALSE otherwise |
| 311 | */ |
| 312 | |
| 313 | tANI_BOOLEAN limIsScanRequestedSSID(tpAniSirGlobal pMac, tSirMacSSid *ssId) |
| 314 | { |
| 315 | tANI_U8 i = 0; |
| 316 | |
| 317 | for (i = 0; i < pMac->lim.gpLimMlmScanReq->numSsid; i++) |
| 318 | { |
| 319 | if ( eANI_BOOLEAN_TRUE == palEqualMemory( pMac->hHdd,(tANI_U8 *) ssId, |
| 320 | (tANI_U8 *) &pMac->lim.gpLimMlmScanReq->ssId[i], |
| 321 | (tANI_U8) (pMac->lim.gpLimMlmScanReq->ssId[i].length + 1))) |
| 322 | { |
| 323 | return eANI_BOOLEAN_TRUE; |
| 324 | } |
| 325 | } |
| 326 | return eANI_BOOLEAN_FALSE; |
| 327 | } |
| 328 | |
| 329 | /** |
| 330 | * limCheckAndAddBssDescription() |
| 331 | * |
| 332 | *FUNCTION: |
| 333 | * This function is called during scan upon receiving |
| 334 | * Beacon/Probe Response frame to check if the received |
| 335 | * frame matches scan criteria, collect BSS description |
| 336 | * and add it to cached scan results. |
| 337 | * |
| 338 | *LOGIC: |
| 339 | * |
| 340 | *ASSUMPTIONS: |
| 341 | * NA |
| 342 | * |
| 343 | *NOTE: |
| 344 | * NA |
| 345 | * |
| 346 | * @param pMac - Pointer to Global MAC structure |
| 347 | * @param pBPR - Pointer to parsed Beacon/Probe Response structure |
| 348 | * @param pRxPacketInfo - Pointer to Received frame's BD |
| 349 | * @param fScanning - boolean to indicate whether the BSS is from current scan or just happen to receive a beacon |
| 350 | * |
| 351 | * @return None |
| 352 | */ |
| 353 | |
| 354 | void |
| 355 | limCheckAndAddBssDescription(tpAniSirGlobal pMac, |
| 356 | tpSirProbeRespBeacon pBPR, |
| 357 | tANI_U8 *pRxPacketInfo, |
| 358 | tANI_BOOLEAN fScanning, |
| 359 | tANI_U8 fProbeRsp) |
| 360 | { |
| 361 | tLimScanResultNode *pBssDescr; |
| 362 | tANI_U32 frameLen, ieLen = 0; |
| 363 | tANI_U8 rxChannelInBeacon = 0; |
| 364 | eHalStatus status; |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 365 | tANI_U8 dontUpdateAll = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 366 | |
| 367 | #ifdef WLAN_FEATURE_P2P |
| 368 | tSirMacAddr bssid = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; |
| 369 | tANI_BOOLEAN fFound = FALSE; |
| 370 | tpSirMacDataHdr3a pHdr; |
| 371 | |
| 372 | pHdr = WDA_GET_RX_MPDUHEADER3A((tANI_U8 *)pRxPacketInfo); |
| 373 | |
| 374 | //Checking if scanning for a particular BSSID |
| 375 | if ((fScanning) && (pMac->lim.gpLimMlmScanReq)) |
| 376 | { |
| 377 | fFound = palEqualMemory(pMac->hHdd, pHdr->addr3, &pMac->lim.gpLimMlmScanReq->bssId, 6); |
| 378 | if (!fFound) |
| 379 | { |
| 380 | if ((pMac->lim.gpLimMlmScanReq->p2pSearch) && |
| 381 | (palEqualMemory(pMac->hHdd, pBPR->P2PProbeRes.P2PDeviceInfo.P2PDeviceAddress, |
| 382 | &pMac->lim.gpLimMlmScanReq->bssId, 6))) |
| 383 | { |
| 384 | fFound = eANI_BOOLEAN_TRUE; |
| 385 | } |
| 386 | } |
| 387 | } |
| 388 | #endif |
| 389 | |
| 390 | /** |
| 391 | * Compare SSID with the one sent in |
| 392 | * Probe Request frame, if any. |
| 393 | * If they don't match, ignore the |
| 394 | * Beacon frame. |
| 395 | * pMac->lim.gLimMlmScanReq->ssId.length == 0 |
| 396 | * indicates Broadcast SSID. |
| 397 | * When gLimReturnAfterFirstMatch is set, it means the scan has to match |
| 398 | * a SSID (if it is also set). Ignore the other BSS in that case. |
| 399 | */ |
| 400 | |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 401 | if ((pMac->lim.gpLimMlmScanReq) && (((fScanning) && ( pMac->lim.gLimReturnAfterFirstMatch & 0x01 ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 402 | && (pMac->lim.gpLimMlmScanReq->numSsid) && |
| 403 | !limIsScanRequestedSSID(pMac, &pBPR->ssId)) |
| 404 | || (!fFound && (pMac->lim.gpLimMlmScanReq && pMac->lim.gpLimMlmScanReq->bssId) && |
Madan Mohan Koyyalamudi | 33ef6a2 | 2012-10-30 17:44:43 -0700 | [diff] [blame] | 405 | !palEqualMemory(pMac->hHdd, bssid, &pMac->lim.gpLimMlmScanReq->bssId, 6))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 406 | ) |
| 407 | { |
| 408 | /** |
| 409 | * Received SSID does not match with |
| 410 | * the one we're scanning for. |
| 411 | * Ignore received Beacon frame |
| 412 | */ |
| 413 | |
| 414 | return; |
| 415 | } |
| 416 | |
| 417 | /* There is no point in caching & reporting the scan results for APs |
| 418 | * which are in the process of switching the channel. So, we are not |
| 419 | * caching the scan results for APs which are adverzing the channel-switch |
| 420 | * element in their beacons and probe responses. |
| 421 | */ |
| 422 | if(pBPR->channelSwitchPresent) |
| 423 | { |
| 424 | return; |
| 425 | } |
| 426 | |
| 427 | /* If beacon/probe resp DS param channel does not match with |
| 428 | * RX BD channel then don't save the results. It might be a beacon |
| 429 | * from another channel heard as noise on the current scanning channel |
| 430 | */ |
| 431 | |
| 432 | if (pBPR->dsParamsPresent) |
| 433 | { |
| 434 | /* This means that we are in 2.4GHz mode or 5GHz 11n mode */ |
| 435 | rxChannelInBeacon = limGetChannelFromBeacon(pMac, pBPR); |
| 436 | if (rxChannelInBeacon < 15) |
| 437 | { |
| 438 | /* This means that we are in 2.4GHz mode */ |
| 439 | if(WDA_GET_RX_CH(pRxPacketInfo) != rxChannelInBeacon) |
| 440 | { |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 441 | /* BCAST Frame, if CH do not match, Drop */ |
| 442 | if(WDA_IS_RX_BCAST(pRxPacketInfo)) |
| 443 | { |
| 444 | limLog(pMac, LOG3, FL("Beacon/Probe Rsp dropped. Channel in BD %d. " |
| 445 | "Channel in beacon" " %d\n"), |
| 446 | WDA_GET_RX_CH(pRxPacketInfo),limGetChannelFromBeacon(pMac, pBPR)); |
| 447 | return; |
| 448 | } |
| 449 | /* Unit cast frame, Probe RSP, do not drop */ |
| 450 | else |
| 451 | { |
| 452 | dontUpdateAll = 1; |
| 453 | limLog(pMac, LOG3, FL("SSID %s, CH in ProbeRsp %d, CH in BD %d, miss-match, Do Not Drop"), |
| 454 | pBPR->ssId.ssId, |
| 455 | rxChannelInBeacon, |
Madan Mohan Koyyalamudi | f41cc0b | 2012-10-25 11:55:30 -0700 | [diff] [blame] | 456 | WDA_GET_RX_CH(pRxPacketInfo)); |
| 457 | WDA_GET_RX_CH(pRxPacketInfo) = rxChannelInBeacon; |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 458 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 459 | } |
| 460 | } |
| 461 | } |
| 462 | |
| 463 | /** |
| 464 | * Allocate buffer to hold BSS description from |
| 465 | * received Beacon frame. |
| 466 | * Include size of fixed fields and IEs length |
| 467 | */ |
| 468 | |
Leela V Kiran Kumar Reddy Chirala | 6a45875 | 2013-02-16 15:41:27 -0800 | [diff] [blame^] | 469 | ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo); |
| 470 | if (ieLen <= SIR_MAC_B_PR_SSID_OFFSET) |
| 471 | { |
| 472 | limLog(pMac, LOGP, |
| 473 | FL("RX packet has invalid length %d\n"), ieLen); |
| 474 | return; |
| 475 | } |
| 476 | |
| 477 | ieLen -= SIR_MAC_B_PR_SSID_OFFSET; |
| 478 | |
| 479 | 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] | 480 | |
| 481 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pBssDescr, frameLen)) |
| 482 | { |
| 483 | // Log error |
| 484 | limLog(pMac, LOGP, |
| 485 | FL("call for palAllocateMemory failed for storing BSS description\n")); |
| 486 | |
| 487 | return; |
| 488 | } |
| 489 | |
| 490 | // In scan state, store scan result. |
| 491 | #if defined WLAN_FEATURE_VOWIFI |
| 492 | limCollectBssDescription(pMac, &pBssDescr->bssDescription, |
| 493 | pBPR, pRxPacketInfo, fScanning); |
| 494 | #else |
| 495 | limCollectBssDescription(pMac, &pBssDescr->bssDescription, |
| 496 | pBPR, pRxPacketInfo); |
| 497 | #endif |
| 498 | |
| 499 | pBssDescr->bssDescription.fProbeRsp = fProbeRsp; |
| 500 | |
| 501 | pBssDescr->next = NULL; |
| 502 | |
| 503 | /** |
| 504 | * Depending on whether to store unique or all |
| 505 | * scan results, pass hash update/add parameter |
| 506 | */ |
| 507 | |
| 508 | //If it is not scanning, only save unique results |
| 509 | if (pMac->lim.gLimReturnUniqueResults || (!fScanning)) |
| 510 | { |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 511 | status = limLookupNaddHashEntry(pMac, pBssDescr, LIM_HASH_UPDATE, dontUpdateAll); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 512 | } |
| 513 | else |
| 514 | { |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 515 | status = limLookupNaddHashEntry(pMac, pBssDescr, LIM_HASH_ADD, dontUpdateAll); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 516 | } |
| 517 | |
| 518 | if(fScanning) |
| 519 | { |
| 520 | if ((pBssDescr->bssDescription.channelId <= 14) && |
| 521 | (pMac->lim.gLimReturnAfterFirstMatch & 0x40) && |
| 522 | pBPR->countryInfoPresent) |
| 523 | pMac->lim.gLim24Band11dScanDone = 1; |
| 524 | |
| 525 | if ((pBssDescr->bssDescription.channelId > 14) && |
| 526 | (pMac->lim.gLimReturnAfterFirstMatch & 0x80) && |
| 527 | pBPR->countryInfoPresent) |
| 528 | pMac->lim.gLim50Band11dScanDone = 1; |
| 529 | |
| 530 | if ( ( pMac->lim.gLimReturnAfterFirstMatch & 0x01 ) || |
| 531 | ( pMac->lim.gLim24Band11dScanDone && ( pMac->lim.gLimReturnAfterFirstMatch & 0x40 ) ) || |
| 532 | ( pMac->lim.gLim50Band11dScanDone && ( pMac->lim.gLimReturnAfterFirstMatch & 0x80 ) ) |
| 533 | #ifdef WLAN_FEATURE_P2P |
| 534 | || fFound |
| 535 | #endif |
| 536 | ) |
| 537 | /* |
| 538 | if ((pMac->lim.gLimReturnAfterFirstMatch & 0x01) || |
| 539 | (pMac->lim.gLim24Band11dScanDone && |
| 540 | !(pMac->lim.gLimReturnAfterFirstMatch & 0xC0)) || |
| 541 | (pMac->lim.gLim50Band11dScanDone && |
| 542 | !(pMac->lim.gLimReturnAfterFirstMatch & 0xC0)) || |
| 543 | (pMac->lim.gLim24Band11dScanDone && |
| 544 | pMac->lim.gLim50Band11dScanDone && |
| 545 | pMac->lim.gLimReturnAfterFirstMatch & 0xC0)) |
| 546 | */ |
| 547 | { |
| 548 | /** |
| 549 | * Stop scanning and return the BSS description(s) |
| 550 | * collected so far. |
| 551 | */ |
| 552 | limLog(pMac, |
| 553 | LOGW, |
| 554 | FL("Completed scan: 24Band11dScan = %d, 50Band11dScan = %d BSS id\n"), |
| 555 | pMac->lim.gLim24Band11dScanDone, |
| 556 | pMac->lim.gLim50Band11dScanDone); |
| 557 | |
| 558 | //Need to disable the timers. If they fire, they will send END_SCAN |
| 559 | //while we already send FINISH_SCAN here. This may mess up the gLimHalScanState |
| 560 | limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER); |
| 561 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
| 562 | //Set the resume channel to Any valid channel (invalid). |
| 563 | //This will instruct HAL to set it to any previous valid channel. |
| 564 | peSetResumeChannel(pMac, 0, 0); |
| 565 | limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE ); |
| 566 | //limSendHalFinishScanReq( pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE ); |
| 567 | } |
| 568 | }//(eANI_BOOLEAN_TRUE == fScanning) |
| 569 | |
| 570 | if( eHAL_STATUS_SUCCESS != status ) |
| 571 | { |
| 572 | palFreeMemory( pMac->hHdd, pBssDescr ); |
| 573 | } |
| 574 | } /****** end limCheckAndAddBssDescription() ******/ |
| 575 | |
| 576 | |
| 577 | |
| 578 | /** |
| 579 | * limScanHashFunction() |
| 580 | * |
| 581 | *FUNCTION: |
| 582 | * This function is called during scan hash entry operations |
| 583 | * |
| 584 | *LOGIC: |
| 585 | * |
| 586 | *ASSUMPTIONS: |
| 587 | * NA |
| 588 | * |
| 589 | *NOTE: |
| 590 | * NA |
| 591 | * |
| 592 | * @param bssId - Received BSSid |
| 593 | * |
| 594 | * @return Hash index |
| 595 | */ |
| 596 | |
| 597 | tANI_U8 |
| 598 | limScanHashFunction(tSirMacAddr bssId) |
| 599 | { |
| 600 | tANI_U16 i, hash = 0; |
| 601 | |
| 602 | for (i = 0; i < sizeof(tSirMacAddr); i++) |
| 603 | hash += bssId[i]; |
| 604 | |
| 605 | return hash % LIM_MAX_NUM_OF_SCAN_RESULTS; |
| 606 | } /****** end limScanHashFunction() ******/ |
| 607 | |
| 608 | |
| 609 | |
| 610 | /** |
| 611 | * limInitHashTable() |
| 612 | * |
| 613 | *FUNCTION: |
| 614 | * This function is called upon receiving SME_START_REQ |
| 615 | * to initialize global cached scan hash table |
| 616 | * |
| 617 | *LOGIC: |
| 618 | * |
| 619 | *ASSUMPTIONS: |
| 620 | * NA |
| 621 | * |
| 622 | *NOTE: |
| 623 | * NA |
| 624 | * |
| 625 | * @param pMac - Pointer to Global MAC structure |
| 626 | * @return None |
| 627 | */ |
| 628 | |
| 629 | void |
| 630 | limInitHashTable(tpAniSirGlobal pMac) |
| 631 | { |
| 632 | tANI_U16 i; |
| 633 | for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++) |
| 634 | pMac->lim.gLimCachedScanHashTable[i] = NULL; |
| 635 | } /****** end limInitHashTable() ******/ |
| 636 | |
| 637 | |
| 638 | |
| 639 | /** |
| 640 | * limLookupNaddHashEntry() |
| 641 | * |
| 642 | *FUNCTION: |
| 643 | * This function is called upon receiving a Beacon or |
| 644 | * Probe Response frame during scan phase to store |
| 645 | * received BSS description into scan result hash table. |
| 646 | * |
| 647 | *LOGIC: |
| 648 | * |
| 649 | *ASSUMPTIONS: |
| 650 | * NA |
| 651 | * |
| 652 | *NOTE: |
| 653 | * NA |
| 654 | * |
| 655 | * @param pMac - Pointer to Global MAC structure |
| 656 | * @param pBssDescr - Pointer to BSS description to be |
| 657 | * added to the scan result hash table. |
| 658 | * @param action - Indicates action to be performed |
| 659 | * when same BSS description is found. This is |
| 660 | * dependent on whether unique scan result to |
| 661 | * be stored or not. |
| 662 | * |
| 663 | * @return None |
| 664 | */ |
| 665 | |
| 666 | eHalStatus |
| 667 | limLookupNaddHashEntry(tpAniSirGlobal pMac, |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 668 | tLimScanResultNode *pBssDescr, tANI_U8 action, |
| 669 | tANI_U8 dontUpdateAll) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 670 | { |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 671 | tANI_U8 index, ssidLen = 0; |
| 672 | tANI_U8 found = false; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 673 | tLimScanResultNode *ptemp, *pprev; |
| 674 | tSirMacCapabilityInfo *pSirCap, *pSirCapTemp; |
| 675 | int idx, len; |
| 676 | tANI_U8 *pbIe; |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 677 | tANI_S8 rssi = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 678 | |
| 679 | index = limScanHashFunction(pBssDescr->bssDescription.bssId); |
| 680 | ptemp = pMac->lim.gLimCachedScanHashTable[index]; |
| 681 | |
| 682 | //ieFields start with TLV of SSID IE |
| 683 | ssidLen = * ((tANI_U8 *) &pBssDescr->bssDescription.ieFields + 1); |
| 684 | pSirCap = (tSirMacCapabilityInfo *)&pBssDescr->bssDescription.capabilityInfo; |
| 685 | |
| 686 | for (pprev = ptemp; ptemp; pprev = ptemp, ptemp = ptemp->next) |
| 687 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 688 | //For infrastructure, check BSSID and SSID. For IBSS, check more |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 689 | pSirCapTemp = (tSirMacCapabilityInfo *)&ptemp->bssDescription.capabilityInfo; |
| 690 | if((pSirCapTemp->ess == pSirCap->ess) && //matching ESS type first |
| 691 | (palEqualMemory( pMac->hHdd,(tANI_U8 *) pBssDescr->bssDescription.bssId, |
| 692 | (tANI_U8 *) ptemp->bssDescription.bssId, |
| 693 | sizeof(tSirMacAddr))) && //matching BSSID |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 694 | (pBssDescr->bssDescription.channelId == |
| 695 | ptemp->bssDescription.channelId) && |
| 696 | palEqualMemory( pMac->hHdd,((tANI_U8 *) &pBssDescr->bssDescription.ieFields + 1), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 697 | ((tANI_U8 *) &ptemp->bssDescription.ieFields + 1), |
| 698 | (tANI_U8) (ssidLen + 1)) && |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 699 | ((pSirCapTemp->ess) || //we are done for infrastructure |
| 700 | //For IBSS, nwType and channelId |
| 701 | (((pBssDescr->bssDescription.nwType == |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 702 | ptemp->bssDescription.nwType) && |
| 703 | (pBssDescr->bssDescription.channelId == |
| 704 | ptemp->bssDescription.channelId)))) |
| 705 | ) |
| 706 | { |
| 707 | // Found the same BSS description |
| 708 | if (action == LIM_HASH_UPDATE) |
| 709 | { |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 710 | if(dontUpdateAll) |
| 711 | { |
| 712 | rssi = ptemp->bssDescription.rssi; |
| 713 | } |
| 714 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 715 | if(pBssDescr->bssDescription.fProbeRsp != ptemp->bssDescription.fProbeRsp) |
| 716 | { |
| 717 | //We get a different, save the old frame WSC IE if it is there |
| 718 | idx = 0; |
| 719 | len = ptemp->bssDescription.length - sizeof(tSirBssDescription) + |
| 720 | sizeof(tANI_U16) + sizeof(tANI_U32) - DOT11F_IE_WSCPROBERES_MIN_LEN - 2; |
| 721 | pbIe = (tANI_U8 *)ptemp->bssDescription.ieFields; |
| 722 | //Save WPS IE if it exists |
| 723 | pBssDescr->bssDescription.WscIeLen = 0; |
| 724 | while(idx < len) |
| 725 | { |
| 726 | if((DOT11F_EID_WSCPROBERES == pbIe[0]) && |
| 727 | (0x00 == pbIe[2]) && (0x50 == pbIe[3]) && (0xf2 == pbIe[4]) && (0x04 == pbIe[5])) |
| 728 | { |
| 729 | //Found it |
| 730 | if((DOT11F_IE_WSCPROBERES_MAX_LEN - 2) >= pbIe[1]) |
| 731 | { |
| 732 | palCopyMemory(pMac->hHdd, pBssDescr->bssDescription.WscIeProbeRsp, |
| 733 | pbIe, pbIe[1] + 2); |
| 734 | pBssDescr->bssDescription.WscIeLen = pbIe[1] + 2; |
| 735 | } |
| 736 | break; |
| 737 | } |
| 738 | idx += pbIe[1] + 2; |
| 739 | pbIe += pbIe[1] + 2; |
| 740 | } |
| 741 | } |
| 742 | |
| 743 | |
| 744 | if(NULL != pMac->lim.gpLimMlmScanReq) |
| 745 | { |
| 746 | if((pMac->lim.gpLimMlmScanReq->numSsid)&& |
| 747 | ( limIsNullSsid((tSirMacSSid *)((tANI_U8 *) |
| 748 | &pBssDescr->bssDescription.ieFields + 1)))) |
| 749 | return eHAL_STATUS_FAILURE; |
| 750 | } |
| 751 | |
| 752 | // Delete this entry |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 753 | if (ptemp == pMac->lim.gLimCachedScanHashTable[index]) |
| 754 | pprev = pMac->lim.gLimCachedScanHashTable[index] = ptemp->next; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 755 | else |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 756 | pprev->next = ptemp->next; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 757 | |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 758 | pMac->lim.gLimMlmScanResultLength -= |
| 759 | ptemp->bssDescription.length + sizeof(tANI_U16); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 760 | |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 761 | palFreeMemory( pMac->hHdd, (tANI_U8 *) ptemp); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 762 | } |
Madan Mohan Koyyalamudi | ca43cdf | 2012-09-24 13:15:49 -0700 | [diff] [blame] | 763 | found = true; |
| 764 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 765 | } |
| 766 | } |
| 767 | |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 768 | //for now, only rssi, we can add more if needed |
Madan Mohan Koyyalamudi | 3e9f202 | 2012-12-04 16:34:19 -0800 | [diff] [blame] | 769 | if ((action == LIM_HASH_UPDATE) && dontUpdateAll && rssi) |
Madan Mohan Koyyalamudi | 1586559 | 2012-09-28 15:55:37 -0700 | [diff] [blame] | 770 | { |
| 771 | pBssDescr->bssDescription.rssi = rssi; |
| 772 | } |
| 773 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 774 | // Add this BSS description at same index |
| 775 | if (pprev == pMac->lim.gLimCachedScanHashTable[index]) |
| 776 | { |
| 777 | pBssDescr->next = pMac->lim.gLimCachedScanHashTable[index]; |
| 778 | pMac->lim.gLimCachedScanHashTable[index] = pBssDescr; |
| 779 | } |
| 780 | else |
| 781 | { |
| 782 | pBssDescr->next = pprev->next; |
| 783 | pprev->next = pBssDescr; |
| 784 | } |
| 785 | pMac->lim.gLimMlmScanResultLength += |
| 786 | pBssDescr->bssDescription.length + sizeof(tANI_U16); |
| 787 | |
| 788 | PELOG2(limLog(pMac, LOG2, FL("Added new BSS description size %d TOT %d BSS id\n"), |
| 789 | pBssDescr->bssDescription.length, |
| 790 | pMac->lim.gLimMlmScanResultLength); |
| 791 | limPrintMacAddr(pMac, pBssDescr->bssDescription.bssId, LOG2);) |
| 792 | |
| 793 | // Send new BSS found indication to HDD if CFG option is set |
| 794 | if (!found) limSendSmeNeighborBssInd(pMac, pBssDescr); |
| 795 | |
| 796 | // |
| 797 | // TODO: IF applicable, do we need to send: |
| 798 | // Mesg - eWNI_SME_WM_STATUS_CHANGE_NTF |
| 799 | // Status change code - eSIR_SME_CB_LEGACY_BSS_FOUND_BY_AP |
| 800 | // |
| 801 | return eHAL_STATUS_SUCCESS; |
| 802 | } |
| 803 | |
| 804 | |
| 805 | |
| 806 | /** |
| 807 | * limDeleteHashEntry() |
| 808 | * |
| 809 | *FUNCTION: |
| 810 | * This function is called upon to delete |
| 811 | * a BSS description from scan result hash table. |
| 812 | * |
| 813 | *LOGIC: |
| 814 | * |
| 815 | *ASSUMPTIONS: |
| 816 | * NA |
| 817 | * |
| 818 | *NOTE: |
| 819 | * Yet to find the utility of the function |
| 820 | * |
| 821 | * @param pBssDescr - Pointer to BSS description to be |
| 822 | * deleted from the scan result hash table. |
| 823 | * |
| 824 | * @return None |
| 825 | */ |
| 826 | |
| 827 | void limDeleteHashEntry(tLimScanResultNode *pBssDescr) |
| 828 | { |
| 829 | } /****** end limDeleteHashEntry() ******/ |
| 830 | |
| 831 | |
| 832 | |
| 833 | /** |
| 834 | * limCopyScanResult() |
| 835 | * |
| 836 | *FUNCTION: |
| 837 | * This function is called by limProcessSmeMessages() while |
| 838 | * sending SME_SCAN_RSP with scan result to HDD. |
| 839 | * |
| 840 | *LOGIC: |
| 841 | * This function traverses the scan list stored in scan hash table |
| 842 | * |
| 843 | *ASSUMPTIONS: |
| 844 | * NA |
| 845 | * |
| 846 | *NOTE: |
| 847 | * NA |
| 848 | * |
| 849 | * @param pMac - Pointer to Global MAC structure |
| 850 | * @param pDest - Destination pointer |
| 851 | * |
| 852 | * @return None |
| 853 | */ |
| 854 | |
| 855 | void |
| 856 | limCopyScanResult(tpAniSirGlobal pMac, tANI_U8 *pDest) |
| 857 | { |
| 858 | tLimScanResultNode *ptemp; |
| 859 | tANI_U16 i; |
| 860 | for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++) |
| 861 | { |
| 862 | if ((ptemp = pMac->lim.gLimCachedScanHashTable[i]) != NULL) |
| 863 | { |
| 864 | while(ptemp) |
| 865 | { |
| 866 | /// Copy entire BSS description including length |
| 867 | palCopyMemory( pMac->hHdd, pDest, |
| 868 | (tANI_U8 *) &ptemp->bssDescription, |
| 869 | ptemp->bssDescription.length + 2); |
| 870 | pDest += ptemp->bssDescription.length + 2; |
| 871 | ptemp = ptemp->next; |
| 872 | } |
| 873 | } |
| 874 | } |
| 875 | } /****** end limCopyScanResult() ******/ |
| 876 | |
| 877 | |
| 878 | |
| 879 | /** |
| 880 | * limDeleteCachedScanResults() |
| 881 | * |
| 882 | *FUNCTION: |
| 883 | * This function is called by limProcessSmeMessages() upon receiving |
| 884 | * SME_SCAN_REQ with fresh scan result flag set. |
| 885 | * |
| 886 | *LOGIC: |
| 887 | * This function traverses the scan list stored in scan hash table |
| 888 | * and deletes the entries if any |
| 889 | * |
| 890 | *ASSUMPTIONS: |
| 891 | * NA |
| 892 | * |
| 893 | *NOTE: |
| 894 | * NA |
| 895 | * |
| 896 | * @param pMac - Pointer to Global MAC structure |
| 897 | * @return None |
| 898 | */ |
| 899 | |
| 900 | void |
| 901 | limDeleteCachedScanResults(tpAniSirGlobal pMac) |
| 902 | { |
| 903 | tLimScanResultNode *pNode, *pNextNode; |
| 904 | tANI_U16 i; |
| 905 | for (i = 0; i < LIM_MAX_NUM_OF_SCAN_RESULTS; i++) |
| 906 | { |
| 907 | if ((pNode = pMac->lim.gLimCachedScanHashTable[i]) != NULL) |
| 908 | { |
| 909 | while (pNode) |
| 910 | { |
| 911 | pNextNode = pNode->next; |
| 912 | |
| 913 | // Delete the current node |
| 914 | palFreeMemory( pMac->hHdd, (tANI_U8 *) pNode); |
| 915 | |
| 916 | pNode = pNextNode; |
| 917 | } |
| 918 | } |
| 919 | } |
| 920 | |
| 921 | pMac->lim.gLimSmeScanResultLength = 0; |
| 922 | } /****** end limDeleteCachedScanResults() ******/ |
| 923 | |
| 924 | |
| 925 | |
| 926 | /** |
| 927 | * limReInitScanResults() |
| 928 | * |
| 929 | *FUNCTION: |
| 930 | * This function is called delete exisiting scan results |
| 931 | * and initialize the scan hash table |
| 932 | * |
| 933 | *LOGIC: |
| 934 | * |
| 935 | *ASSUMPTIONS: |
| 936 | * NA |
| 937 | * |
| 938 | *NOTE: |
| 939 | * NA |
| 940 | * |
| 941 | * @param pMac - Pointer to Global MAC structure |
| 942 | * @return None |
| 943 | */ |
| 944 | |
| 945 | void |
| 946 | limReInitScanResults(tpAniSirGlobal pMac) |
| 947 | { |
| 948 | limDeleteCachedScanResults(pMac); |
| 949 | limInitHashTable(pMac); |
| 950 | |
| 951 | // !!LAC - need to clear out the global scan result length |
| 952 | // since the list was just purged from the hash table. |
| 953 | pMac->lim.gLimMlmScanResultLength = 0; |
| 954 | |
| 955 | } /****** end limReInitScanResults() ******/ |