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