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