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 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 42 | /** ------------------------------------------------------------------------- * |
| 43 | ------------------------------------------------------------------------- * |
| 44 | |
| 45 | |
| 46 | \file csrNeighborRoam.c |
| 47 | |
| 48 | Implementation for the simple roaming algorithm for 802.11r Fast transitions and Legacy roaming for Android platform. |
| 49 | |
| 50 | Copyright (C) 2010 Qualcomm, Incorporated |
| 51 | |
| 52 | |
| 53 | ========================================================================== */ |
| 54 | |
| 55 | /*=========================================================================== |
| 56 | |
| 57 | EDIT HISTORY FOR FILE |
| 58 | |
| 59 | |
| 60 | This section contains comments describing changes made to the module. |
| 61 | Notice that changes are listed in reverse chronological order. |
| 62 | |
| 63 | |
| 64 | |
| 65 | when who what, where, why |
| 66 | ---------- --- -------------------------------------------------------- |
| 67 | 08/01/10 Murali Created |
| 68 | |
| 69 | ===========================================================================*/ |
| 70 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING |
| 71 | #include "wlan_qct_wda.h" |
| 72 | #include "palApi.h" |
| 73 | #include "csrInsideApi.h" |
| 74 | #include "smsDebug.h" |
| 75 | #include "logDump.h" |
| 76 | #include "smeQosInternal.h" |
| 77 | #include "wlan_qct_tl.h" |
| 78 | #include "smeInside.h" |
| 79 | #include "vos_diag_core_event.h" |
| 80 | #include "vos_diag_core_log.h" |
| 81 | #include "csrApi.h" |
| 82 | #include "wlan_qct_tl.h" |
| 83 | #include "sme_Api.h" |
| 84 | #include "csrNeighborRoam.h" |
| 85 | #ifdef FEATURE_WLAN_CCX |
| 86 | #include "csrCcx.h" |
| 87 | #endif |
| 88 | |
| 89 | #define WLAN_FEATURE_NEIGHBOR_ROAMING_DEBUG 1 |
| 90 | #ifdef WLAN_FEATURE_NEIGHBOR_ROAMING_DEBUG |
| 91 | #define NEIGHBOR_ROAM_DEBUG smsLog |
| 92 | #else |
| 93 | #define NEIGHBOR_ROAM_DEBUG(x...) |
| 94 | #endif |
| 95 | |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 96 | static void csrNeighborRoamResetChannelInfo(tpCsrNeighborRoamChannelInfo rChInfo); |
| 97 | static void csrNeighborRoamResetCfgListChanScanControlInfo(tpAniSirGlobal pMac); |
| 98 | static void csrNeighborRoamResetPreauthControlInfo(tpAniSirGlobal pMac); |
| 99 | static void csrNeighborRoamDeregAllRssiIndication(tpAniSirGlobal pMac); |
| 100 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 101 | VOS_STATUS csrNeighborRoamNeighborLookupUPCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification, |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 102 | v_PVOID_t pUserCtxt, |
| 103 | v_S7_t avgRssi); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 104 | VOS_STATUS csrNeighborRoamNeighborLookupDOWNCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification, |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 105 | v_PVOID_t pUserCtxt, |
| 106 | v_S7_t avgRssi); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 107 | void csrNeighborRoamRRMNeighborReportResult(void *context, VOS_STATUS vosStatus); |
| 108 | eHalStatus csrRoamCopyConnectedProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pDstProfile ); |
| 109 | |
| 110 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 111 | static eHalStatus csrNeighborRoamIssuePreauthReq(tpAniSirGlobal pMac); |
| 112 | VOS_STATUS csrNeighborRoamIssueNeighborRptRequest(tpAniSirGlobal pMac); |
| 113 | #endif |
| 114 | |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 115 | #define ROAM_STATE_RETURN_STRING( str )\ |
| 116 | case ( ( str ) ): return( #str ) |
| 117 | |
| 118 | |
| 119 | v_U8_t *csrNeighborRoamStateToString(v_U8_t state) |
| 120 | { |
| 121 | switch(state) |
| 122 | { |
| 123 | ROAM_STATE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_CLOSED ); |
| 124 | ROAM_STATE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_INIT ); |
| 125 | ROAM_STATE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_CONNECTED ); |
| 126 | ROAM_STATE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN ); |
| 127 | ROAM_STATE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING ); |
| 128 | ROAM_STATE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY ); |
| 129 | ROAM_STATE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN ); |
| 130 | ROAM_STATE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING ); |
| 131 | ROAM_STATE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE ); |
| 132 | default: |
| 133 | return "eCSR_NEIGHBOR_ROAM_STATE_UNKNOWN"; |
| 134 | } |
| 135 | |
| 136 | } |
| 137 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 138 | /* State Transition macro */ |
| 139 | #define CSR_NEIGHBOR_ROAM_STATE_TRANSITION(newState)\ |
| 140 | {\ |
| 141 | pMac->roam.neighborRoamInfo.prevNeighborRoamState = pMac->roam.neighborRoamInfo.neighborRoamState;\ |
| 142 | pMac->roam.neighborRoamInfo.neighborRoamState = newState;\ |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 143 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, \ |
| 144 | FL("Neighbor Roam Transition from state %s ==> %s"), \ |
| 145 | csrNeighborRoamStateToString (pMac->roam.neighborRoamInfo.prevNeighborRoamState), \ |
| 146 | csrNeighborRoamStateToString (newState));\ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | /* --------------------------------------------------------------------------- |
| 150 | |
| 151 | \fn csrNeighborRoamFreeNeighborRoamBSSNode |
| 152 | |
| 153 | \brief This function frees all the internal pointers CSR NeighborRoam BSS Info |
| 154 | and also frees the node itself |
| 155 | |
| 156 | \param pMac - The handle returned by macOpen. |
| 157 | neighborRoamBSSNode - Neighbor Roam BSS Node to be freed |
| 158 | |
| 159 | \return VOID |
| 160 | |
| 161 | ---------------------------------------------------------------------------*/ |
| 162 | void csrNeighborRoamFreeNeighborRoamBSSNode(tpAniSirGlobal pMac, tpCsrNeighborRoamBSSInfo neighborRoamBSSNode) |
| 163 | { |
| 164 | if (neighborRoamBSSNode) |
| 165 | { |
| 166 | if (neighborRoamBSSNode->pBssDescription) |
| 167 | { |
| 168 | vos_mem_free(neighborRoamBSSNode->pBssDescription); |
| 169 | neighborRoamBSSNode->pBssDescription = NULL; |
| 170 | } |
| 171 | vos_mem_free(neighborRoamBSSNode); |
| 172 | neighborRoamBSSNode = NULL; |
| 173 | } |
| 174 | |
| 175 | return; |
| 176 | } |
| 177 | |
| 178 | /* --------------------------------------------------------------------------- |
| 179 | |
| 180 | \fn csrNeighborRoamRemoveRoamableAPListEntry |
| 181 | |
| 182 | \brief This function removes a given entry from the given list |
| 183 | |
| 184 | \param pMac - The handle returned by macOpen. |
| 185 | pList - The list from which the entry should be removed |
| 186 | pNeighborEntry - Neighbor Roam BSS Node to be removed |
| 187 | |
| 188 | \return TRUE if successfully removed, else FALSE |
| 189 | |
| 190 | ---------------------------------------------------------------------------*/ |
| 191 | tANI_BOOLEAN csrNeighborRoamRemoveRoamableAPListEntry(tpAniSirGlobal pMac, |
| 192 | tDblLinkList *pList, tpCsrNeighborRoamBSSInfo pNeighborEntry) |
| 193 | { |
| 194 | if(pList) |
| 195 | { |
| 196 | return csrLLRemoveEntry(pList, &pNeighborEntry->List, LL_ACCESS_LOCK); |
| 197 | } |
| 198 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 199 | smsLog(pMac, LOGE, FL("Removing neighbor BSS node from list failed. Current count = %d"), csrLLCount(pList)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 200 | |
| 201 | return eANI_BOOLEAN_FALSE; |
| 202 | } |
| 203 | |
| 204 | /* --------------------------------------------------------------------------- |
| 205 | |
| 206 | \fn csrNeighborRoamGetRoamableAPListNextEntry |
| 207 | |
| 208 | \brief Gets the entry next to passed entry. If NULL is passed, return the entry in the head of the list |
| 209 | |
| 210 | \param pMac - The handle returned by macOpen. |
| 211 | pList - The list from which the entry should be returned |
| 212 | pNeighborEntry - Neighbor Roam BSS Node whose next entry should be returned |
| 213 | |
| 214 | \return Neighbor Roam BSS Node to be returned |
| 215 | |
| 216 | ---------------------------------------------------------------------------*/ |
| 217 | tpCsrNeighborRoamBSSInfo csrNeighborRoamGetRoamableAPListNextEntry(tpAniSirGlobal pMac, |
| 218 | tDblLinkList *pList, tpCsrNeighborRoamBSSInfo pNeighborEntry) |
| 219 | { |
| 220 | tListElem *pEntry = NULL; |
| 221 | tpCsrNeighborRoamBSSInfo pResult = NULL; |
| 222 | |
| 223 | if(pList) |
| 224 | { |
| 225 | if(NULL == pNeighborEntry) |
| 226 | { |
| 227 | pEntry = csrLLPeekHead(pList, LL_ACCESS_LOCK); |
| 228 | } |
| 229 | else |
| 230 | { |
| 231 | pEntry = csrLLNext(pList, &pNeighborEntry->List, LL_ACCESS_LOCK); |
| 232 | } |
| 233 | if(pEntry) |
| 234 | { |
| 235 | pResult = GET_BASE_ADDR(pEntry, tCsrNeighborRoamBSSInfo, List); |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | return pResult; |
| 240 | } |
| 241 | |
| 242 | /* --------------------------------------------------------------------------- |
| 243 | |
| 244 | \fn csrNeighborRoamFreeRoamableBSSList |
| 245 | |
| 246 | \brief Empties and frees all the nodes in the roamable AP list |
| 247 | |
| 248 | \param pMac - The handle returned by macOpen. |
| 249 | pList - Neighbor Roam BSS List to be emptied |
| 250 | |
| 251 | \return VOID |
| 252 | |
| 253 | ---------------------------------------------------------------------------*/ |
| 254 | void csrNeighborRoamFreeRoamableBSSList(tpAniSirGlobal pMac, tDblLinkList *pList) |
| 255 | { |
| 256 | tpCsrNeighborRoamBSSInfo pResult = NULL; |
| 257 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 258 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Emptying the BSS list. Current count = %d"), csrLLCount(pList)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 259 | |
| 260 | /* Pick up the head, remove and free the node till the list becomes empty */ |
| 261 | while ((pResult = csrNeighborRoamGetRoamableAPListNextEntry(pMac, pList, NULL)) != NULL) |
| 262 | { |
| 263 | csrNeighborRoamRemoveRoamableAPListEntry(pMac, pList, pResult); |
| 264 | csrNeighborRoamFreeNeighborRoamBSSNode(pMac, pResult); |
| 265 | } |
| 266 | return; |
| 267 | } |
| 268 | |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 269 | static void csrNeighborRoamTriggerHandoff(tpAniSirGlobal pMac, |
| 270 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo) |
| 271 | { |
| 272 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 273 | if (pNeighborRoamInfo->is11rAssoc) |
| 274 | { |
| 275 | if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState) |
| 276 | { |
| 277 | csrNeighborRoamIssuePreauthReq(pMac); |
| 278 | } |
| 279 | else |
| 280 | { |
| 281 | smsLog(pMac, LOGE, FL("11R Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState); |
| 282 | VOS_ASSERT(0); |
| 283 | } |
| 284 | } |
| 285 | else |
| 286 | #endif |
| 287 | |
| 288 | #ifdef FEATURE_WLAN_CCX |
| 289 | if (pNeighborRoamInfo->isCCXAssoc) |
| 290 | { |
| 291 | if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState) |
| 292 | { |
| 293 | csrNeighborRoamIssuePreauthReq(pMac); |
| 294 | } |
| 295 | else |
| 296 | { |
| 297 | smsLog(pMac, LOGE, FL("CCX Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState); |
| 298 | VOS_ASSERT(0); |
| 299 | } |
| 300 | } |
| 301 | else |
| 302 | #endif |
| 303 | #ifdef FEATURE_WLAN_LFR |
| 304 | if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID)) |
| 305 | { |
| 306 | if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState) |
| 307 | { |
| 308 | csrNeighborRoamIssuePreauthReq(pMac); |
| 309 | } |
| 310 | else |
| 311 | { |
| 312 | smsLog(pMac, LOGE, FL("LFR Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState); |
| 313 | VOS_ASSERT(0); |
| 314 | } |
| 315 | } |
| 316 | else |
| 317 | #endif |
| 318 | { |
| 319 | if (eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN == pNeighborRoamInfo->neighborRoamState) |
| 320 | { |
| 321 | csrNeighborRoamRequestHandoff(pMac); |
| 322 | } |
| 323 | else |
| 324 | { |
| 325 | smsLog(pMac, LOGE, FL("Non-11R Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState); |
| 326 | VOS_ASSERT(0); |
| 327 | } |
| 328 | } |
| 329 | } |
| 330 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 331 | VOS_STATUS csrNeighborRoamSetLookupRssiThreshold(tpAniSirGlobal pMac, v_U8_t neighborLookupRssiThreshold) |
| 332 | { |
| 333 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 334 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 335 | |
| 336 | if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState) |
| 337 | { |
| 338 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in CONNECTED state, so deregister all and re-register for DOWN event again")); |
| 339 | /* De-register existing lookup UP/DOWN, Rssi indications */ |
| 340 | csrNeighborRoamDeregAllRssiIndication(pMac); |
| 341 | pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold = neighborLookupRssiThreshold; |
| 342 | pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold; |
| 343 | |
| 344 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"), pNeighborRoamInfo->currentNeighborLookupThreshold); |
| 345 | /* Register Neighbor Lookup threshold callback with TL for DOWN event only */ |
| 346 | vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1), |
| 347 | WLANTL_HO_THRESHOLD_DOWN, |
| 348 | csrNeighborRoamNeighborLookupDOWNCallback, |
| 349 | VOS_MODULE_ID_SME, pMac); |
| 350 | if (!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 351 | { |
| 352 | //err msg |
| 353 | smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d"), vosStatus); |
| 354 | vosStatus = VOS_STATUS_E_FAILURE; |
| 355 | } |
| 356 | } |
| 357 | else if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState) |
| 358 | { |
| 359 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in INIT state, safe to set lookupRssi threshold")); |
| 360 | pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold = neighborLookupRssiThreshold; |
| 361 | pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold; |
| 362 | } |
| 363 | else |
| 364 | { |
| 365 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Unexpected state %d, returning failure"), pNeighborRoamInfo->neighborRoamState); |
| 366 | vosStatus = VOS_STATUS_E_FAILURE; |
| 367 | } |
| 368 | return vosStatus; |
| 369 | } |
| 370 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 371 | /* --------------------------------------------------------------------------- |
| 372 | |
| 373 | \fn csrNeighborRoamReassocIndCallback |
| 374 | |
| 375 | \brief Reassoc callback invoked by TL on crossing the registered re-assoc threshold. |
| 376 | Directly triggere HO in case of non-11r association |
| 377 | In case of 11R association, triggers a pre-auth eventually followed by actual HO |
| 378 | |
| 379 | \param pAdapter - VOS Context |
| 380 | trafficStatus - UP/DOWN indication from TL |
| 381 | pUserCtxt - Parameter for callback registered during callback registration. Should be pMac |
| 382 | |
| 383 | \return VOID |
| 384 | |
| 385 | ---------------------------------------------------------------------------*/ |
| 386 | VOS_STATUS csrNeighborRoamReassocIndCallback(v_PVOID_t pAdapter, |
| 387 | v_U8_t trafficStatus, |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 388 | v_PVOID_t pUserCtxt, |
| 389 | v_S7_t avgRssi) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 390 | { |
| 391 | tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt ); |
| 392 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 393 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 394 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 395 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event reassoc callback with TL. Threshold RSSI = %d Reported RSSI = %d"), |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 396 | pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1), |
| 397 | avgRssi); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 398 | |
| 399 | vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1), |
| 400 | WLANTL_HO_THRESHOLD_DOWN, |
| 401 | csrNeighborRoamReassocIndCallback, |
| 402 | VOS_MODULE_ID_SME); |
| 403 | |
| 404 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 405 | { |
| 406 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 407 | smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 408 | } |
| 409 | |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 410 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Rcvd reassoc notification-deregister UP indication. Threshold RSSI = %d Reported RSSI = %d"), |
| 411 | NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1), avgRssi); |
Madan Mohan Koyyalamudi | 4450acc | 2012-11-15 17:24:31 -0800 | [diff] [blame] | 412 | vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, |
| 413 | (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1), |
| 414 | WLANTL_HO_THRESHOLD_UP, |
| 415 | csrNeighborRoamNeighborLookupUPCallback, |
| 416 | VOS_MODULE_ID_SME); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 417 | |
| 418 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 419 | { |
| 420 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 421 | smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamNeighborLookupUPCallback with TL: Status = %d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 422 | } |
| 423 | |
| 424 | /* We dont need to run this timer any more. */ |
| 425 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 426 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 427 | |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 428 | csrNeighborRoamTriggerHandoff(pMac, pNeighborRoamInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 429 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 430 | return VOS_STATUS_SUCCESS; |
| 431 | } |
| 432 | |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 433 | /*CleanUP Routines*/ |
| 434 | static void csrNeighborRoamResetChannelInfo(tpCsrNeighborRoamChannelInfo rChInfo) |
| 435 | { |
| 436 | if ((rChInfo->IAPPNeighborListReceived == FALSE) && |
| 437 | (rChInfo->currentChannelListInfo.numOfChannels)) |
| 438 | { |
| 439 | rChInfo->currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX; |
| 440 | rChInfo->currentChannelListInfo.numOfChannels = 0; |
| 441 | |
| 442 | if (rChInfo->currentChannelListInfo.ChannelList) |
| 443 | vos_mem_free(rChInfo->currentChannelListInfo.ChannelList); |
| 444 | |
| 445 | rChInfo->currentChannelListInfo.ChannelList = NULL; |
| 446 | rChInfo->chanListScanInProgress = eANI_BOOLEAN_FALSE; |
| 447 | } |
| 448 | else |
| 449 | { |
| 450 | rChInfo->currentChanIndex = 0; |
| 451 | rChInfo->chanListScanInProgress = eANI_BOOLEAN_TRUE; |
| 452 | } |
| 453 | } |
| 454 | |
| 455 | static void csrNeighborRoamResetCfgListChanScanControlInfo(tpAniSirGlobal pMac) |
| 456 | { |
| 457 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 458 | |
| 459 | /* Stop neighbor scan timer */ |
| 460 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 461 | |
Madan Mohan Koyyalamudi | 04039a1 | 2012-10-21 12:24:56 -0700 | [diff] [blame] | 462 | /* Stop neighbor scan results refresh timer */ |
| 463 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer); |
| 464 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 465 | /* Stop empty scan results refresh timer */ |
| 466 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer); |
| 467 | |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 468 | /* Abort any ongoing scan */ |
| 469 | if (eANI_BOOLEAN_TRUE == pNeighborRoamInfo->scanRspPending) |
| 470 | { |
| 471 | csrScanAbortMacScan(pMac); |
| 472 | } |
| 473 | pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE; |
| 474 | |
| 475 | /* Reset roam channel list information */ |
| 476 | csrNeighborRoamResetChannelInfo(&pNeighborRoamInfo->roamChannelInfo); |
| 477 | } |
| 478 | |
| 479 | static void csrNeighborRoamResetPreauthControlInfo(tpAniSirGlobal pMac) |
| 480 | { |
| 481 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 482 | |
| 483 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 484 | pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_FALSE; |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 485 | /* Purge pre-auth fail list */ |
| 486 | csrNeighborRoamPurgePreauthFailedList(pMac); |
| 487 | #endif |
| 488 | |
| 489 | pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_FALSE; |
| 490 | pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0; |
| 491 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 492 | /* Do not free up the preauth done list here */ |
| 493 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0; |
| 494 | pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE; |
| 495 | pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0; |
| 496 | vos_mem_zero(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT); |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 497 | #endif |
| 498 | } |
| 499 | |
| 500 | static void csrNeighborRoamDeregAllRssiIndication(tpAniSirGlobal pMac) |
| 501 | { |
| 502 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 503 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 504 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 505 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 506 | FL("Deregister neighbor lookup UP callback with TL. RSSI = %d"), |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 507 | NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1)); |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 508 | |
| 509 | /* Deregister reassoc callback. Ignore return status */ |
| 510 | vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 511 | (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1), |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 512 | WLANTL_HO_THRESHOLD_UP, |
| 513 | csrNeighborRoamNeighborLookupUPCallback, |
| 514 | VOS_MODULE_ID_SME); |
| 515 | |
| 516 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 517 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 518 | smsLog(pMac, LOGW, |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 519 | FL("Couldn't deregister csrNeighborRoamNeighborLookupUPCallback " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 520 | "with TL: Status = %d"), vosStatus); |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 521 | } |
| 522 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 523 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 524 | FL("Deregistering reassoc DOWN callback with TL. RSSI = %d"), |
| 525 | pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1)); |
| 526 | |
| 527 | /* Deregister reassoc callback. Ignore return status */ |
| 528 | vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, |
| 529 | (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1), |
| 530 | WLANTL_HO_THRESHOLD_DOWN, |
| 531 | csrNeighborRoamReassocIndCallback, |
| 532 | VOS_MODULE_ID_SME); |
| 533 | |
| 534 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 535 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 536 | smsLog(pMac, LOGW, |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 537 | FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 538 | "TL: Status = %d"), vosStatus); |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 539 | } |
| 540 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 541 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 542 | FL("Deregistering neighborLookup DOWN callback with TL. RSSI = %d"), |
| 543 | pNeighborRoamInfo->currentNeighborLookupThreshold * (-1)); |
| 544 | |
| 545 | /* Deregister neighbor lookup callback. Ignore return status */ |
| 546 | vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, |
| 547 | (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1), |
| 548 | WLANTL_HO_THRESHOLD_DOWN, |
| 549 | csrNeighborRoamNeighborLookupDOWNCallback, |
| 550 | VOS_MODULE_ID_SME); |
| 551 | |
| 552 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 553 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 554 | smsLog(pMac, LOGW, |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 555 | FL(" Couldn't deregister csrNeighborRoamNeighborLookupDOWNCallback " |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 556 | "with TL: Status = %d"), vosStatus); |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 557 | } |
| 558 | |
| 559 | /* Reset thresholds only after deregistering DOWN event from TL */ |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 560 | pNeighborRoamInfo->currentNeighborLookupThreshold = |
| 561 | pNeighborRoamInfo->cfgParams.neighborLookupThreshold; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 562 | #ifdef FEATURE_WLAN_LFR |
| 563 | pNeighborRoamInfo->uEmptyScanCount = 0; |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 564 | pNeighborRoamInfo->lookupDOWNRssi = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 565 | pNeighborRoamInfo->uScanMode = DEFAULT_SCAN; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 566 | #endif |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 567 | } |
| 568 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 569 | /* --------------------------------------------------------------------------- |
| 570 | |
| 571 | \fn csrNeighborRoamResetConnectedStateControlInfo |
| 572 | |
| 573 | \brief This function will reset the neighbor roam control info data structures. |
| 574 | This function should be invoked whenever we move to CONNECTED state from |
| 575 | any state other than INIT state |
| 576 | |
| 577 | \param pMac - The handle returned by macOpen. |
| 578 | |
| 579 | \return VOID |
| 580 | |
| 581 | ---------------------------------------------------------------------------*/ |
| 582 | void csrNeighborRoamResetConnectedStateControlInfo(tpAniSirGlobal pMac) |
| 583 | { |
| 584 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 585 | |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 586 | csrNeighborRoamResetChannelInfo(&pNeighborRoamInfo->roamChannelInfo); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 587 | csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 588 | |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 589 | /* We dont need to run this timer any more. */ |
| 590 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 591 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 592 | |
| 593 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 594 | /* Do not free up the preauth done list here */ |
| 595 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0; |
| 596 | pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE; |
| 597 | pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0; |
| 598 | pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0; |
| 599 | pNeighborRoamInfo->FTRoamInfo.preauthRspPending = 0; |
| 600 | vos_mem_zero(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 601 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 602 | } |
| 603 | |
Madan Mohan Koyyalamudi | 4f292df | 2012-09-18 17:27:40 -0700 | [diff] [blame] | 604 | void csrNeighborRoamResetReportScanStateControlInfo(tpAniSirGlobal pMac) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 605 | { |
| 606 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 607 | pNeighborRoamInfo->csrSessionId = CSR_SESSION_ID_INVALID; |
| 608 | vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0); |
| 609 | pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac; |
| 610 | pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 611 | #ifdef FEATURE_WLAN_CCX |
| 612 | pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_FALSE; |
| 613 | pNeighborRoamInfo->isVOAdmitted = eANI_BOOLEAN_FALSE; |
| 614 | pNeighborRoamInfo->MinQBssLoadRequired = 0; |
| 615 | #endif |
Madan Mohan Koyyalamudi | 595208a | 2012-10-05 12:48:38 -0700 | [diff] [blame] | 616 | |
| 617 | /* Stop scan refresh timer */ |
| 618 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 619 | /* Stop empty scan results refresh timer */ |
| 620 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer); |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 621 | /* Purge roamable AP list */ |
| 622 | csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 623 | return; |
| 624 | } |
| 625 | |
Madan Mohan Koyyalamudi | 4f292df | 2012-09-18 17:27:40 -0700 | [diff] [blame] | 626 | /* --------------------------------------------------------------------------- |
| 627 | |
| 628 | \fn csrNeighborRoamResetInitStateControlInfo |
| 629 | |
| 630 | \brief This function will reset the neighbor roam control info data structures. |
| 631 | This function should be invoked whenever we move to CONNECTED state from |
| 632 | INIT state |
| 633 | |
| 634 | \param pMac - The handle returned by macOpen. |
| 635 | |
| 636 | \return VOID |
| 637 | |
| 638 | ---------------------------------------------------------------------------*/ |
| 639 | void csrNeighborRoamResetInitStateControlInfo(tpAniSirGlobal pMac) |
| 640 | { |
| 641 | csrNeighborRoamResetConnectedStateControlInfo(pMac); |
| 642 | |
| 643 | /* In addition to the above resets, we should clear off the curAPBssId/Session ID in the timers */ |
| 644 | csrNeighborRoamResetReportScanStateControlInfo(pMac); |
| 645 | } |
| 646 | |
| 647 | |
| 648 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 649 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 650 | /* --------------------------------------------------------------------------- |
| 651 | |
| 652 | \fn csrNeighborRoamBssIdScanFilter |
| 653 | |
| 654 | \brief This API is used to prepare a filter to obtain scan results when |
| 655 | we complete the scan in the REPORT_SCAN state after receiving a |
| 656 | valid neighbor report from AP. This filter includes BSSIDs received from |
| 657 | the neighbor report from the AP in addition to the other filter parameters |
| 658 | created from connected profile |
| 659 | |
| 660 | \param pMac - The handle returned by macOpen. |
| 661 | pScanFilter - Scan filter to be filled and returned |
| 662 | |
| 663 | \return eHAL_STATUS_SUCCESS on succesful filter creation, corresponding error |
| 664 | code otherwise |
| 665 | |
| 666 | ---------------------------------------------------------------------------*/ |
| 667 | static eHalStatus csrNeighborRoamBssIdScanFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter) |
| 668 | { |
| 669 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 670 | tANI_U8 i = 0; |
| 671 | |
| 672 | VOS_ASSERT(pScanFilter != NULL); |
| 673 | vos_mem_zero(pScanFilter, sizeof(tCsrScanResultFilter)); |
| 674 | |
| 675 | pScanFilter->BSSIDs.numOfBSSIDs = pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport; |
| 676 | pScanFilter->BSSIDs.bssid = vos_mem_malloc(sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs); |
| 677 | if (NULL == pScanFilter->BSSIDs.bssid) |
| 678 | { |
| 679 | smsLog(pMac, LOGE, FL("Scan Filter BSSID mem alloc failed")); |
| 680 | return eHAL_STATUS_FAILED_ALLOC; |
| 681 | } |
| 682 | |
| 683 | vos_mem_zero(pScanFilter->BSSIDs.bssid, sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs); |
| 684 | |
| 685 | /* Populate the BSSID from Neighbor BSS info received from neighbor report */ |
| 686 | for (i = 0; i < pScanFilter->BSSIDs.numOfBSSIDs; i++) |
| 687 | { |
| 688 | vos_mem_copy(&pScanFilter->BSSIDs.bssid[i], |
| 689 | pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[i].neighborBssId, sizeof(tSirMacAddr)); |
| 690 | } |
| 691 | |
| 692 | /* Fill other general scan filter params */ |
| 693 | return csrNeighborRoamPrepareScanProfileFilter(pMac, pScanFilter); |
| 694 | } |
| 695 | |
| 696 | /* --------------------------------------------------------------------------- |
| 697 | |
| 698 | \fn csrNeighborRoamPurgePreauthFailList |
| 699 | |
| 700 | \brief This function empties the preauth fail list |
| 701 | |
| 702 | \param pMac - The handle returned by macOpen. |
| 703 | |
| 704 | \return VOID |
| 705 | |
| 706 | ---------------------------------------------------------------------------*/ |
| 707 | void csrNeighborRoamPurgePreauthFailList(tpAniSirGlobal pMac) |
| 708 | { |
| 709 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 710 | |
| 711 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Purging the preauth fail list")); |
| 712 | while (pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress) |
| 713 | { |
| 714 | vos_mem_zero(pNeighborRoamInfo->FTRoamInfo.preAuthFailList.macAddress[pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress-1], |
| 715 | sizeof(tSirMacAddr)); |
| 716 | pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress--; |
| 717 | } |
| 718 | return; |
| 719 | } |
| 720 | |
| 721 | /* --------------------------------------------------------------------------- |
| 722 | |
| 723 | \fn csrNeighborRoamAddBssIdToPreauthFailList |
| 724 | |
| 725 | \brief This function adds the given BSSID to the Preauth fail list |
| 726 | |
| 727 | \param pMac - The handle returned by macOpen. |
| 728 | bssId - BSSID to be added to the preauth fail list |
| 729 | |
| 730 | \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise |
| 731 | |
| 732 | ---------------------------------------------------------------------------*/ |
| 733 | eHalStatus csrNeighborRoamAddBssIdToPreauthFailList(tpAniSirGlobal pMac, tSirMacAddr bssId) |
| 734 | { |
| 735 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 736 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 737 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL(" Added BSSID %02x:%02x:%02x:%02x:%02x:%02x to Preauth failed list"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 738 | bssId[0], bssId[1], bssId[2], bssId[3], bssId[4], bssId[5]); |
| 739 | |
| 740 | |
| 741 | if ((pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress + 1) > |
| 742 | MAX_NUM_PREAUTH_FAIL_LIST_ADDRESS) |
| 743 | { |
| 744 | smsLog(pMac, LOGE, FL("Preauth fail list already full.. Cannot add new one")); |
| 745 | return eHAL_STATUS_FAILURE; |
| 746 | } |
| 747 | vos_mem_copy(pNeighborRoamInfo->FTRoamInfo.preAuthFailList.macAddress[pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress], |
| 748 | bssId, sizeof(tSirMacAddr)); |
| 749 | pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress++; |
| 750 | |
| 751 | return eHAL_STATUS_SUCCESS; |
| 752 | } |
| 753 | |
| 754 | /* --------------------------------------------------------------------------- |
| 755 | |
| 756 | \fn csrNeighborRoamIsPreauthCandidate |
| 757 | |
| 758 | \brief This function checks whether the given MAC address is already |
| 759 | present in the preauth fail list and returns TRUE/FALSE accordingly |
| 760 | |
| 761 | \param pMac - The handle returned by macOpen. |
| 762 | |
| 763 | \return eANI_BOOLEAN_TRUE if preauth candidate, eANI_BOOLEAN_FALSE otherwise |
| 764 | |
| 765 | ---------------------------------------------------------------------------*/ |
| 766 | tANI_BOOLEAN csrNeighborRoamIsPreauthCandidate(tpAniSirGlobal pMac, tSirMacAddr bssId) |
| 767 | { |
| 768 | tANI_U8 i = 0; |
| 769 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 770 | |
| 771 | if (0 == pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress) |
| 772 | return eANI_BOOLEAN_TRUE; |
| 773 | |
| 774 | for (i = 0; i < pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress; i++) |
| 775 | { |
| 776 | if (VOS_TRUE == vos_mem_compare(pNeighborRoamInfo->FTRoamInfo.preAuthFailList.macAddress[i], |
| 777 | bssId, sizeof(tSirMacAddr))) |
| 778 | { |
| 779 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("BSSID %02x:%02x:%02x:%02x:%02x:%02x already present in preauth fail list"), |
| 780 | bssId[0], bssId[1], bssId[2], bssId[3], bssId[4], bssId[5]); |
| 781 | return eANI_BOOLEAN_FALSE; |
| 782 | } |
| 783 | } |
| 784 | |
| 785 | return eANI_BOOLEAN_TRUE; |
| 786 | } |
| 787 | |
| 788 | /* --------------------------------------------------------------------------- |
| 789 | |
| 790 | \fn csrNeighborRoamIssuePreauthReq |
| 791 | |
| 792 | \brief This function issues preauth request to PE with the 1st AP entry in the |
| 793 | roamable AP list |
| 794 | |
| 795 | \param pMac - The handle returned by macOpen. |
| 796 | |
| 797 | \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise |
| 798 | |
| 799 | ---------------------------------------------------------------------------*/ |
| 800 | static eHalStatus csrNeighborRoamIssuePreauthReq(tpAniSirGlobal pMac) |
| 801 | { |
| 802 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 803 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 804 | tpCsrNeighborRoamBSSInfo pNeighborBssNode; |
| 805 | |
| 806 | /* This must not be true here */ |
| 807 | VOS_ASSERT(pNeighborRoamInfo->FTRoamInfo.preauthRspPending == eANI_BOOLEAN_FALSE); |
| 808 | |
| 809 | /* Issue Preauth request to PE here */ |
| 810 | /* Need to issue the preauth request with the BSSID that is there in the head of the roamable AP list */ |
| 811 | /* Parameters that should be passed are BSSID, Channel number and the neighborScanPeriod(probably) */ |
| 812 | /* If roamableAPList gets empty, should transition to REPORT_SCAN state */ |
| 813 | pNeighborBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL); |
| 814 | |
| 815 | if (NULL == pNeighborBssNode) |
| 816 | { |
| 817 | smsLog(pMac, LOG1, FL("Roamable AP list is empty.. ")); |
| 818 | return eHAL_STATUS_FAILURE; |
| 819 | } |
| 820 | else |
| 821 | { |
Madan Mohan Koyyalamudi | 286b60e | 2012-10-11 12:59:07 -0700 | [diff] [blame] | 822 | status = csrRoamEnqueuePreauth(pMac, pNeighborRoamInfo->csrSessionId, pNeighborBssNode->pBssDescription, |
| 823 | eCsrPerformPreauth, eANI_BOOLEAN_TRUE); |
Madan Mohan Koyyalamudi | 22f2708 | 2012-11-27 19:11:12 +0530 | [diff] [blame] | 824 | |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 825 | smsLog(pMac, LOG1, FL("Before Pre-Auth: BSSID %02x:%02x:%02x:%02x:%02x:%02x, Ch:%d"), |
Madan Mohan Koyyalamudi | 22f2708 | 2012-11-27 19:11:12 +0530 | [diff] [blame] | 826 | pNeighborBssNode->pBssDescription->bssId[0], |
| 827 | pNeighborBssNode->pBssDescription->bssId[1], |
| 828 | pNeighborBssNode->pBssDescription->bssId[2], |
| 829 | pNeighborBssNode->pBssDescription->bssId[3], |
| 830 | pNeighborBssNode->pBssDescription->bssId[4], |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 831 | pNeighborBssNode->pBssDescription->bssId[5], |
| 832 | (int)pNeighborBssNode->pBssDescription->channelId); |
Madan Mohan Koyyalamudi | 22f2708 | 2012-11-27 19:11:12 +0530 | [diff] [blame] | 833 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 834 | if (eHAL_STATUS_SUCCESS != status) |
| 835 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 836 | smsLog(pMac, LOGE, FL("Send Preauth request to PE failed with status %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 837 | return status; |
| 838 | } |
| 839 | } |
| 840 | |
| 841 | pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_TRUE; |
| 842 | |
| 843 | /* Increment the preauth retry count */ |
| 844 | pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries++; |
| 845 | |
| 846 | /* Transition the state to preauthenticating */ |
| 847 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 848 | |
| 849 | return status; |
| 850 | } |
| 851 | |
| 852 | /* --------------------------------------------------------------------------- |
| 853 | |
| 854 | \fn csrNeighborRoamPreauthRspHandler |
| 855 | |
| 856 | \brief This function handle the Preauth response from PE |
| 857 | Every preauth is allowed max 3 tries if it fails. If a bssid failed |
| 858 | for more than MAX_TRIES, we will remove it from the list and try |
| 859 | with the next node in the roamable AP list and add the BSSID to pre-auth failed |
| 860 | list. If no more entries present in |
| 861 | roamable AP list, transition to REPORT_SCAN state |
| 862 | |
| 863 | \param pMac - The handle returned by macOpen. |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 864 | limStatus - eSIR_SUCCESS/eSIR_FAILURE/eSIR_LIM_MAX_STA_REACHED_ERROR/ |
| 865 | eSIT_LIM_AUTH_RSP_TIMEOUT status from PE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 866 | |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 867 | \return eHAL_STATUS_SUCCESS on success (i.e. pre-auth processed), |
| 868 | eHAL_STATUS_FAILURE otherwise |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 869 | |
| 870 | ---------------------------------------------------------------------------*/ |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 871 | eHalStatus csrNeighborRoamPreauthRspHandler(tpAniSirGlobal pMac, tSirRetStatus limStatus) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 872 | { |
| 873 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 874 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 875 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 876 | eHalStatus preauthProcessed = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 877 | tpCsrNeighborRoamBSSInfo pPreauthRspNode = NULL; |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 878 | |
| 879 | if (eANI_BOOLEAN_FALSE == pNeighborRoamInfo->FTRoamInfo.preauthRspPending) |
| 880 | { |
| 881 | |
| 882 | /* This can happen when we disconnect immediately |
| 883 | * after sending a pre-auth request. During processing |
| 884 | * of the disconnect command, we would have reset |
| 885 | * preauthRspPending and transitioned to INIT state. |
| 886 | */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 887 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, |
| 888 | FL("Unexpected pre-auth response in state %d"), |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 889 | pNeighborRoamInfo->neighborRoamState); |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 890 | preauthProcessed = eHAL_STATUS_FAILURE; |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 891 | goto DEQ_PREAUTH; |
| 892 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 893 | |
| 894 | // We can receive it in these 2 states. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 895 | if ((pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING) && |
| 896 | (pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)) |
| 897 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 898 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Preauth response received in state %d"), |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 899 | pNeighborRoamInfo->neighborRoamState); |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 900 | preauthProcessed = eHAL_STATUS_FAILURE; |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 901 | goto DEQ_PREAUTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 902 | } |
| 903 | |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 904 | pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 905 | |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 906 | if (eSIR_SUCCESS == limStatus) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 907 | { |
| 908 | pPreauthRspNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL); |
| 909 | } |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 910 | if ((eSIR_SUCCESS == limStatus) && (NULL != pPreauthRspNode)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 911 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 912 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Preauth completed successfully after %d tries"), pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 913 | |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 914 | smsLog(pMac, LOG1, FL("After Pre-Auth: BSSID %02x:%02x:%02x:%02x:%02x:%02x, Ch:%d"), |
Madan Mohan Koyyalamudi | 22f2708 | 2012-11-27 19:11:12 +0530 | [diff] [blame] | 915 | pPreauthRspNode->pBssDescription->bssId[0], |
| 916 | pPreauthRspNode->pBssDescription->bssId[1], |
| 917 | pPreauthRspNode->pBssDescription->bssId[2], |
| 918 | pPreauthRspNode->pBssDescription->bssId[3], |
| 919 | pPreauthRspNode->pBssDescription->bssId[4], |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 920 | pPreauthRspNode->pBssDescription->bssId[5], |
| 921 | (int)pPreauthRspNode->pBssDescription->channelId); |
Madan Mohan Koyyalamudi | 22f2708 | 2012-11-27 19:11:12 +0530 | [diff] [blame] | 922 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 923 | /* Preauth competer successfully. Insert the preauthenticated node to tail of preAuthDoneList */ |
| 924 | csrNeighborRoamRemoveRoamableAPListEntry(pMac, &pNeighborRoamInfo->roamableAPList, pPreauthRspNode); |
| 925 | csrLLInsertTail(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, &pPreauthRspNode->List, LL_ACCESS_LOCK); |
| 926 | |
| 927 | /* Pre-auth completed successfully. Transition to PREAUTH Done state */ |
| 928 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE) |
| 929 | pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0; |
| 930 | |
| 931 | /* The caller of this function would start a timer and by the time it expires, supplicant should |
| 932 | have provided the updated FTIEs to SME. So, when it expires, handoff will be triggered then */ |
| 933 | } |
| 934 | else |
| 935 | { |
| 936 | tpCsrNeighborRoamBSSInfo pNeighborBssNode = NULL; |
| 937 | tListElem *pEntry; |
| 938 | |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 939 | smsLog(pMac, LOGE, FL("Preauth failed retry number %d, status = 0x%x"), |
| 940 | pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries, limStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 941 | |
| 942 | /* Preauth failed. Add the bssId to the preAuth failed list MAC Address. Also remove the AP from roamable AP list */ |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 943 | if ((pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries >= |
| 944 | CSR_NEIGHBOR_ROAM_MAX_NUM_PREAUTH_RETRIES) || |
| 945 | (eSIR_LIM_MAX_STA_REACHED_ERROR == limStatus)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 946 | { |
| 947 | /* We are going to remove the node as it fails for more than MAX tries. Reset this count to 0 */ |
| 948 | pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0; |
| 949 | |
| 950 | /* The one in the head of the list should be one with which we issued pre-auth and failed */ |
| 951 | pEntry = csrLLRemoveHead(&pNeighborRoamInfo->roamableAPList, LL_ACCESS_LOCK); |
| 952 | if(pEntry) |
| 953 | { |
| 954 | pNeighborBssNode = GET_BASE_ADDR(pEntry, tCsrNeighborRoamBSSInfo, List); |
| 955 | /* Add the BSSID to pre-auth fail list */ |
| 956 | status = csrNeighborRoamAddBssIdToPreauthFailList(pMac, pNeighborBssNode->pBssDescription->bssId); |
| 957 | /* Now we can free this node */ |
| 958 | csrNeighborRoamFreeNeighborRoamBSSNode(pMac, pNeighborBssNode); |
| 959 | } |
| 960 | } |
| 961 | |
| 962 | /* Issue preauth request for the same/next entry */ |
| 963 | if (eHAL_STATUS_SUCCESS == csrNeighborRoamIssuePreauthReq(pMac)) |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 964 | goto DEQ_PREAUTH; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 965 | |
Madan Mohan Koyyalamudi | 4450acc | 2012-11-15 17:24:31 -0800 | [diff] [blame] | 966 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN); |
| 967 | |
| 968 | /* Register Neighbor Lookup threshold callback with TL for UP event now */ |
| 969 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("No more pre-auth candidates-" |
| 970 | "register UP indication with TL. RSSI = %d,"), NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1)); |
| 971 | |
| 972 | vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, |
| 973 | (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1), |
| 974 | WLANTL_HO_THRESHOLD_UP, |
| 975 | csrNeighborRoamNeighborLookupUPCallback, |
| 976 | VOS_MODULE_ID_SME, pMac); |
| 977 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 978 | { |
| 979 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 980 | smsLog(pMac, LOGE, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback UP event with TL: Status = %d"), status); |
Madan Mohan Koyyalamudi | 4450acc | 2012-11-15 17:24:31 -0800 | [diff] [blame] | 981 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 982 | |
| 983 | /* Start the neighbor results refresh timer and transition to REPORT_SCAN state to perform scan again */ |
| 984 | status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer, |
| 985 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT, |
| 986 | eANI_BOOLEAN_FALSE); |
| 987 | if (eHAL_STATUS_SUCCESS != status) |
| 988 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 989 | smsLog(pMac, LOGE, FL("Neighbor results refresh timer start failed with status %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 990 | } |
| 991 | } |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 992 | |
| 993 | DEQ_PREAUTH: |
| 994 | csrRoamDequeuePreauth(pMac); |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 995 | return preauthProcessed; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 996 | } |
| 997 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
| 998 | |
| 999 | /* --------------------------------------------------------------------------- |
| 1000 | |
| 1001 | \fn csrNeighborRoamPrepareScanProfileFilter |
| 1002 | |
| 1003 | \brief This function creates a scan filter based on the currently connected profile. |
| 1004 | Based on this filter, scan results are obtained |
| 1005 | |
| 1006 | \param pMac - The handle returned by macOpen. |
| 1007 | pScanFilter - Populated scan filter based on the connected profile |
| 1008 | |
| 1009 | \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise |
| 1010 | |
| 1011 | ---------------------------------------------------------------------------*/ |
| 1012 | eHalStatus csrNeighborRoamPrepareScanProfileFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter) |
| 1013 | { |
| 1014 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1015 | tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId; |
| 1016 | tCsrRoamConnectedProfile *pCurProfile = &pMac->roam.roamSession[sessionId].connectedProfile; |
| 1017 | tANI_U8 i = 0; |
| 1018 | |
| 1019 | VOS_ASSERT(pScanFilter != NULL); |
| 1020 | |
| 1021 | vos_mem_zero(pScanFilter, sizeof(tCsrScanResultFilter)); |
| 1022 | |
| 1023 | /* We dont want to set BSSID based Filter */ |
| 1024 | pScanFilter->BSSIDs.numOfBSSIDs = 0; |
| 1025 | |
| 1026 | /* Populate all the information from the connected profile */ |
| 1027 | pScanFilter->SSIDs.numOfSSIDs = 1; |
| 1028 | pScanFilter->SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo)); |
| 1029 | if (NULL == pScanFilter->SSIDs.SSIDList) |
| 1030 | { |
| 1031 | smsLog(pMac, LOGE, FL("Scan Filter SSID mem alloc failed")); |
| 1032 | return eHAL_STATUS_FAILED_ALLOC; |
| 1033 | } |
| 1034 | pScanFilter->SSIDs.SSIDList->handoffPermitted = 1; |
| 1035 | pScanFilter->SSIDs.SSIDList->ssidHidden = 0; |
| 1036 | pScanFilter->SSIDs.SSIDList->SSID.length = pCurProfile->SSID.length; |
| 1037 | vos_mem_copy((void *)pScanFilter->SSIDs.SSIDList->SSID.ssId, (void *)pCurProfile->SSID.ssId, pCurProfile->SSID.length); |
| 1038 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1039 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Filtering for SSID %s from scan results.. SSID Length = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1040 | pScanFilter->SSIDs.SSIDList->SSID.ssId, pScanFilter->SSIDs.SSIDList->SSID.length); |
| 1041 | pScanFilter->authType.numEntries = 1; |
| 1042 | pScanFilter->authType.authType[0] = pCurProfile->AuthType; |
| 1043 | |
| 1044 | pScanFilter->EncryptionType.numEntries = 1; //This must be 1 |
| 1045 | pScanFilter->EncryptionType.encryptionType[0] = pCurProfile->EncryptionType; |
| 1046 | |
| 1047 | pScanFilter->mcEncryptionType.numEntries = 1; |
| 1048 | pScanFilter->mcEncryptionType.encryptionType[0] = pCurProfile->mcEncryptionType; |
| 1049 | |
| 1050 | pScanFilter->BSSType = pCurProfile->BSSType; |
| 1051 | |
| 1052 | /* We are intrested only in the scan results on channels that we scanned */ |
| 1053 | pScanFilter->ChannelInfo.numOfChannels = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels; |
| 1054 | pScanFilter->ChannelInfo.ChannelList = vos_mem_malloc(pScanFilter->ChannelInfo.numOfChannels * sizeof(tANI_U8)); |
| 1055 | if (NULL == pScanFilter->ChannelInfo.ChannelList) |
| 1056 | { |
| 1057 | smsLog(pMac, LOGE, FL("Scan Filter Channel list mem alloc failed")); |
| 1058 | vos_mem_free(pScanFilter->SSIDs.SSIDList); |
| 1059 | pScanFilter->SSIDs.SSIDList = NULL; |
| 1060 | return eHAL_STATUS_FAILED_ALLOC; |
| 1061 | } |
| 1062 | for (i = 0; i < pScanFilter->ChannelInfo.numOfChannels; i++) |
| 1063 | { |
| 1064 | pScanFilter->ChannelInfo.ChannelList[i] = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i]; |
| 1065 | } |
| 1066 | |
| 1067 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1068 | if (pNeighborRoamInfo->is11rAssoc) |
| 1069 | { |
| 1070 | /* MDIE should be added as a part of profile. This should be added as a part of filter as well */ |
| 1071 | pScanFilter->MDID.mdiePresent = pCurProfile->MDID.mdiePresent; |
| 1072 | pScanFilter->MDID.mobilityDomain = pCurProfile->MDID.mobilityDomain; |
| 1073 | } |
| 1074 | #endif |
| 1075 | |
| 1076 | return eHAL_STATUS_SUCCESS; |
| 1077 | } |
| 1078 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1079 | tANI_U32 csrGetCurrentAPRssi(tpAniSirGlobal pMac, tScanResultHandle *pScanResultList) |
| 1080 | { |
| 1081 | tCsrScanResultInfo *pScanResult; |
| 1082 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
Srinivas Girigowda | 2efea0e | 2013-01-24 17:40:41 -0800 | [diff] [blame] | 1083 | #ifdef FEATURE_WLAN_LFR |
| 1084 | tANI_U32 CurrAPRssi = pNeighborRoamInfo->lookupDOWNRssi; |
| 1085 | #else |
| 1086 | /* We are setting this as default value to make sure we return this value, |
| 1087 | when we do not see this AP in the scan result for some reason.However,it is |
| 1088 | less likely that we are associated to an AP and do not see it in the scan list */ |
| 1089 | tANI_U32 CurrAPRssi = -125; |
| 1090 | #endif |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1091 | |
| 1092 | while (NULL != (pScanResult = csrScanResultGetNext(pMac, *pScanResultList))) |
| 1093 | { |
| 1094 | |
| 1095 | if (VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId, |
| 1096 | pNeighborRoamInfo->currAPbssid, sizeof(tSirMacAddr))) |
| 1097 | { |
| 1098 | /* We got a match with the currently associated AP. |
| 1099 | * Capture the RSSI value and complete the while loop. |
| 1100 | * The while loop is completed in order to make the current entry go back to NULL, |
| 1101 | * and in the next while loop, it properly starts searching from the head of the list. |
| 1102 | * TODO: Can also try setting the current entry directly to NULL as soon as we find the new AP*/ |
| 1103 | |
| 1104 | CurrAPRssi = (int)pScanResult->BssDescriptor.rssi * (-1) ; |
| 1105 | |
| 1106 | } else { |
| 1107 | continue; |
| 1108 | } |
| 1109 | } |
| 1110 | |
| 1111 | return CurrAPRssi; |
| 1112 | |
| 1113 | } |
| 1114 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1115 | /* --------------------------------------------------------------------------- |
| 1116 | |
| 1117 | \fn csrNeighborRoamProcessScanResults |
| 1118 | |
| 1119 | \brief This function extracts scan results, sorts on the basis of neighbor score(todo). |
| 1120 | Assumed that the results are already sorted by RSSI by csrScanGetResult |
| 1121 | |
| 1122 | \param pMac - The handle returned by macOpen. |
| 1123 | pScanResultList - Scan result result obtained from csrScanGetResult() |
| 1124 | |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1125 | \return tANI_BOOLEAN - return TRUE if we have a candidate we can immediately |
| 1126 | roam to. Otherwise, return FALSE. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1127 | |
| 1128 | ---------------------------------------------------------------------------*/ |
| 1129 | |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1130 | static tANI_BOOLEAN csrNeighborRoamProcessScanResults(tpAniSirGlobal pMac, |
| 1131 | tScanResultHandle *pScanResultList) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1132 | { |
| 1133 | tCsrScanResultInfo *pScanResult; |
| 1134 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1135 | tpCsrNeighborRoamBSSInfo pBssInfo; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1136 | tANI_U32 CurrAPRssi; |
| 1137 | tANI_U8 RoamRssiDiff = pMac->roam.configParam.RoamRssiDiff; |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1138 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 1139 | tANI_U8 immediateRoamRssiDiff = pMac->roam.configParam.nImmediateRoamRssiDiff; |
| 1140 | #endif |
| 1141 | tANI_BOOLEAN roamNow = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1142 | |
| 1143 | /*************************************************************** |
| 1144 | * Find out the Current AP RSSI and keep it handy to check if |
| 1145 | * it is better than the RSSI of the AP which we are |
| 1146 | * going to roam.If so, we are going to continue with the |
| 1147 | * current AP. |
| 1148 | ***************************************************************/ |
| 1149 | CurrAPRssi = csrGetCurrentAPRssi(pMac, pScanResultList); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1150 | |
| 1151 | /* Expecting the scan result already to be in the sorted order based on the RSSI */ |
| 1152 | /* Based on the previous state we need to check whether the list should be sorted again taking neighbor score into consideration */ |
| 1153 | /* If previous state is CFG_CHAN_LIST_SCAN, there should not be any neighbor score associated with any of the BSS. |
| 1154 | If the previous state is REPORT_QUERY, then there will be neighbor score for each of the APs */ |
| 1155 | /* For now, let us take the top of the list provided as it is by the CSR Scan result API. This means it is assumed that neighbor score |
| 1156 | and rssi score are in the same order. This will be taken care later */ |
| 1157 | |
| 1158 | while (NULL != (pScanResult = csrScanResultGetNext(pMac, *pScanResultList))) |
| 1159 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 1160 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 1161 | FL("Scan result: BSSID %02x:%02x:%02x:%02x:%02x:%02x (Rssi %d, Ch:%d)"), |
Madan Mohan Koyyalamudi | 04039a1 | 2012-10-21 12:24:56 -0700 | [diff] [blame] | 1162 | pScanResult->BssDescriptor.bssId[0], |
| 1163 | pScanResult->BssDescriptor.bssId[1], |
| 1164 | pScanResult->BssDescriptor.bssId[2], |
| 1165 | pScanResult->BssDescriptor.bssId[3], |
| 1166 | pScanResult->BssDescriptor.bssId[4], |
| 1167 | pScanResult->BssDescriptor.bssId[5], |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 1168 | abs(pScanResult->BssDescriptor.rssi), |
| 1169 | pScanResult->BssDescriptor.channelId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1170 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1171 | if (VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1172 | pNeighborRoamInfo->currAPbssid, sizeof(tSirMacAddr))) |
| 1173 | { |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1174 | /* currently associated AP. Do not have this in the roamable AP list */ |
Madan Mohan Koyyalamudi | 4450acc | 2012-11-15 17:24:31 -0800 | [diff] [blame] | 1175 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1176 | "SKIP-currently associated AP"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1177 | continue; |
| 1178 | } |
| 1179 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1180 | /* This condition is to ensure to roam to an AP with better RSSI. if the value of RoamRssiDiff is Zero, this feature |
| 1181 | * is disabled and we continue to roam without any check*/ |
| 1182 | if(RoamRssiDiff > 0) |
| 1183 | { |
Madan Mohan Koyyalamudi | f553b74 | 2012-12-03 16:37:39 -0800 | [diff] [blame] | 1184 | /* |
| 1185 | * If RSSI is lower than the lookup threshold, then continue. |
| 1186 | */ |
| 1187 | if (abs(pScanResult->BssDescriptor.rssi) > |
| 1188 | pNeighborRoamInfo->currentNeighborLookupThreshold) |
| 1189 | { |
| 1190 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1191 | "%s: [INFOLOG] new ap rssi (%d) lower than lookup threshold (%d)", |
Madan Mohan Koyyalamudi | f553b74 | 2012-12-03 16:37:39 -0800 | [diff] [blame] | 1192 | __func__, (int)pScanResult->BssDescriptor.rssi * (-1), |
| 1193 | (int)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1)); |
| 1194 | continue; |
| 1195 | } |
| 1196 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1197 | if (abs(CurrAPRssi) < abs(pScanResult->BssDescriptor.rssi)) |
| 1198 | { |
| 1199 | /*Do not roam to an AP with worse RSSI than the current*/ |
| 1200 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1201 | "%s: [INFOLOG]Current AP rssi=%d new ap rssi worse=%d", __func__, |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1202 | CurrAPRssi, |
| 1203 | (int)pScanResult->BssDescriptor.rssi * (-1) ); |
| 1204 | continue; |
| 1205 | } else { |
| 1206 | /*Do not roam to an AP which is having better RSSI than the current AP, but still less than the |
| 1207 | * margin that is provided by user from the ini file (RoamRssiDiff)*/ |
| 1208 | if (abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)) < RoamRssiDiff) |
| 1209 | { |
Madan Mohan Koyyalamudi | 4450acc | 2012-11-15 17:24:31 -0800 | [diff] [blame] | 1210 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1211 | "%s: [INFOLOG]Current AP rssi=%d new ap rssi=%d not good enough, roamRssiDiff=%d", __func__, |
Madan Mohan Koyyalamudi | 4450acc | 2012-11-15 17:24:31 -0800 | [diff] [blame] | 1212 | CurrAPRssi, |
| 1213 | (int)pScanResult->BssDescriptor.rssi * (-1), |
| 1214 | RoamRssiDiff); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1215 | continue; |
| 1216 | } |
| 1217 | else { |
| 1218 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1219 | "%s: [INFOLOG]Current AP rssi=%d new ap rssi better=%d", __func__, |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1220 | CurrAPRssi, |
| 1221 | (int)pScanResult->BssDescriptor.rssi * (-1) ); |
| 1222 | } |
| 1223 | } |
| 1224 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1225 | |
| 1226 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1227 | if (pNeighborRoamInfo->is11rAssoc) |
| 1228 | { |
| 1229 | if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId)) |
| 1230 | { |
| 1231 | smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring")); |
| 1232 | continue; |
| 1233 | } |
| 1234 | } |
| 1235 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 1236 | |
| 1237 | #ifdef FEATURE_WLAN_CCX |
| 1238 | if (pNeighborRoamInfo->isCCXAssoc) |
| 1239 | { |
| 1240 | if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId)) |
| 1241 | { |
| 1242 | smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring")); |
| 1243 | continue; |
| 1244 | } |
| 1245 | } |
| 1246 | if ((pScanResult->BssDescriptor.QBSSLoad_present) && |
| 1247 | (pScanResult->BssDescriptor.QBSSLoad_avail)) |
| 1248 | { |
| 1249 | if (pNeighborRoamInfo->isVOAdmitted) |
| 1250 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1251 | smsLog(pMac, LOG1, FL("New AP has %x BW available"), (unsigned int)pScanResult->BssDescriptor.QBSSLoad_avail); |
| 1252 | smsLog(pMac, LOG1, FL("We need %x BW available"),(unsigned int)pNeighborRoamInfo->MinQBssLoadRequired); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1253 | if (pScanResult->BssDescriptor.QBSSLoad_avail < pNeighborRoamInfo->MinQBssLoadRequired) |
| 1254 | { |
| 1255 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1256 | "[INFOLOG]BSSID : %02x:%02x:%02x:%02x:%02x:%02x has no bandwidth ignoring..not adding to roam list", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1257 | pScanResult->BssDescriptor.bssId[0], |
| 1258 | pScanResult->BssDescriptor.bssId[1], |
| 1259 | pScanResult->BssDescriptor.bssId[2], |
| 1260 | pScanResult->BssDescriptor.bssId[3], |
| 1261 | pScanResult->BssDescriptor.bssId[4], |
| 1262 | pScanResult->BssDescriptor.bssId[5]); |
| 1263 | continue; |
| 1264 | } |
| 1265 | } |
| 1266 | } |
| 1267 | else |
| 1268 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1269 | smsLog(pMac, LOGE, FL("No QBss %x %x"), (unsigned int)pScanResult->BssDescriptor.QBSSLoad_avail, (unsigned int)pScanResult->BssDescriptor.QBSSLoad_present); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1270 | if (pNeighborRoamInfo->isVOAdmitted) |
| 1271 | { |
| 1272 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1273 | "[INFOLOG]BSSID : %02x:%02x:%02x:%02x:%02x:%02x has no QBSSLoad IE, ignoring..not adding to roam list", |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1274 | pScanResult->BssDescriptor.bssId[0], |
| 1275 | pScanResult->BssDescriptor.bssId[1], |
| 1276 | pScanResult->BssDescriptor.bssId[2], |
| 1277 | pScanResult->BssDescriptor.bssId[3], |
| 1278 | pScanResult->BssDescriptor.bssId[4], |
| 1279 | pScanResult->BssDescriptor.bssId[5]); |
| 1280 | continue; |
| 1281 | } |
| 1282 | } |
| 1283 | #endif /* FEATURE_WLAN_CCX */ |
| 1284 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1285 | #ifdef FEATURE_WLAN_LFR |
| 1286 | // If we are supporting legacy roaming, and |
| 1287 | // if the candidate is on the "pre-auth failed" list, ignore it. |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 1288 | if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1289 | { |
| 1290 | if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId)) |
| 1291 | { |
| 1292 | smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring")); |
| 1293 | continue; |
| 1294 | } |
| 1295 | } |
| 1296 | #endif /* FEATURE_WLAN_LFR */ |
| 1297 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1298 | /* If the received timestamp in BSS description is earlier than the scan request timestamp, skip |
| 1299 | * this result */ |
| 1300 | if (pNeighborRoamInfo->scanRequestTimeStamp >= pScanResult->BssDescriptor.nReceivedTime) |
| 1301 | { |
| 1302 | smsLog(pMac, LOGE, FL("Ignoring BSS as it is older than the scan request timestamp")); |
| 1303 | continue; |
| 1304 | } |
| 1305 | |
| 1306 | pBssInfo = vos_mem_malloc(sizeof(tCsrNeighborRoamBSSInfo)); |
| 1307 | if (NULL == pBssInfo) |
| 1308 | { |
| 1309 | smsLog(pMac, LOGE, FL("Memory allocation for Neighbor Roam BSS Info failed.. Just ignoring")); |
| 1310 | continue; |
| 1311 | } |
| 1312 | |
| 1313 | pBssInfo->pBssDescription = vos_mem_malloc(pScanResult->BssDescriptor.length + sizeof(pScanResult->BssDescriptor.length)); |
| 1314 | if (pBssInfo->pBssDescription != NULL) |
| 1315 | { |
| 1316 | vos_mem_copy(pBssInfo->pBssDescription, &pScanResult->BssDescriptor, |
| 1317 | pScanResult->BssDescriptor.length + sizeof(pScanResult->BssDescriptor.length)); |
| 1318 | } |
| 1319 | else |
| 1320 | { |
| 1321 | smsLog(pMac, LOGE, FL("Memory allocation for Neighbor Roam BSS Descriptor failed.. Just ignoring")); |
| 1322 | vos_mem_free(pBssInfo); |
| 1323 | continue; |
| 1324 | |
| 1325 | } |
| 1326 | pBssInfo->apPreferenceVal = 10; //some value for now. Need to calculate the actual score based on RSSI and neighbor AP score |
| 1327 | |
| 1328 | /* Just add to the end of the list as it is already sorted by RSSI */ |
| 1329 | csrLLInsertTail(&pNeighborRoamInfo->roamableAPList, &pBssInfo->List, LL_ACCESS_LOCK); |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1330 | |
| 1331 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1332 | if (abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)) >= immediateRoamRssiDiff) |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1333 | { |
| 1334 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 1335 | "%s: [INFOLOG] potential candidate to roam immediately (diff=%d, expected=%d)", |
| 1336 | __func__, abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)), |
| 1337 | immediateRoamRssiDiff); |
| 1338 | roamNow = eANI_BOOLEAN_TRUE; |
| 1339 | } |
| 1340 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1341 | } |
| 1342 | |
| 1343 | /* Now we have all the scan results in our local list. Good time to free up the the list we got as a part of csrGetScanResult */ |
| 1344 | csrScanResultPurge(pMac, *pScanResultList); |
| 1345 | |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1346 | return roamNow; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1347 | } |
| 1348 | |
| 1349 | /* --------------------------------------------------------------------------- |
| 1350 | |
| 1351 | \fn csrNeighborRoamHandleEmptyScanResult |
| 1352 | |
| 1353 | \brief This function will be invoked in CFG_CHAN_LIST_SCAN state when |
| 1354 | there are no valid APs in the scan result for roaming. This means |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1355 | our AP is the best and no other AP is around. No point in scanning |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1356 | again and again. Performing the following here. |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1357 | 1. Stop the neighbor scan timer. |
| 1358 | 2a. If this is the first time we encountered empty scan, then |
| 1359 | re-register with TL with modified lookup threshold. |
| 1360 | 2b. Else if this is the second time we encountered empty scan, |
| 1361 | then start neighbor scan results refresh timer (20s). |
| 1362 | 2c. Else, nothing more to do. |
| 1363 | NOTE: In LFR, channels selected for scanning is dervied from |
| 1364 | the occuped channel list. Scan cycle following one which |
| 1365 | yielded empty results is split into two halves: (i) scan on |
| 1366 | channels in the occupied list, and (ii) scan on channels not |
| 1367 | in the occupied list. This helps converging faster (while |
| 1368 | looking for candidates in the occupied list first), and also, |
| 1369 | adds channels to the occupied channel list upon finding candidates |
| 1370 | matching SSID profile of interest. |
| 1371 | |
| 1372 | uEmptyScanCount Comments |
| 1373 | eFirstEmptyScan Previous scan was done on channels in the |
| 1374 | occupied list and yielded potential candidates. |
| 1375 | This scan cycle was likely triggered through |
| 1376 | receipt of lookup DOWN notification event. |
| 1377 | eSecondEmptyScan Previous scan was done on channels in the |
| 1378 | occupied list and yielded no candidates. This scan |
| 1379 | cycle was triggered through RSSI notification |
| 1380 | with modified lookup threshold. |
| 1381 | eThirdEmptyScan Previous scan was done on channels NOT in |
| 1382 | the occupied list and yielded no candidates. This |
| 1383 | scan cycle was triggered immediately after scanning |
| 1384 | channels in the occupied list and no candidates |
| 1385 | were found. |
| 1386 | eFourthEmptyScan Previous scan was done on channels in the |
| 1387 | occupied list and yielded no candidates. This scan |
| 1388 | cycle was triggered upon expiry of |
| 1389 | neighborScanResultsRefreshPeriod (=20s). |
| 1390 | eFifthEmptyScan Previous scan was done on channels NOT in |
| 1391 | the occupied list and yielded no candidates. This |
| 1392 | scan cycle was triggered immediately after scanning |
| 1393 | channels in the occupied list and no candidates |
| 1394 | were found. |
| 1395 | |
| 1396 | [1], [2,3] and [4,5] together form one discrete set of scan cycle. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1397 | |
| 1398 | \param pMac - The handle returned by macOpen. |
| 1399 | |
| 1400 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 1401 | |
| 1402 | ---------------------------------------------------------------------------*/ |
| 1403 | static VOS_STATUS csrNeighborRoamHandleEmptyScanResult(tpAniSirGlobal pMac) |
| 1404 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1405 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1406 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1407 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1408 | #ifdef FEATURE_WLAN_LFR |
| 1409 | tANI_BOOLEAN performPeriodicScan = |
| 1410 | (pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod) ? TRUE : FALSE; |
| 1411 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1412 | |
Madan Mohan Koyyalamudi | 04039a1 | 2012-10-21 12:24:56 -0700 | [diff] [blame] | 1413 | /* Stop neighbor scan timer */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1414 | status = palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
Madan Mohan Koyyalamudi | 04039a1 | 2012-10-21 12:24:56 -0700 | [diff] [blame] | 1415 | if (eHAL_STATUS_SUCCESS != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1416 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1417 | smsLog(pMac, LOGW, FL("stopping neighborScanTimer failed with status %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1418 | } |
| 1419 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1420 | /* |
| 1421 | * Increase the neighbor lookup threshold by 3 dB |
| 1422 | * after every scan cycle. NOTE: uEmptyScanCount |
| 1423 | * would be either 1, 3 or 5 at the end of every |
| 1424 | * scan cycle. |
| 1425 | */ |
| 1426 | #ifdef FEATURE_WLAN_LFR |
| 1427 | if ((++pNeighborRoamInfo->uEmptyScanCount) > eFifthEmptyScan) |
| 1428 | { |
| 1429 | pNeighborRoamInfo->uEmptyScanCount = eFifthEmptyScan; |
| 1430 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1431 | if ((abs(pNeighborRoamInfo->lookupDOWNRssi) > |
| 1432 | abs(pNeighborRoamInfo->cfgParams.neighborReassocThreshold)) && |
| 1433 | ((pNeighborRoamInfo->uEmptyScanCount == eSecondEmptyScan) || |
| 1434 | (pNeighborRoamInfo->uEmptyScanCount == eFourthEmptyScan))) |
| 1435 | { |
| 1436 | /* |
| 1437 | * If the scan was triggered due to lookupDOWNRssi > reassoc threshold, |
| 1438 | * then it would be a contiguous scan on all valid non-DFS channels. |
| 1439 | * In this mode, there is no need to trigger an immediate scan upon |
| 1440 | * empty scan results for the second and fourth time (which would |
| 1441 | * be equivalent to scanning on channels in non-occupied list). |
| 1442 | * Incrementing uEmptyScanCount will correspond to skipping this step. |
| 1443 | * NOTE: double increment of uEmptyScanCount corresponds to completion |
| 1444 | * of scans on all valid channels. |
| 1445 | */ |
| 1446 | ++pNeighborRoamInfo->uEmptyScanCount; |
| 1447 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Extra increment of empty scan count (=%d)" |
| 1448 | " in contiguous scan mode", pNeighborRoamInfo->uEmptyScanCount); |
| 1449 | } |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1450 | #endif |
| 1451 | if (((pNeighborRoamInfo->currentNeighborLookupThreshold+3) < |
| 1452 | pNeighborRoamInfo->cfgParams.neighborReassocThreshold) |
| 1453 | #ifdef FEATURE_WLAN_LFR |
| 1454 | && ((pNeighborRoamInfo->uEmptyScanCount % 2) == 1) |
| 1455 | #endif |
| 1456 | ) |
| 1457 | { |
| 1458 | pNeighborRoamInfo->currentNeighborLookupThreshold += 3; |
| 1459 | } |
| 1460 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1461 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1462 | /* Clear off the old neighbor report details */ |
| 1463 | vos_mem_zero(&pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT); |
| 1464 | #endif |
| 1465 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1466 | /* Transition to CONNECTED state */ |
| 1467 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED); |
| 1468 | |
| 1469 | /* Reset all the necessary variables before transitioning to the CONNECTED state */ |
| 1470 | csrNeighborRoamResetConnectedStateControlInfo(pMac); |
| 1471 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1472 | #ifdef FEATURE_WLAN_LFR |
| 1473 | if (pNeighborRoamInfo->uEmptyScanCount == eFirstEmptyScan) |
| 1474 | { |
| 1475 | #endif |
| 1476 | /* Empty scan results for the first time */ |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1477 | /* Re-register neighbor lookup DOWN threshold callback with TL */ |
| 1478 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, |
| 1479 | FL("Registering DOWN event neighbor lookup callback with TL for RSSI = %d"), |
| 1480 | pNeighborRoamInfo->currentNeighborLookupThreshold * (-1)); |
| 1481 | |
| 1482 | vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, |
| 1483 | (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1), |
| 1484 | WLANTL_HO_THRESHOLD_DOWN, |
| 1485 | csrNeighborRoamNeighborLookupDOWNCallback, |
| 1486 | VOS_MODULE_ID_SME, pMac); |
| 1487 | |
| 1488 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1489 | { |
| 1490 | smsLog(pMac, LOGW, |
| 1491 | FL("Couldn't re-register csrNeighborRoamNeighborLookupDOWNCallback" |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1492 | " with TL: Status = %d"), status); |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1493 | } |
| 1494 | #ifdef FEATURE_WLAN_LFR |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1495 | pNeighborRoamInfo->lookupDOWNRssi = 0; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1496 | } |
| 1497 | else if ((pNeighborRoamInfo->uEmptyScanCount == eSecondEmptyScan) || |
| 1498 | (pNeighborRoamInfo->uEmptyScanCount == eFourthEmptyScan)) |
| 1499 | { |
| 1500 | /* Empty scan results for the second or fourth time */ |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1501 | |
| 1502 | /* Immediately scan on channels in non-occupied list */ |
| 1503 | csrNeighborRoamTransitToCFGChanScan(pMac); |
| 1504 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1505 | else if (pNeighborRoamInfo->uEmptyScanCount >= eThirdEmptyScan) |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1506 | { |
| 1507 | /* Empty scan results for the third time */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1508 | if (performPeriodicScan) |
| 1509 | { |
| 1510 | smsLog(pMac, LOGE, FL("Performing periodic scan, uEmptyScanCount=%d"), |
| 1511 | pNeighborRoamInfo->uEmptyScanCount); |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1512 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1513 | /* |
| 1514 | * Set uEmptyScanCount to MAX so that we always enter this |
| 1515 | * condition on subsequent empty scan results |
| 1516 | */ |
| 1517 | pNeighborRoamInfo->uEmptyScanCount = eMaxEmptyScan; |
| 1518 | |
| 1519 | /* From here on, ONLY scan on channels in the occupied list */ |
| 1520 | pNeighborRoamInfo->uScanMode = SPLIT_SCAN_OCCUPIED_LIST; |
| 1521 | |
| 1522 | /* Start empty scan refresh timer */ |
| 1523 | if (eHAL_STATUS_SUCCESS != |
| 1524 | palTimerStart(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer, |
| 1525 | pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod * PAL_TIMER_TO_MS_UNIT, |
| 1526 | eANI_BOOLEAN_FALSE)) |
| 1527 | { |
| 1528 | smsLog(pMac, LOGE, FL("Empty scan refresh timer failed to start (%d)"), |
| 1529 | status); |
| 1530 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 1531 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
| 1532 | vosStatus = VOS_STATUS_E_FAILURE; |
| 1533 | } |
| 1534 | else |
| 1535 | { |
| 1536 | smsLog(pMac, LOGE, FL("Empty scan refresh timer started (%ld ms)"), |
| 1537 | (pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod)); |
| 1538 | } |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1539 | } |
| 1540 | else |
| 1541 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1542 | /* Start neighbor scan results refresh timer */ |
| 1543 | if (eHAL_STATUS_SUCCESS != |
| 1544 | palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer, |
| 1545 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT, |
| 1546 | eANI_BOOLEAN_FALSE)) |
| 1547 | { |
| 1548 | smsLog(pMac, LOGE, FL("Neighbor results refresh timer failed to start (%d)"), |
| 1549 | status); |
| 1550 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 1551 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
| 1552 | vosStatus = VOS_STATUS_E_FAILURE; |
| 1553 | } |
| 1554 | else |
| 1555 | { |
| 1556 | smsLog(pMac, LOG2, FL("Neighbor results refresh timer started (%ld ms)"), |
| 1557 | (pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT)); |
| 1558 | } |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1559 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1560 | } |
Madan Mohan Koyyalamudi | 04039a1 | 2012-10-21 12:24:56 -0700 | [diff] [blame] | 1561 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1562 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Neighbor roam empty scan count=%d scan mode=%d", |
| 1563 | pNeighborRoamInfo->uEmptyScanCount, pNeighborRoamInfo->uScanMode); |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1564 | #endif |
| 1565 | return vosStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1566 | } |
| 1567 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1568 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1569 | static eHalStatus csrNeighborRoamProcessScanComplete (tpAniSirGlobal pMac) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1570 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1571 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1572 | tCsrScanResultFilter scanFilter; |
| 1573 | tScanResultHandle scanResult; |
| 1574 | tANI_U32 tempVal = 0; |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1575 | tANI_BOOLEAN roamNow = eANI_BOOLEAN_FALSE; |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1576 | eHalStatus hstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1577 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1578 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1579 | /* If the state is REPORT_SCAN, then this must be the scan after the REPORT_QUERY state. So, we |
| 1580 | should use the BSSID filter made out of neighbor reports */ |
| 1581 | if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState) |
| 1582 | { |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1583 | hstatus = csrNeighborRoamBssIdScanFilter(pMac, &scanFilter); |
| 1584 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("11R or CCX Association: Prepare scan filter status with neighbor AP = %d"), hstatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1585 | tempVal = 1; |
| 1586 | } |
| 1587 | else |
| 1588 | #endif |
| 1589 | { |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1590 | hstatus = csrNeighborRoamPrepareScanProfileFilter(pMac, &scanFilter); |
| 1591 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("11R/CCX/Other Association: Prepare scan to find neighbor AP filter status = %d"), hstatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1592 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1593 | if (eHAL_STATUS_SUCCESS != hstatus) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1594 | { |
| 1595 | smsLog(pMac, LOGE, FL("Scan Filter preparation failed for Assoc type %d.. Bailing out.."), tempVal); |
| 1596 | return eHAL_STATUS_FAILURE; |
| 1597 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1598 | hstatus = csrScanGetResult(pMac, &scanFilter, &scanResult); |
Madan Mohan Koyyalamudi | 22f2708 | 2012-11-27 19:11:12 +0530 | [diff] [blame] | 1599 | if (hstatus != eHAL_STATUS_SUCCESS) |
| 1600 | { |
| 1601 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Get Scan Result status code %d"), hstatus); |
| 1602 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1603 | /* Process the scan results and update roamable AP list */ |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1604 | roamNow = csrNeighborRoamProcessScanResults(pMac, &scanResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1605 | |
| 1606 | /* Free the scan filter */ |
| 1607 | csrFreeScanFilter(pMac, &scanFilter); |
| 1608 | |
| 1609 | tempVal = csrLLCount(&pNeighborRoamInfo->roamableAPList); |
| 1610 | |
| 1611 | switch(pNeighborRoamInfo->neighborRoamState) |
| 1612 | { |
| 1613 | case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN: |
| 1614 | if (tempVal) |
| 1615 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1616 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 04039a1 | 2012-10-21 12:24:56 -0700 | [diff] [blame] | 1617 | /* |
| 1618 | * Since there are non-zero candidates found |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1619 | * after the scan, reset empty scan count. |
Madan Mohan Koyyalamudi | 04039a1 | 2012-10-21 12:24:56 -0700 | [diff] [blame] | 1620 | */ |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1621 | pNeighborRoamInfo->uEmptyScanCount = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1622 | pNeighborRoamInfo->uScanMode = DEFAULT_SCAN; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1623 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1624 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1625 | /* If this is a non-11r association, then we can register the reassoc callback here as we have some |
| 1626 | APs in the roamable AP list */ |
| 1627 | if (pNeighborRoamInfo->is11rAssoc) |
| 1628 | { |
| 1629 | /* Valid APs are found after scan. Now we can initiate pre-authentication */ |
| 1630 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN) |
| 1631 | } |
| 1632 | else |
| 1633 | #endif |
| 1634 | #ifdef FEATURE_WLAN_CCX |
| 1635 | /* If this is a non-11r association, then we can register the reassoc callback here as we have some |
| 1636 | APs in the roamable AP list */ |
| 1637 | if (pNeighborRoamInfo->isCCXAssoc) |
| 1638 | { |
| 1639 | /* Valid APs are found after scan. Now we can initiate pre-authentication */ |
| 1640 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN) |
| 1641 | } |
| 1642 | else |
| 1643 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1644 | #ifdef FEATURE_WLAN_LFR |
| 1645 | /* If LFR is enabled, then we can register the reassoc callback here as we have some |
| 1646 | APs in the roamable AP list */ |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 1647 | if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1648 | { |
| 1649 | /* Valid APs are found after scan. Now we can initiate pre-authentication */ |
| 1650 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN) |
| 1651 | } |
| 1652 | else |
| 1653 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1654 | { |
| 1655 | |
| 1656 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Completed scanning of CFG CHAN LIST in non-11r association. Registering reassoc callback")); |
| 1657 | /* Nothing much to do now. Will continue to remain in this state in case of non-11r association */ |
| 1658 | /* Stop the timer. But how long the roamable AP list will be valid in here. At some point of time, we |
| 1659 | need to restart the CFG CHAN list scan procedure if reassoc callback is not invoked from TL |
| 1660 | within certain duration */ |
| 1661 | |
| 1662 | // palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 1663 | } |
| 1664 | } |
| 1665 | else |
| 1666 | { |
Madan Mohan Koyyalamudi | b40e558 | 2012-10-11 16:48:42 -0700 | [diff] [blame] | 1667 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("No candidate found after scanning in state %d.. "), pNeighborRoamInfo->neighborRoamState); |
| 1668 | /* Handle it appropriately */ |
| 1669 | csrNeighborRoamHandleEmptyScanResult(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1670 | } |
| 1671 | break; |
| 1672 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1673 | case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN: |
| 1674 | if (!tempVal) |
| 1675 | { |
| 1676 | smsLog(pMac, LOGE, FL("No candidate found after scanning in state %d.. "), pNeighborRoamInfo->neighborRoamState); |
| 1677 | /* Stop the timer here as the same timer will be started again in CFG_CHAN_SCAN_STATE */ |
| 1678 | csrNeighborRoamTransitToCFGChanScan(pMac); |
| 1679 | } |
| 1680 | break; |
| 1681 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 1682 | default: |
| 1683 | // Can come only in INIT state. Where in we are associated, we sent scan and user |
| 1684 | // in the meantime decides to disassoc, we will be in init state and still received call |
| 1685 | // back issued. Should not come here in any other state, printing just in case |
| 1686 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1687 | "%s: [INFOLOG] State %d", __func__, (pNeighborRoamInfo->neighborRoamState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1688 | |
| 1689 | // Lets just exit out silently. |
| 1690 | return eHAL_STATUS_SUCCESS; |
| 1691 | } |
| 1692 | |
| 1693 | if (tempVal) |
| 1694 | { |
| 1695 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 1696 | |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1697 | if (roamNow) |
| 1698 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1699 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1700 | FL("Immediate roam-deregister UP indication. RSSI = %d"), |
| 1701 | NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1)); |
| 1702 | |
| 1703 | vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, |
| 1704 | (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1), |
| 1705 | WLANTL_HO_THRESHOLD_UP, |
| 1706 | csrNeighborRoamNeighborLookupUPCallback, |
| 1707 | VOS_MODULE_ID_SME); |
| 1708 | |
| 1709 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1710 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1711 | smsLog(pMac, LOGW, |
| 1712 | FL("Couldn't deregister lookup UP callback with TL: Status = %d"), vosStatus); |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1713 | } |
| 1714 | |
| 1715 | csrNeighborRoamTriggerHandoff(pMac, pNeighborRoamInfo); |
| 1716 | return eHAL_STATUS_SUCCESS; |
| 1717 | } |
| 1718 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1719 | hstatus = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer, |
| 1720 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT, |
| 1721 | eANI_BOOLEAN_FALSE); |
| 1722 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1723 | /* This timer should be started before registering the Reassoc callback with TL. This is because, it is very likely |
| 1724 | * that the callback getting called immediately and the timer would never be stopped when pre-auth is in progress */ |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1725 | if (eHAL_STATUS_SUCCESS != hstatus) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1726 | { |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1727 | smsLog(pMac, LOGE, FL("Neighbor results refresh timer failed to start, status = %d"), hstatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1728 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 1729 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1730 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1731 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1732 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1733 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event Reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1)); |
| 1734 | /* Register a reassoc Indication callback */ |
| 1735 | vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1), |
| 1736 | WLANTL_HO_THRESHOLD_DOWN, |
| 1737 | csrNeighborRoamReassocIndCallback, |
| 1738 | VOS_MODULE_ID_SME, pMac); |
| 1739 | |
| 1740 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1741 | { |
| 1742 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1743 | smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamReassocIndCallback with TL: Status = %d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1744 | } |
| 1745 | |
| 1746 | } |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1747 | |
| 1748 | return eHAL_STATUS_SUCCESS; |
| 1749 | |
| 1750 | } |
| 1751 | |
| 1752 | |
| 1753 | /* --------------------------------------------------------------------------- |
| 1754 | |
| 1755 | \fn csrNeighborRoamScanRequestCallback |
| 1756 | |
| 1757 | \brief This function is the callback function registered in csrScanRequest() to |
| 1758 | indicate the completion of scan. If scan is completed for all the channels in |
| 1759 | the channel list, this function gets the scan result and starts the refresh results |
| 1760 | timer to avoid having stale results. If scan is not completed on all the channels, |
| 1761 | it restarts the neighbor scan timer which on expiry issues scan on the next |
| 1762 | channel |
| 1763 | |
| 1764 | \param halHandle - The handle returned by macOpen. |
| 1765 | pContext - not used |
| 1766 | scanId - not used |
| 1767 | status - not used |
| 1768 | |
| 1769 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 1770 | |
| 1771 | ---------------------------------------------------------------------------*/ |
| 1772 | static eHalStatus csrNeighborRoamScanRequestCallback(tHalHandle halHandle, void *pContext, |
| 1773 | tANI_U32 scanId, eCsrScanStatus status) |
| 1774 | { |
| 1775 | tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle; |
| 1776 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1777 | tANI_U8 currentChanIndex; |
| 1778 | eHalStatus hstatus; |
| 1779 | |
| 1780 | pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE; |
| 1781 | |
| 1782 | /* This can happen when we receive a UP event from TL in any of the scan states. Silently ignore it */ |
| 1783 | if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState) |
| 1784 | { |
| 1785 | smsLog(pMac, LOGE, FL("Received in CONNECTED state. Must be because a UP event from TL after issuing scan request. Ignore it")); |
| 1786 | return eHAL_STATUS_SUCCESS; |
| 1787 | } |
| 1788 | |
| 1789 | /* -1 is done because the chanIndex would have got incremented after issuing a successful scan request */ |
| 1790 | currentChanIndex = (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex) ? (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex - 1) : 0; |
| 1791 | |
| 1792 | /* Validate inputs */ |
| 1793 | if (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList) { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1794 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("csrNeighborRoamScanRequestCallback received for Channel = %d, ChanIndex = %d"), |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1795 | pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList[currentChanIndex], currentChanIndex); |
| 1796 | } |
| 1797 | else |
| 1798 | { |
| 1799 | smsLog(pMac, LOG1, FL("Received during clean-up. Silently ignore scan completion event.")); |
| 1800 | return eHAL_STATUS_SUCCESS; |
| 1801 | } |
| 1802 | |
| 1803 | if (eANI_BOOLEAN_FALSE == pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress) |
| 1804 | { |
| 1805 | /* Scan is completed in the CFG_CHAN_SCAN state. We can transition to REPORT_SCAN state |
| 1806 | just to get the results and perform PREAUTH */ |
| 1807 | /* Now we have completed scanning the channel list. We have get the result by applying appropriate filter |
| 1808 | sort the results based on neighborScore and RSSI and select the best candidate out of the list */ |
| 1809 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Channel list scan completed. Current chan index = %d"), currentChanIndex); |
| 1810 | VOS_ASSERT(pNeighborRoamInfo->roamChannelInfo.currentChanIndex == 0); |
| 1811 | |
| 1812 | hstatus = csrNeighborRoamProcessScanComplete(pMac); |
| 1813 | |
| 1814 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 1815 | { |
| 1816 | smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus); |
| 1817 | return eHAL_STATUS_FAILURE; |
| 1818 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1819 | } |
| 1820 | else |
| 1821 | { |
| 1822 | |
| 1823 | /* Restart the timer for the next scan sequence as scanning is not over */ |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1824 | hstatus = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1825 | pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT, |
| 1826 | eANI_BOOLEAN_FALSE); |
| 1827 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1828 | if (eHAL_STATUS_SUCCESS != hstatus) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1829 | { |
| 1830 | /* Timer start failed.. Should we ASSERT here??? */ |
| 1831 | smsLog(pMac, LOGE, FL("Neighbor scan PAL Timer start failed, status = %d, Ignoring state transition"), status); |
| 1832 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 1833 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1834 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1835 | } |
| 1836 | } |
| 1837 | return eHAL_STATUS_SUCCESS; |
| 1838 | } |
| 1839 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1840 | #ifdef FEATURE_WLAN_LFR |
| 1841 | static eHalStatus csrNeighborRoamContiguousScanRequestCallback(tHalHandle halHandle, |
| 1842 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 1843 | { |
| 1844 | tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle; |
| 1845 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1846 | eHalStatus hstatus = eHAL_STATUS_SUCCESS; |
| 1847 | |
| 1848 | pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE; |
| 1849 | |
| 1850 | /* This can happen when we receive a UP event from TL in any of the scan states. Silently ignore it */ |
| 1851 | if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState) |
| 1852 | { |
| 1853 | smsLog(pMac, LOGE, FL("Received in CONNECTED state. Must be because a UP event from TL after issuing scan request. Ignore it")); |
| 1854 | return eHAL_STATUS_SUCCESS; |
| 1855 | } |
| 1856 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1857 | if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState) |
| 1858 | { |
| 1859 | smsLog(pMac, LOGE, FL("Received in INIT state. Must have disconnected. Ignore it")); |
| 1860 | return eHAL_STATUS_SUCCESS; |
| 1861 | } |
| 1862 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1863 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "%s: process scan results", __func__); |
| 1864 | hstatus = csrNeighborRoamProcessScanComplete(pMac); |
| 1865 | |
| 1866 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 1867 | { |
| 1868 | smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus); |
| 1869 | } |
| 1870 | |
| 1871 | return hstatus; |
| 1872 | } |
| 1873 | #endif |
| 1874 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1875 | /* --------------------------------------------------------------------------- |
| 1876 | |
| 1877 | \fn csrNeighborRoamIssueBgScanRequest |
| 1878 | |
| 1879 | \brief This function issues CSR scan request after populating all the BG scan params |
| 1880 | passed |
| 1881 | |
| 1882 | \param pMac - The handle returned by macOpen. |
| 1883 | pBgScanParams - Params that need to be populated into csr Scan request |
| 1884 | |
| 1885 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 1886 | |
| 1887 | ---------------------------------------------------------------------------*/ |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1888 | eHalStatus csrNeighborRoamIssueBgScanRequest(tpAniSirGlobal pMac, |
| 1889 | tCsrBGScanRequest *pBgScanParams, |
| 1890 | csrScanCompleteCallback callbackfn) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1891 | { |
| 1892 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1893 | tANI_U32 scanId; |
| 1894 | tCsrScanRequest scanReq; |
| 1895 | tANI_U8 channel; |
| 1896 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1897 | if (1 == pBgScanParams->ChannelInfo.numOfChannels) |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1898 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Channel = %d, ChanIndex = %d"), |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1899 | pBgScanParams->ChannelInfo.ChannelList[0], |
| 1900 | pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1901 | |
| 1902 | //send down the scan req for 1 channel on the associated SSID |
| 1903 | palZeroMemory(pMac->hHdd, &scanReq, sizeof(tCsrScanRequest)); |
| 1904 | /* Fill in the SSID Info */ |
| 1905 | scanReq.SSIDs.numOfSSIDs = 1; |
| 1906 | scanReq.SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo) * scanReq.SSIDs.numOfSSIDs); |
| 1907 | if(NULL == scanReq.SSIDs.SSIDList) |
| 1908 | { |
| 1909 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1910 | smsLog(pMac, LOGE, FL("Couldn't allocate memory for the SSID..Freeing memory allocated for Channel List")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1911 | return eHAL_STATUS_FAILURE; |
| 1912 | } |
| 1913 | vos_mem_zero(scanReq.SSIDs.SSIDList, sizeof(tCsrSSIDInfo) * scanReq.SSIDs.numOfSSIDs); |
| 1914 | |
| 1915 | scanReq.SSIDs.SSIDList[0].handoffPermitted = eANI_BOOLEAN_TRUE; |
| 1916 | scanReq.SSIDs.SSIDList[0].ssidHidden = eANI_BOOLEAN_TRUE; |
| 1917 | vos_mem_copy((void *)&scanReq.SSIDs.SSIDList[0].SSID, (void *)&pBgScanParams->SSID, sizeof(pBgScanParams->SSID)); |
| 1918 | |
| 1919 | scanReq.ChannelInfo.numOfChannels = pBgScanParams->ChannelInfo.numOfChannels; |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1920 | if (1 == pBgScanParams->ChannelInfo.numOfChannels) |
| 1921 | { |
| 1922 | channel = pBgScanParams->ChannelInfo.ChannelList[0]; |
| 1923 | scanReq.ChannelInfo.ChannelList = &channel; |
| 1924 | } |
| 1925 | else |
| 1926 | { |
| 1927 | scanReq.ChannelInfo.ChannelList = pBgScanParams->ChannelInfo.ChannelList; |
| 1928 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1929 | |
| 1930 | scanReq.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
| 1931 | scanReq.scanType = eSIR_ACTIVE_SCAN; |
| 1932 | scanReq.requestType = eCSR_SCAN_HO_BG_SCAN; |
| 1933 | scanReq.maxChnTime = pBgScanParams->maxChnTime; |
| 1934 | scanReq.minChnTime = pBgScanParams->minChnTime; |
| 1935 | status = csrScanRequest(pMac, CSR_SESSION_ID_INVALID, &scanReq, |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1936 | &scanId, callbackfn, NULL); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1937 | if (eHAL_STATUS_SUCCESS != status) |
| 1938 | { |
| 1939 | smsLog(pMac, LOGE, FL("CSR Scan Request failed with status %d"), status); |
| 1940 | vos_mem_free(scanReq.SSIDs.SSIDList); |
| 1941 | return status; |
| 1942 | } |
| 1943 | pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_TRUE; |
| 1944 | |
| 1945 | vos_mem_free(scanReq.SSIDs.SSIDList); |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1946 | if (1 == pBgScanParams->ChannelInfo.numOfChannels) |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 1947 | NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Channel List Address = %08x, Actual index = %d"), |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1948 | &pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList[0], |
| 1949 | pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex); |
| 1950 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1951 | return status; |
| 1952 | } |
| 1953 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1954 | static void csrNeighborRoamFillNonChannelBgScanParams (tpAniSirGlobal pMac, |
| 1955 | tpCsrBGScanRequest bgScanParams) |
| 1956 | { |
| 1957 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1958 | tANI_U8 broadcastBssid[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
| 1959 | |
| 1960 | vos_mem_copy(bgScanParams->bssid, broadcastBssid, sizeof(tCsrBssid)); |
| 1961 | bgScanParams->SSID.length = pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length; |
| 1962 | vos_mem_copy(bgScanParams->SSID.ssId, |
| 1963 | pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.ssId, |
| 1964 | pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length); |
| 1965 | |
| 1966 | bgScanParams->minChnTime = pNeighborRoamInfo->cfgParams.minChannelScanTime; |
| 1967 | bgScanParams->maxChnTime = pNeighborRoamInfo->cfgParams.maxChannelScanTime; |
| 1968 | } |
| 1969 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1970 | /* --------------------------------------------------------------------------- |
| 1971 | |
| 1972 | \fn csrNeighborRoamPerformBgScan |
| 1973 | |
| 1974 | \brief This function is invoked on every expiry of neighborScanTimer till all |
| 1975 | the channels in the channel list are scanned. It populates necessary |
| 1976 | parameters for BG scan and calls appropriate AP to invoke the CSR scan |
| 1977 | request |
| 1978 | |
| 1979 | \param pMac - The handle returned by macOpen. |
| 1980 | |
| 1981 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 1982 | |
| 1983 | ---------------------------------------------------------------------------*/ |
| 1984 | eHalStatus csrNeighborRoamPerformBgScan(tpAniSirGlobal pMac) |
| 1985 | { |
| 1986 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 1987 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1988 | tCsrBGScanRequest bgScanParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1989 | tANI_U8 channel = 0; |
| 1990 | |
| 1991 | if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList) |
| 1992 | { |
Madan Mohan Koyyalamudi | 22f2708 | 2012-11-27 19:11:12 +0530 | [diff] [blame] | 1993 | NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Channel List Address = %08x"), &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[0]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1994 | } |
| 1995 | else |
| 1996 | { |
| 1997 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Channel List Empty")); |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 1998 | // Go back and restart. Mostly timer start failure has occurred. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1999 | // When timer start is declared a failure, then we delete the list. |
| 2000 | // Should not happen now as we stop and then only start the scan timer. |
| 2001 | // still handle the unlikely case. |
| 2002 | csrNeighborRoamHandleEmptyScanResult(pMac); |
| 2003 | return status; |
| 2004 | } |
| 2005 | /* Need to perform scan here before getting the list */ |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2006 | |
| 2007 | palZeroMemory(pMac->hHdd, &bgScanParams, sizeof(tCsrBGScanRequest)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2008 | |
| 2009 | channel = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[pNeighborRoamInfo->roamChannelInfo.currentChanIndex]; |
| 2010 | bgScanParams.ChannelInfo.numOfChannels = 1; |
| 2011 | bgScanParams.ChannelInfo.ChannelList = &channel; |
| 2012 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2013 | csrNeighborRoamFillNonChannelBgScanParams(pMac, &bgScanParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2014 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2015 | status = csrNeighborRoamIssueBgScanRequest(pMac, &bgScanParams, |
| 2016 | csrNeighborRoamScanRequestCallback); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2017 | if (eHAL_STATUS_SUCCESS != status) |
| 2018 | { |
| 2019 | smsLog(pMac, LOGE, FL("Issue of BG Scan request failed: Status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2020 | } |
| 2021 | |
| 2022 | pNeighborRoamInfo->roamChannelInfo.currentChanIndex++; |
| 2023 | if (pNeighborRoamInfo->roamChannelInfo.currentChanIndex >= |
| 2024 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels) |
| 2025 | { |
Madan Mohan Koyyalamudi | 22f2708 | 2012-11-27 19:11:12 +0530 | [diff] [blame] | 2026 | NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Completed scanning channels in Channel List: CurrChanIndex = %d, Num Channels = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2027 | pNeighborRoamInfo->roamChannelInfo.currentChanIndex, |
| 2028 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels); |
| 2029 | /* We have completed scanning all the channels */ |
| 2030 | pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0; |
| 2031 | /* We are no longer scanning the channel list. Next timer firing should be used to get the scan results |
| 2032 | and select the best AP in the list */ |
| 2033 | if (eANI_BOOLEAN_TRUE == pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress) |
| 2034 | { |
| 2035 | pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE; |
| 2036 | } |
| 2037 | } |
| 2038 | |
Gopichand Nakkala | c7b1d3e | 2012-12-31 14:07:19 -0800 | [diff] [blame] | 2039 | if (eHAL_STATUS_SUCCESS != status) |
| 2040 | { |
| 2041 | /* |
| 2042 | * If the status is not success, we need to call the callback |
| 2043 | * routine so that the state machine does not get stuck. |
| 2044 | */ |
| 2045 | csrNeighborRoamScanRequestCallback(pMac, NULL, 0, eCSR_SCAN_FAILURE); |
| 2046 | } |
| 2047 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2048 | return status; |
| 2049 | } |
| 2050 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2051 | #ifdef FEATURE_WLAN_LFR |
| 2052 | eHalStatus csrNeighborRoamPerformContiguousBgScan(tpAniSirGlobal pMac) |
| 2053 | { |
| 2054 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2055 | tCsrBGScanRequest bgScanParams; |
| 2056 | int numOfChannels = 0, i = 0; |
| 2057 | tANI_U8 *channelList = NULL; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2058 | tANI_U8 *pInChannelList = NULL; |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2059 | |
| 2060 | palZeroMemory(pMac->hHdd, &bgScanParams, sizeof(tCsrBGScanRequest)); |
| 2061 | |
| 2062 | /* Contiguously scan all channels from valid list */ |
| 2063 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "%s: get valid channel list", __func__); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2064 | |
| 2065 | if (NULL != pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.ChannelList) |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2066 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2067 | /* this list is filled only if the country code is set to KR */ |
| 2068 | numOfChannels = pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels; |
| 2069 | pInChannelList = pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.ChannelList; |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2070 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2071 | else |
| 2072 | { |
| 2073 | numOfChannels = sizeof(pMac->roam.validChannelList); |
| 2074 | |
| 2075 | if(!HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, |
| 2076 | (tANI_U8 *)pMac->roam.validChannelList, |
| 2077 | (tANI_U32 *) &numOfChannels))) |
| 2078 | { |
| 2079 | smsLog(pMac, LOGE, FL("Could not get valid channel list")); |
| 2080 | return eHAL_STATUS_FAILURE; |
| 2081 | } |
| 2082 | pInChannelList = pMac->roam.validChannelList; |
| 2083 | } |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2084 | channelList = vos_mem_malloc( numOfChannels ); |
| 2085 | if( NULL == channelList ) |
| 2086 | { |
| 2087 | smsLog(pMac, LOGE, FL("could not allocate memory for channelList")); |
| 2088 | return eHAL_STATUS_FAILURE; |
| 2089 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2090 | vos_mem_copy(channelList, (tANI_U8 *)pInChannelList, |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2091 | numOfChannels * sizeof(tANI_U8)); |
| 2092 | |
| 2093 | bgScanParams.ChannelInfo.numOfChannels = numOfChannels; |
| 2094 | bgScanParams.ChannelInfo.ChannelList = channelList; |
| 2095 | for (i = 0; i < numOfChannels; i++) |
| 2096 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2097 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "%s: valid channel list = %d", |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2098 | __func__, bgScanParams.ChannelInfo.ChannelList[i]); |
| 2099 | } |
| 2100 | csrNeighborRoamFillNonChannelBgScanParams(pMac, &bgScanParams); |
| 2101 | |
| 2102 | status = csrNeighborRoamIssueBgScanRequest(pMac, &bgScanParams, |
| 2103 | csrNeighborRoamContiguousScanRequestCallback); |
| 2104 | |
| 2105 | vos_mem_free( channelList ); |
| 2106 | |
| 2107 | if (eHAL_STATUS_SUCCESS != status) |
| 2108 | { |
| 2109 | smsLog(pMac, LOGE, FL("Issue of BG Scan request failed: Status = %d"), status); |
| 2110 | } |
| 2111 | |
| 2112 | return status; |
| 2113 | } |
| 2114 | #endif |
| 2115 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2116 | /* --------------------------------------------------------------------------- |
| 2117 | |
| 2118 | \fn csrNeighborRoamNeighborScanTimerCallback |
| 2119 | |
| 2120 | \brief This function is the neighbor scan timer callback function. It invokes |
| 2121 | the BG scan request based on the current and previous states |
| 2122 | |
| 2123 | \param pv - CSR timer context info which includes pMac and session ID |
| 2124 | |
| 2125 | \return VOID |
| 2126 | |
| 2127 | ---------------------------------------------------------------------------*/ |
| 2128 | void csrNeighborRoamNeighborScanTimerCallback(void *pv) |
| 2129 | { |
| 2130 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 2131 | tpAniSirGlobal pMac = pInfo->pMac; |
| 2132 | tANI_U32 sessionId = pInfo->sessionId; |
| 2133 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2134 | |
| 2135 | // check if bg scan is on going, no need to send down the new params if true |
| 2136 | if(eANI_BOOLEAN_TRUE == pNeighborRoamInfo->scanRspPending) |
| 2137 | { |
| 2138 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2139 | smsLog(pMac, LOGW, FL("Already BgScanRsp is Pending")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2140 | return; |
| 2141 | } |
| 2142 | |
| 2143 | VOS_ASSERT(sessionId == pNeighborRoamInfo->csrSessionId); |
| 2144 | |
| 2145 | switch (pNeighborRoamInfo->neighborRoamState) |
| 2146 | { |
| 2147 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2148 | case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN: |
| 2149 | switch(pNeighborRoamInfo->prevNeighborRoamState) |
| 2150 | { |
| 2151 | case eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY: |
| 2152 | csrNeighborRoamPerformBgScan(pMac); |
| 2153 | break; |
| 2154 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2155 | smsLog(pMac, LOGE, FL("Neighbor scan callback received in state %d, prev state = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2156 | pNeighborRoamInfo->neighborRoamState, pNeighborRoamInfo->prevNeighborRoamState); |
| 2157 | break; |
| 2158 | } |
| 2159 | break; |
| 2160 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 2161 | case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN: |
| 2162 | csrNeighborRoamPerformBgScan(pMac); |
| 2163 | break; |
| 2164 | default: |
| 2165 | break; |
| 2166 | } |
| 2167 | return; |
| 2168 | } |
| 2169 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2170 | void csrNeighborRoamEmptyScanRefreshTimerCallback(void *context) |
| 2171 | { |
| 2172 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)context; |
| 2173 | tpAniSirGlobal pMac = pInfo->pMac; |
| 2174 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 2175 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2176 | |
| 2177 | /* Reset all the variables just as no scan had happened before */ |
| 2178 | csrNeighborRoamResetConnectedStateControlInfo(pMac); |
| 2179 | |
| 2180 | #if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI |
| 2181 | if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled)) |
| 2182 | { |
| 2183 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state")); |
| 2184 | vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac); |
| 2185 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 2186 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2187 | smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2188 | return; |
| 2189 | } |
| 2190 | /* Increment the neighbor report retry count after sending the neighbor request successfully */ |
| 2191 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++; |
| 2192 | pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE; |
| 2193 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY) |
| 2194 | } |
| 2195 | else |
| 2196 | #endif |
| 2197 | { |
| 2198 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Non 11R or CCX Association:empty scan refresh timer expired")); |
| 2199 | vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac); |
| 2200 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 2201 | { |
| 2202 | return; |
| 2203 | } |
| 2204 | } |
| 2205 | return; |
| 2206 | } |
| 2207 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2208 | /* --------------------------------------------------------------------------- |
| 2209 | |
| 2210 | \fn csrNeighborRoamResultsRefreshTimerCallback |
| 2211 | |
| 2212 | \brief This function is the timer callback function for results refresh timer. |
| 2213 | When this is invoked, it is as good as down event received from TL. So, |
| 2214 | clear off the roamable AP list and start the scan procedure based on 11R |
| 2215 | or non-11R association |
| 2216 | |
| 2217 | \param context - CSR timer context info which includes pMac and session ID |
| 2218 | |
| 2219 | \return VOID |
| 2220 | |
| 2221 | ---------------------------------------------------------------------------*/ |
| 2222 | void csrNeighborRoamResultsRefreshTimerCallback(void *context) |
| 2223 | { |
| 2224 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)context; |
| 2225 | tpAniSirGlobal pMac = pInfo->pMac; |
| 2226 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 2227 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2228 | |
| 2229 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1)); |
| 2230 | |
| 2231 | /* Deregister reassoc callback. Ignore return status */ |
| 2232 | vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1), |
| 2233 | WLANTL_HO_THRESHOLD_DOWN, |
| 2234 | csrNeighborRoamReassocIndCallback, |
| 2235 | VOS_MODULE_ID_SME); |
| 2236 | |
| 2237 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2238 | { |
| 2239 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2240 | smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2241 | } |
| 2242 | |
| 2243 | /* Reset all the variables just as no scan had happened before */ |
| 2244 | csrNeighborRoamResetConnectedStateControlInfo(pMac); |
| 2245 | |
| 2246 | #if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI |
| 2247 | if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled)) |
| 2248 | { |
| 2249 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state")); |
| 2250 | vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac); |
| 2251 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 2252 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2253 | smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2254 | return; |
| 2255 | } |
| 2256 | /* Increment the neighbor report retry count after sending the neighbor request successfully */ |
| 2257 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++; |
| 2258 | pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE; |
| 2259 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY) |
| 2260 | } |
| 2261 | else |
| 2262 | #endif |
| 2263 | { |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2264 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Non 11R or CCX Association:results refresh timer expired")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2265 | vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac); |
| 2266 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 2267 | { |
| 2268 | return; |
| 2269 | } |
| 2270 | } |
| 2271 | return; |
| 2272 | } |
| 2273 | |
| 2274 | #if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI |
| 2275 | /* --------------------------------------------------------------------------- |
| 2276 | |
| 2277 | \fn csrNeighborRoamIssueNeighborRptRequest |
| 2278 | |
| 2279 | \brief This function is invoked when TL issues a down event and the current assoc |
| 2280 | is a 11R association. It invokes SME RRM API to issue the neighbor request to |
| 2281 | the currently associated AP with the current SSID |
| 2282 | |
| 2283 | \param pMac - The handle returned by macOpen. |
| 2284 | |
| 2285 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 2286 | |
| 2287 | ---------------------------------------------------------------------------*/ |
| 2288 | VOS_STATUS csrNeighborRoamIssueNeighborRptRequest(tpAniSirGlobal pMac) |
| 2289 | { |
| 2290 | tRrmNeighborRspCallbackInfo callbackInfo; |
| 2291 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2292 | tRrmNeighborReq neighborReq; |
| 2293 | |
| 2294 | |
| 2295 | neighborReq.no_ssid = 0; |
| 2296 | |
| 2297 | /* Fill in the SSID */ |
| 2298 | neighborReq.ssid.length = pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length; |
| 2299 | vos_mem_copy(neighborReq.ssid.ssId, pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.ssId, |
| 2300 | pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length); |
| 2301 | |
| 2302 | callbackInfo.neighborRspCallback = csrNeighborRoamRRMNeighborReportResult; |
| 2303 | callbackInfo.neighborRspCallbackContext = pMac; |
| 2304 | callbackInfo.timeout = pNeighborRoamInfo->FTRoamInfo.neighborReportTimeout; |
| 2305 | |
| 2306 | return sme_NeighborReportRequest(pMac,(tANI_U8) pNeighborRoamInfo->csrSessionId, &neighborReq, &callbackInfo); |
| 2307 | } |
| 2308 | |
| 2309 | /* --------------------------------------------------------------------------- |
| 2310 | |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2311 | \fn csrNeighborRoamMergeChannelLists |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2312 | |
| 2313 | \brief This function is used to merge two channel list. |
| 2314 | NB: If called with outputNumOfChannels == 0, this routines |
| 2315 | simply copies the input channel list to the output channel list. |
| 2316 | |
| 2317 | \param pMac - The handle returned by macOpen. |
| 2318 | \param pInputChannelList - The addtional channels to merge in to the "merged" channels list. |
| 2319 | \param inputNumOfChannels - The number of additional channels. |
| 2320 | \param pOutputChannelList - The place to put the "merged" channel list. |
| 2321 | \param outputNumOfChannels - The original number of channels in the "merged" channels list. |
| 2322 | \param pMergedOutputNumOfChannels - The final number of channels in the "merged" channel list. |
| 2323 | |
| 2324 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 2325 | |
| 2326 | ---------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2327 | VOS_STATUS csrNeighborRoamMergeChannelLists( |
| 2328 | tpAniSirGlobal pMac, |
| 2329 | tANI_U8 *pInputChannelList, |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2330 | int inputNumOfChannels, |
| 2331 | tANI_U8 *pOutputChannelList, |
| 2332 | int outputNumOfChannels, |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2333 | int *pMergedOutputNumOfChannels |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2334 | ) |
| 2335 | { |
| 2336 | int i = 0; |
| 2337 | int j = 0; |
| 2338 | int numChannels = outputNumOfChannels; |
| 2339 | |
| 2340 | // Check for NULL pointer |
| 2341 | if (!pInputChannelList) return eHAL_STATUS_E_NULL_VALUE; |
| 2342 | |
| 2343 | // Check for NULL pointer |
| 2344 | if (!pOutputChannelList) return eHAL_STATUS_E_NULL_VALUE; |
| 2345 | |
| 2346 | // Add the "new" channels in the input list to the end of the output list. |
| 2347 | for (i = 0; i < inputNumOfChannels; i++) |
| 2348 | { |
| 2349 | for (j = 0; j < outputNumOfChannels; j++) |
| 2350 | { |
| 2351 | if (pInputChannelList[i] == pOutputChannelList[j]) |
| 2352 | break; |
| 2353 | } |
| 2354 | if (j == outputNumOfChannels) |
| 2355 | { |
| 2356 | if (pInputChannelList[i]) |
| 2357 | { |
Madan Mohan Koyyalamudi | f5c368b | 2012-12-06 13:10:13 -0800 | [diff] [blame] | 2358 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2359 | "%s: [INFOLOG] Adding extra %d to Neighbor channel list", __func__, |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2360 | pInputChannelList[i]); |
| 2361 | pOutputChannelList[numChannels] = pInputChannelList[i]; |
| 2362 | numChannels++; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2363 | } |
| 2364 | } |
| 2365 | } |
| 2366 | |
| 2367 | // Return final number of channels |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2368 | *pMergedOutputNumOfChannels = numChannels; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2369 | |
| 2370 | return eHAL_STATUS_SUCCESS; |
| 2371 | } |
| 2372 | |
| 2373 | /* --------------------------------------------------------------------------- |
| 2374 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2375 | \fn csrNeighborRoamCreateChanListFromNeighborReport |
| 2376 | |
| 2377 | \brief This function is invoked when neighbor report is received for the |
| 2378 | neighbor request. Based on the channels present in the neighbor report, |
| 2379 | it generates channel list which will be used in REPORT_SCAN state to |
| 2380 | scan for these neighbor APs |
| 2381 | |
| 2382 | \param pMac - The handle returned by macOpen. |
| 2383 | |
| 2384 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 2385 | |
| 2386 | ---------------------------------------------------------------------------*/ |
| 2387 | VOS_STATUS csrNeighborRoamCreateChanListFromNeighborReport(tpAniSirGlobal pMac) |
| 2388 | { |
| 2389 | tpRrmNeighborReportDesc pNeighborBssDesc; |
| 2390 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2391 | tANI_U8 numChannels = 0, i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2392 | tANI_U8 channelList[MAX_BSS_IN_NEIGHBOR_RPT]; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2393 | #if 0 |
| 2394 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2395 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2396 | |
| 2397 | /* This should always start from 0 whenever we create a channel list out of neighbor AP list */ |
| 2398 | pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0; |
| 2399 | |
| 2400 | pNeighborBssDesc = smeRrmGetFirstBssEntryFromNeighborCache(pMac); |
| 2401 | |
| 2402 | while (pNeighborBssDesc) |
| 2403 | { |
| 2404 | if (pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport >= MAX_BSS_IN_NEIGHBOR_RPT) break; |
| 2405 | |
| 2406 | /* Update the neighbor BSS Info in the 11r FT Roam Info */ |
| 2407 | pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].channelNum = |
| 2408 | pNeighborBssDesc->pNeighborBssDescription->channel; |
| 2409 | pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].neighborScore = |
| 2410 | (tANI_U8)pNeighborBssDesc->roamScore; |
| 2411 | vos_mem_copy(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].neighborBssId, |
| 2412 | pNeighborBssDesc->pNeighborBssDescription->bssId, sizeof(tSirMacAddr)); |
| 2413 | pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport++; |
| 2414 | |
| 2415 | /* Saving the channel list non-redundantly */ |
| 2416 | if (numChannels > 0) |
| 2417 | { |
| 2418 | for (i = 0; i < numChannels; i++) |
| 2419 | { |
| 2420 | if (pNeighborBssDesc->pNeighborBssDescription->channel == channelList[i]) |
| 2421 | break; |
| 2422 | } |
| 2423 | |
| 2424 | } |
| 2425 | if (i == numChannels) |
| 2426 | { |
| 2427 | if (pNeighborBssDesc->pNeighborBssDescription->channel) |
| 2428 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2429 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2430 | "%s: [INFOLOG] Adding %d to Neighbor channel list", __func__, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2431 | pNeighborBssDesc->pNeighborBssDescription->channel); |
| 2432 | channelList[numChannels] = pNeighborBssDesc->pNeighborBssDescription->channel; |
| 2433 | numChannels++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2434 | } |
| 2435 | } |
| 2436 | |
| 2437 | pNeighborBssDesc = smeRrmGetNextBssEntryFromNeighborCache(pMac, pNeighborBssDesc); |
| 2438 | } |
| 2439 | |
| 2440 | if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList) |
| 2441 | { |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2442 | #if 0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2443 | // Before we free the existing channel list for a safety net make sure |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2444 | // we have a union of the IAPP and the already existing list. |
| 2445 | status = csrNeighborRoamMergeChannelLists( |
| 2446 | pMac, |
| 2447 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList, |
| 2448 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels, |
| 2449 | channelList, |
| 2450 | numChannels, |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2451 | &numChannels ); |
| 2452 | #endif |
| 2453 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2454 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 2455 | } |
| 2456 | |
| 2457 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
| 2458 | /* Store the obtained channel list to the Neighbor Control data structure */ |
| 2459 | if (numChannels) |
| 2460 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = vos_mem_malloc((numChannels) * sizeof(tANI_U8)); |
| 2461 | if (NULL == pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList) |
| 2462 | { |
| 2463 | smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed.. TL event ignored")); |
| 2464 | return VOS_STATUS_E_RESOURCES; |
| 2465 | } |
| 2466 | |
| 2467 | vos_mem_copy(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList, |
| 2468 | channelList, (numChannels) * sizeof(tANI_U8)); |
| 2469 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = numChannels; |
| 2470 | if (numChannels) |
| 2471 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2472 | smsLog(pMac, LOG1, FL("IAPP Neighbor list callback received as expected in state %d."), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2473 | pNeighborRoamInfo->neighborRoamState); |
| 2474 | pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_TRUE; |
| 2475 | } |
| 2476 | pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0; |
| 2477 | pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE; |
| 2478 | |
| 2479 | return VOS_STATUS_SUCCESS; |
| 2480 | } |
| 2481 | |
| 2482 | /* --------------------------------------------------------------------------- |
| 2483 | |
| 2484 | \fn csrNeighborRoamRRMNeighborReportResult |
| 2485 | |
| 2486 | \brief This function is the neighbor report callback that will be invoked by |
| 2487 | SME RRM on receiving a neighbor report or of neighbor report is not |
| 2488 | received after timeout. On receiving a valid report, it generates a |
| 2489 | channel list from the neighbor report and starts the |
| 2490 | neighbor scan timer |
| 2491 | |
| 2492 | \param context - The handle returned by macOpen. |
| 2493 | vosStatus - Status of the callback(SUCCESS/FAILURE) |
| 2494 | |
| 2495 | \return VOID |
| 2496 | |
| 2497 | ---------------------------------------------------------------------------*/ |
| 2498 | void csrNeighborRoamRRMNeighborReportResult(void *context, VOS_STATUS vosStatus) |
| 2499 | { |
| 2500 | tpAniSirGlobal pMac = PMAC_STRUCT(context); |
| 2501 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2502 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2503 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2504 | smsLog(pMac, LOG1, FL("Neighbor report result callback with status = %d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2505 | switch (pNeighborRoamInfo->neighborRoamState) |
| 2506 | { |
| 2507 | case eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY: |
| 2508 | /* Reset the report pending variable */ |
| 2509 | pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE; |
| 2510 | if (VOS_STATUS_SUCCESS == vosStatus) |
| 2511 | { |
| 2512 | /* Need to create channel list based on the neighbor AP list and transition to REPORT_SCAN state */ |
| 2513 | vosStatus = csrNeighborRoamCreateChanListFromNeighborReport(pMac); |
| 2514 | if (VOS_STATUS_SUCCESS == vosStatus) |
| 2515 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2516 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Channel List created from Neighbor report, Transitioning to NEIGHBOR_SCAN state")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2517 | } |
| 2518 | |
| 2519 | /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */ |
| 2520 | pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 2521 | |
| 2522 | /* Now ready for neighbor scan based on the channel list created */ |
| 2523 | /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is |
| 2524 | what palTimerStart expects */ |
| 2525 | status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer, |
| 2526 | pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT, |
| 2527 | eANI_BOOLEAN_FALSE); |
| 2528 | if (eHAL_STATUS_SUCCESS != status) |
| 2529 | { |
| 2530 | /* Timer start failed.. Should we ASSERT here??? */ |
| 2531 | smsLog(pMac, LOGE, FL("PAL Timer start for neighbor scan timer failed, status = %d, Ignoring state transition"), status); |
| 2532 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 2533 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
| 2534 | return; |
| 2535 | } |
| 2536 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0; |
| 2537 | /* Neighbor scan timer started. Transition to REPORT_SCAN state */ |
| 2538 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN) |
| 2539 | } |
| 2540 | else |
| 2541 | { |
| 2542 | /* Neighbor report timeout happened in SME RRM. We can try sending more neighbor requests until we |
| 2543 | reach the maxNeighborRetries or receiving a successful neighbor response */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2544 | smsLog(pMac, LOGE, FL("Neighbor report result failed after %d retries, MAX RETRIES = %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2545 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum, pNeighborRoamInfo->cfgParams.maxNeighborRetries); |
| 2546 | if (pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum >= |
| 2547 | pNeighborRoamInfo->cfgParams.maxNeighborRetries) |
| 2548 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2549 | smsLog(pMac, LOGE, FL("Bailing out to CFG Channel list scan.. ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2550 | vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac); |
| 2551 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 2552 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2553 | smsLog(pMac, LOGE, FL("Transit to CFG Channel list scan state failed with status %d "), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2554 | return; |
| 2555 | } |
| 2556 | /* We transitioned to different state now. Reset the Neighbor report retry count */ |
| 2557 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0; |
| 2558 | } |
| 2559 | else |
| 2560 | { |
| 2561 | vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac); |
| 2562 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 2563 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2564 | smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2565 | return; |
| 2566 | } |
| 2567 | pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE; |
| 2568 | /* Increment the neighbor report retry count after sending the neighbor request successfully */ |
| 2569 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++; |
| 2570 | } |
| 2571 | } |
| 2572 | break; |
| 2573 | default: |
| 2574 | smsLog(pMac, LOGE, FL("Neighbor result callback not expected in state %d, Ignoring.."), pNeighborRoamInfo->neighborRoamState); |
| 2575 | break; |
| 2576 | } |
| 2577 | return; |
| 2578 | } |
| 2579 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 2580 | |
| 2581 | |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2582 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2583 | tANI_BOOLEAN csrNeighborRoamIsSsidAndSecurityMatch( |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2584 | tpAniSirGlobal pMac, |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2585 | tCsrRoamConnectedProfile *pCurProfile, |
| 2586 | tSirBssDescription *pBssDesc, |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2587 | tDot11fBeaconIEs *pIes) |
| 2588 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2589 | tCsrAuthList authType; |
| 2590 | tCsrEncryptionList uCEncryptionType; |
| 2591 | tCsrEncryptionList mCEncryptionType; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2592 | tANI_BOOLEAN fMatch = FALSE; |
| 2593 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2594 | authType.numEntries = 1; |
| 2595 | authType.authType[0] = pCurProfile->AuthType; |
| 2596 | uCEncryptionType.numEntries = 1; |
| 2597 | uCEncryptionType.encryptionType[0] = pCurProfile->EncryptionType; |
| 2598 | mCEncryptionType.numEntries = 1; |
| 2599 | mCEncryptionType.encryptionType[0] = pCurProfile->mcEncryptionType; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2600 | |
| 2601 | if( pIes ) |
| 2602 | { |
| 2603 | if(pIes->SSID.present) |
| 2604 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2605 | fMatch = csrIsSsidMatch( pMac, |
| 2606 | (void *)pCurProfile->SSID.ssId, pCurProfile->SSID.length, |
| 2607 | pIes->SSID.ssid, pIes->SSID.num_ssid, |
| 2608 | eANI_BOOLEAN_TRUE ); |
| 2609 | if(TRUE == fMatch) |
| 2610 | { |
| 2611 | fMatch = csrIsSecurityMatch( pMac, &authType, &uCEncryptionType, |
| 2612 | &mCEncryptionType, pBssDesc, pIes, NULL, NULL, NULL ); |
| 2613 | return (fMatch); |
| 2614 | } |
| 2615 | else |
| 2616 | { |
| 2617 | return (fMatch); |
| 2618 | } |
| 2619 | |
| 2620 | } |
| 2621 | else |
| 2622 | { |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2623 | return FALSE; // Treat a missing SSID as a non-match. |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2624 | } |
| 2625 | } |
| 2626 | else |
| 2627 | { |
| 2628 | return FALSE; // Again, treat missing pIes as a non-match. |
| 2629 | } |
| 2630 | } |
| 2631 | |
| 2632 | tANI_BOOLEAN csrNeighborRoamIsNewConnectedProfile( |
| 2633 | tpAniSirGlobal pMac) |
| 2634 | { |
| 2635 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2636 | tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId; |
| 2637 | tCsrRoamConnectedProfile *pCurrProfile = NULL; |
| 2638 | tCsrRoamConnectedProfile *pPrevProfile = NULL; |
| 2639 | tDot11fBeaconIEs *pIes = NULL; |
| 2640 | tSirBssDescription *pBssDesc = NULL; |
| 2641 | tANI_BOOLEAN fNew = TRUE; |
| 2642 | |
| 2643 | if(!(pMac->roam.roamSession && CSR_IS_SESSION_VALID(pMac, sessionId))) |
| 2644 | { |
| 2645 | return (fNew); |
| 2646 | } |
| 2647 | |
| 2648 | pCurrProfile = &pMac->roam.roamSession[sessionId].connectedProfile; |
| 2649 | if( !pCurrProfile ) |
| 2650 | { |
| 2651 | return (fNew); |
| 2652 | } |
| 2653 | |
| 2654 | pPrevProfile = &pNeighborRoamInfo->prevConnProfile; |
| 2655 | if( !pPrevProfile ) |
| 2656 | { |
| 2657 | return (fNew); |
| 2658 | } |
| 2659 | |
| 2660 | pBssDesc = pPrevProfile->pBssDesc; |
| 2661 | if (pBssDesc) |
| 2662 | { |
| 2663 | if (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, |
| 2664 | pBssDesc, &pIes)) && |
| 2665 | csrNeighborRoamIsSsidAndSecurityMatch(pMac, pCurrProfile, pBssDesc, pIes)) |
| 2666 | { |
| 2667 | fNew = FALSE; |
| 2668 | } |
| 2669 | if (pIes) { |
| 2670 | palFreeMemory(pMac->hHdd, pIes); |
| 2671 | } |
| 2672 | } |
| 2673 | |
| 2674 | if (fNew) |
| 2675 | { |
| 2676 | smsLog(pMac, LOG1, FL("Prev roam profile did not match current")); |
| 2677 | csrRoamFreeConnectProfile(pMac, pPrevProfile); |
| 2678 | csrRoamGetConnectProfile(pMac, sessionId, pPrevProfile); |
| 2679 | } |
| 2680 | else |
| 2681 | { |
| 2682 | smsLog(pMac, LOG1, FL("Prev roam profile matches current")); |
| 2683 | } |
| 2684 | |
| 2685 | return (fNew); |
| 2686 | } |
| 2687 | |
| 2688 | tANI_BOOLEAN csrNeighborRoamConnectedProfileMatch( |
| 2689 | tpAniSirGlobal pMac, |
| 2690 | tCsrScanResult *pResult, |
| 2691 | tDot11fBeaconIEs *pIes) |
| 2692 | { |
| 2693 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2694 | tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId; |
| 2695 | tCsrRoamConnectedProfile *pCurProfile = NULL; |
| 2696 | tSirBssDescription *pBssDesc = &pResult->Result.BssDescriptor; |
| 2697 | |
| 2698 | if( !(pMac->roam.roamSession |
| 2699 | && CSR_IS_SESSION_VALID(pMac, sessionId))) |
| 2700 | { |
| 2701 | return FALSE; |
| 2702 | } |
| 2703 | |
| 2704 | pCurProfile = &pMac->roam.roamSession[sessionId].connectedProfile; |
| 2705 | |
| 2706 | if( !pCurProfile) |
| 2707 | { |
| 2708 | return FALSE; |
| 2709 | } |
| 2710 | |
| 2711 | return csrNeighborRoamIsSsidAndSecurityMatch(pMac, pCurProfile, pBssDesc, pIes); |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2712 | } |
| 2713 | |
| 2714 | /* --------------------------------------------------------------------------- |
| 2715 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2716 | \fn csrNeighborRoamPrepareNonOccupiedChannelList |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2717 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2718 | \brief This function is used to prepare a channel list that is derived from |
| 2719 | the list of valid channels and does not include those in the occupied |
| 2720 | list. |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2721 | |
| 2722 | \param pMac - The handle returned by macOpen. |
| 2723 | \param pInputChannelList - The default channels list. |
| 2724 | \param numOfChannels - The number of channels in the default channels list. |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2725 | \param pOutputChannelList - The place to put the non-occupied channel list. |
| 2726 | \param pOutputNumOfChannels - The number of channels in the non-occupied channel list. |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2727 | |
| 2728 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 2729 | |
| 2730 | ---------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2731 | VOS_STATUS csrNeighborRoamPrepareNonOccupiedChannelList( |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2732 | tpAniSirGlobal pMac, |
| 2733 | tANI_U8 *pInputChannelList, |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2734 | int numOfChannels, |
| 2735 | tANI_U8 *pOutputChannelList, |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2736 | int *pOutputNumOfChannels |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2737 | ) |
| 2738 | { |
| 2739 | int i = 0; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2740 | int outputNumOfChannels = 0; // Clear the output number of channels |
| 2741 | tANI_U8 numOccupiedChannels = pMac->scan.occupiedChannels.numChannels; |
| 2742 | tANI_U8 *pOccupiedChannelList = pMac->scan.occupiedChannels.channelList; |
| 2743 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2744 | for (i = 0; i < numOfChannels; i++) |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2745 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2746 | if (!csrIsChannelPresentInList(pOccupiedChannelList, numOccupiedChannels, |
| 2747 | pInputChannelList[i])) |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2748 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2749 | pOutputChannelList[outputNumOfChannels++] = pInputChannelList[i]; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2750 | } |
| 2751 | } |
| 2752 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2753 | smsLog(pMac, LOG2, FL("Number of channels in the valid channel list=%d; " |
| 2754 | "Number of channels in the non-occupied list list=%d"), |
| 2755 | numOfChannels, outputNumOfChannels); |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2756 | |
| 2757 | // Return the number of channels |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2758 | *pOutputNumOfChannels = outputNumOfChannels; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2759 | |
| 2760 | return eHAL_STATUS_SUCCESS; |
| 2761 | } |
| 2762 | #endif /* FEATURE_WLAN_LFR */ |
| 2763 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2764 | /* --------------------------------------------------------------------------- |
| 2765 | |
| 2766 | \fn csrNeighborRoamTransitToCFGChanScan |
| 2767 | |
| 2768 | \brief This function is called whenever there is a transition to CFG chan scan |
| 2769 | state from any state. It frees up the current channel list and allocates |
| 2770 | a new memory for the channels received from CFG item. It then starts the |
| 2771 | neighbor scan timer to perform the scan on each channel one by one |
| 2772 | |
| 2773 | \param pMac - The handle returned by macOpen. |
| 2774 | |
| 2775 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 2776 | |
| 2777 | ---------------------------------------------------------------------------*/ |
| 2778 | VOS_STATUS csrNeighborRoamTransitToCFGChanScan(tpAniSirGlobal pMac) |
| 2779 | { |
| 2780 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2781 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2782 | int i = 0; |
| 2783 | int numOfChannels = 0; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2784 | tANI_U8 channelList[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2785 | tpCsrChannelInfo currChannelListInfo; |
| 2786 | |
| 2787 | currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2788 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2789 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2790 | #ifdef FEATURE_WLAN_CCX |
| 2791 | ((pNeighborRoamInfo->isCCXAssoc) && |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 2792 | (pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == eANI_BOOLEAN_FALSE)) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2793 | (pNeighborRoamInfo->isCCXAssoc == eANI_BOOLEAN_FALSE) || |
| 2794 | #endif // CCX |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2795 | currChannelListInfo->numOfChannels == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2796 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2797 | smsLog(pMac, LOGW, FL("Building channel list to scan")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2798 | |
| 2799 | |
| 2800 | /* Free up the channel list and allocate a new memory. This is because we dont know how much |
| 2801 | was allocated last time. If we directly copy more number of bytes than allocated earlier, this might |
| 2802 | result in memory corruption */ |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2803 | if (NULL != currChannelListInfo->ChannelList) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2804 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2805 | vos_mem_free(currChannelListInfo->ChannelList); |
| 2806 | currChannelListInfo->ChannelList = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2807 | } |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2808 | |
| 2809 | // Now obtain the contents for "channelList" (the "default valid channel list") from EITHER |
| 2810 | // the gNeighborScanChannelList in "cfg.ini", OR the actual "valid channel list" information formed by CSR. |
| 2811 | if (0 != pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2812 | { |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2813 | // Copy the "default valid channel list" (channelList) from the gNeighborScanChannelList in "cfg.ini". |
| 2814 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, "Using the channel list from cfg.ini"); |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2815 | status = csrNeighborRoamMergeChannelLists( |
| 2816 | pMac, |
| 2817 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, |
| 2818 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels, |
| 2819 | channelList, |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2820 | 0, //NB: If 0, simply copy the input channel list to the output list. |
| 2821 | &numOfChannels ); |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2822 | |
| 2823 | currChannelListInfo->ChannelList = |
| 2824 | vos_mem_malloc(numOfChannels*sizeof(tANI_U8)); |
| 2825 | if (NULL == currChannelListInfo->ChannelList) |
| 2826 | { |
| 2827 | smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed")); |
| 2828 | return VOS_STATUS_E_RESOURCES; |
| 2829 | } |
| 2830 | |
| 2831 | vos_mem_copy(currChannelListInfo->ChannelList, |
| 2832 | channelList, numOfChannels * sizeof(tANI_U8)); |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2833 | } |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2834 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2835 | else if ((pNeighborRoamInfo->uScanMode == DEFAULT_SCAN) && |
| 2836 | (abs(pNeighborRoamInfo->lookupDOWNRssi) > |
| 2837 | abs(pNeighborRoamInfo->cfgParams.neighborReassocThreshold))) |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2838 | { |
| 2839 | /* |
| 2840 | * Trigger a contiguous scan on all channels when the |
| 2841 | * RSSI in the lookup DOWN notification is below reassoc |
| 2842 | * threshold. This will help us find the best available |
| 2843 | * candidate and also update the channel cache. |
| 2844 | */ |
| 2845 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "Triggering contiguous scan " |
| 2846 | "(lookupDOWNRssi=%d,reassocThreshold=%d)", |
| 2847 | pNeighborRoamInfo->lookupDOWNRssi, |
| 2848 | pNeighborRoamInfo->cfgParams.neighborReassocThreshold*(-1)); |
| 2849 | |
| 2850 | pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 2851 | |
| 2852 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 2853 | |
| 2854 | /* We are about to start a fresh scan cycle, |
| 2855 | * purge non-P2P results from the past */ |
| 2856 | csrScanFlushSelectiveResult(pMac, VOS_FALSE); |
| 2857 | |
| 2858 | csrNeighborRoamPerformContiguousBgScan(pMac); |
| 2859 | |
| 2860 | /* Transition to CFG_CHAN_LIST_SCAN */ |
| 2861 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN); |
| 2862 | |
| 2863 | return VOS_STATUS_SUCCESS; |
| 2864 | } |
| 2865 | #endif |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2866 | else |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2867 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2868 | numOfChannels = pMac->scan.occupiedChannels.numChannels; |
| 2869 | if (numOfChannels |
| 2870 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2871 | && ((pNeighborRoamInfo->uScanMode == SPLIT_SCAN_OCCUPIED_LIST) || |
| 2872 | (pNeighborRoamInfo->uEmptyScanCount == 0) || |
| 2873 | ((pNeighborRoamInfo->uEmptyScanCount % 2) == 1)) |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2874 | #endif |
| 2875 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2876 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2877 | /* |
| 2878 | * Always scan channels in the occupied channel list |
| 2879 | * before scanning on the non-occupied list. |
| 2880 | */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2881 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Switching to occupied channel list" |
| 2882 | #ifdef FEATURE_WLAN_LFR |
| 2883 | "-uScanMode=%d, uEmptyScanCount=%d", |
| 2884 | pNeighborRoamInfo->uScanMode, |
| 2885 | pNeighborRoamInfo->uEmptyScanCount |
| 2886 | #endif |
| 2887 | ); |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2888 | VOS_ASSERT(currChannelListInfo->ChannelList == NULL); |
| 2889 | currChannelListInfo->ChannelList = vos_mem_malloc(numOfChannels); |
| 2890 | |
| 2891 | if (NULL == currChannelListInfo->ChannelList) |
| 2892 | { |
| 2893 | smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed")); |
| 2894 | return VOS_STATUS_E_RESOURCES; |
| 2895 | } |
| 2896 | vos_mem_copy(currChannelListInfo->ChannelList, |
| 2897 | pMac->scan.occupiedChannels.channelList, |
| 2898 | numOfChannels * sizeof(tANI_U8)); |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2899 | } |
| 2900 | else |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2901 | { |
| 2902 | /* Scan all channels from non-occupied list */ |
| 2903 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Get valid channel list"); |
| 2904 | numOfChannels = sizeof(pMac->roam.validChannelList); |
| 2905 | |
| 2906 | if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, |
| 2907 | (tANI_U8 *)pMac->roam.validChannelList, |
| 2908 | (tANI_U32 *) &numOfChannels))) |
| 2909 | { |
| 2910 | #ifdef FEATURE_WLAN_LFR |
| 2911 | /* |
| 2912 | * Prepare non-occupied channel list (channelList) |
| 2913 | * from the actual "valid channel list" information |
| 2914 | * formed by CSR. |
| 2915 | */ |
Madan Mohan Koyyalamudi | 22f2708 | 2012-11-27 19:11:12 +0530 | [diff] [blame] | 2916 | NEIGHBOR_ROAM_DEBUG(pMac, LOG1, "Switching to non-occupied channel list"); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2917 | status = csrNeighborRoamPrepareNonOccupiedChannelList(pMac, |
| 2918 | (tANI_U8 *)pMac->roam.validChannelList, |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2919 | numOfChannels, |
| 2920 | channelList, |
| 2921 | &numOfChannels); |
| 2922 | #else |
| 2923 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Merging channel list"); |
| 2924 | status = csrNeighborRoamMergeChannelLists( |
| 2925 | pMac, |
| 2926 | (tANI_U8 *)pMac->roam.validChannelList, |
| 2927 | numOfChannels, // The number of channels in the validChannelList |
| 2928 | channelList, |
| 2929 | 0, //NB: If 0, simply copy the input channel list to the output list. |
| 2930 | &numOfChannels ); // The final number of channels in the output list. Will be numOfChannels |
| 2931 | #endif |
| 2932 | } |
| 2933 | else |
| 2934 | { |
| 2935 | smsLog(pMac, LOGE, FL("Could not get valid channel list")); |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2936 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2937 | } |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2938 | currChannelListInfo->ChannelList = |
| 2939 | vos_mem_malloc(numOfChannels*sizeof(tANI_U8)); |
| 2940 | |
| 2941 | if (NULL == currChannelListInfo->ChannelList) |
| 2942 | { |
| 2943 | smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed")); |
| 2944 | return VOS_STATUS_E_RESOURCES; |
| 2945 | } |
| 2946 | #ifdef FEATURE_WLAN_LFR |
| 2947 | vos_mem_copy(currChannelListInfo->ChannelList, |
| 2948 | channelList, numOfChannels * sizeof(tANI_U8)); |
| 2949 | #else |
| 2950 | vos_mem_copy(currChannelListInfo->ChannelList, |
| 2951 | (tANI_U8 *)pMac->roam.validChannelList, |
| 2952 | numOfChannels * sizeof(tANI_U8)); |
| 2953 | #endif |
| 2954 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2955 | } |
| 2956 | |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2957 | /* Adjust for the actual number that are used */ |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2958 | currChannelListInfo->numOfChannels = numOfChannels; |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2959 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, |
| 2960 | "Number of channels from CFG (or) (non-)occupied list=%d", |
| 2961 | currChannelListInfo->numOfChannels); |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2962 | for (i = 0; i < currChannelListInfo->numOfChannels; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2963 | { |
Madan Mohan Koyyalamudi | 22f2708 | 2012-11-27 19:11:12 +0530 | [diff] [blame] | 2964 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "Channel List from CFG (or) (non-)occupied list" |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 2965 | "= %d", currChannelListInfo->ChannelList[i]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2966 | } |
| 2967 | } |
| 2968 | |
| 2969 | /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */ |
| 2970 | pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 2971 | |
| 2972 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 2973 | /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is |
| 2974 | what palTimerStart expects */ |
| 2975 | status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer, |
| 2976 | pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT, |
| 2977 | eANI_BOOLEAN_FALSE); |
| 2978 | |
| 2979 | if (eHAL_STATUS_SUCCESS != status) |
| 2980 | { |
| 2981 | /* Timer start failed.. */ |
| 2982 | smsLog(pMac, LOGE, FL("Neighbor scan PAL Timer start failed, status = %d, Ignoring state transition"), status); |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 2983 | vos_mem_free(currChannelListInfo->ChannelList); |
| 2984 | currChannelListInfo->ChannelList = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2985 | return VOS_STATUS_E_FAILURE; |
| 2986 | } |
| 2987 | |
| 2988 | pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0; |
| 2989 | pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE; |
Madan Mohan Koyyalamudi | 5850f31 | 2012-11-27 19:00:25 +0530 | [diff] [blame] | 2990 | /* We are about to start a fresh scan cycle, |
| 2991 | * purge non-P2P results from the past */ |
| 2992 | csrScanFlushSelectiveResult(pMac, VOS_FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2993 | |
| 2994 | /* Transition to CFG_CHAN_LIST_SCAN_STATE */ |
| 2995 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN) |
| 2996 | |
| 2997 | return VOS_STATUS_SUCCESS; |
| 2998 | } |
| 2999 | |
| 3000 | /* --------------------------------------------------------------------------- |
| 3001 | |
| 3002 | \fn csrNeighborRoamNeighborLookupUpEvent |
| 3003 | |
| 3004 | \brief This function is called as soon as TL indicates that the current AP's |
| 3005 | RSSI is better than the neighbor lookup threshold. Here, we transition to |
| 3006 | CONNECTED state and reset all the scan parameters |
| 3007 | |
| 3008 | \param pMac - The handle returned by macOpen. |
| 3009 | |
| 3010 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3011 | |
| 3012 | ---------------------------------------------------------------------------*/ |
| 3013 | VOS_STATUS csrNeighborRoamNeighborLookupUpEvent(tpAniSirGlobal pMac) |
| 3014 | { |
| 3015 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3016 | VOS_STATUS vosStatus; |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 3017 | csrNeighborRoamDeregAllRssiIndication(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3018 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3019 | /* Recheck whether the below check is needed. */ |
| 3020 | if (pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_CONNECTED) |
| 3021 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3022 | |
| 3023 | /* Reset all the neighbor roam info control variables. Free all the allocated memory. It is like we are just associated now */ |
| 3024 | csrNeighborRoamResetConnectedStateControlInfo(pMac); |
| 3025 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3026 | |
| 3027 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event neighbor lookup callback with TL. RSSI = %d,"), pNeighborRoamInfo->currentNeighborLookupThreshold * (-1)); |
| 3028 | /* Register Neighbor Lookup threshold callback with TL for DOWN event now */ |
| 3029 | vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1), |
| 3030 | WLANTL_HO_THRESHOLD_DOWN, |
| 3031 | csrNeighborRoamNeighborLookupDOWNCallback, |
| 3032 | VOS_MODULE_ID_SME, pMac); |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 3033 | #ifdef FEATURE_WLAN_LFR |
| 3034 | pNeighborRoamInfo->lookupDOWNRssi = 0; |
| 3035 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3036 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 3037 | { |
| 3038 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 3039 | smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback DOWN event with TL: Status = %d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3040 | } |
| 3041 | |
| 3042 | |
| 3043 | return vosStatus; |
| 3044 | } |
| 3045 | |
| 3046 | /* --------------------------------------------------------------------------- |
| 3047 | |
| 3048 | \fn csrNeighborRoamNeighborLookupDownEvent |
| 3049 | |
| 3050 | \brief This function is called as soon as TL indicates that the current AP's |
| 3051 | RSSI falls below the current eighbor lookup threshold. Here, we transition to |
| 3052 | REPORT_QUERY for 11r association and CFG_CHAN_LIST_SCAN state if the assoc is |
| 3053 | a non-11R association. |
| 3054 | |
| 3055 | \param pMac - The handle returned by macOpen. |
| 3056 | |
| 3057 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3058 | |
| 3059 | ---------------------------------------------------------------------------*/ |
| 3060 | VOS_STATUS csrNeighborRoamNeighborLookupDownEvent(tpAniSirGlobal pMac) |
| 3061 | { |
| 3062 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3063 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 3064 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3065 | |
| 3066 | switch (pNeighborRoamInfo->neighborRoamState) |
| 3067 | { |
| 3068 | case eCSR_NEIGHBOR_ROAM_STATE_CONNECTED: |
| 3069 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 3070 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event neighbor lookup callback with TL. RSSI = %d,"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3071 | pNeighborRoamInfo->currentNeighborLookupThreshold * (-1)); |
| 3072 | /* De-register Neighbor Lookup threshold callback with TL */ |
| 3073 | vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1), |
| 3074 | WLANTL_HO_THRESHOLD_DOWN, |
| 3075 | csrNeighborRoamNeighborLookupDOWNCallback, |
| 3076 | VOS_MODULE_ID_SME); |
| 3077 | |
| 3078 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 3079 | { |
| 3080 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 3081 | smsLog(pMac, LOGW, FL(" Couldn't Deregister csrNeighborRoamNeighborLookupCallback DOWN event from TL: Status = %d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3082 | } |
| 3083 | |
| 3084 | |
| 3085 | #if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI |
| 3086 | if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled)) |
| 3087 | { |
| 3088 | |
| 3089 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state")); |
| 3090 | vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac); |
| 3091 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 3092 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 3093 | smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3094 | return vosStatus; |
| 3095 | } |
| 3096 | /* Increment the neighbor report retry count after sending the neighbor request successfully */ |
| 3097 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++; |
| 3098 | pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE; |
| 3099 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY) |
| 3100 | } |
| 3101 | else |
| 3102 | #endif |
| 3103 | { |
| 3104 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Non 11R or CCX Association:Neighbor Lookup Down event received in CONNECTED state")); |
| 3105 | |
| 3106 | vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac); |
| 3107 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 3108 | { |
Madan Mohan Koyyalamudi | 4450acc | 2012-11-15 17:24:31 -0800 | [diff] [blame] | 3109 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("csrNeighborRoamTransitToCFGChanScan failed" |
| 3110 | " with status=%d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3111 | return vosStatus; |
| 3112 | } |
| 3113 | } |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3114 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering UP event neighbor lookup callback with TL. RSSI = %d,"), NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3115 | /* Register Neighbor Lookup threshold callback with TL for UP event now */ |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3116 | vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, |
| 3117 | (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3118 | WLANTL_HO_THRESHOLD_UP, |
| 3119 | csrNeighborRoamNeighborLookupUPCallback, |
| 3120 | VOS_MODULE_ID_SME, pMac); |
| 3121 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 3122 | { |
| 3123 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 3124 | smsLog(pMac, LOGE, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback UP event with TL: Status = %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3125 | } |
| 3126 | break; |
| 3127 | default: |
| 3128 | smsLog(pMac, LOGE, FL("DOWN event received in invalid state %d..Ignoring..."), pNeighborRoamInfo->neighborRoamState); |
| 3129 | break; |
| 3130 | |
| 3131 | } |
| 3132 | return vosStatus; |
| 3133 | } |
| 3134 | |
| 3135 | /* --------------------------------------------------------------------------- |
| 3136 | |
| 3137 | \fn csrNeighborRoamNeighborLookupUPCallback |
| 3138 | |
| 3139 | \brief This function is registered with TL to indicate whenever the RSSI |
| 3140 | gets better than the neighborLookup RSSI Threshold |
| 3141 | |
| 3142 | \param pAdapter - VOS Context |
| 3143 | trafficStatus - UP/DOWN indication from TL |
| 3144 | pUserCtxt - Parameter for callback registered during callback registration. Should be pMac |
| 3145 | |
| 3146 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3147 | |
| 3148 | ---------------------------------------------------------------------------*/ |
| 3149 | VOS_STATUS csrNeighborRoamNeighborLookupUPCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification, |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 3150 | v_PVOID_t pUserCtxt, |
| 3151 | v_S7_t avgRssi) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3152 | { |
| 3153 | tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt ); |
| 3154 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3155 | VOS_STATUS vosStatus = eHAL_STATUS_SUCCESS; |
| 3156 | |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 3157 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Neighbor Lookup UP indication callback called with notification %d Reported RSSI = %d"), |
| 3158 | rssiNotification, |
| 3159 | avgRssi); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3160 | |
| 3161 | if(!csrIsConnStateConnectedInfra(pMac, pNeighborRoamInfo->csrSessionId)) |
| 3162 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 3163 | smsLog(pMac, LOGW, "Ignoring the indication as we are not connected"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3164 | return VOS_STATUS_SUCCESS; |
| 3165 | } |
| 3166 | |
| 3167 | VOS_ASSERT(WLANTL_HO_THRESHOLD_UP == rssiNotification); |
| 3168 | vosStatus = csrNeighborRoamNeighborLookupUpEvent(pMac); |
| 3169 | return vosStatus; |
| 3170 | } |
| 3171 | |
| 3172 | /* --------------------------------------------------------------------------- |
| 3173 | |
| 3174 | \fn csrNeighborRoamNeighborLookupDOWNCallback |
| 3175 | |
| 3176 | \brief This function is registered with TL to indicate whenever the RSSI |
| 3177 | falls below the current neighborLookup RSSI Threshold |
| 3178 | |
| 3179 | \param pAdapter - VOS Context |
| 3180 | trafficStatus - UP/DOWN indication from TL |
| 3181 | pUserCtxt - Parameter for callback registered during callback registration. Should be pMac |
| 3182 | |
| 3183 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3184 | |
| 3185 | ---------------------------------------------------------------------------*/ |
| 3186 | VOS_STATUS csrNeighborRoamNeighborLookupDOWNCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification, |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 3187 | v_PVOID_t pUserCtxt, |
| 3188 | v_S7_t avgRssi) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3189 | { |
| 3190 | tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt ); |
| 3191 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3192 | VOS_STATUS vosStatus = eHAL_STATUS_SUCCESS; |
| 3193 | |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 3194 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Neighbor Lookup DOWN indication callback called with notification %d Reported RSSI = %d"), |
| 3195 | rssiNotification, |
| 3196 | avgRssi); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3197 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 3198 | #ifdef FEATURE_WLAN_LFR |
| 3199 | pNeighborRoamInfo->lookupDOWNRssi = avgRssi; |
| 3200 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3201 | if(!csrIsConnStateConnectedInfra(pMac, pNeighborRoamInfo->csrSessionId)) |
| 3202 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 3203 | smsLog(pMac, LOGW, "Ignoring the indication as we are not connected"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3204 | return VOS_STATUS_SUCCESS; |
| 3205 | } |
| 3206 | |
| 3207 | VOS_ASSERT(WLANTL_HO_THRESHOLD_DOWN == rssiNotification); |
| 3208 | vosStatus = csrNeighborRoamNeighborLookupDownEvent(pMac); |
| 3209 | |
| 3210 | return vosStatus; |
| 3211 | } |
| 3212 | |
| 3213 | #ifdef RSSI_HACK |
| 3214 | extern int dumpCmdRSSI; |
| 3215 | #endif |
| 3216 | |
| 3217 | /* --------------------------------------------------------------------------- |
| 3218 | |
| 3219 | \fn csrNeighborRoamIndicateDisconnect |
| 3220 | |
| 3221 | \brief This function is called by CSR as soon as the station disconnects from |
| 3222 | the AP. This function does the necessary cleanup of neighbor roam data |
| 3223 | structures. Neighbor roam state transitions to INIT state whenever this |
| 3224 | function is called except if the current state is REASSOCIATING |
| 3225 | |
| 3226 | \param pMac - The handle returned by macOpen. |
| 3227 | sessionId - CSR session id that got disconnected |
| 3228 | |
| 3229 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3230 | |
| 3231 | ---------------------------------------------------------------------------*/ |
| 3232 | eHalStatus csrNeighborRoamIndicateDisconnect(tpAniSirGlobal pMac, tANI_U8 sessionId) |
| 3233 | { |
| 3234 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3235 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 3236 | smsLog(pMac, LOGE, FL("Disconnect indication on session %d in state %d (sub-state %d)"), |
Madan Mohan Koyyalamudi | 5ad3dff | 2012-10-21 11:32:02 -0700 | [diff] [blame] | 3237 | sessionId, pNeighborRoamInfo->neighborRoamState, |
| 3238 | pMac->roam.curSubState[sessionId]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3239 | |
| 3240 | #ifdef FEATURE_WLAN_CCX |
| 3241 | { |
| 3242 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId); |
| 3243 | if (pSession->connectedProfile.isCCXAssoc) |
| 3244 | { |
| 3245 | vos_mem_copy(&pSession->prevApSSID, &pSession->connectedProfile.SSID, sizeof(tSirMacSSid)); |
| 3246 | vos_mem_copy(pSession->prevApBssid, pSession->connectedProfile.bssid, sizeof(tSirMacAddr)); |
| 3247 | pSession->prevOpChannel = pSession->connectedProfile.operationChannel; |
| 3248 | pSession->isPrevApInfoValid = TRUE; |
| 3249 | pSession->roamTS1 = vos_timer_get_system_time(); |
| 3250 | |
| 3251 | } |
| 3252 | } |
| 3253 | #endif |
| 3254 | |
| 3255 | #ifdef RSSI_HACK |
| 3256 | dumpCmdRSSI = -40; |
| 3257 | #endif |
| 3258 | switch (pNeighborRoamInfo->neighborRoamState) |
| 3259 | { |
| 3260 | case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING: |
| 3261 | // Stop scan and neighbor refresh timers. |
| 3262 | // These are indeed not required when we are in reassociating |
| 3263 | // state. |
| 3264 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 3265 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3266 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer); |
Madan Mohan Koyyalamudi | 5ad3dff | 2012-10-21 11:32:02 -0700 | [diff] [blame] | 3267 | if (!CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId )) { |
| 3268 | /* |
| 3269 | * Disconnect indication during Disassoc Handoff sub-state |
| 3270 | * is received when we are trying to disconnect with the old |
| 3271 | * AP during roam. BUT, if receive a disconnect indication |
| 3272 | * outside of Disassoc Handoff sub-state, then it means that |
| 3273 | * this is a genuine disconnect and we need to clean up. |
| 3274 | * Otherwise, we will be stuck in reassoc state which will |
| 3275 | * in-turn block scans (see csrIsScanAllowed). |
| 3276 | */ |
| 3277 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT); |
| 3278 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3279 | break; |
| 3280 | |
| 3281 | case eCSR_NEIGHBOR_ROAM_STATE_INIT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3282 | csrNeighborRoamResetInitStateControlInfo(pMac); |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 3283 | csrNeighborRoamDeregAllRssiIndication(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3284 | break; |
| 3285 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 3286 | case eCSR_NEIGHBOR_ROAM_STATE_CONNECTED: |
| 3287 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT) |
| 3288 | csrNeighborRoamResetConnectedStateControlInfo(pMac); |
| 3289 | csrNeighborRoamDeregAllRssiIndication(pMac); |
| 3290 | break; |
| 3291 | |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 3292 | case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN: |
| 3293 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT); |
| 3294 | csrNeighborRoamResetCfgListChanScanControlInfo(pMac); |
| 3295 | csrNeighborRoamDeregAllRssiIndication(pMac); |
| 3296 | break; |
| 3297 | |
| 3298 | case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE: |
| 3299 | /* Stop pre-auth to reassoc interval timer */ |
| 3300 | palTimerStop(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer); |
Madan Mohan Koyyalamudi | 4f292df | 2012-09-18 17:27:40 -0700 | [diff] [blame] | 3301 | case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN: |
| 3302 | case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING: |
| 3303 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT) |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 3304 | csrNeighborRoamResetPreauthControlInfo(pMac); |
Madan Mohan Koyyalamudi | 4f292df | 2012-09-18 17:27:40 -0700 | [diff] [blame] | 3305 | csrNeighborRoamResetReportScanStateControlInfo(pMac); |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 3306 | csrNeighborRoamDeregAllRssiIndication(pMac); |
Madan Mohan Koyyalamudi | 4f292df | 2012-09-18 17:27:40 -0700 | [diff] [blame] | 3307 | break; |
| 3308 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3309 | default: |
Madan Mohan Koyyalamudi | 5695b50 | 2012-09-24 14:21:12 -0700 | [diff] [blame] | 3310 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Received disconnect event in state %d"), pNeighborRoamInfo->neighborRoamState); |
| 3311 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Transitioning to INIT state")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3312 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT) |
Madan Mohan Koyyalamudi | 4f292df | 2012-09-18 17:27:40 -0700 | [diff] [blame] | 3313 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3314 | } |
| 3315 | return eHAL_STATUS_SUCCESS; |
| 3316 | } |
| 3317 | |
| 3318 | /* --------------------------------------------------------------------------- |
| 3319 | |
| 3320 | \fn csrNeighborRoamIndicateConnect |
| 3321 | |
| 3322 | \brief This function is called by CSR as soon as the station connects to an AP. |
| 3323 | This initializes all the necessary data structures related to the |
| 3324 | associated AP and transitions the state to CONNECTED state |
| 3325 | |
| 3326 | \param pMac - The handle returned by macOpen. |
| 3327 | sessionId - CSR session id that got connected |
| 3328 | vosStatus - connect status SUCCESS/FAILURE |
| 3329 | |
| 3330 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3331 | |
| 3332 | ---------------------------------------------------------------------------*/ |
| 3333 | eHalStatus csrNeighborRoamIndicateConnect(tpAniSirGlobal pMac, tANI_U8 sessionId, VOS_STATUS vosStatus) |
| 3334 | { |
| 3335 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3336 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3337 | VOS_STATUS vstatus; |
| 3338 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3339 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3340 | int init_ft_flag = FALSE; |
| 3341 | #endif |
| 3342 | |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 3343 | smsLog(pMac, LOG2, FL("Connect indication received with session id %d in state %d"), sessionId, pNeighborRoamInfo->neighborRoamState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3344 | |
| 3345 | switch (pNeighborRoamInfo->neighborRoamState) |
| 3346 | { |
| 3347 | case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING: |
| 3348 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 3349 | { |
| 3350 | /* Just transition the state to INIT state. Rest of the clean up happens when we get next connect indication */ |
| 3351 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT) |
| 3352 | break; |
| 3353 | } |
| 3354 | /* Fall through if the status is SUCCESS */ |
| 3355 | case eCSR_NEIGHBOR_ROAM_STATE_INIT: |
| 3356 | /* Reset all the data structures here */ |
| 3357 | csrNeighborRoamResetInitStateControlInfo(pMac); |
| 3358 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3359 | pNeighborRoamInfo->csrSessionId = sessionId; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3360 | |
| 3361 | #ifdef FEATURE_WLAN_LFR |
| 3362 | /* |
| 3363 | * Initialize the occupied list ONLY if we are |
| 3364 | * transitioning from INIT state to CONNECTED state. |
| 3365 | */ |
| 3366 | if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState) |
| 3367 | csrInitOccupiedChannelsList(pMac); |
| 3368 | #endif |
| 3369 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED); |
| 3370 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3371 | vos_mem_copy(pNeighborRoamInfo->currAPbssid, |
| 3372 | pMac->roam.roamSession[sessionId].connectedProfile.bssid, sizeof(tCsrBssid)); |
| 3373 | pNeighborRoamInfo->currAPoperationChannel = pMac->roam.roamSession[sessionId].connectedProfile.operationChannel; |
| 3374 | pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac; |
| 3375 | pNeighborRoamInfo->neighborScanTimerInfo.sessionId = sessionId; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3376 | pNeighborRoamInfo->currentNeighborLookupThreshold = |
| 3377 | pNeighborRoamInfo->cfgParams.neighborLookupThreshold; |
| 3378 | #ifdef FEATURE_WLAN_LFR |
| 3379 | pNeighborRoamInfo->uEmptyScanCount = 0; |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 3380 | pNeighborRoamInfo->lookupDOWNRssi = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3381 | pNeighborRoamInfo->uScanMode = DEFAULT_SCAN; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3382 | #endif |
| 3383 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3384 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3385 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3386 | /* Now we can clear the preauthDone that was saved as we are connected afresh */ |
| 3387 | csrNeighborRoamFreeRoamableBSSList(pMac, &pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList); |
| 3388 | #endif |
| 3389 | |
| 3390 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 3391 | // Based on the auth scheme tell if we are 11r |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3392 | if ( csrIsAuthType11r( pMac->roam.roamSession[sessionId].connectedProfile.AuthType, |
| 3393 | pMac->roam.roamSession[sessionId].connectedProfile.MDID.mdiePresent)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3394 | { |
| 3395 | if (pMac->roam.configParam.isFastTransitionEnabled) |
| 3396 | init_ft_flag = TRUE; |
| 3397 | pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_TRUE; |
| 3398 | } |
| 3399 | else |
| 3400 | pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_FALSE; |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 3401 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("11rAssoc is = %d"), pNeighborRoamInfo->is11rAssoc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3402 | #endif |
| 3403 | |
| 3404 | #ifdef FEATURE_WLAN_CCX |
| 3405 | // Based on the auth scheme tell if we are 11r |
| 3406 | if (pMac->roam.roamSession[sessionId].connectedProfile.isCCXAssoc) |
| 3407 | { |
| 3408 | if (pMac->roam.configParam.isFastTransitionEnabled) |
| 3409 | init_ft_flag = TRUE; |
| 3410 | pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_TRUE; |
| 3411 | } |
| 3412 | else |
| 3413 | pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_FALSE; |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 3414 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("isCCXAssoc is = %d ft = %d"), |
| 3415 | pNeighborRoamInfo->isCCXAssoc, init_ft_flag); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3416 | |
| 3417 | #endif |
| 3418 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3419 | #ifdef FEATURE_WLAN_LFR |
| 3420 | // If "Legacy Fast Roaming" is enabled |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 3421 | if (csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3422 | { |
| 3423 | init_ft_flag = TRUE; |
| 3424 | } |
| 3425 | #endif |
| 3426 | |
| 3427 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3428 | if ( init_ft_flag == TRUE ) |
| 3429 | { |
| 3430 | /* Initialize all the data structures needed for the 11r FT Preauth */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3431 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0; |
| 3432 | csrNeighborRoamPurgePreauthFailedList(pMac); |
| 3433 | |
| 3434 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"), pNeighborRoamInfo->currentNeighborLookupThreshold); |
| 3435 | /* Register Neighbor Lookup threshold callback with TL for DOWN event only */ |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3436 | vstatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3437 | WLANTL_HO_THRESHOLD_DOWN, |
| 3438 | csrNeighborRoamNeighborLookupDOWNCallback, |
| 3439 | VOS_MODULE_ID_SME, pMac); |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 3440 | #ifdef FEATURE_WLAN_LFR |
| 3441 | pNeighborRoamInfo->lookupDOWNRssi = 0; |
| 3442 | #endif |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3443 | if(!VOS_IS_STATUS_SUCCESS(vstatus)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3444 | { |
| 3445 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 3446 | smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d"), vstatus); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3447 | status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3448 | } |
| 3449 | } |
| 3450 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3451 | break; |
| 3452 | default: |
| 3453 | smsLog(pMac, LOGE, FL("Connect event received in invalid state %d..Ignoring..."), pNeighborRoamInfo->neighborRoamState); |
| 3454 | break; |
| 3455 | } |
| 3456 | return status; |
| 3457 | } |
| 3458 | |
| 3459 | |
| 3460 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 3461 | /* --------------------------------------------------------------------------- |
| 3462 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3463 | \fn csrNeighborRoamPurgePreauthFailedList |
| 3464 | |
| 3465 | \brief This function purges all the MAC addresses in the pre-auth fail list |
| 3466 | |
| 3467 | \param pMac - The handle returned by macOpen. |
| 3468 | |
| 3469 | \return VOID |
| 3470 | |
| 3471 | ---------------------------------------------------------------------------*/ |
| 3472 | void csrNeighborRoamPurgePreauthFailedList(tpAniSirGlobal pMac) |
| 3473 | { |
| 3474 | tANI_U8 i; |
| 3475 | |
| 3476 | for (i = 0; i < pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.numMACAddress; i++) |
| 3477 | { |
| 3478 | vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.macAddress[i], sizeof(tSirMacAddr)); |
| 3479 | } |
| 3480 | pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.numMACAddress = 0; |
| 3481 | |
| 3482 | return; |
| 3483 | } |
| 3484 | |
| 3485 | /* --------------------------------------------------------------------------- |
| 3486 | |
| 3487 | \fn csrNeighborRoamInit11rAssocInfo |
| 3488 | |
| 3489 | \brief This function initializes 11r related neighbor roam data structures |
| 3490 | |
| 3491 | \param pMac - The handle returned by macOpen. |
| 3492 | |
| 3493 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3494 | |
| 3495 | ---------------------------------------------------------------------------*/ |
| 3496 | eHalStatus csrNeighborRoamInit11rAssocInfo(tpAniSirGlobal pMac) |
| 3497 | { |
| 3498 | eHalStatus status; |
| 3499 | tpCsr11rAssocNeighborInfo pFTRoamInfo = &pMac->roam.neighborRoamInfo.FTRoamInfo; |
| 3500 | |
| 3501 | pMac->roam.neighborRoamInfo.is11rAssoc = eANI_BOOLEAN_FALSE; |
| 3502 | pMac->roam.neighborRoamInfo.cfgParams.maxNeighborRetries = pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries; |
| 3503 | pFTRoamInfo->neighborReportTimeout = CSR_NEIGHBOR_ROAM_REPORT_QUERY_TIMEOUT; |
| 3504 | pFTRoamInfo->PEPreauthRespTimeout = CSR_NEIGHBOR_ROAM_PREAUTH_RSP_WAIT_MULTIPLIER * pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod; |
| 3505 | pFTRoamInfo->neighborRptPending = eANI_BOOLEAN_FALSE; |
| 3506 | pFTRoamInfo->preauthRspPending = eANI_BOOLEAN_FALSE; |
| 3507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3508 | pMac->roam.neighborRoamInfo.FTRoamInfo.currentNeighborRptRetryNum = 0; |
| 3509 | pMac->roam.neighborRoamInfo.FTRoamInfo.numBssFromNeighborReport = 0; |
| 3510 | vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.neighboReportBssInfo, |
| 3511 | sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT); |
| 3512 | |
| 3513 | |
| 3514 | status = csrLLOpen(pMac->hHdd, &pFTRoamInfo->preAuthDoneList); |
| 3515 | if (eHAL_STATUS_SUCCESS != status) |
| 3516 | { |
| 3517 | smsLog(pMac, LOGE, FL("LL Open of preauth done AP List failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3518 | return eHAL_STATUS_RESOURCES; |
| 3519 | } |
| 3520 | return status; |
| 3521 | } |
| 3522 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 3523 | |
| 3524 | /* --------------------------------------------------------------------------- |
| 3525 | |
| 3526 | \fn csrNeighborRoamInit |
| 3527 | |
| 3528 | \brief This function initializes neighbor roam data structures |
| 3529 | |
| 3530 | \param pMac - The handle returned by macOpen. |
| 3531 | |
| 3532 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3533 | |
| 3534 | ---------------------------------------------------------------------------*/ |
| 3535 | eHalStatus csrNeighborRoamInit(tpAniSirGlobal pMac) |
| 3536 | { |
| 3537 | eHalStatus status; |
| 3538 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3539 | |
| 3540 | pNeighborRoamInfo->neighborRoamState = eCSR_NEIGHBOR_ROAM_STATE_CLOSED; |
| 3541 | pNeighborRoamInfo->prevNeighborRoamState = eCSR_NEIGHBOR_ROAM_STATE_CLOSED; |
| 3542 | pNeighborRoamInfo->csrSessionId = CSR_SESSION_ID_INVALID; |
| 3543 | pNeighborRoamInfo->cfgParams.maxChannelScanTime = pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime; |
| 3544 | pNeighborRoamInfo->cfgParams.minChannelScanTime = pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime; |
| 3545 | pNeighborRoamInfo->cfgParams.maxNeighborRetries = 0; |
| 3546 | pNeighborRoamInfo->cfgParams.neighborLookupThreshold = pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold; |
| 3547 | pNeighborRoamInfo->cfgParams.neighborReassocThreshold = pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold; |
| 3548 | pNeighborRoamInfo->cfgParams.neighborScanPeriod = pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod; |
| 3549 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod = pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3550 | pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod = pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod; |
| 3551 | |
| 3552 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 3553 | pNeighborRoamInfo->cfgParams.countryChannelInfo.revision = SME_KR_25; |
| 3554 | pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.ChannelList = NULL; |
| 3555 | pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels = 0; |
| 3556 | |
| 3557 | if (0 == strncmp(pMac->scan.countryCodeCurrent, "KR", 2)) |
| 3558 | { |
| 3559 | csrInitCountryValidChannelList(pMac, SME_KR_25); |
| 3560 | } |
| 3561 | #endif |
| 3562 | |
| 3563 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3564 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; |
| 3565 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3566 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3567 | vos_mem_malloc(pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels); |
| 3568 | |
| 3569 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 3570 | { |
| 3571 | smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed")); |
| 3572 | return eHAL_STATUS_RESOURCES; |
| 3573 | } |
| 3574 | |
| 3575 | /* Update the roam global structure from CFG */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3576 | palCopyMemory(pMac->hHdd, pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3577 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList, |
| 3578 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels); |
| 3579 | |
| 3580 | vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0); |
| 3581 | pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3582 | #ifdef FEATURE_WLAN_LFR |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 3583 | pNeighborRoamInfo->lookupDOWNRssi = 0; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3584 | pNeighborRoamInfo->uEmptyScanCount = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3585 | pNeighborRoamInfo->uScanMode = DEFAULT_SCAN; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3586 | palZeroMemory(pMac->hHdd, &pNeighborRoamInfo->prevConnProfile, |
| 3587 | sizeof(tCsrRoamConnectedProfile)); |
| 3588 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3589 | pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE; |
| 3590 | |
| 3591 | pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac; |
| 3592 | pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 3593 | status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->neighborScanTimer, |
| 3594 | csrNeighborRoamNeighborScanTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo); |
| 3595 | |
| 3596 | if (eHAL_STATUS_SUCCESS != status) |
| 3597 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3598 | smsLog(pMac, LOGE, FL("Neighbor scan timer allocation failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3599 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 3600 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
| 3601 | return eHAL_STATUS_RESOURCES; |
| 3602 | } |
| 3603 | |
| 3604 | status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->neighborResultsRefreshTimer, |
| 3605 | csrNeighborRoamResultsRefreshTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo); |
| 3606 | |
| 3607 | if (eHAL_STATUS_SUCCESS != status) |
| 3608 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3609 | smsLog(pMac, LOGE, FL("Neighbor results refresh timer allocation failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3610 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 3611 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
| 3612 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 3613 | return eHAL_STATUS_RESOURCES; |
| 3614 | } |
| 3615 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3616 | status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->emptyScanRefreshTimer, |
| 3617 | csrNeighborRoamEmptyScanRefreshTimerCallback, |
| 3618 | (void *)&pNeighborRoamInfo->neighborScanTimerInfo); |
| 3619 | |
| 3620 | if (eHAL_STATUS_SUCCESS != status) |
| 3621 | { |
| 3622 | smsLog(pMac, LOGE, FL("Empty scan refresh timer allocation failed")); |
| 3623 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 3624 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
| 3625 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 3626 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer); |
| 3627 | return eHAL_STATUS_RESOURCES; |
| 3628 | } |
| 3629 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3630 | status = csrLLOpen(pMac->hHdd, &pNeighborRoamInfo->roamableAPList); |
| 3631 | if (eHAL_STATUS_SUCCESS != status) |
| 3632 | { |
| 3633 | smsLog(pMac, LOGE, FL("LL Open of roamable AP List failed")); |
| 3634 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 3635 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
| 3636 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 3637 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3638 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3639 | return eHAL_STATUS_RESOURCES; |
| 3640 | } |
| 3641 | |
| 3642 | pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX; |
| 3643 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0; |
| 3644 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
| 3645 | pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE; |
| 3646 | pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE; |
| 3647 | |
| 3648 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 3649 | status = csrNeighborRoamInit11rAssocInfo(pMac); |
| 3650 | if (eHAL_STATUS_SUCCESS != status) |
| 3651 | { |
| 3652 | smsLog(pMac, LOGE, FL("LL Open of roamable AP List failed")); |
| 3653 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 3654 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
| 3655 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 3656 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3657 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3658 | csrLLClose(&pNeighborRoamInfo->roamableAPList); |
| 3659 | return eHAL_STATUS_RESOURCES; |
| 3660 | } |
| 3661 | #endif |
| 3662 | /* Initialize this with the current tick count */ |
| 3663 | pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 3664 | |
| 3665 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT) |
| 3666 | |
| 3667 | return eHAL_STATUS_SUCCESS; |
| 3668 | } |
| 3669 | |
| 3670 | /* --------------------------------------------------------------------------- |
| 3671 | |
| 3672 | \fn csrNeighborRoamClose |
| 3673 | |
| 3674 | \brief This function closes/frees all the neighbor roam data structures |
| 3675 | |
| 3676 | \param pMac - The handle returned by macOpen. |
| 3677 | |
| 3678 | \return VOID |
| 3679 | |
| 3680 | ---------------------------------------------------------------------------*/ |
| 3681 | void csrNeighborRoamClose(tpAniSirGlobal pMac) |
| 3682 | { |
| 3683 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3684 | |
| 3685 | if (eCSR_NEIGHBOR_ROAM_STATE_CLOSED == pNeighborRoamInfo->neighborRoamState) |
| 3686 | { |
Madan Mohan Koyyalamudi | 8b7f1e6 | 2012-10-05 14:56:51 -0700 | [diff] [blame] | 3687 | smsLog(pMac, LOGW, FL("Neighbor Roam Algorithm Already Closed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3688 | return; |
| 3689 | } |
| 3690 | |
| 3691 | if (pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 3692 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 3693 | |
| 3694 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
| 3695 | |
| 3696 | pNeighborRoamInfo->neighborScanTimerInfo.pMac = NULL; |
| 3697 | pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 3698 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 3699 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3700 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3701 | |
| 3702 | /* Should free up the nodes in the list before closing the double Linked list */ |
| 3703 | csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList); |
| 3704 | csrLLClose(&pNeighborRoamInfo->roamableAPList); |
| 3705 | |
| 3706 | if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList) |
| 3707 | { |
| 3708 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 3709 | } |
| 3710 | |
| 3711 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
| 3712 | pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX; |
| 3713 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0; |
| 3714 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
| 3715 | pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE; |
| 3716 | pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE; |
| 3717 | |
| 3718 | /* Free the profile.. */ |
| 3719 | csrReleaseProfile(pMac, &pNeighborRoamInfo->csrNeighborRoamProfile); |
Sandeep P | c4818ef | 2012-12-13 14:19:25 -0800 | [diff] [blame] | 3720 | #ifdef FEATURE_WLAN_LFR |
Sandeep P | c2b00f6 | 2012-12-12 16:44:44 -0800 | [diff] [blame] | 3721 | csrRoamFreeConnectProfile(pMac, &pNeighborRoamInfo->prevConnProfile); |
Sandeep P | c4818ef | 2012-12-13 14:19:25 -0800 | [diff] [blame] | 3722 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3723 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 3724 | pMac->roam.neighborRoamInfo.FTRoamInfo.currentNeighborRptRetryNum = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3725 | pMac->roam.neighborRoamInfo.FTRoamInfo.numBssFromNeighborReport = 0; |
| 3726 | vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.neighboReportBssInfo, |
| 3727 | sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT); |
| 3728 | csrNeighborRoamFreeRoamableBSSList(pMac, &pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList); |
| 3729 | csrLLClose(&pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList); |
| 3730 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 3731 | |
| 3732 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CLOSED) |
| 3733 | |
| 3734 | return; |
| 3735 | } |
| 3736 | |
| 3737 | /* --------------------------------------------------------------------------- |
| 3738 | |
| 3739 | \fn csrNeighborRoamRequestHandoff |
| 3740 | |
| 3741 | \brief This function triggers actual switching from one AP to the new AP. |
| 3742 | It issues disassociate with reason code as Handoff and CSR as a part of |
| 3743 | handling disassoc rsp, issues reassociate to the new AP |
| 3744 | |
| 3745 | \param pMac - The handle returned by macOpen. |
| 3746 | |
| 3747 | \return VOID |
| 3748 | |
| 3749 | ---------------------------------------------------------------------------*/ |
| 3750 | void csrNeighborRoamRequestHandoff(tpAniSirGlobal pMac) |
| 3751 | { |
| 3752 | |
| 3753 | tCsrRoamInfo roamInfo; |
| 3754 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3755 | tANI_U32 sessionId = pNeighborRoamInfo->csrSessionId; |
| 3756 | tCsrNeighborRoamBSSInfo handoffNode; |
| 3757 | extern void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeDisassocRsp ); |
| 3758 | tANI_U32 roamId = 0; |
| 3759 | |
| 3760 | if (pMac->roam.neighborRoamInfo.neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE) |
| 3761 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 3762 | smsLog(pMac, LOGE, FL("Roam requested when Neighbor roam is in %d state"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3763 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 3764 | return; |
| 3765 | } |
| 3766 | |
| 3767 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 3768 | csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId, &roamInfo, roamId, eCSR_ROAM_FT_START, |
| 3769 | eSIR_SME_SUCCESS); |
| 3770 | |
| 3771 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 3772 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING) |
| 3773 | |
| 3774 | csrNeighborRoamGetHandoffAPInfo(pMac, &handoffNode); |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 3775 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 3776 | FL("HANDOFF CANDIDATE BSSID %02x:%02x:%02x:%02x:%02x:%02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3777 | handoffNode.pBssDescription->bssId[0], |
| 3778 | handoffNode.pBssDescription->bssId[1], |
| 3779 | handoffNode.pBssDescription->bssId[2], |
| 3780 | handoffNode.pBssDescription->bssId[3], |
| 3781 | handoffNode.pBssDescription->bssId[4], |
| 3782 | handoffNode.pBssDescription->bssId[5]); |
| 3783 | |
| 3784 | /* Free the profile.. Just to make sure we dont leak memory here */ |
| 3785 | csrReleaseProfile(pMac, &pNeighborRoamInfo->csrNeighborRoamProfile); |
| 3786 | /* Create the Handoff AP profile. Copy the currently connected profile and update only the BSSID and channel number |
| 3787 | This should happen before issuing disconnect */ |
| 3788 | csrRoamCopyConnectedProfile(pMac, pNeighborRoamInfo->csrSessionId, &pNeighborRoamInfo->csrNeighborRoamProfile); |
| 3789 | vos_mem_copy(pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, handoffNode.pBssDescription->bssId, sizeof(tSirMacAddr)); |
| 3790 | pNeighborRoamInfo->csrNeighborRoamProfile.ChannelInfo.ChannelList[0] = handoffNode.pBssDescription->channelId; |
| 3791 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 3792 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, " csrRoamHandoffRequested: disassociating with current AP"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3793 | |
| 3794 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_HANDOFF))) |
| 3795 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame^] | 3796 | smsLog(pMac, LOGW, "csrRoamHandoffRequested: fail to issue disassociate"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3797 | return; |
| 3798 | } |
| 3799 | |
| 3800 | //notify HDD for handoff, providing the BSSID too |
| 3801 | roamInfo.reasonCode = eCsrRoamReasonBetterAP; |
| 3802 | |
| 3803 | vos_mem_copy(roamInfo.bssid, |
| 3804 | handoffNode.pBssDescription->bssId, |
| 3805 | sizeof( tCsrBssid )); |
| 3806 | |
| 3807 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
| 3808 | |
| 3809 | |
| 3810 | return; |
| 3811 | } |
| 3812 | |
| 3813 | /* --------------------------------------------------------------------------- |
| 3814 | |
| 3815 | \fn csrNeighborRoamIsHandoffInProgress |
| 3816 | |
| 3817 | \brief This function returns whether handoff is in progress or not based on |
| 3818 | the current neighbor roam state |
| 3819 | |
| 3820 | \param pMac - The handle returned by macOpen. |
| 3821 | is11rReassoc - Return whether reassoc is of type 802.11r reassoc |
| 3822 | |
| 3823 | \return eANI_BOOLEAN_TRUE if reassoc in progress, eANI_BOOLEAN_FALSE otherwise |
| 3824 | |
| 3825 | ---------------------------------------------------------------------------*/ |
| 3826 | tANI_BOOLEAN csrNeighborRoamIsHandoffInProgress(tpAniSirGlobal pMac) |
| 3827 | { |
| 3828 | if (eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING == pMac->roam.neighborRoamInfo.neighborRoamState) |
| 3829 | return eANI_BOOLEAN_TRUE; |
| 3830 | |
| 3831 | return eANI_BOOLEAN_FALSE; |
| 3832 | } |
| 3833 | |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 3834 | #if defined(WLAN_FEATURE_VOWIFI_11R) || defined(WLAN_FEATURE_NEIGHBOR_ROAMING) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3835 | /* --------------------------------------------------------------------------- |
| 3836 | |
| 3837 | \fn csrNeighborRoamIs11rAssoc |
| 3838 | |
| 3839 | \brief This function returns whether the current association is a 11r assoc or not |
| 3840 | |
| 3841 | \param pMac - The handle returned by macOpen. |
| 3842 | |
| 3843 | \return eANI_BOOLEAN_TRUE if current assoc is 11r, eANI_BOOLEAN_FALSE otherwise |
| 3844 | |
| 3845 | ---------------------------------------------------------------------------*/ |
| 3846 | tANI_BOOLEAN csrNeighborRoamIs11rAssoc(tpAniSirGlobal pMac) |
| 3847 | { |
| 3848 | return pMac->roam.neighborRoamInfo.is11rAssoc; |
| 3849 | } |
| 3850 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 3851 | |
| 3852 | |
| 3853 | /* --------------------------------------------------------------------------- |
| 3854 | |
| 3855 | \fn csrNeighborRoamGetHandoffAPInfo |
| 3856 | |
| 3857 | \brief This function returns the best possible AP for handoff. For 11R case, it |
| 3858 | returns the 1st entry from pre-auth done list. For non-11r case, it returns |
| 3859 | the 1st entry from roamable AP list |
| 3860 | |
| 3861 | \param pMac - The handle returned by macOpen. |
| 3862 | pHandoffNode - AP node that is the handoff candidate returned |
| 3863 | |
| 3864 | \return VOID |
| 3865 | |
| 3866 | ---------------------------------------------------------------------------*/ |
| 3867 | void csrNeighborRoamGetHandoffAPInfo(tpAniSirGlobal pMac, tpCsrNeighborRoamBSSInfo pHandoffNode) |
| 3868 | { |
| 3869 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3870 | tpCsrNeighborRoamBSSInfo pBssNode; |
| 3871 | |
| 3872 | VOS_ASSERT(NULL != pHandoffNode); |
| 3873 | |
| 3874 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 3875 | if (pNeighborRoamInfo->is11rAssoc) |
| 3876 | { |
| 3877 | /* Always the BSS info in the head is the handoff candidate */ |
| 3878 | pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL); |
| 3879 | NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList)); |
| 3880 | } |
| 3881 | else |
| 3882 | #endif |
| 3883 | #ifdef FEATURE_WLAN_CCX |
| 3884 | if (pNeighborRoamInfo->isCCXAssoc) |
| 3885 | { |
| 3886 | /* Always the BSS info in the head is the handoff candidate */ |
| 3887 | pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL); |
| 3888 | NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList)); |
| 3889 | } |
| 3890 | else |
| 3891 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3892 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 3893 | if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3894 | { |
| 3895 | /* Always the BSS info in the head is the handoff candidate */ |
| 3896 | pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL); |
| 3897 | NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList)); |
| 3898 | } |
| 3899 | else |
| 3900 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3901 | { |
| 3902 | pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL); |
| 3903 | NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->roamableAPList)); |
| 3904 | } |
| 3905 | vos_mem_copy(pHandoffNode, pBssNode, sizeof(tCsrNeighborRoamBSSInfo)); |
| 3906 | |
| 3907 | return; |
| 3908 | } |
| 3909 | |
| 3910 | /* --------------------------------------------------------------------------- |
| 3911 | \brief This function returns TRUE if preauth is completed |
| 3912 | |
| 3913 | \param pMac - The handle returned by macOpen. |
| 3914 | |
| 3915 | \return boolean |
| 3916 | |
| 3917 | ---------------------------------------------------------------------------*/ |
| 3918 | tANI_BOOLEAN csrNeighborRoamStatePreauthDone(tpAniSirGlobal pMac) |
| 3919 | { |
| 3920 | return (pMac->roam.neighborRoamInfo.neighborRoamState == |
| 3921 | eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE); |
| 3922 | } |
| 3923 | |
| 3924 | /* --------------------------------------------------------------------------- |
| 3925 | \brief In the event that we are associated with AP1 and we have |
| 3926 | completed pre auth with AP2. Then we receive a deauth/disassoc from |
| 3927 | AP1. |
| 3928 | At this point neighbor roam is in pre auth done state, pre auth timer |
| 3929 | is running. We now handle this case by stopping timer and clearing |
| 3930 | the pre-auth state. We basically clear up and just go to disconnected |
| 3931 | state. |
| 3932 | |
| 3933 | \param pMac - The handle returned by macOpen. |
| 3934 | |
| 3935 | \return boolean |
| 3936 | ---------------------------------------------------------------------------*/ |
| 3937 | void csrNeighborRoamTranistionPreauthDoneToDisconnected(tpAniSirGlobal pMac) |
| 3938 | { |
| 3939 | if (pMac->roam.neighborRoamInfo.neighborRoamState != |
| 3940 | eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE) return; |
| 3941 | |
| 3942 | // Stop timer |
| 3943 | palTimerStop(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer); |
| 3944 | |
| 3945 | // Transition to init state |
| 3946 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT) |
| 3947 | } |
| 3948 | |
Srikant Kuppa | fef66a7 | 2013-01-30 17:32:44 -0800 | [diff] [blame] | 3949 | /* --------------------------------------------------------------------------- |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 3950 | \brief This function returns TRUE if background scan triggered by |
| 3951 | LFR is in progress. |
Srikant Kuppa | fef66a7 | 2013-01-30 17:32:44 -0800 | [diff] [blame] | 3952 | |
| 3953 | \param halHandle - The handle from HDD context. |
| 3954 | |
| 3955 | \return boolean |
| 3956 | |
| 3957 | ---------------------------------------------------------------------------*/ |
| 3958 | tANI_BOOLEAN csrNeighborRoamScanRspPending (tHalHandle hHal) |
| 3959 | { |
| 3960 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3961 | return (pMac->roam.neighborRoamInfo.scanRspPending); |
| 3962 | } |
| 3963 | |
Srinivas Girigowda | a553c46 | 2013-03-07 19:42:52 -0800 | [diff] [blame] | 3964 | /* --------------------------------------------------------------------------- |
| 3965 | \brief This function returns TRUE if STA is in the middle of roaming states |
| 3966 | |
| 3967 | \param halHandle - The handle from HDD context. |
| 3968 | |
| 3969 | \return boolean |
| 3970 | |
| 3971 | ---------------------------------------------------------------------------*/ |
| 3972 | tANI_BOOLEAN csrNeighborMiddleOfRoaming (tHalHandle hHal) |
| 3973 | { |
| 3974 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 3975 | tANI_BOOLEAN val = (eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING == pMac->roam.neighborRoamInfo.neighborRoamState) || |
| 3976 | (eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING == pMac->roam.neighborRoamInfo.neighborRoamState) || |
| 3977 | (eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE == pMac->roam.neighborRoamInfo.neighborRoamState) || |
| 3978 | (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pMac->roam.neighborRoamInfo.neighborRoamState) || |
| 3979 | (eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN == pMac->roam.neighborRoamInfo.neighborRoamState); |
| 3980 | return (val); |
| 3981 | } |
| 3982 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3983 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |