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