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