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