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 | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 1152 | pNeighborRoamInfo->uOsRequestedHandoff = 0; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1153 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_RESTART, REASON_PREAUTH_FAILED_FOR_ALL); |
| 1154 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED); |
| 1155 | } else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1156 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1157 | #endif |
| 1158 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN); |
| 1159 | |
| 1160 | /* Register Neighbor Lookup threshold callback with TL for UP event now */ |
| 1161 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("No more pre-auth candidates-" |
| 1162 | "register UP indication with TL. RSSI = %d,"), NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1)); |
| 1163 | |
| 1164 | vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, |
| 1165 | (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1), |
| 1166 | WLANTL_HO_THRESHOLD_UP, |
| 1167 | csrNeighborRoamNeighborLookupUPCallback, |
| 1168 | VOS_MODULE_ID_SME, pMac); |
| 1169 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1170 | { |
| 1171 | //err msg |
| 1172 | smsLog(pMac, LOGE, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback UP event with TL: Status = %d"), status); |
| 1173 | } |
| 1174 | |
| 1175 | /* Start the neighbor results refresh timer and transition to REPORT_SCAN state to perform scan again */ |
| 1176 | status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer, |
| 1177 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT, |
| 1178 | eANI_BOOLEAN_FALSE); |
| 1179 | if (eHAL_STATUS_SUCCESS != status) |
| 1180 | { |
| 1181 | smsLog(pMac, LOGE, FL("Neighbor results refresh timer start failed with status %d"), status); |
| 1182 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1183 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1184 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1185 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1186 | #endif |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 1187 | |
| 1188 | DEQ_PREAUTH: |
| 1189 | csrRoamDequeuePreauth(pMac); |
Madan Mohan Koyyalamudi | 7a579cc | 2012-10-21 11:25:39 -0700 | [diff] [blame] | 1190 | return preauthProcessed; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1191 | } |
| 1192 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |
| 1193 | |
| 1194 | /* --------------------------------------------------------------------------- |
| 1195 | |
| 1196 | \fn csrNeighborRoamPrepareScanProfileFilter |
| 1197 | |
| 1198 | \brief This function creates a scan filter based on the currently connected profile. |
| 1199 | Based on this filter, scan results are obtained |
| 1200 | |
| 1201 | \param pMac - The handle returned by macOpen. |
| 1202 | pScanFilter - Populated scan filter based on the connected profile |
| 1203 | |
| 1204 | \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise |
| 1205 | |
| 1206 | ---------------------------------------------------------------------------*/ |
| 1207 | eHalStatus csrNeighborRoamPrepareScanProfileFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter) |
| 1208 | { |
| 1209 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1210 | tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId; |
| 1211 | tCsrRoamConnectedProfile *pCurProfile = &pMac->roam.roamSession[sessionId].connectedProfile; |
| 1212 | tANI_U8 i = 0; |
| 1213 | |
| 1214 | VOS_ASSERT(pScanFilter != NULL); |
Gopichand Nakkala | d5a904e | 2013-03-29 01:07:54 +0530 | [diff] [blame] | 1215 | if (pScanFilter == NULL) |
| 1216 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1217 | |
| 1218 | vos_mem_zero(pScanFilter, sizeof(tCsrScanResultFilter)); |
| 1219 | |
| 1220 | /* We dont want to set BSSID based Filter */ |
| 1221 | pScanFilter->BSSIDs.numOfBSSIDs = 0; |
| 1222 | |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 1223 | //only for HDD requested handoff fill in the BSSID in the filter |
| 1224 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1225 | if (pNeighborRoamInfo->uOsRequestedHandoff) |
| 1226 | { |
| 1227 | pScanFilter->BSSIDs.numOfBSSIDs = 1; |
| 1228 | pScanFilter->BSSIDs.bssid = vos_mem_malloc(sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs); |
| 1229 | if (NULL == pScanFilter->BSSIDs.bssid) |
| 1230 | { |
| 1231 | smsLog(pMac, LOGE, FL("Scan Filter BSSID mem alloc failed")); |
| 1232 | return eHAL_STATUS_FAILED_ALLOC; |
| 1233 | } |
| 1234 | |
| 1235 | vos_mem_zero(pScanFilter->BSSIDs.bssid, sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs); |
| 1236 | |
| 1237 | /* Populate the BSSID from handoff info received from HDD */ |
| 1238 | for (i = 0; i < pScanFilter->BSSIDs.numOfBSSIDs; i++) |
| 1239 | { |
| 1240 | vos_mem_copy(&pScanFilter->BSSIDs.bssid[i], |
| 1241 | pNeighborRoamInfo->handoffReqInfo.bssid, sizeof(tSirMacAddr)); |
| 1242 | } |
| 1243 | } |
| 1244 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1245 | /* Populate all the information from the connected profile */ |
| 1246 | pScanFilter->SSIDs.numOfSSIDs = 1; |
| 1247 | pScanFilter->SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo)); |
| 1248 | if (NULL == pScanFilter->SSIDs.SSIDList) |
| 1249 | { |
| 1250 | smsLog(pMac, LOGE, FL("Scan Filter SSID mem alloc failed")); |
| 1251 | return eHAL_STATUS_FAILED_ALLOC; |
| 1252 | } |
| 1253 | pScanFilter->SSIDs.SSIDList->handoffPermitted = 1; |
| 1254 | pScanFilter->SSIDs.SSIDList->ssidHidden = 0; |
| 1255 | pScanFilter->SSIDs.SSIDList->SSID.length = pCurProfile->SSID.length; |
| 1256 | vos_mem_copy((void *)pScanFilter->SSIDs.SSIDList->SSID.ssId, (void *)pCurProfile->SSID.ssId, pCurProfile->SSID.length); |
| 1257 | |
Gopichand Nakkala | 66c0bd0 | 2013-04-10 11:36:29 +0530 | [diff] [blame] | 1258 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Filtering from scan results for" |
| 1259 | "SSID = 0x%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx\nSSID Length = %d"), |
| 1260 | pScanFilter->SSIDs.SSIDList->SSID.ssId[0], |
| 1261 | pScanFilter->SSIDs.SSIDList->SSID.ssId[4], |
| 1262 | pScanFilter->SSIDs.SSIDList->SSID.ssId[8], |
| 1263 | pScanFilter->SSIDs.SSIDList->SSID.ssId[12], |
| 1264 | pScanFilter->SSIDs.SSIDList->SSID.ssId[16], |
| 1265 | pScanFilter->SSIDs.SSIDList->SSID.ssId[20], |
| 1266 | pScanFilter->SSIDs.SSIDList->SSID.ssId[24], |
| 1267 | pScanFilter->SSIDs.SSIDList->SSID.ssId[28], |
| 1268 | pScanFilter->SSIDs.SSIDList->SSID.length); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1269 | pScanFilter->authType.numEntries = 1; |
| 1270 | pScanFilter->authType.authType[0] = pCurProfile->AuthType; |
| 1271 | |
| 1272 | pScanFilter->EncryptionType.numEntries = 1; //This must be 1 |
| 1273 | pScanFilter->EncryptionType.encryptionType[0] = pCurProfile->EncryptionType; |
| 1274 | |
| 1275 | pScanFilter->mcEncryptionType.numEntries = 1; |
| 1276 | pScanFilter->mcEncryptionType.encryptionType[0] = pCurProfile->mcEncryptionType; |
| 1277 | |
| 1278 | pScanFilter->BSSType = pCurProfile->BSSType; |
| 1279 | |
| 1280 | /* We are intrested only in the scan results on channels that we scanned */ |
| 1281 | pScanFilter->ChannelInfo.numOfChannels = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels; |
| 1282 | pScanFilter->ChannelInfo.ChannelList = vos_mem_malloc(pScanFilter->ChannelInfo.numOfChannels * sizeof(tANI_U8)); |
| 1283 | if (NULL == pScanFilter->ChannelInfo.ChannelList) |
| 1284 | { |
| 1285 | smsLog(pMac, LOGE, FL("Scan Filter Channel list mem alloc failed")); |
| 1286 | vos_mem_free(pScanFilter->SSIDs.SSIDList); |
| 1287 | pScanFilter->SSIDs.SSIDList = NULL; |
| 1288 | return eHAL_STATUS_FAILED_ALLOC; |
| 1289 | } |
| 1290 | for (i = 0; i < pScanFilter->ChannelInfo.numOfChannels; i++) |
| 1291 | { |
| 1292 | pScanFilter->ChannelInfo.ChannelList[i] = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i]; |
| 1293 | } |
| 1294 | |
| 1295 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1296 | if (pNeighborRoamInfo->is11rAssoc) |
| 1297 | { |
| 1298 | /* MDIE should be added as a part of profile. This should be added as a part of filter as well */ |
| 1299 | pScanFilter->MDID.mdiePresent = pCurProfile->MDID.mdiePresent; |
| 1300 | pScanFilter->MDID.mobilityDomain = pCurProfile->MDID.mobilityDomain; |
| 1301 | } |
| 1302 | #endif |
| 1303 | |
| 1304 | return eHAL_STATUS_SUCCESS; |
| 1305 | } |
| 1306 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1307 | tANI_U32 csrGetCurrentAPRssi(tpAniSirGlobal pMac, tScanResultHandle *pScanResultList) |
| 1308 | { |
| 1309 | tCsrScanResultInfo *pScanResult; |
| 1310 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
Srinivas Girigowda | 2efea0e | 2013-01-24 17:40:41 -0800 | [diff] [blame] | 1311 | #ifdef FEATURE_WLAN_LFR |
| 1312 | tANI_U32 CurrAPRssi = pNeighborRoamInfo->lookupDOWNRssi; |
| 1313 | #else |
| 1314 | /* We are setting this as default value to make sure we return this value, |
| 1315 | when we do not see this AP in the scan result for some reason.However,it is |
| 1316 | less likely that we are associated to an AP and do not see it in the scan list */ |
| 1317 | tANI_U32 CurrAPRssi = -125; |
| 1318 | #endif |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1319 | |
| 1320 | while (NULL != (pScanResult = csrScanResultGetNext(pMac, *pScanResultList))) |
| 1321 | { |
| 1322 | |
| 1323 | if (VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId, |
| 1324 | pNeighborRoamInfo->currAPbssid, sizeof(tSirMacAddr))) |
| 1325 | { |
| 1326 | /* We got a match with the currently associated AP. |
| 1327 | * Capture the RSSI value and complete the while loop. |
| 1328 | * The while loop is completed in order to make the current entry go back to NULL, |
| 1329 | * and in the next while loop, it properly starts searching from the head of the list. |
| 1330 | * TODO: Can also try setting the current entry directly to NULL as soon as we find the new AP*/ |
| 1331 | |
| 1332 | CurrAPRssi = (int)pScanResult->BssDescriptor.rssi * (-1) ; |
| 1333 | |
| 1334 | } else { |
| 1335 | continue; |
| 1336 | } |
| 1337 | } |
| 1338 | |
| 1339 | return CurrAPRssi; |
| 1340 | |
| 1341 | } |
| 1342 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1343 | /* --------------------------------------------------------------------------- |
| 1344 | |
| 1345 | \fn csrNeighborRoamProcessScanResults |
| 1346 | |
| 1347 | \brief This function extracts scan results, sorts on the basis of neighbor score(todo). |
| 1348 | Assumed that the results are already sorted by RSSI by csrScanGetResult |
| 1349 | |
| 1350 | \param pMac - The handle returned by macOpen. |
| 1351 | pScanResultList - Scan result result obtained from csrScanGetResult() |
| 1352 | |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1353 | \return tANI_BOOLEAN - return TRUE if we have a candidate we can immediately |
| 1354 | roam to. Otherwise, return FALSE. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1355 | |
| 1356 | ---------------------------------------------------------------------------*/ |
| 1357 | |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1358 | static tANI_BOOLEAN csrNeighborRoamProcessScanResults(tpAniSirGlobal pMac, |
| 1359 | tScanResultHandle *pScanResultList) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1360 | { |
| 1361 | tCsrScanResultInfo *pScanResult; |
| 1362 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1363 | tpCsrNeighborRoamBSSInfo pBssInfo; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1364 | tANI_U32 CurrAPRssi; |
| 1365 | tANI_U8 RoamRssiDiff = pMac->roam.configParam.RoamRssiDiff; |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1366 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 1367 | tANI_U8 immediateRoamRssiDiff = pMac->roam.configParam.nImmediateRoamRssiDiff; |
| 1368 | #endif |
| 1369 | tANI_BOOLEAN roamNow = eANI_BOOLEAN_FALSE; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1370 | |
| 1371 | /*************************************************************** |
| 1372 | * Find out the Current AP RSSI and keep it handy to check if |
| 1373 | * it is better than the RSSI of the AP which we are |
| 1374 | * going to roam.If so, we are going to continue with the |
| 1375 | * current AP. |
| 1376 | ***************************************************************/ |
| 1377 | CurrAPRssi = csrGetCurrentAPRssi(pMac, pScanResultList); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1378 | |
| 1379 | /* Expecting the scan result already to be in the sorted order based on the RSSI */ |
| 1380 | /* Based on the previous state we need to check whether the list should be sorted again taking neighbor score into consideration */ |
| 1381 | /* If previous state is CFG_CHAN_LIST_SCAN, there should not be any neighbor score associated with any of the BSS. |
| 1382 | If the previous state is REPORT_QUERY, then there will be neighbor score for each of the APs */ |
| 1383 | /* 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 |
| 1384 | and rssi score are in the same order. This will be taken care later */ |
| 1385 | |
| 1386 | while (NULL != (pScanResult = csrScanResultGetNext(pMac, *pScanResultList))) |
| 1387 | { |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 1388 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 1389 | 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] | 1390 | pScanResult->BssDescriptor.bssId[0], |
| 1391 | pScanResult->BssDescriptor.bssId[1], |
| 1392 | pScanResult->BssDescriptor.bssId[2], |
| 1393 | pScanResult->BssDescriptor.bssId[3], |
| 1394 | pScanResult->BssDescriptor.bssId[4], |
| 1395 | pScanResult->BssDescriptor.bssId[5], |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 1396 | abs(pScanResult->BssDescriptor.rssi), |
| 1397 | pScanResult->BssDescriptor.channelId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1398 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1399 | if (VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1400 | pNeighborRoamInfo->currAPbssid, sizeof(tSirMacAddr))) |
| 1401 | { |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1402 | /* 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] | 1403 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1404 | "SKIP-currently associated AP"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1405 | continue; |
| 1406 | } |
| 1407 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1408 | /* This condition is to ensure to roam to an AP with better RSSI. if the value of RoamRssiDiff is Zero, this feature |
| 1409 | * is disabled and we continue to roam without any check*/ |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1410 | if ((RoamRssiDiff > 0) |
| 1411 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1412 | && !csrRoamIsRoamOffloadScanEnabled(pMac) |
| 1413 | #endif |
| 1414 | ) |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1415 | { |
Madan Mohan Koyyalamudi | f553b74 | 2012-12-03 16:37:39 -0800 | [diff] [blame] | 1416 | /* |
| 1417 | * If RSSI is lower than the lookup threshold, then continue. |
| 1418 | */ |
| 1419 | if (abs(pScanResult->BssDescriptor.rssi) > |
| 1420 | pNeighborRoamInfo->currentNeighborLookupThreshold) |
| 1421 | { |
| 1422 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1423 | "%s: [INFOLOG] new ap rssi (%d) lower than lookup threshold (%d)", |
Madan Mohan Koyyalamudi | f553b74 | 2012-12-03 16:37:39 -0800 | [diff] [blame] | 1424 | __func__, (int)pScanResult->BssDescriptor.rssi * (-1), |
| 1425 | (int)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1)); |
| 1426 | continue; |
| 1427 | } |
| 1428 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1429 | if (abs(CurrAPRssi) < abs(pScanResult->BssDescriptor.rssi)) |
| 1430 | { |
| 1431 | /*Do not roam to an AP with worse RSSI than the current*/ |
| 1432 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1433 | "%s: [INFOLOG]Current AP rssi=%d new ap rssi worse=%d", __func__, |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1434 | CurrAPRssi, |
| 1435 | (int)pScanResult->BssDescriptor.rssi * (-1) ); |
| 1436 | continue; |
| 1437 | } else { |
| 1438 | /*Do not roam to an AP which is having better RSSI than the current AP, but still less than the |
| 1439 | * margin that is provided by user from the ini file (RoamRssiDiff)*/ |
| 1440 | if (abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)) < RoamRssiDiff) |
| 1441 | { |
Madan Mohan Koyyalamudi | 4450acc | 2012-11-15 17:24:31 -0800 | [diff] [blame] | 1442 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1443 | "%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] | 1444 | CurrAPRssi, |
| 1445 | (int)pScanResult->BssDescriptor.rssi * (-1), |
| 1446 | RoamRssiDiff); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1447 | continue; |
| 1448 | } |
| 1449 | else { |
| 1450 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1451 | "%s: [INFOLOG]Current AP rssi=%d new ap rssi better=%d", __func__, |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1452 | CurrAPRssi, |
| 1453 | (int)pScanResult->BssDescriptor.rssi * (-1) ); |
| 1454 | } |
| 1455 | } |
| 1456 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1457 | |
| 1458 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1459 | if (pNeighborRoamInfo->is11rAssoc) |
| 1460 | { |
| 1461 | if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId)) |
| 1462 | { |
| 1463 | smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring")); |
| 1464 | continue; |
| 1465 | } |
| 1466 | } |
| 1467 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 1468 | |
| 1469 | #ifdef FEATURE_WLAN_CCX |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1470 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1471 | if (!csrRoamIsRoamOffloadScanEnabled(pMac)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1472 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1473 | #endif |
| 1474 | if (pNeighborRoamInfo->isCCXAssoc) |
| 1475 | { |
| 1476 | if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId)) |
| 1477 | { |
| 1478 | smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring")); |
| 1479 | continue; |
| 1480 | } |
| 1481 | } |
| 1482 | if ((pScanResult->BssDescriptor.QBSSLoad_present) && |
| 1483 | (pScanResult->BssDescriptor.QBSSLoad_avail)) |
| 1484 | { |
| 1485 | if (pNeighborRoamInfo->isVOAdmitted) |
| 1486 | { |
| 1487 | smsLog(pMac, LOG1, FL("New AP has %x BW available"), (unsigned int)pScanResult->BssDescriptor.QBSSLoad_avail); |
| 1488 | smsLog(pMac, LOG1, FL("We need %x BW available"),(unsigned int)pNeighborRoamInfo->MinQBssLoadRequired); |
| 1489 | if (pScanResult->BssDescriptor.QBSSLoad_avail < pNeighborRoamInfo->MinQBssLoadRequired) |
| 1490 | { |
| 1491 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 1492 | "[INFOLOG]BSSID : %02x:%02x:%02x:%02x:%02x:%02x has no bandwidth ignoring..not adding to roam list", |
| 1493 | pScanResult->BssDescriptor.bssId[0], |
| 1494 | pScanResult->BssDescriptor.bssId[1], |
| 1495 | pScanResult->BssDescriptor.bssId[2], |
| 1496 | pScanResult->BssDescriptor.bssId[3], |
| 1497 | pScanResult->BssDescriptor.bssId[4], |
| 1498 | pScanResult->BssDescriptor.bssId[5]); |
| 1499 | continue; |
| 1500 | } |
| 1501 | } |
| 1502 | } |
| 1503 | else |
| 1504 | { |
| 1505 | smsLog(pMac, LOGE, FL("No QBss %x %x"), (unsigned int)pScanResult->BssDescriptor.QBSSLoad_avail, (unsigned int)pScanResult->BssDescriptor.QBSSLoad_present); |
| 1506 | if (pNeighborRoamInfo->isVOAdmitted) |
| 1507 | { |
| 1508 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 1509 | "[INFOLOG]BSSID : %02x:%02x:%02x:%02x:%02x:%02x has no QBSSLoad IE, ignoring..not adding to roam list", |
| 1510 | pScanResult->BssDescriptor.bssId[0], |
| 1511 | pScanResult->BssDescriptor.bssId[1], |
| 1512 | pScanResult->BssDescriptor.bssId[2], |
| 1513 | pScanResult->BssDescriptor.bssId[3], |
| 1514 | pScanResult->BssDescriptor.bssId[4], |
| 1515 | pScanResult->BssDescriptor.bssId[5]); |
| 1516 | continue; |
| 1517 | } |
| 1518 | } |
| 1519 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1520 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1521 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1522 | #endif /* FEATURE_WLAN_CCX */ |
| 1523 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1524 | #ifdef FEATURE_WLAN_LFR |
| 1525 | // If we are supporting legacy roaming, and |
| 1526 | // 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] | 1527 | if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1528 | { |
| 1529 | if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId)) |
| 1530 | { |
| 1531 | smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring")); |
| 1532 | continue; |
| 1533 | } |
| 1534 | } |
| 1535 | #endif /* FEATURE_WLAN_LFR */ |
| 1536 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1537 | /* If the received timestamp in BSS description is earlier than the scan request timestamp, skip |
| 1538 | * this result */ |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1539 | if ((pNeighborRoamInfo->scanRequestTimeStamp >= pScanResult->BssDescriptor.nReceivedTime) |
| 1540 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1541 | && !csrRoamIsRoamOffloadScanEnabled(pMac) |
| 1542 | #endif |
| 1543 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1544 | { |
| 1545 | smsLog(pMac, LOGE, FL("Ignoring BSS as it is older than the scan request timestamp")); |
| 1546 | continue; |
| 1547 | } |
| 1548 | |
| 1549 | pBssInfo = vos_mem_malloc(sizeof(tCsrNeighborRoamBSSInfo)); |
| 1550 | if (NULL == pBssInfo) |
| 1551 | { |
| 1552 | smsLog(pMac, LOGE, FL("Memory allocation for Neighbor Roam BSS Info failed.. Just ignoring")); |
| 1553 | continue; |
| 1554 | } |
| 1555 | |
| 1556 | pBssInfo->pBssDescription = vos_mem_malloc(pScanResult->BssDescriptor.length + sizeof(pScanResult->BssDescriptor.length)); |
| 1557 | if (pBssInfo->pBssDescription != NULL) |
| 1558 | { |
| 1559 | vos_mem_copy(pBssInfo->pBssDescription, &pScanResult->BssDescriptor, |
| 1560 | pScanResult->BssDescriptor.length + sizeof(pScanResult->BssDescriptor.length)); |
| 1561 | } |
| 1562 | else |
| 1563 | { |
| 1564 | smsLog(pMac, LOGE, FL("Memory allocation for Neighbor Roam BSS Descriptor failed.. Just ignoring")); |
| 1565 | vos_mem_free(pBssInfo); |
| 1566 | continue; |
| 1567 | |
| 1568 | } |
| 1569 | pBssInfo->apPreferenceVal = 10; //some value for now. Need to calculate the actual score based on RSSI and neighbor AP score |
| 1570 | |
| 1571 | /* Just add to the end of the list as it is already sorted by RSSI */ |
| 1572 | csrLLInsertTail(&pNeighborRoamInfo->roamableAPList, &pBssInfo->List, LL_ACCESS_LOCK); |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1573 | |
| 1574 | #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] | 1575 | if ((abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)) >= immediateRoamRssiDiff) |
| 1576 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1577 | && !csrRoamIsRoamOffloadScanEnabled(pMac) |
| 1578 | #endif |
| 1579 | ) |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1580 | { |
| 1581 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 1582 | "%s: [INFOLOG] potential candidate to roam immediately (diff=%d, expected=%d)", |
| 1583 | __func__, abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)), |
| 1584 | immediateRoamRssiDiff); |
| 1585 | roamNow = eANI_BOOLEAN_TRUE; |
| 1586 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1587 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1588 | /* If we are here means, FW already found candidates to roam, so we are |
| 1589 | good to go with pre-auth */ |
| 1590 | if(csrRoamIsRoamOffloadScanEnabled(pMac)) |
| 1591 | { |
| 1592 | roamNow = eANI_BOOLEAN_TRUE; |
| 1593 | } |
| 1594 | #endif |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1595 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1596 | } |
| 1597 | |
| 1598 | /* 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 */ |
| 1599 | csrScanResultPurge(pMac, *pScanResultList); |
| 1600 | |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1601 | return roamNow; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1602 | } |
| 1603 | |
| 1604 | /* --------------------------------------------------------------------------- |
| 1605 | |
| 1606 | \fn csrNeighborRoamHandleEmptyScanResult |
| 1607 | |
| 1608 | \brief This function will be invoked in CFG_CHAN_LIST_SCAN state when |
| 1609 | 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] | 1610 | 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] | 1611 | again and again. Performing the following here. |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1612 | 1. Stop the neighbor scan timer. |
| 1613 | 2a. If this is the first time we encountered empty scan, then |
| 1614 | re-register with TL with modified lookup threshold. |
| 1615 | 2b. Else if this is the second time we encountered empty scan, |
| 1616 | then start neighbor scan results refresh timer (20s). |
| 1617 | 2c. Else, nothing more to do. |
| 1618 | NOTE: In LFR, channels selected for scanning is dervied from |
| 1619 | the occuped channel list. Scan cycle following one which |
| 1620 | yielded empty results is split into two halves: (i) scan on |
| 1621 | channels in the occupied list, and (ii) scan on channels not |
| 1622 | in the occupied list. This helps converging faster (while |
| 1623 | looking for candidates in the occupied list first), and also, |
| 1624 | adds channels to the occupied channel list upon finding candidates |
| 1625 | matching SSID profile of interest. |
| 1626 | |
| 1627 | uEmptyScanCount Comments |
| 1628 | eFirstEmptyScan Previous scan was done on channels in the |
| 1629 | occupied list and yielded potential candidates. |
| 1630 | This scan cycle was likely triggered through |
| 1631 | receipt of lookup DOWN notification event. |
| 1632 | eSecondEmptyScan Previous scan was done on channels in the |
| 1633 | occupied list and yielded no candidates. This scan |
| 1634 | cycle was triggered through RSSI notification |
| 1635 | with modified lookup threshold. |
| 1636 | eThirdEmptyScan Previous scan was done on channels NOT in |
| 1637 | the occupied list and yielded no candidates. This |
| 1638 | scan cycle was triggered immediately after scanning |
| 1639 | channels in the occupied list and no candidates |
| 1640 | were found. |
| 1641 | eFourthEmptyScan Previous scan was done on channels in the |
| 1642 | occupied list and yielded no candidates. This scan |
| 1643 | cycle was triggered upon expiry of |
| 1644 | neighborScanResultsRefreshPeriod (=20s). |
| 1645 | eFifthEmptyScan Previous scan was done on channels NOT in |
| 1646 | the occupied list and yielded no candidates. This |
| 1647 | scan cycle was triggered immediately after scanning |
| 1648 | channels in the occupied list and no candidates |
| 1649 | were found. |
| 1650 | |
| 1651 | [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] | 1652 | |
| 1653 | \param pMac - The handle returned by macOpen. |
| 1654 | |
| 1655 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 1656 | |
| 1657 | ---------------------------------------------------------------------------*/ |
| 1658 | static VOS_STATUS csrNeighborRoamHandleEmptyScanResult(tpAniSirGlobal pMac) |
| 1659 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1660 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1661 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 1662 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1663 | #ifdef FEATURE_WLAN_LFR |
| 1664 | tANI_BOOLEAN performPeriodicScan = |
| 1665 | (pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod) ? TRUE : FALSE; |
| 1666 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1667 | |
Madan Mohan Koyyalamudi | 04039a1 | 2012-10-21 12:24:56 -0700 | [diff] [blame] | 1668 | /* Stop neighbor scan timer */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1669 | status = palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
Madan Mohan Koyyalamudi | 04039a1 | 2012-10-21 12:24:56 -0700 | [diff] [blame] | 1670 | if (eHAL_STATUS_SUCCESS != status) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1671 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1672 | smsLog(pMac, LOGW, FL("stopping neighborScanTimer failed with status %d"), status); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1673 | } |
| 1674 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1675 | /* |
| 1676 | * Increase the neighbor lookup threshold by 3 dB |
| 1677 | * after every scan cycle. NOTE: uEmptyScanCount |
| 1678 | * would be either 1, 3 or 5 at the end of every |
| 1679 | * scan cycle. |
| 1680 | */ |
| 1681 | #ifdef FEATURE_WLAN_LFR |
| 1682 | if ((++pNeighborRoamInfo->uEmptyScanCount) > eFifthEmptyScan) |
| 1683 | { |
| 1684 | pNeighborRoamInfo->uEmptyScanCount = eFifthEmptyScan; |
| 1685 | } |
Srikant Kuppa | 327c52e | 2013-05-09 15:09:24 -0700 | [diff] [blame] | 1686 | if (((0 != pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels) || |
| 1687 | (abs(pNeighborRoamInfo->lookupDOWNRssi) > |
| 1688 | abs(pNeighborRoamInfo->cfgParams.neighborReassocThreshold))) && |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1689 | ((pNeighborRoamInfo->uEmptyScanCount == eSecondEmptyScan) || |
| 1690 | (pNeighborRoamInfo->uEmptyScanCount == eFourthEmptyScan))) |
| 1691 | { |
| 1692 | /* |
| 1693 | * If the scan was triggered due to lookupDOWNRssi > reassoc threshold, |
| 1694 | * 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] | 1695 | * If channels are configured in INI, then only those channels need |
| 1696 | * to be scanned. |
| 1697 | * In either of these modes, there is no need to trigger an immediate |
| 1698 | * scan upon empty scan results for the second and fourth time (which |
| 1699 | * would be equivalent to scanning on channels in non-occupied list). |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1700 | * Incrementing uEmptyScanCount will correspond to skipping this step. |
| 1701 | * NOTE: double increment of uEmptyScanCount corresponds to completion |
| 1702 | * of scans on all valid channels. |
| 1703 | */ |
| 1704 | ++pNeighborRoamInfo->uEmptyScanCount; |
| 1705 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Extra increment of empty scan count (=%d)" |
| 1706 | " in contiguous scan mode", pNeighborRoamInfo->uEmptyScanCount); |
| 1707 | } |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1708 | #endif |
| 1709 | if (((pNeighborRoamInfo->currentNeighborLookupThreshold+3) < |
| 1710 | pNeighborRoamInfo->cfgParams.neighborReassocThreshold) |
| 1711 | #ifdef FEATURE_WLAN_LFR |
| 1712 | && ((pNeighborRoamInfo->uEmptyScanCount % 2) == 1) |
| 1713 | #endif |
| 1714 | ) |
| 1715 | { |
| 1716 | pNeighborRoamInfo->currentNeighborLookupThreshold += 3; |
| 1717 | } |
| 1718 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1719 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1720 | /* Clear off the old neighbor report details */ |
| 1721 | vos_mem_zero(&pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT); |
| 1722 | #endif |
| 1723 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1724 | /* Transition to CONNECTED state */ |
| 1725 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED); |
| 1726 | |
| 1727 | /* Reset all the necessary variables before transitioning to the CONNECTED state */ |
| 1728 | csrNeighborRoamResetConnectedStateControlInfo(pMac); |
| 1729 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1730 | #ifdef FEATURE_WLAN_LFR |
| 1731 | if (pNeighborRoamInfo->uEmptyScanCount == eFirstEmptyScan) |
| 1732 | { |
| 1733 | #endif |
| 1734 | /* Empty scan results for the first time */ |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1735 | /* Re-register neighbor lookup DOWN threshold callback with TL */ |
| 1736 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, |
| 1737 | FL("Registering DOWN event neighbor lookup callback with TL for RSSI = %d"), |
| 1738 | pNeighborRoamInfo->currentNeighborLookupThreshold * (-1)); |
| 1739 | |
| 1740 | vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, |
| 1741 | (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1), |
| 1742 | WLANTL_HO_THRESHOLD_DOWN, |
| 1743 | csrNeighborRoamNeighborLookupDOWNCallback, |
| 1744 | VOS_MODULE_ID_SME, pMac); |
| 1745 | |
| 1746 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1747 | { |
| 1748 | smsLog(pMac, LOGW, |
| 1749 | FL("Couldn't re-register csrNeighborRoamNeighborLookupDOWNCallback" |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1750 | " with TL: Status = %d"), status); |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1751 | } |
| 1752 | #ifdef FEATURE_WLAN_LFR |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1753 | pNeighborRoamInfo->lookupDOWNRssi = 0; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1754 | } |
| 1755 | else if ((pNeighborRoamInfo->uEmptyScanCount == eSecondEmptyScan) || |
| 1756 | (pNeighborRoamInfo->uEmptyScanCount == eFourthEmptyScan)) |
| 1757 | { |
| 1758 | /* Empty scan results for the second or fourth time */ |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1759 | |
| 1760 | /* Immediately scan on channels in non-occupied list */ |
| 1761 | csrNeighborRoamTransitToCFGChanScan(pMac); |
| 1762 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1763 | else if (pNeighborRoamInfo->uEmptyScanCount >= eThirdEmptyScan) |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1764 | { |
| 1765 | /* Empty scan results for the third time */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1766 | if (performPeriodicScan) |
| 1767 | { |
| 1768 | smsLog(pMac, LOGE, FL("Performing periodic scan, uEmptyScanCount=%d"), |
| 1769 | pNeighborRoamInfo->uEmptyScanCount); |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1770 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1771 | /* |
| 1772 | * Set uEmptyScanCount to MAX so that we always enter this |
| 1773 | * condition on subsequent empty scan results |
| 1774 | */ |
| 1775 | pNeighborRoamInfo->uEmptyScanCount = eMaxEmptyScan; |
| 1776 | |
| 1777 | /* From here on, ONLY scan on channels in the occupied list */ |
| 1778 | pNeighborRoamInfo->uScanMode = SPLIT_SCAN_OCCUPIED_LIST; |
| 1779 | |
| 1780 | /* Start empty scan refresh timer */ |
| 1781 | if (eHAL_STATUS_SUCCESS != |
| 1782 | palTimerStart(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer, |
| 1783 | pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod * PAL_TIMER_TO_MS_UNIT, |
| 1784 | eANI_BOOLEAN_FALSE)) |
| 1785 | { |
| 1786 | smsLog(pMac, LOGE, FL("Empty scan refresh timer failed to start (%d)"), |
| 1787 | status); |
| 1788 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 1789 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
Kiran Kumar Lokere | f0bd438 | 2013-03-19 22:06:52 -0700 | [diff] [blame] | 1790 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1791 | vosStatus = VOS_STATUS_E_FAILURE; |
| 1792 | } |
| 1793 | else |
| 1794 | { |
| 1795 | smsLog(pMac, LOGE, FL("Empty scan refresh timer started (%ld ms)"), |
| 1796 | (pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod)); |
| 1797 | } |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1798 | } |
Srikant Kuppa | 327c52e | 2013-05-09 15:09:24 -0700 | [diff] [blame] | 1799 | else if (eThirdEmptyScan == pNeighborRoamInfo->uEmptyScanCount) |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1800 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1801 | /* Start neighbor scan results refresh timer */ |
| 1802 | if (eHAL_STATUS_SUCCESS != |
| 1803 | palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer, |
| 1804 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT, |
| 1805 | eANI_BOOLEAN_FALSE)) |
| 1806 | { |
| 1807 | smsLog(pMac, LOGE, FL("Neighbor results refresh timer failed to start (%d)"), |
| 1808 | status); |
| 1809 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 1810 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
Kiran Kumar Lokere | f0bd438 | 2013-03-19 22:06:52 -0700 | [diff] [blame] | 1811 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1812 | vosStatus = VOS_STATUS_E_FAILURE; |
| 1813 | } |
| 1814 | else |
| 1815 | { |
| 1816 | smsLog(pMac, LOG2, FL("Neighbor results refresh timer started (%ld ms)"), |
| 1817 | (pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT)); |
| 1818 | } |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1819 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1820 | } |
Madan Mohan Koyyalamudi | 04039a1 | 2012-10-21 12:24:56 -0700 | [diff] [blame] | 1821 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1822 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Neighbor roam empty scan count=%d scan mode=%d", |
| 1823 | pNeighborRoamInfo->uEmptyScanCount, pNeighborRoamInfo->uScanMode); |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1824 | #endif |
| 1825 | return vosStatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1826 | } |
| 1827 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1828 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1829 | static eHalStatus csrNeighborRoamProcessScanComplete (tpAniSirGlobal pMac) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1830 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1831 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1832 | tCsrScanResultFilter scanFilter; |
| 1833 | tScanResultHandle scanResult; |
| 1834 | tANI_U32 tempVal = 0; |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1835 | tANI_BOOLEAN roamNow = eANI_BOOLEAN_FALSE; |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1836 | eHalStatus hstatus; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1837 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1838 | #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] | 1839 | /* If the state is REPORT_SCAN, then this must be the scan after the REPORT_QUERY state. So, we |
| 1840 | should use the BSSID filter made out of neighbor reports */ |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1841 | if ((eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState) |
| 1842 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1843 | && (!csrRoamIsRoamOffloadScanEnabled(pMac)) |
| 1844 | #endif |
| 1845 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1846 | { |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1847 | hstatus = csrNeighborRoamBssIdScanFilter(pMac, &scanFilter); |
| 1848 | 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] | 1849 | tempVal = 1; |
| 1850 | } |
| 1851 | else |
| 1852 | #endif |
| 1853 | { |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1854 | hstatus = csrNeighborRoamPrepareScanProfileFilter(pMac, &scanFilter); |
| 1855 | 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] | 1856 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1857 | if (eHAL_STATUS_SUCCESS != hstatus) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1858 | { |
| 1859 | smsLog(pMac, LOGE, FL("Scan Filter preparation failed for Assoc type %d.. Bailing out.."), tempVal); |
| 1860 | return eHAL_STATUS_FAILURE; |
| 1861 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 1862 | hstatus = csrScanGetResult(pMac, &scanFilter, &scanResult); |
Madan Mohan Koyyalamudi | 22f2708 | 2012-11-27 19:11:12 +0530 | [diff] [blame] | 1863 | if (hstatus != eHAL_STATUS_SUCCESS) |
| 1864 | { |
| 1865 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Get Scan Result status code %d"), hstatus); |
| 1866 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1867 | /* Process the scan results and update roamable AP list */ |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1868 | roamNow = csrNeighborRoamProcessScanResults(pMac, &scanResult); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1869 | |
| 1870 | /* Free the scan filter */ |
| 1871 | csrFreeScanFilter(pMac, &scanFilter); |
| 1872 | |
| 1873 | tempVal = csrLLCount(&pNeighborRoamInfo->roamableAPList); |
| 1874 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1875 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1876 | if(!csrRoamIsRoamOffloadScanEnabled(pMac)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1877 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1878 | #endif |
| 1879 | switch(pNeighborRoamInfo->neighborRoamState) |
| 1880 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1881 | case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN: |
| 1882 | if (tempVal) |
| 1883 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1884 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 04039a1 | 2012-10-21 12:24:56 -0700 | [diff] [blame] | 1885 | /* |
| 1886 | * Since there are non-zero candidates found |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1887 | * after the scan, reset empty scan count. |
Madan Mohan Koyyalamudi | 04039a1 | 2012-10-21 12:24:56 -0700 | [diff] [blame] | 1888 | */ |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1889 | pNeighborRoamInfo->uEmptyScanCount = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 1890 | pNeighborRoamInfo->uScanMode = DEFAULT_SCAN; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 1891 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1892 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1893 | /* If this is a non-11r association, then we can register the reassoc callback here as we have some |
| 1894 | APs in the roamable AP list */ |
| 1895 | if (pNeighborRoamInfo->is11rAssoc) |
| 1896 | { |
| 1897 | /* Valid APs are found after scan. Now we can initiate pre-authentication */ |
| 1898 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN) |
| 1899 | } |
| 1900 | else |
| 1901 | #endif |
| 1902 | #ifdef FEATURE_WLAN_CCX |
| 1903 | /* If this is a non-11r association, then we can register the reassoc callback here as we have some |
| 1904 | APs in the roamable AP list */ |
| 1905 | if (pNeighborRoamInfo->isCCXAssoc) |
| 1906 | { |
| 1907 | /* Valid APs are found after scan. Now we can initiate pre-authentication */ |
| 1908 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN) |
| 1909 | } |
| 1910 | else |
| 1911 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1912 | #ifdef FEATURE_WLAN_LFR |
| 1913 | /* If LFR is enabled, then we can register the reassoc callback here as we have some |
| 1914 | APs in the roamable AP list */ |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 1915 | if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 1916 | { |
| 1917 | /* Valid APs are found after scan. Now we can initiate pre-authentication */ |
| 1918 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN) |
| 1919 | } |
| 1920 | else |
| 1921 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1922 | { |
| 1923 | |
| 1924 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Completed scanning of CFG CHAN LIST in non-11r association. Registering reassoc callback")); |
| 1925 | /* Nothing much to do now. Will continue to remain in this state in case of non-11r association */ |
| 1926 | /* Stop the timer. But how long the roamable AP list will be valid in here. At some point of time, we |
| 1927 | need to restart the CFG CHAN list scan procedure if reassoc callback is not invoked from TL |
| 1928 | within certain duration */ |
| 1929 | |
| 1930 | // palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 1931 | } |
| 1932 | } |
| 1933 | else |
| 1934 | { |
Madan Mohan Koyyalamudi | b40e558 | 2012-10-11 16:48:42 -0700 | [diff] [blame] | 1935 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("No candidate found after scanning in state %d.. "), pNeighborRoamInfo->neighborRoamState); |
| 1936 | /* Handle it appropriately */ |
| 1937 | csrNeighborRoamHandleEmptyScanResult(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1938 | } |
| 1939 | break; |
| 1940 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 1941 | case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN: |
| 1942 | if (!tempVal) |
| 1943 | { |
| 1944 | smsLog(pMac, LOGE, FL("No candidate found after scanning in state %d.. "), pNeighborRoamInfo->neighborRoamState); |
| 1945 | /* Stop the timer here as the same timer will be started again in CFG_CHAN_SCAN_STATE */ |
| 1946 | csrNeighborRoamTransitToCFGChanScan(pMac); |
| 1947 | } |
| 1948 | break; |
| 1949 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 1950 | default: |
| 1951 | // Can come only in INIT state. Where in we are associated, we sent scan and user |
| 1952 | // in the meantime decides to disassoc, we will be in init state and still received call |
| 1953 | // back issued. Should not come here in any other state, printing just in case |
| 1954 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 1955 | "%s: [INFOLOG] State %d", __func__, (pNeighborRoamInfo->neighborRoamState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1956 | |
| 1957 | // Lets just exit out silently. |
| 1958 | return eHAL_STATUS_SUCCESS; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1959 | } |
| 1960 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1961 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1962 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1963 | |
| 1964 | if (tempVal) |
| 1965 | { |
| 1966 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 1967 | |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1968 | if (roamNow) |
| 1969 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1970 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 1971 | if(!csrRoamIsRoamOffloadScanEnabled(pMac)) |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1972 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1973 | #endif |
| 1974 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, |
| 1975 | FL("Immediate roam-deregister UP indication. RSSI = %d"), |
| 1976 | NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1)); |
| 1977 | |
| 1978 | vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, |
| 1979 | (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1), |
| 1980 | WLANTL_HO_THRESHOLD_UP, |
| 1981 | csrNeighborRoamNeighborLookupUPCallback, |
| 1982 | VOS_MODULE_ID_SME); |
| 1983 | |
| 1984 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 1985 | { |
| 1986 | smsLog(pMac, LOGW, |
| 1987 | FL("Couldn't deregister lookup UP callback with TL: Status = %d"), vosStatus); |
| 1988 | } |
| 1989 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1990 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 1991 | #endif |
Madan Mohan Koyyalamudi | 62b55b0 | 2012-12-03 16:45:39 -0800 | [diff] [blame] | 1992 | |
| 1993 | csrNeighborRoamTriggerHandoff(pMac, pNeighborRoamInfo); |
| 1994 | return eHAL_STATUS_SUCCESS; |
| 1995 | } |
| 1996 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 1997 | hstatus = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer, |
| 1998 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT, |
| 1999 | eANI_BOOLEAN_FALSE); |
| 2000 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2001 | /* This timer should be started before registering the Reassoc callback with TL. This is because, it is very likely |
| 2002 | * 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] | 2003 | if (eHAL_STATUS_SUCCESS != hstatus) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2004 | { |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2005 | 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] | 2006 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 2007 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
Kiran Kumar Lokere | f0bd438 | 2013-03-19 22:06:52 -0700 | [diff] [blame] | 2008 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2009 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2010 | } |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2011 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2012 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event Reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1)); |
| 2013 | /* Register a reassoc Indication callback */ |
| 2014 | vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1), |
| 2015 | WLANTL_HO_THRESHOLD_DOWN, |
| 2016 | csrNeighborRoamReassocIndCallback, |
| 2017 | VOS_MODULE_ID_SME, pMac); |
| 2018 | |
| 2019 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2020 | { |
| 2021 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2022 | 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] | 2023 | } |
| 2024 | |
| 2025 | } |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2026 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 2027 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 2028 | if (csrRoamIsRoamOffloadScanEnabled(pMac)) |
| 2029 | { |
| 2030 | if (!tempVal || !roamNow) |
| 2031 | { |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 2032 | pNeighborRoamInfo->uOsRequestedHandoff = 0; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 2033 | /* There is no candidate or We are not roaming Now. |
| 2034 | * Inform the FW to restart Roam Offload Scan */ |
| 2035 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_RESTART, REASON_NO_CAND_FOUND_OR_NOT_ROAMING_NOW); |
| 2036 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED); |
| 2037 | } |
| 2038 | } |
| 2039 | #endif |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2040 | return eHAL_STATUS_SUCCESS; |
| 2041 | |
| 2042 | } |
| 2043 | |
| 2044 | |
| 2045 | /* --------------------------------------------------------------------------- |
| 2046 | |
| 2047 | \fn csrNeighborRoamScanRequestCallback |
| 2048 | |
| 2049 | \brief This function is the callback function registered in csrScanRequest() to |
| 2050 | indicate the completion of scan. If scan is completed for all the channels in |
| 2051 | the channel list, this function gets the scan result and starts the refresh results |
| 2052 | timer to avoid having stale results. If scan is not completed on all the channels, |
| 2053 | it restarts the neighbor scan timer which on expiry issues scan on the next |
| 2054 | channel |
| 2055 | |
| 2056 | \param halHandle - The handle returned by macOpen. |
| 2057 | pContext - not used |
| 2058 | scanId - not used |
| 2059 | status - not used |
| 2060 | |
| 2061 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 2062 | |
| 2063 | ---------------------------------------------------------------------------*/ |
| 2064 | static eHalStatus csrNeighborRoamScanRequestCallback(tHalHandle halHandle, void *pContext, |
| 2065 | tANI_U32 scanId, eCsrScanStatus status) |
| 2066 | { |
| 2067 | tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle; |
| 2068 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2069 | tANI_U8 currentChanIndex; |
| 2070 | eHalStatus hstatus; |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2071 | #ifdef FEATURE_WLAN_LFR |
| 2072 | tANI_U32 sessionId = CSR_SESSION_ID_INVALID; |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2073 | |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2074 | if (NULL != pContext) |
| 2075 | { |
| 2076 | sessionId = *((tANI_U32*)pContext); |
| 2077 | if (!csrRoamIsFastRoamEnabled(pMac,sessionId)) |
| 2078 | { |
| 2079 | smsLog(pMac, LOGE, FL("Received when fast roam is disabled. Ignore it")); |
| 2080 | vos_mem_free(pContext); |
| 2081 | return eHAL_STATUS_SUCCESS; |
| 2082 | } |
| 2083 | } |
| 2084 | #endif |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2085 | pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE; |
| 2086 | |
| 2087 | /* This can happen when we receive a UP event from TL in any of the scan states. Silently ignore it */ |
| 2088 | if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState) |
| 2089 | { |
| 2090 | 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] | 2091 | if (NULL != pContext) |
| 2092 | vos_mem_free(pContext); |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2093 | return eHAL_STATUS_SUCCESS; |
| 2094 | } |
| 2095 | |
| 2096 | /* -1 is done because the chanIndex would have got incremented after issuing a successful scan request */ |
| 2097 | currentChanIndex = (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex) ? (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex - 1) : 0; |
| 2098 | |
| 2099 | /* Validate inputs */ |
| 2100 | if (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList) { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2101 | 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] | 2102 | pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList[currentChanIndex], currentChanIndex); |
| 2103 | } |
| 2104 | else |
| 2105 | { |
| 2106 | 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] | 2107 | if (NULL != pContext) |
| 2108 | vos_mem_free(pContext); |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2109 | return eHAL_STATUS_SUCCESS; |
| 2110 | } |
| 2111 | |
| 2112 | if (eANI_BOOLEAN_FALSE == pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress) |
| 2113 | { |
| 2114 | /* Scan is completed in the CFG_CHAN_SCAN state. We can transition to REPORT_SCAN state |
| 2115 | just to get the results and perform PREAUTH */ |
| 2116 | /* Now we have completed scanning the channel list. We have get the result by applying appropriate filter |
| 2117 | sort the results based on neighborScore and RSSI and select the best candidate out of the list */ |
| 2118 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Channel list scan completed. Current chan index = %d"), currentChanIndex); |
| 2119 | VOS_ASSERT(pNeighborRoamInfo->roamChannelInfo.currentChanIndex == 0); |
| 2120 | |
| 2121 | hstatus = csrNeighborRoamProcessScanComplete(pMac); |
| 2122 | |
| 2123 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 2124 | { |
| 2125 | 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] | 2126 | if (NULL != pContext) |
| 2127 | vos_mem_free(pContext); |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2128 | return eHAL_STATUS_FAILURE; |
| 2129 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2130 | } |
| 2131 | else |
| 2132 | { |
| 2133 | |
| 2134 | /* 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] | 2135 | hstatus = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2136 | pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT, |
| 2137 | eANI_BOOLEAN_FALSE); |
| 2138 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2139 | if (eHAL_STATUS_SUCCESS != hstatus) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2140 | { |
| 2141 | /* Timer start failed.. Should we ASSERT here??? */ |
| 2142 | smsLog(pMac, LOGE, FL("Neighbor scan PAL Timer start failed, status = %d, Ignoring state transition"), status); |
| 2143 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 2144 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
Kiran Kumar Lokere | f0bd438 | 2013-03-19 22:06:52 -0700 | [diff] [blame] | 2145 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0; |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2146 | if (NULL != pContext) |
| 2147 | vos_mem_free(pContext); |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2148 | return eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2149 | } |
| 2150 | } |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2151 | |
| 2152 | if (NULL != pContext) |
| 2153 | vos_mem_free(pContext); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2154 | return eHAL_STATUS_SUCCESS; |
| 2155 | } |
| 2156 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 2157 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 2158 | /* --------------------------------------------------------------------------- |
| 2159 | |
| 2160 | \fn csrNeighborRoamScanResultRequestCallback |
| 2161 | |
| 2162 | \brief This function is the callback function registered in csrScanRequestLfrResult() to |
| 2163 | indicate the completion of scan. If scan is completed for all the channels in |
| 2164 | the channel list, this function gets the scan result and treats them as candidates |
| 2165 | |
| 2166 | \param halHandle - The handle returned by macOpen. |
| 2167 | pContext - not used |
| 2168 | scanId - not used |
| 2169 | status - not used |
| 2170 | |
| 2171 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 2172 | |
| 2173 | ---------------------------------------------------------------------------*/ |
| 2174 | static eHalStatus csrNeighborRoamScanResultRequestCallback(tHalHandle halHandle, void *pContext, |
| 2175 | tANI_U32 scanId, eCsrScanStatus status) |
| 2176 | { |
| 2177 | tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle; |
| 2178 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2179 | eHalStatus hstatus; |
| 2180 | |
| 2181 | smsLog(pMac, LOG2, FL("called ")); |
| 2182 | pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE; |
| 2183 | |
| 2184 | /* we must be in connected state, if not ignore it */ |
| 2185 | if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED != pNeighborRoamInfo->neighborRoamState) |
| 2186 | { |
| 2187 | smsLog(pMac, LOGW, FL("Received in not CONNECTED state. Ignore it")); |
| 2188 | return eHAL_STATUS_SUCCESS; |
| 2189 | } |
| 2190 | |
| 2191 | /* Now we have completed scanning the channel list. We have get the result by applying appropriate filter |
| 2192 | sort the results based on neighborScore and RSSI and select the best candidate out of the list */ |
| 2193 | |
| 2194 | hstatus = csrNeighborRoamProcessScanComplete(pMac); |
| 2195 | |
| 2196 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 2197 | { |
| 2198 | smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus); |
| 2199 | return eHAL_STATUS_FAILURE; |
| 2200 | } |
| 2201 | return eHAL_STATUS_SUCCESS; |
| 2202 | } |
| 2203 | #endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 2204 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2205 | #ifdef FEATURE_WLAN_LFR |
| 2206 | static eHalStatus csrNeighborRoamContiguousScanRequestCallback(tHalHandle halHandle, |
| 2207 | void *pContext, tANI_U32 scanId, eCsrScanStatus status) |
| 2208 | { |
| 2209 | tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle; |
| 2210 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2211 | eHalStatus hstatus = eHAL_STATUS_SUCCESS; |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2212 | tANI_U32 sessionId = CSR_SESSION_ID_INVALID; |
| 2213 | |
| 2214 | if (NULL != pContext) |
| 2215 | { |
| 2216 | sessionId = *((tANI_U32*)pContext); |
| 2217 | if (!csrRoamIsFastRoamEnabled(pMac,sessionId)) |
| 2218 | { |
| 2219 | smsLog(pMac, LOGE, FL("Received when fast roam is disabled. Ignore it")); |
| 2220 | vos_mem_free(pContext); |
| 2221 | return eHAL_STATUS_SUCCESS; |
| 2222 | } |
| 2223 | } |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2224 | |
| 2225 | pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE; |
| 2226 | |
| 2227 | /* This can happen when we receive a UP event from TL in any of the scan states. Silently ignore it */ |
| 2228 | if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState) |
| 2229 | { |
| 2230 | 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] | 2231 | if (NULL != pContext) |
| 2232 | vos_mem_free(pContext); |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2233 | return eHAL_STATUS_SUCCESS; |
| 2234 | } |
| 2235 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2236 | if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState) |
| 2237 | { |
| 2238 | 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] | 2239 | if (NULL != pContext) |
| 2240 | vos_mem_free(pContext); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2241 | return eHAL_STATUS_SUCCESS; |
| 2242 | } |
| 2243 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2244 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "%s: process scan results", __func__); |
| 2245 | hstatus = csrNeighborRoamProcessScanComplete(pMac); |
| 2246 | |
| 2247 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 2248 | { |
| 2249 | smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus); |
| 2250 | } |
| 2251 | |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2252 | if (NULL != pContext) |
| 2253 | vos_mem_free(pContext); |
| 2254 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2255 | return hstatus; |
| 2256 | } |
| 2257 | #endif |
| 2258 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2259 | /* --------------------------------------------------------------------------- |
| 2260 | |
| 2261 | \fn csrNeighborRoamIssueBgScanRequest |
| 2262 | |
| 2263 | \brief This function issues CSR scan request after populating all the BG scan params |
| 2264 | passed |
| 2265 | |
| 2266 | \param pMac - The handle returned by macOpen. |
| 2267 | pBgScanParams - Params that need to be populated into csr Scan request |
| 2268 | |
| 2269 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 2270 | |
| 2271 | ---------------------------------------------------------------------------*/ |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2272 | eHalStatus csrNeighborRoamIssueBgScanRequest(tpAniSirGlobal pMac, |
| 2273 | tCsrBGScanRequest *pBgScanParams, |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2274 | tANI_U32 sessionId, |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2275 | csrScanCompleteCallback callbackfn) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2276 | { |
| 2277 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2278 | tANI_U32 scanId; |
| 2279 | tCsrScanRequest scanReq; |
| 2280 | tANI_U8 channel; |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2281 | void * userData = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2282 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2283 | if (1 == pBgScanParams->ChannelInfo.numOfChannels) |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2284 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Channel = %d, ChanIndex = %d"), |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2285 | pBgScanParams->ChannelInfo.ChannelList[0], |
| 2286 | pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2287 | |
| 2288 | //send down the scan req for 1 channel on the associated SSID |
| 2289 | palZeroMemory(pMac->hHdd, &scanReq, sizeof(tCsrScanRequest)); |
| 2290 | /* Fill in the SSID Info */ |
| 2291 | scanReq.SSIDs.numOfSSIDs = 1; |
| 2292 | scanReq.SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo) * scanReq.SSIDs.numOfSSIDs); |
| 2293 | if(NULL == scanReq.SSIDs.SSIDList) |
| 2294 | { |
| 2295 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2296 | 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] | 2297 | return eHAL_STATUS_FAILURE; |
| 2298 | } |
| 2299 | vos_mem_zero(scanReq.SSIDs.SSIDList, sizeof(tCsrSSIDInfo) * scanReq.SSIDs.numOfSSIDs); |
| 2300 | |
| 2301 | scanReq.SSIDs.SSIDList[0].handoffPermitted = eANI_BOOLEAN_TRUE; |
| 2302 | scanReq.SSIDs.SSIDList[0].ssidHidden = eANI_BOOLEAN_TRUE; |
| 2303 | vos_mem_copy((void *)&scanReq.SSIDs.SSIDList[0].SSID, (void *)&pBgScanParams->SSID, sizeof(pBgScanParams->SSID)); |
| 2304 | |
| 2305 | scanReq.ChannelInfo.numOfChannels = pBgScanParams->ChannelInfo.numOfChannels; |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2306 | if (1 == pBgScanParams->ChannelInfo.numOfChannels) |
| 2307 | { |
| 2308 | channel = pBgScanParams->ChannelInfo.ChannelList[0]; |
| 2309 | scanReq.ChannelInfo.ChannelList = &channel; |
| 2310 | } |
| 2311 | else |
| 2312 | { |
| 2313 | scanReq.ChannelInfo.ChannelList = pBgScanParams->ChannelInfo.ChannelList; |
| 2314 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2315 | |
| 2316 | scanReq.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE; |
| 2317 | scanReq.scanType = eSIR_ACTIVE_SCAN; |
| 2318 | scanReq.requestType = eCSR_SCAN_HO_BG_SCAN; |
| 2319 | scanReq.maxChnTime = pBgScanParams->maxChnTime; |
| 2320 | scanReq.minChnTime = pBgScanParams->minChnTime; |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2321 | |
| 2322 | userData = vos_mem_malloc(sizeof(tANI_U32)); |
| 2323 | if (NULL == userData) |
| 2324 | { |
| 2325 | smsLog(pMac, LOGE, FL("Failed to allocate memory for scan request")); |
| 2326 | vos_mem_free(scanReq.SSIDs.SSIDList); |
| 2327 | return eHAL_STATUS_FAILURE; |
| 2328 | } |
| 2329 | *((tANI_U32*)userData) = sessionId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2330 | status = csrScanRequest(pMac, CSR_SESSION_ID_INVALID, &scanReq, |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2331 | &scanId, callbackfn, (void *) userData); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2332 | if (eHAL_STATUS_SUCCESS != status) |
| 2333 | { |
| 2334 | smsLog(pMac, LOGE, FL("CSR Scan Request failed with status %d"), status); |
| 2335 | vos_mem_free(scanReq.SSIDs.SSIDList); |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2336 | vos_mem_free(userData); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2337 | return status; |
| 2338 | } |
| 2339 | pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_TRUE; |
| 2340 | |
| 2341 | vos_mem_free(scanReq.SSIDs.SSIDList); |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2342 | if (1 == pBgScanParams->ChannelInfo.numOfChannels) |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2343 | 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] | 2344 | &pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList[0], |
| 2345 | pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex); |
| 2346 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2347 | return status; |
| 2348 | } |
| 2349 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2350 | static void csrNeighborRoamFillNonChannelBgScanParams (tpAniSirGlobal pMac, |
| 2351 | tpCsrBGScanRequest bgScanParams) |
| 2352 | { |
| 2353 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2354 | tANI_U8 broadcastBssid[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; |
| 2355 | |
| 2356 | vos_mem_copy(bgScanParams->bssid, broadcastBssid, sizeof(tCsrBssid)); |
| 2357 | bgScanParams->SSID.length = pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length; |
| 2358 | vos_mem_copy(bgScanParams->SSID.ssId, |
| 2359 | pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.ssId, |
| 2360 | pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length); |
| 2361 | |
| 2362 | bgScanParams->minChnTime = pNeighborRoamInfo->cfgParams.minChannelScanTime; |
| 2363 | bgScanParams->maxChnTime = pNeighborRoamInfo->cfgParams.maxChannelScanTime; |
| 2364 | } |
| 2365 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2366 | /* --------------------------------------------------------------------------- |
| 2367 | |
| 2368 | \fn csrNeighborRoamPerformBgScan |
| 2369 | |
| 2370 | \brief This function is invoked on every expiry of neighborScanTimer till all |
| 2371 | the channels in the channel list are scanned. It populates necessary |
| 2372 | parameters for BG scan and calls appropriate AP to invoke the CSR scan |
| 2373 | request |
| 2374 | |
| 2375 | \param pMac - The handle returned by macOpen. |
| 2376 | |
| 2377 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 2378 | |
| 2379 | ---------------------------------------------------------------------------*/ |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2380 | eHalStatus csrNeighborRoamPerformBgScan(tpAniSirGlobal pMac, tANI_U32 sessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2381 | { |
| 2382 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2383 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2384 | tCsrBGScanRequest bgScanParams; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2385 | tANI_U8 channel = 0; |
| 2386 | |
| 2387 | if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList) |
| 2388 | { |
Madan Mohan Koyyalamudi | 22f2708 | 2012-11-27 19:11:12 +0530 | [diff] [blame] | 2389 | 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] | 2390 | } |
| 2391 | else |
| 2392 | { |
| 2393 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Channel List Empty")); |
Jeff Johnson | 902c983 | 2012-12-10 14:28:09 -0800 | [diff] [blame] | 2394 | // Go back and restart. Mostly timer start failure has occurred. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2395 | // When timer start is declared a failure, then we delete the list. |
| 2396 | // Should not happen now as we stop and then only start the scan timer. |
| 2397 | // still handle the unlikely case. |
| 2398 | csrNeighborRoamHandleEmptyScanResult(pMac); |
| 2399 | return status; |
| 2400 | } |
James Zmuda | 9ea1edd | 2013-04-18 18:20:54 -0700 | [diff] [blame] | 2401 | |
| 2402 | /* Validate the currentChanIndex value before using it to index the ChannelList array */ |
| 2403 | if ( pNeighborRoamInfo->roamChannelInfo.currentChanIndex |
| 2404 | > pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels) |
| 2405 | { |
| 2406 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Invalid channel index: %d"), pNeighborRoamInfo->roamChannelInfo.currentChanIndex); |
| 2407 | // Go back and restart. |
| 2408 | csrNeighborRoamHandleEmptyScanResult(pMac); |
| 2409 | return status; |
| 2410 | } |
| 2411 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2412 | /* Need to perform scan here before getting the list */ |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2413 | |
| 2414 | palZeroMemory(pMac->hHdd, &bgScanParams, sizeof(tCsrBGScanRequest)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2415 | |
| 2416 | channel = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[pNeighborRoamInfo->roamChannelInfo.currentChanIndex]; |
| 2417 | bgScanParams.ChannelInfo.numOfChannels = 1; |
| 2418 | bgScanParams.ChannelInfo.ChannelList = &channel; |
| 2419 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2420 | csrNeighborRoamFillNonChannelBgScanParams(pMac, &bgScanParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2421 | |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2422 | status = csrNeighborRoamIssueBgScanRequest(pMac, &bgScanParams, |
| 2423 | sessionId, csrNeighborRoamScanRequestCallback); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2424 | if (eHAL_STATUS_SUCCESS != status) |
| 2425 | { |
| 2426 | 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] | 2427 | } |
| 2428 | |
| 2429 | pNeighborRoamInfo->roamChannelInfo.currentChanIndex++; |
| 2430 | if (pNeighborRoamInfo->roamChannelInfo.currentChanIndex >= |
| 2431 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels) |
| 2432 | { |
Madan Mohan Koyyalamudi | 22f2708 | 2012-11-27 19:11:12 +0530 | [diff] [blame] | 2433 | 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] | 2434 | pNeighborRoamInfo->roamChannelInfo.currentChanIndex, |
| 2435 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels); |
| 2436 | /* We have completed scanning all the channels */ |
| 2437 | pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0; |
| 2438 | /* We are no longer scanning the channel list. Next timer firing should be used to get the scan results |
| 2439 | and select the best AP in the list */ |
| 2440 | if (eANI_BOOLEAN_TRUE == pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress) |
| 2441 | { |
| 2442 | pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE; |
| 2443 | } |
| 2444 | } |
| 2445 | |
Gopichand Nakkala | c7b1d3e | 2012-12-31 14:07:19 -0800 | [diff] [blame] | 2446 | if (eHAL_STATUS_SUCCESS != status) |
| 2447 | { |
| 2448 | /* |
| 2449 | * If the status is not success, we need to call the callback |
| 2450 | * routine so that the state machine does not get stuck. |
| 2451 | */ |
| 2452 | csrNeighborRoamScanRequestCallback(pMac, NULL, 0, eCSR_SCAN_FAILURE); |
| 2453 | } |
| 2454 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2455 | return status; |
| 2456 | } |
| 2457 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2458 | #ifdef FEATURE_WLAN_LFR |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2459 | eHalStatus csrNeighborRoamPerformContiguousBgScan(tpAniSirGlobal pMac, tANI_U32 sessionId) |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2460 | { |
| 2461 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2462 | tCsrBGScanRequest bgScanParams; |
| 2463 | int numOfChannels = 0, i = 0; |
| 2464 | tANI_U8 *channelList = NULL; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2465 | tANI_U8 *pInChannelList = NULL; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 2466 | tANI_U8 tmpChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2467 | |
| 2468 | palZeroMemory(pMac->hHdd, &bgScanParams, sizeof(tCsrBGScanRequest)); |
| 2469 | |
| 2470 | /* Contiguously scan all channels from valid list */ |
| 2471 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "%s: get valid channel list", __func__); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2472 | |
| 2473 | if (NULL != pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.ChannelList) |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2474 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2475 | /* this list is filled only if the country code is set to KR */ |
| 2476 | numOfChannels = pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels; |
| 2477 | pInChannelList = pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.ChannelList; |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2478 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2479 | else |
| 2480 | { |
| 2481 | numOfChannels = sizeof(pMac->roam.validChannelList); |
| 2482 | |
| 2483 | if(!HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, |
| 2484 | (tANI_U8 *)pMac->roam.validChannelList, |
| 2485 | (tANI_U32 *) &numOfChannels))) |
| 2486 | { |
| 2487 | smsLog(pMac, LOGE, FL("Could not get valid channel list")); |
| 2488 | return eHAL_STATUS_FAILURE; |
| 2489 | } |
| 2490 | pInChannelList = pMac->roam.validChannelList; |
| 2491 | } |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 2492 | |
| 2493 | if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac)) |
| 2494 | { |
| 2495 | csrNeighborRoamChannelsFilterByCurrentBand( |
| 2496 | pMac, |
| 2497 | pInChannelList, |
| 2498 | numOfChannels, |
| 2499 | tmpChannelList, |
| 2500 | &numOfChannels); |
| 2501 | pInChannelList = tmpChannelList; |
| 2502 | } |
| 2503 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2504 | channelList = vos_mem_malloc( numOfChannels ); |
| 2505 | if( NULL == channelList ) |
| 2506 | { |
| 2507 | smsLog(pMac, LOGE, FL("could not allocate memory for channelList")); |
| 2508 | return eHAL_STATUS_FAILURE; |
| 2509 | } |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2510 | vos_mem_copy(channelList, (tANI_U8 *)pInChannelList, |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2511 | numOfChannels * sizeof(tANI_U8)); |
| 2512 | |
| 2513 | bgScanParams.ChannelInfo.numOfChannels = numOfChannels; |
| 2514 | bgScanParams.ChannelInfo.ChannelList = channelList; |
| 2515 | for (i = 0; i < numOfChannels; i++) |
| 2516 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2517 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "%s: valid channel list = %d", |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2518 | __func__, bgScanParams.ChannelInfo.ChannelList[i]); |
| 2519 | } |
| 2520 | csrNeighborRoamFillNonChannelBgScanParams(pMac, &bgScanParams); |
| 2521 | |
| 2522 | status = csrNeighborRoamIssueBgScanRequest(pMac, &bgScanParams, |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2523 | sessionId, csrNeighborRoamContiguousScanRequestCallback); |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2524 | |
| 2525 | vos_mem_free( channelList ); |
| 2526 | |
| 2527 | if (eHAL_STATUS_SUCCESS != status) |
| 2528 | { |
| 2529 | smsLog(pMac, LOGE, FL("Issue of BG Scan request failed: Status = %d"), status); |
| 2530 | } |
| 2531 | |
| 2532 | return status; |
| 2533 | } |
| 2534 | #endif |
| 2535 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2536 | /* --------------------------------------------------------------------------- |
| 2537 | |
| 2538 | \fn csrNeighborRoamNeighborScanTimerCallback |
| 2539 | |
| 2540 | \brief This function is the neighbor scan timer callback function. It invokes |
| 2541 | the BG scan request based on the current and previous states |
| 2542 | |
| 2543 | \param pv - CSR timer context info which includes pMac and session ID |
| 2544 | |
| 2545 | \return VOID |
| 2546 | |
| 2547 | ---------------------------------------------------------------------------*/ |
| 2548 | void csrNeighborRoamNeighborScanTimerCallback(void *pv) |
| 2549 | { |
| 2550 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv; |
| 2551 | tpAniSirGlobal pMac = pInfo->pMac; |
| 2552 | tANI_U32 sessionId = pInfo->sessionId; |
| 2553 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2554 | |
| 2555 | // check if bg scan is on going, no need to send down the new params if true |
| 2556 | if(eANI_BOOLEAN_TRUE == pNeighborRoamInfo->scanRspPending) |
| 2557 | { |
| 2558 | //msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2559 | smsLog(pMac, LOGW, FL("Already BgScanRsp is Pending")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2560 | return; |
| 2561 | } |
| 2562 | |
| 2563 | VOS_ASSERT(sessionId == pNeighborRoamInfo->csrSessionId); |
| 2564 | |
| 2565 | switch (pNeighborRoamInfo->neighborRoamState) |
| 2566 | { |
| 2567 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 2568 | case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN: |
| 2569 | switch(pNeighborRoamInfo->prevNeighborRoamState) |
| 2570 | { |
| 2571 | case eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY: |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2572 | csrNeighborRoamPerformBgScan(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2573 | break; |
| 2574 | default: |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2575 | 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] | 2576 | pNeighborRoamInfo->neighborRoamState, pNeighborRoamInfo->prevNeighborRoamState); |
| 2577 | break; |
| 2578 | } |
| 2579 | break; |
| 2580 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 2581 | case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN: |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 2582 | csrNeighborRoamPerformBgScan(pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2583 | break; |
| 2584 | default: |
| 2585 | break; |
| 2586 | } |
| 2587 | return; |
| 2588 | } |
| 2589 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2590 | void csrNeighborRoamEmptyScanRefreshTimerCallback(void *context) |
| 2591 | { |
| 2592 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)context; |
| 2593 | tpAniSirGlobal pMac = pInfo->pMac; |
| 2594 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 2595 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2596 | |
| 2597 | /* Reset all the variables just as no scan had happened before */ |
| 2598 | csrNeighborRoamResetConnectedStateControlInfo(pMac); |
| 2599 | |
| 2600 | #if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI |
| 2601 | if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled)) |
| 2602 | { |
| 2603 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state")); |
| 2604 | vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac); |
| 2605 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 2606 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2607 | smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 2608 | return; |
| 2609 | } |
| 2610 | /* Increment the neighbor report retry count after sending the neighbor request successfully */ |
| 2611 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++; |
| 2612 | pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE; |
| 2613 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY) |
| 2614 | } |
| 2615 | else |
| 2616 | #endif |
| 2617 | { |
| 2618 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Non 11R or CCX Association:empty scan refresh timer expired")); |
| 2619 | vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac); |
| 2620 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 2621 | { |
| 2622 | return; |
| 2623 | } |
| 2624 | } |
| 2625 | return; |
| 2626 | } |
| 2627 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2628 | /* --------------------------------------------------------------------------- |
| 2629 | |
| 2630 | \fn csrNeighborRoamResultsRefreshTimerCallback |
| 2631 | |
| 2632 | \brief This function is the timer callback function for results refresh timer. |
| 2633 | When this is invoked, it is as good as down event received from TL. So, |
| 2634 | clear off the roamable AP list and start the scan procedure based on 11R |
| 2635 | or non-11R association |
| 2636 | |
| 2637 | \param context - CSR timer context info which includes pMac and session ID |
| 2638 | |
| 2639 | \return VOID |
| 2640 | |
| 2641 | ---------------------------------------------------------------------------*/ |
| 2642 | void csrNeighborRoamResultsRefreshTimerCallback(void *context) |
| 2643 | { |
| 2644 | tCsrTimerInfo *pInfo = (tCsrTimerInfo *)context; |
| 2645 | tpAniSirGlobal pMac = pInfo->pMac; |
| 2646 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 2647 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2648 | |
| 2649 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1)); |
| 2650 | |
| 2651 | /* Deregister reassoc callback. Ignore return status */ |
| 2652 | vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1), |
| 2653 | WLANTL_HO_THRESHOLD_DOWN, |
| 2654 | csrNeighborRoamReassocIndCallback, |
| 2655 | VOS_MODULE_ID_SME); |
| 2656 | |
| 2657 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 2658 | { |
| 2659 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2660 | 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] | 2661 | } |
| 2662 | |
| 2663 | /* Reset all the variables just as no scan had happened before */ |
| 2664 | csrNeighborRoamResetConnectedStateControlInfo(pMac); |
| 2665 | |
| 2666 | #if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI |
| 2667 | if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled)) |
| 2668 | { |
| 2669 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state")); |
| 2670 | vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac); |
| 2671 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 2672 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2673 | smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2674 | return; |
| 2675 | } |
| 2676 | /* Increment the neighbor report retry count after sending the neighbor request successfully */ |
| 2677 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++; |
| 2678 | pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE; |
| 2679 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY) |
| 2680 | } |
| 2681 | else |
| 2682 | #endif |
| 2683 | { |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 2684 | 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] | 2685 | vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac); |
| 2686 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 2687 | { |
| 2688 | return; |
| 2689 | } |
| 2690 | } |
| 2691 | return; |
| 2692 | } |
| 2693 | |
| 2694 | #if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI |
| 2695 | /* --------------------------------------------------------------------------- |
| 2696 | |
| 2697 | \fn csrNeighborRoamIssueNeighborRptRequest |
| 2698 | |
| 2699 | \brief This function is invoked when TL issues a down event and the current assoc |
| 2700 | is a 11R association. It invokes SME RRM API to issue the neighbor request to |
| 2701 | the currently associated AP with the current SSID |
| 2702 | |
| 2703 | \param pMac - The handle returned by macOpen. |
| 2704 | |
| 2705 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 2706 | |
| 2707 | ---------------------------------------------------------------------------*/ |
| 2708 | VOS_STATUS csrNeighborRoamIssueNeighborRptRequest(tpAniSirGlobal pMac) |
| 2709 | { |
| 2710 | tRrmNeighborRspCallbackInfo callbackInfo; |
| 2711 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 2712 | tRrmNeighborReq neighborReq; |
| 2713 | |
| 2714 | |
| 2715 | neighborReq.no_ssid = 0; |
| 2716 | |
| 2717 | /* Fill in the SSID */ |
| 2718 | neighborReq.ssid.length = pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length; |
| 2719 | vos_mem_copy(neighborReq.ssid.ssId, pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.ssId, |
| 2720 | pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length); |
| 2721 | |
| 2722 | callbackInfo.neighborRspCallback = csrNeighborRoamRRMNeighborReportResult; |
| 2723 | callbackInfo.neighborRspCallbackContext = pMac; |
| 2724 | callbackInfo.timeout = pNeighborRoamInfo->FTRoamInfo.neighborReportTimeout; |
| 2725 | |
| 2726 | return sme_NeighborReportRequest(pMac,(tANI_U8) pNeighborRoamInfo->csrSessionId, &neighborReq, &callbackInfo); |
| 2727 | } |
| 2728 | |
| 2729 | /* --------------------------------------------------------------------------- |
| 2730 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 2731 | \fn csrNeighborRoamChannelsFilterByCurrentBand |
| 2732 | |
| 2733 | \brief This function is used to filter out the channels |
| 2734 | based on the currently associated AP channel |
| 2735 | |
| 2736 | \param pMac - The handle returned by macOpen. |
| 2737 | \param pInputChannelList - The input channel list |
| 2738 | \param inputNumOfChannels - The number of channels in input channel list |
| 2739 | \param pOutputChannelList - The output channel list |
| 2740 | \param outputNumOfChannels - The number of channels in output channel list |
| 2741 | \param pMergedOutputNumOfChannels - The final number of channels in the output channel list. |
| 2742 | |
| 2743 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 2744 | |
| 2745 | ---------------------------------------------------------------------------*/ |
| 2746 | |
| 2747 | VOS_STATUS csrNeighborRoamChannelsFilterByCurrentBand( |
| 2748 | tpAniSirGlobal pMac, |
| 2749 | tANI_U8* pInputChannelList, |
| 2750 | int inputNumOfChannels, |
| 2751 | tANI_U8* pOutputChannelList, |
| 2752 | int* pMergedOutputNumOfChannels |
| 2753 | ) |
| 2754 | { |
| 2755 | int i = 0; |
| 2756 | int numChannels = 0; |
| 2757 | tANI_U8 currAPoperationChannel = pMac->roam.neighborRoamInfo.currAPoperationChannel; |
| 2758 | // Check for NULL pointer |
Gopichand Nakkala | 9cd573c | 2013-04-19 21:52:58 +0530 | [diff] [blame] | 2759 | if (!pInputChannelList) return VOS_STATUS_E_INVAL; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 2760 | |
| 2761 | // Check for NULL pointer |
Gopichand Nakkala | 9cd573c | 2013-04-19 21:52:58 +0530 | [diff] [blame] | 2762 | if (!pOutputChannelList) return VOS_STATUS_E_INVAL; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 2763 | |
Gopichand Nakkala | 9cd573c | 2013-04-19 21:52:58 +0530 | [diff] [blame] | 2764 | if (inputNumOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 2765 | { |
| 2766 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 2767 | "%s: Wrong Number of Input Channels %d", |
| 2768 | __func__, inputNumOfChannels); |
| 2769 | return VOS_STATUS_E_INVAL; |
| 2770 | } |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 2771 | for (i = 0; i < inputNumOfChannels; i++) |
| 2772 | { |
| 2773 | if (GetRFBand(currAPoperationChannel) == GetRFBand(pInputChannelList[i])) |
| 2774 | { |
| 2775 | pOutputChannelList[numChannels] = pInputChannelList[i]; |
| 2776 | numChannels++; |
| 2777 | } |
| 2778 | } |
| 2779 | |
| 2780 | // Return final number of channels |
| 2781 | *pMergedOutputNumOfChannels = numChannels; |
| 2782 | |
Gopichand Nakkala | 9cd573c | 2013-04-19 21:52:58 +0530 | [diff] [blame] | 2783 | return VOS_STATUS_SUCCESS; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 2784 | } |
| 2785 | |
| 2786 | /* --------------------------------------------------------------------------- |
| 2787 | |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2788 | \fn csrNeighborRoamMergeChannelLists |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2789 | |
| 2790 | \brief This function is used to merge two channel list. |
| 2791 | NB: If called with outputNumOfChannels == 0, this routines |
| 2792 | simply copies the input channel list to the output channel list. |
| 2793 | |
| 2794 | \param pMac - The handle returned by macOpen. |
| 2795 | \param pInputChannelList - The addtional channels to merge in to the "merged" channels list. |
| 2796 | \param inputNumOfChannels - The number of additional channels. |
| 2797 | \param pOutputChannelList - The place to put the "merged" channel list. |
| 2798 | \param outputNumOfChannels - The original number of channels in the "merged" channels list. |
| 2799 | \param pMergedOutputNumOfChannels - The final number of channels in the "merged" channel list. |
| 2800 | |
| 2801 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 2802 | |
| 2803 | ---------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2804 | VOS_STATUS csrNeighborRoamMergeChannelLists( |
| 2805 | tpAniSirGlobal pMac, |
| 2806 | tANI_U8 *pInputChannelList, |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2807 | int inputNumOfChannels, |
| 2808 | tANI_U8 *pOutputChannelList, |
| 2809 | int outputNumOfChannels, |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2810 | int *pMergedOutputNumOfChannels |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2811 | ) |
| 2812 | { |
| 2813 | int i = 0; |
| 2814 | int j = 0; |
| 2815 | int numChannels = outputNumOfChannels; |
| 2816 | |
| 2817 | // Check for NULL pointer |
Gopichand Nakkala | 9cd573c | 2013-04-19 21:52:58 +0530 | [diff] [blame] | 2818 | if (!pInputChannelList) return VOS_STATUS_E_INVAL; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2819 | |
| 2820 | // Check for NULL pointer |
Gopichand Nakkala | 9cd573c | 2013-04-19 21:52:58 +0530 | [diff] [blame] | 2821 | if (!pOutputChannelList) return VOS_STATUS_E_INVAL; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2822 | |
Gopichand Nakkala | 9cd573c | 2013-04-19 21:52:58 +0530 | [diff] [blame] | 2823 | if (inputNumOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 2824 | { |
| 2825 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, |
| 2826 | "%s: Wrong Number of Input Channels %d", |
| 2827 | __func__, inputNumOfChannels); |
| 2828 | return VOS_STATUS_E_INVAL; |
| 2829 | } |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2830 | // Add the "new" channels in the input list to the end of the output list. |
| 2831 | for (i = 0; i < inputNumOfChannels; i++) |
| 2832 | { |
| 2833 | for (j = 0; j < outputNumOfChannels; j++) |
| 2834 | { |
| 2835 | if (pInputChannelList[i] == pOutputChannelList[j]) |
| 2836 | break; |
| 2837 | } |
| 2838 | if (j == outputNumOfChannels) |
| 2839 | { |
| 2840 | if (pInputChannelList[i]) |
| 2841 | { |
Madan Mohan Koyyalamudi | f5c368b | 2012-12-06 13:10:13 -0800 | [diff] [blame] | 2842 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2843 | "%s: [INFOLOG] Adding extra %d to Neighbor channel list", __func__, |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2844 | pInputChannelList[i]); |
| 2845 | pOutputChannelList[numChannels] = pInputChannelList[i]; |
| 2846 | numChannels++; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2847 | } |
| 2848 | } |
| 2849 | } |
| 2850 | |
| 2851 | // Return final number of channels |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 2852 | *pMergedOutputNumOfChannels = numChannels; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2853 | |
Gopichand Nakkala | 9cd573c | 2013-04-19 21:52:58 +0530 | [diff] [blame] | 2854 | return VOS_STATUS_SUCCESS; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2855 | } |
| 2856 | |
| 2857 | /* --------------------------------------------------------------------------- |
| 2858 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2859 | \fn csrNeighborRoamCreateChanListFromNeighborReport |
| 2860 | |
| 2861 | \brief This function is invoked when neighbor report is received for the |
| 2862 | neighbor request. Based on the channels present in the neighbor report, |
| 2863 | it generates channel list which will be used in REPORT_SCAN state to |
| 2864 | scan for these neighbor APs |
| 2865 | |
| 2866 | \param pMac - The handle returned by macOpen. |
| 2867 | |
| 2868 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 2869 | |
| 2870 | ---------------------------------------------------------------------------*/ |
| 2871 | VOS_STATUS csrNeighborRoamCreateChanListFromNeighborReport(tpAniSirGlobal pMac) |
| 2872 | { |
| 2873 | tpRrmNeighborReportDesc pNeighborBssDesc; |
| 2874 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2875 | tANI_U8 numChannels = 0, i = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2876 | tANI_U8 channelList[MAX_BSS_IN_NEIGHBOR_RPT]; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2877 | #if 0 |
| 2878 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 2879 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2880 | |
| 2881 | /* This should always start from 0 whenever we create a channel list out of neighbor AP list */ |
| 2882 | pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0; |
| 2883 | |
| 2884 | pNeighborBssDesc = smeRrmGetFirstBssEntryFromNeighborCache(pMac); |
| 2885 | |
| 2886 | while (pNeighborBssDesc) |
| 2887 | { |
| 2888 | if (pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport >= MAX_BSS_IN_NEIGHBOR_RPT) break; |
| 2889 | |
| 2890 | /* Update the neighbor BSS Info in the 11r FT Roam Info */ |
| 2891 | pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].channelNum = |
| 2892 | pNeighborBssDesc->pNeighborBssDescription->channel; |
| 2893 | pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].neighborScore = |
| 2894 | (tANI_U8)pNeighborBssDesc->roamScore; |
| 2895 | vos_mem_copy(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].neighborBssId, |
| 2896 | pNeighborBssDesc->pNeighborBssDescription->bssId, sizeof(tSirMacAddr)); |
| 2897 | pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport++; |
| 2898 | |
| 2899 | /* Saving the channel list non-redundantly */ |
| 2900 | if (numChannels > 0) |
| 2901 | { |
| 2902 | for (i = 0; i < numChannels; i++) |
| 2903 | { |
| 2904 | if (pNeighborBssDesc->pNeighborBssDescription->channel == channelList[i]) |
| 2905 | break; |
| 2906 | } |
| 2907 | |
| 2908 | } |
| 2909 | if (i == numChannels) |
| 2910 | { |
| 2911 | if (pNeighborBssDesc->pNeighborBssDescription->channel) |
| 2912 | { |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 2913 | if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac)) |
| 2914 | { |
| 2915 | // Make sure to add only if its the same band |
| 2916 | if (GetRFBand(pNeighborRoamInfo->currAPoperationChannel) == |
| 2917 | GetRFBand(pNeighborBssDesc->pNeighborBssDescription->channel)) |
| 2918 | { |
| 2919 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 2920 | "%s: [INFOLOG] Adding %d to Neighbor channel list (Same band)\n", __func__, |
| 2921 | pNeighborBssDesc->pNeighborBssDescription->channel); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2922 | channelList[numChannels] = pNeighborBssDesc->pNeighborBssDescription->channel; |
| 2923 | numChannels++; |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 2924 | } |
| 2925 | } |
| 2926 | else |
| 2927 | { |
| 2928 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, |
| 2929 | "%s: [INFOLOG] Adding %d to Neighbor channel list\n", __func__, |
| 2930 | pNeighborBssDesc->pNeighborBssDescription->channel); |
| 2931 | channelList[numChannels] = pNeighborBssDesc->pNeighborBssDescription->channel; |
| 2932 | numChannels++; |
| 2933 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2934 | } |
| 2935 | } |
| 2936 | |
| 2937 | pNeighborBssDesc = smeRrmGetNextBssEntryFromNeighborCache(pMac, pNeighborBssDesc); |
| 2938 | } |
| 2939 | |
| 2940 | if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList) |
| 2941 | { |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2942 | #if 0 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2943 | // 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] | 2944 | // we have a union of the IAPP and the already existing list. |
| 2945 | status = csrNeighborRoamMergeChannelLists( |
| 2946 | pMac, |
| 2947 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList, |
| 2948 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels, |
| 2949 | channelList, |
| 2950 | numChannels, |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 2951 | &numChannels ); |
| 2952 | #endif |
| 2953 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2954 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 2955 | } |
| 2956 | |
| 2957 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
Kiran Kumar Lokere | f0bd438 | 2013-03-19 22:06:52 -0700 | [diff] [blame] | 2958 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2959 | /* Store the obtained channel list to the Neighbor Control data structure */ |
| 2960 | if (numChannels) |
| 2961 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = vos_mem_malloc((numChannels) * sizeof(tANI_U8)); |
| 2962 | if (NULL == pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList) |
| 2963 | { |
| 2964 | smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed.. TL event ignored")); |
| 2965 | return VOS_STATUS_E_RESOURCES; |
| 2966 | } |
| 2967 | |
| 2968 | vos_mem_copy(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList, |
| 2969 | channelList, (numChannels) * sizeof(tANI_U8)); |
| 2970 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = numChannels; |
| 2971 | if (numChannels) |
| 2972 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 2973 | 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] | 2974 | pNeighborRoamInfo->neighborRoamState); |
| 2975 | pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_TRUE; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 2976 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 2977 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 2978 | { |
| 2979 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED); |
| 2980 | } |
| 2981 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2982 | } |
| 2983 | pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0; |
| 2984 | pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE; |
| 2985 | |
| 2986 | return VOS_STATUS_SUCCESS; |
| 2987 | } |
| 2988 | |
| 2989 | /* --------------------------------------------------------------------------- |
| 2990 | |
| 2991 | \fn csrNeighborRoamRRMNeighborReportResult |
| 2992 | |
| 2993 | \brief This function is the neighbor report callback that will be invoked by |
| 2994 | SME RRM on receiving a neighbor report or of neighbor report is not |
| 2995 | received after timeout. On receiving a valid report, it generates a |
| 2996 | channel list from the neighbor report and starts the |
| 2997 | neighbor scan timer |
| 2998 | |
| 2999 | \param context - The handle returned by macOpen. |
| 3000 | vosStatus - Status of the callback(SUCCESS/FAILURE) |
| 3001 | |
| 3002 | \return VOID |
| 3003 | |
| 3004 | ---------------------------------------------------------------------------*/ |
| 3005 | void csrNeighborRoamRRMNeighborReportResult(void *context, VOS_STATUS vosStatus) |
| 3006 | { |
| 3007 | tpAniSirGlobal pMac = PMAC_STRUCT(context); |
| 3008 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3009 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3010 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3011 | smsLog(pMac, LOG1, FL("Neighbor report result callback with status = %d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3012 | switch (pNeighborRoamInfo->neighborRoamState) |
| 3013 | { |
| 3014 | case eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY: |
| 3015 | /* Reset the report pending variable */ |
| 3016 | pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE; |
| 3017 | if (VOS_STATUS_SUCCESS == vosStatus) |
| 3018 | { |
| 3019 | /* Need to create channel list based on the neighbor AP list and transition to REPORT_SCAN state */ |
| 3020 | vosStatus = csrNeighborRoamCreateChanListFromNeighborReport(pMac); |
| 3021 | if (VOS_STATUS_SUCCESS == vosStatus) |
| 3022 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3023 | 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] | 3024 | } |
| 3025 | |
| 3026 | /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */ |
| 3027 | pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 3028 | |
| 3029 | /* Now ready for neighbor scan based on the channel list created */ |
| 3030 | /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is |
| 3031 | what palTimerStart expects */ |
| 3032 | status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer, |
| 3033 | pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT, |
| 3034 | eANI_BOOLEAN_FALSE); |
| 3035 | if (eHAL_STATUS_SUCCESS != status) |
| 3036 | { |
| 3037 | /* Timer start failed.. Should we ASSERT here??? */ |
| 3038 | smsLog(pMac, LOGE, FL("PAL Timer start for neighbor scan timer failed, status = %d, Ignoring state transition"), status); |
| 3039 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 3040 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
Kiran Kumar Lokere | f0bd438 | 2013-03-19 22:06:52 -0700 | [diff] [blame] | 3041 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3042 | return; |
| 3043 | } |
| 3044 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0; |
| 3045 | /* Neighbor scan timer started. Transition to REPORT_SCAN state */ |
| 3046 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN) |
| 3047 | } |
| 3048 | else |
| 3049 | { |
| 3050 | /* Neighbor report timeout happened in SME RRM. We can try sending more neighbor requests until we |
| 3051 | reach the maxNeighborRetries or receiving a successful neighbor response */ |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3052 | 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] | 3053 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum, pNeighborRoamInfo->cfgParams.maxNeighborRetries); |
| 3054 | if (pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum >= |
| 3055 | pNeighborRoamInfo->cfgParams.maxNeighborRetries) |
| 3056 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3057 | smsLog(pMac, LOGE, FL("Bailing out to CFG Channel list scan.. ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3058 | vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac); |
| 3059 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 3060 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3061 | 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] | 3062 | return; |
| 3063 | } |
| 3064 | /* We transitioned to different state now. Reset the Neighbor report retry count */ |
| 3065 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0; |
| 3066 | } |
| 3067 | else |
| 3068 | { |
| 3069 | vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac); |
| 3070 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 3071 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3072 | smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3073 | return; |
| 3074 | } |
| 3075 | pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE; |
| 3076 | /* Increment the neighbor report retry count after sending the neighbor request successfully */ |
| 3077 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++; |
| 3078 | } |
| 3079 | } |
| 3080 | break; |
| 3081 | default: |
| 3082 | smsLog(pMac, LOGE, FL("Neighbor result callback not expected in state %d, Ignoring.."), pNeighborRoamInfo->neighborRoamState); |
| 3083 | break; |
| 3084 | } |
| 3085 | return; |
| 3086 | } |
| 3087 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 3088 | |
| 3089 | |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 3090 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3091 | tANI_BOOLEAN csrNeighborRoamIsSsidAndSecurityMatch( |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 3092 | tpAniSirGlobal pMac, |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3093 | tCsrRoamConnectedProfile *pCurProfile, |
| 3094 | tSirBssDescription *pBssDesc, |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3095 | tDot11fBeaconIEs *pIes) |
| 3096 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3097 | tCsrAuthList authType; |
| 3098 | tCsrEncryptionList uCEncryptionType; |
| 3099 | tCsrEncryptionList mCEncryptionType; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3100 | tANI_BOOLEAN fMatch = FALSE; |
| 3101 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3102 | authType.numEntries = 1; |
| 3103 | authType.authType[0] = pCurProfile->AuthType; |
| 3104 | uCEncryptionType.numEntries = 1; |
| 3105 | uCEncryptionType.encryptionType[0] = pCurProfile->EncryptionType; |
| 3106 | mCEncryptionType.numEntries = 1; |
| 3107 | mCEncryptionType.encryptionType[0] = pCurProfile->mcEncryptionType; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3108 | |
| 3109 | if( pIes ) |
| 3110 | { |
| 3111 | if(pIes->SSID.present) |
| 3112 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3113 | fMatch = csrIsSsidMatch( pMac, |
| 3114 | (void *)pCurProfile->SSID.ssId, pCurProfile->SSID.length, |
| 3115 | pIes->SSID.ssid, pIes->SSID.num_ssid, |
| 3116 | eANI_BOOLEAN_TRUE ); |
| 3117 | if(TRUE == fMatch) |
| 3118 | { |
| 3119 | fMatch = csrIsSecurityMatch( pMac, &authType, &uCEncryptionType, |
| 3120 | &mCEncryptionType, pBssDesc, pIes, NULL, NULL, NULL ); |
| 3121 | return (fMatch); |
| 3122 | } |
| 3123 | else |
| 3124 | { |
| 3125 | return (fMatch); |
| 3126 | } |
| 3127 | |
| 3128 | } |
| 3129 | else |
| 3130 | { |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3131 | return FALSE; // Treat a missing SSID as a non-match. |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3132 | } |
| 3133 | } |
| 3134 | else |
| 3135 | { |
| 3136 | return FALSE; // Again, treat missing pIes as a non-match. |
| 3137 | } |
| 3138 | } |
| 3139 | |
| 3140 | tANI_BOOLEAN csrNeighborRoamIsNewConnectedProfile( |
| 3141 | tpAniSirGlobal pMac) |
| 3142 | { |
| 3143 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3144 | tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId; |
| 3145 | tCsrRoamConnectedProfile *pCurrProfile = NULL; |
| 3146 | tCsrRoamConnectedProfile *pPrevProfile = NULL; |
| 3147 | tDot11fBeaconIEs *pIes = NULL; |
| 3148 | tSirBssDescription *pBssDesc = NULL; |
| 3149 | tANI_BOOLEAN fNew = TRUE; |
| 3150 | |
| 3151 | if(!(pMac->roam.roamSession && CSR_IS_SESSION_VALID(pMac, sessionId))) |
| 3152 | { |
| 3153 | return (fNew); |
| 3154 | } |
| 3155 | |
| 3156 | pCurrProfile = &pMac->roam.roamSession[sessionId].connectedProfile; |
| 3157 | if( !pCurrProfile ) |
| 3158 | { |
| 3159 | return (fNew); |
| 3160 | } |
| 3161 | |
| 3162 | pPrevProfile = &pNeighborRoamInfo->prevConnProfile; |
| 3163 | if( !pPrevProfile ) |
| 3164 | { |
| 3165 | return (fNew); |
| 3166 | } |
| 3167 | |
| 3168 | pBssDesc = pPrevProfile->pBssDesc; |
| 3169 | if (pBssDesc) |
| 3170 | { |
| 3171 | if (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac, |
| 3172 | pBssDesc, &pIes)) && |
| 3173 | csrNeighborRoamIsSsidAndSecurityMatch(pMac, pCurrProfile, pBssDesc, pIes)) |
| 3174 | { |
| 3175 | fNew = FALSE; |
| 3176 | } |
| 3177 | if (pIes) { |
| 3178 | palFreeMemory(pMac->hHdd, pIes); |
| 3179 | } |
| 3180 | } |
| 3181 | |
| 3182 | if (fNew) |
| 3183 | { |
| 3184 | smsLog(pMac, LOG1, FL("Prev roam profile did not match current")); |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3185 | } |
| 3186 | else |
| 3187 | { |
| 3188 | smsLog(pMac, LOG1, FL("Prev roam profile matches current")); |
| 3189 | } |
| 3190 | |
| 3191 | return (fNew); |
| 3192 | } |
| 3193 | |
| 3194 | tANI_BOOLEAN csrNeighborRoamConnectedProfileMatch( |
| 3195 | tpAniSirGlobal pMac, |
| 3196 | tCsrScanResult *pResult, |
| 3197 | tDot11fBeaconIEs *pIes) |
| 3198 | { |
| 3199 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3200 | tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId; |
| 3201 | tCsrRoamConnectedProfile *pCurProfile = NULL; |
| 3202 | tSirBssDescription *pBssDesc = &pResult->Result.BssDescriptor; |
| 3203 | |
| 3204 | if( !(pMac->roam.roamSession |
| 3205 | && CSR_IS_SESSION_VALID(pMac, sessionId))) |
| 3206 | { |
| 3207 | return FALSE; |
| 3208 | } |
| 3209 | |
| 3210 | pCurProfile = &pMac->roam.roamSession[sessionId].connectedProfile; |
| 3211 | |
| 3212 | if( !pCurProfile) |
| 3213 | { |
| 3214 | return FALSE; |
| 3215 | } |
| 3216 | |
| 3217 | return csrNeighborRoamIsSsidAndSecurityMatch(pMac, pCurProfile, pBssDesc, pIes); |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3218 | } |
| 3219 | |
| 3220 | /* --------------------------------------------------------------------------- |
| 3221 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3222 | \fn csrNeighborRoamPrepareNonOccupiedChannelList |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3223 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3224 | \brief This function is used to prepare a channel list that is derived from |
| 3225 | the list of valid channels and does not include those in the occupied |
| 3226 | list. |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3227 | |
| 3228 | \param pMac - The handle returned by macOpen. |
| 3229 | \param pInputChannelList - The default channels list. |
| 3230 | \param numOfChannels - The number of channels in the default channels list. |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3231 | \param pOutputChannelList - The place to put the non-occupied channel list. |
| 3232 | \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] | 3233 | |
| 3234 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3235 | |
| 3236 | ---------------------------------------------------------------------------*/ |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3237 | VOS_STATUS csrNeighborRoamPrepareNonOccupiedChannelList( |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 3238 | tpAniSirGlobal pMac, |
| 3239 | tANI_U8 *pInputChannelList, |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3240 | int numOfChannels, |
| 3241 | tANI_U8 *pOutputChannelList, |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 3242 | int *pOutputNumOfChannels |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3243 | ) |
| 3244 | { |
| 3245 | int i = 0; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3246 | int outputNumOfChannels = 0; // Clear the output number of channels |
| 3247 | tANI_U8 numOccupiedChannels = pMac->scan.occupiedChannels.numChannels; |
| 3248 | tANI_U8 *pOccupiedChannelList = pMac->scan.occupiedChannels.channelList; |
| 3249 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3250 | for (i = 0; i < numOfChannels; i++) |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3251 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3252 | if (!csrIsChannelPresentInList(pOccupiedChannelList, numOccupiedChannels, |
| 3253 | pInputChannelList[i])) |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3254 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3255 | pOutputChannelList[outputNumOfChannels++] = pInputChannelList[i]; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3256 | } |
| 3257 | } |
| 3258 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3259 | smsLog(pMac, LOG2, FL("Number of channels in the valid channel list=%d; " |
| 3260 | "Number of channels in the non-occupied list list=%d"), |
| 3261 | numOfChannels, outputNumOfChannels); |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3262 | |
| 3263 | // Return the number of channels |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 3264 | *pOutputNumOfChannels = outputNumOfChannels; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3265 | |
| 3266 | return eHAL_STATUS_SUCCESS; |
| 3267 | } |
| 3268 | #endif /* FEATURE_WLAN_LFR */ |
| 3269 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3270 | /* --------------------------------------------------------------------------- |
| 3271 | |
| 3272 | \fn csrNeighborRoamTransitToCFGChanScan |
| 3273 | |
| 3274 | \brief This function is called whenever there is a transition to CFG chan scan |
| 3275 | state from any state. It frees up the current channel list and allocates |
| 3276 | a new memory for the channels received from CFG item. It then starts the |
| 3277 | neighbor scan timer to perform the scan on each channel one by one |
| 3278 | |
| 3279 | \param pMac - The handle returned by macOpen. |
| 3280 | |
| 3281 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3282 | |
| 3283 | ---------------------------------------------------------------------------*/ |
| 3284 | VOS_STATUS csrNeighborRoamTransitToCFGChanScan(tpAniSirGlobal pMac) |
| 3285 | { |
| 3286 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3287 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3288 | int i = 0; |
| 3289 | int numOfChannels = 0; |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3290 | tANI_U8 channelList[WNI_CFG_VALID_CHANNEL_LIST_LEN]; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3291 | tpCsrChannelInfo currChannelListInfo; |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 3292 | #ifdef FEATURE_WLAN_LFR |
| 3293 | tANI_U32 sessionId = pNeighborRoamInfo->csrSessionId; |
| 3294 | #endif |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3295 | currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3296 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3297 | if ( |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3298 | #ifdef FEATURE_WLAN_CCX |
| 3299 | ((pNeighborRoamInfo->isCCXAssoc) && |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3300 | (pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == eANI_BOOLEAN_FALSE)) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3301 | (pNeighborRoamInfo->isCCXAssoc == eANI_BOOLEAN_FALSE) || |
| 3302 | #endif // CCX |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3303 | currChannelListInfo->numOfChannels == 0) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3304 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3305 | smsLog(pMac, LOGW, FL("Building channel list to scan")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3306 | |
| 3307 | |
| 3308 | /* Free up the channel list and allocate a new memory. This is because we dont know how much |
| 3309 | was allocated last time. If we directly copy more number of bytes than allocated earlier, this might |
| 3310 | result in memory corruption */ |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3311 | if (NULL != currChannelListInfo->ChannelList) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3312 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3313 | vos_mem_free(currChannelListInfo->ChannelList); |
| 3314 | currChannelListInfo->ChannelList = NULL; |
Kiran Kumar Lokere | f0bd438 | 2013-03-19 22:06:52 -0700 | [diff] [blame] | 3315 | currChannelListInfo->numOfChannels = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3316 | } |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3317 | |
| 3318 | // Now obtain the contents for "channelList" (the "default valid channel list") from EITHER |
| 3319 | // the gNeighborScanChannelList in "cfg.ini", OR the actual "valid channel list" information formed by CSR. |
| 3320 | if (0 != pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3321 | { |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3322 | // Copy the "default valid channel list" (channelList) from the gNeighborScanChannelList in "cfg.ini". |
| 3323 | 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] | 3324 | status = csrNeighborRoamMergeChannelLists( |
| 3325 | pMac, |
| 3326 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, |
| 3327 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels, |
| 3328 | channelList, |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3329 | 0, //NB: If 0, simply copy the input channel list to the output list. |
| 3330 | &numOfChannels ); |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3331 | |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 3332 | if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac)) |
| 3333 | { |
| 3334 | csrNeighborRoamChannelsFilterByCurrentBand( |
| 3335 | pMac, |
| 3336 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, |
| 3337 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels, |
| 3338 | channelList, |
| 3339 | &numOfChannels); |
| 3340 | } |
Gopichand Nakkala | 9cd573c | 2013-04-19 21:52:58 +0530 | [diff] [blame] | 3341 | if(numOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 3342 | { |
| 3343 | smsLog(pMac, LOGE, FL("Received wrong number of Channel list")); |
| 3344 | return VOS_STATUS_E_INVAL; |
| 3345 | } |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 3346 | currChannelListInfo->ChannelList = |
| 3347 | vos_mem_malloc(numOfChannels*sizeof(tANI_U8)); |
| 3348 | if (NULL == currChannelListInfo->ChannelList) |
| 3349 | { |
| 3350 | smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed")); |
| 3351 | return VOS_STATUS_E_RESOURCES; |
| 3352 | } |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 3353 | vos_mem_copy(currChannelListInfo->ChannelList, |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3354 | channelList, numOfChannels * sizeof(tANI_U8)); |
Madan Mohan Koyyalamudi | 596e4fb | 2012-10-05 11:39:52 -0700 | [diff] [blame] | 3355 | } |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 3356 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3357 | else if ((pNeighborRoamInfo->uScanMode == DEFAULT_SCAN) && |
| 3358 | (abs(pNeighborRoamInfo->lookupDOWNRssi) > |
| 3359 | abs(pNeighborRoamInfo->cfgParams.neighborReassocThreshold))) |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 3360 | { |
| 3361 | /* |
| 3362 | * Trigger a contiguous scan on all channels when the |
| 3363 | * RSSI in the lookup DOWN notification is below reassoc |
| 3364 | * threshold. This will help us find the best available |
| 3365 | * candidate and also update the channel cache. |
| 3366 | */ |
| 3367 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "Triggering contiguous scan " |
| 3368 | "(lookupDOWNRssi=%d,reassocThreshold=%d)", |
| 3369 | pNeighborRoamInfo->lookupDOWNRssi, |
| 3370 | pNeighborRoamInfo->cfgParams.neighborReassocThreshold*(-1)); |
| 3371 | |
| 3372 | pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 3373 | |
| 3374 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 3375 | |
| 3376 | /* We are about to start a fresh scan cycle, |
| 3377 | * purge non-P2P results from the past */ |
| 3378 | csrScanFlushSelectiveResult(pMac, VOS_FALSE); |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 3379 | |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 3380 | csrNeighborRoamPerformContiguousBgScan(pMac, sessionId); |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 3381 | |
| 3382 | /* Transition to CFG_CHAN_LIST_SCAN */ |
| 3383 | 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] | 3384 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 3385 | return VOS_STATUS_SUCCESS; |
| 3386 | } |
| 3387 | #endif |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3388 | else |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3389 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3390 | numOfChannels = pMac->scan.occupiedChannels.numChannels; |
| 3391 | if (numOfChannels |
| 3392 | #ifdef FEATURE_WLAN_LFR |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3393 | && ((pNeighborRoamInfo->uScanMode == SPLIT_SCAN_OCCUPIED_LIST) || |
| 3394 | (pNeighborRoamInfo->uEmptyScanCount == 0) || |
| 3395 | ((pNeighborRoamInfo->uEmptyScanCount % 2) == 1)) |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3396 | #endif |
| 3397 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3398 | { |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3399 | /* |
| 3400 | * Always scan channels in the occupied channel list |
| 3401 | * before scanning on the non-occupied list. |
| 3402 | */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3403 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Switching to occupied channel list" |
| 3404 | #ifdef FEATURE_WLAN_LFR |
| 3405 | "-uScanMode=%d, uEmptyScanCount=%d", |
| 3406 | pNeighborRoamInfo->uScanMode, |
| 3407 | pNeighborRoamInfo->uEmptyScanCount |
| 3408 | #endif |
| 3409 | ); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 3410 | if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac)) |
| 3411 | { |
| 3412 | csrNeighborRoamChannelsFilterByCurrentBand( |
| 3413 | pMac, |
| 3414 | pMac->scan.occupiedChannels.channelList, |
| 3415 | numOfChannels, |
| 3416 | channelList, |
| 3417 | &numOfChannels); |
| 3418 | } |
| 3419 | else |
| 3420 | { |
Krunal Soni | a75019a | 2013-05-01 01:08:22 -0700 | [diff] [blame] | 3421 | if (numOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 3422 | { |
| 3423 | numOfChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 3424 | } |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 3425 | vos_mem_copy(channelList, |
| 3426 | pMac->scan.occupiedChannels.channelList, |
| 3427 | numOfChannels * sizeof(tANI_U8)); |
| 3428 | } |
| 3429 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3430 | VOS_ASSERT(currChannelListInfo->ChannelList == NULL); |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 3431 | currChannelListInfo->ChannelList = vos_mem_malloc(numOfChannels * sizeof(tANI_U8)); |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3432 | |
| 3433 | if (NULL == currChannelListInfo->ChannelList) |
| 3434 | { |
| 3435 | smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed")); |
| 3436 | return VOS_STATUS_E_RESOURCES; |
| 3437 | } |
Krunal Soni | 81b2426 | 2013-05-15 17:46:41 -0700 | [diff] [blame] | 3438 | if (numOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 3439 | { |
| 3440 | numOfChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 3441 | } |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3442 | vos_mem_copy(currChannelListInfo->ChannelList, |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 3443 | channelList, |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3444 | numOfChannels * sizeof(tANI_U8)); |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3445 | } |
| 3446 | else |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3447 | { |
| 3448 | /* Scan all channels from non-occupied list */ |
| 3449 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Get valid channel list"); |
| 3450 | numOfChannels = sizeof(pMac->roam.validChannelList); |
| 3451 | |
| 3452 | if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac, |
| 3453 | (tANI_U8 *)pMac->roam.validChannelList, |
| 3454 | (tANI_U32 *) &numOfChannels))) |
| 3455 | { |
| 3456 | #ifdef FEATURE_WLAN_LFR |
| 3457 | /* |
| 3458 | * Prepare non-occupied channel list (channelList) |
| 3459 | * from the actual "valid channel list" information |
| 3460 | * formed by CSR. |
| 3461 | */ |
Madan Mohan Koyyalamudi | 22f2708 | 2012-11-27 19:11:12 +0530 | [diff] [blame] | 3462 | NEIGHBOR_ROAM_DEBUG(pMac, LOG1, "Switching to non-occupied channel list"); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3463 | status = csrNeighborRoamPrepareNonOccupiedChannelList(pMac, |
| 3464 | (tANI_U8 *)pMac->roam.validChannelList, |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3465 | numOfChannels, |
| 3466 | channelList, |
| 3467 | &numOfChannels); |
| 3468 | #else |
| 3469 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Merging channel list"); |
| 3470 | status = csrNeighborRoamMergeChannelLists( |
| 3471 | pMac, |
| 3472 | (tANI_U8 *)pMac->roam.validChannelList, |
| 3473 | numOfChannels, // The number of channels in the validChannelList |
| 3474 | channelList, |
| 3475 | 0, //NB: If 0, simply copy the input channel list to the output list. |
| 3476 | &numOfChannels ); // The final number of channels in the output list. Will be numOfChannels |
| 3477 | #endif |
| 3478 | } |
| 3479 | else |
| 3480 | { |
| 3481 | smsLog(pMac, LOGE, FL("Could not get valid channel list")); |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3482 | return VOS_STATUS_E_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3483 | } |
Srinivas Girigowda | bbd16eb | 2013-03-21 12:34:46 -0700 | [diff] [blame] | 3484 | |
| 3485 | if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac)) |
| 3486 | { |
| 3487 | csrNeighborRoamChannelsFilterByCurrentBand( |
| 3488 | pMac, |
| 3489 | (tANI_U8 *)pMac->roam.validChannelList, |
| 3490 | numOfChannels, |
| 3491 | channelList, |
| 3492 | &numOfChannels); |
| 3493 | } |
| 3494 | |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3495 | currChannelListInfo->ChannelList = |
| 3496 | vos_mem_malloc(numOfChannels*sizeof(tANI_U8)); |
| 3497 | |
| 3498 | if (NULL == currChannelListInfo->ChannelList) |
| 3499 | { |
| 3500 | smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed")); |
| 3501 | return VOS_STATUS_E_RESOURCES; |
| 3502 | } |
| 3503 | #ifdef FEATURE_WLAN_LFR |
| 3504 | vos_mem_copy(currChannelListInfo->ChannelList, |
| 3505 | channelList, numOfChannels * sizeof(tANI_U8)); |
| 3506 | #else |
Krunal Soni | a75019a | 2013-05-01 01:08:22 -0700 | [diff] [blame] | 3507 | if (numOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN) |
| 3508 | { |
| 3509 | numOfChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN; |
| 3510 | } |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3511 | vos_mem_copy(currChannelListInfo->ChannelList, |
| 3512 | (tANI_U8 *)pMac->roam.validChannelList, |
| 3513 | numOfChannels * sizeof(tANI_U8)); |
| 3514 | #endif |
| 3515 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3516 | } |
| 3517 | |
Madan Mohan Koyyalamudi | 470d2cf | 2012-09-28 14:43:44 -0700 | [diff] [blame] | 3518 | /* Adjust for the actual number that are used */ |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3519 | currChannelListInfo->numOfChannels = numOfChannels; |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 3520 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, |
| 3521 | "Number of channels from CFG (or) (non-)occupied list=%d", |
| 3522 | currChannelListInfo->numOfChannels); |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3523 | for (i = 0; i < currChannelListInfo->numOfChannels; i++) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3524 | { |
Madan Mohan Koyyalamudi | 22f2708 | 2012-11-27 19:11:12 +0530 | [diff] [blame] | 3525 | 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] | 3526 | "= %d", currChannelListInfo->ChannelList[i]); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3527 | } |
| 3528 | } |
| 3529 | |
| 3530 | /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */ |
| 3531 | pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 3532 | |
| 3533 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 3534 | /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is |
| 3535 | what palTimerStart expects */ |
| 3536 | status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer, |
| 3537 | pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT, |
| 3538 | eANI_BOOLEAN_FALSE); |
| 3539 | |
| 3540 | if (eHAL_STATUS_SUCCESS != status) |
| 3541 | { |
| 3542 | /* Timer start failed.. */ |
| 3543 | 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] | 3544 | vos_mem_free(currChannelListInfo->ChannelList); |
| 3545 | currChannelListInfo->ChannelList = NULL; |
Kiran Kumar Lokere | f0bd438 | 2013-03-19 22:06:52 -0700 | [diff] [blame] | 3546 | currChannelListInfo->numOfChannels = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3547 | return VOS_STATUS_E_FAILURE; |
| 3548 | } |
| 3549 | |
| 3550 | pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0; |
| 3551 | pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE; |
Madan Mohan Koyyalamudi | 5850f31 | 2012-11-27 19:00:25 +0530 | [diff] [blame] | 3552 | /* We are about to start a fresh scan cycle, |
| 3553 | * purge non-P2P results from the past */ |
| 3554 | csrScanFlushSelectiveResult(pMac, VOS_FALSE); |
James Zmuda | 5ba36d0 | 2013-03-14 17:39:07 -0700 | [diff] [blame] | 3555 | |
| 3556 | /* We are about to start a fresh scan cycle, |
| 3557 | * purge failed pre-auth results from the past */ |
| 3558 | csrNeighborRoamPurgePreauthFailedList(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3559 | |
| 3560 | /* Transition to CFG_CHAN_LIST_SCAN_STATE */ |
| 3561 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN) |
| 3562 | |
| 3563 | return VOS_STATUS_SUCCESS; |
| 3564 | } |
| 3565 | |
| 3566 | /* --------------------------------------------------------------------------- |
| 3567 | |
| 3568 | \fn csrNeighborRoamNeighborLookupUpEvent |
| 3569 | |
| 3570 | \brief This function is called as soon as TL indicates that the current AP's |
| 3571 | RSSI is better than the neighbor lookup threshold. Here, we transition to |
| 3572 | CONNECTED state and reset all the scan parameters |
| 3573 | |
| 3574 | \param pMac - The handle returned by macOpen. |
| 3575 | |
| 3576 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3577 | |
| 3578 | ---------------------------------------------------------------------------*/ |
| 3579 | VOS_STATUS csrNeighborRoamNeighborLookupUpEvent(tpAniSirGlobal pMac) |
| 3580 | { |
| 3581 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3582 | VOS_STATUS vosStatus; |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 3583 | csrNeighborRoamDeregAllRssiIndication(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3584 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3585 | /* Recheck whether the below check is needed. */ |
| 3586 | if (pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_CONNECTED) |
| 3587 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED) |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 3588 | #ifdef FEATURE_WLAN_LFR |
| 3589 | if (!csrRoamIsFastRoamEnabled(pMac,pMac->roam.neighborRoamInfo.csrSessionId)) |
| 3590 | { |
| 3591 | smsLog(pMac, LOGE, FL("Received when fast roam is disabled. Ignore it")); |
| 3592 | return eHAL_STATUS_SUCCESS; |
| 3593 | } |
| 3594 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3595 | /* Reset all the neighbor roam info control variables. Free all the allocated memory. It is like we are just associated now */ |
| 3596 | csrNeighborRoamResetConnectedStateControlInfo(pMac); |
| 3597 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3598 | |
| 3599 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event neighbor lookup callback with TL. RSSI = %d,"), pNeighborRoamInfo->currentNeighborLookupThreshold * (-1)); |
| 3600 | /* Register Neighbor Lookup threshold callback with TL for DOWN event now */ |
| 3601 | vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1), |
| 3602 | WLANTL_HO_THRESHOLD_DOWN, |
| 3603 | csrNeighborRoamNeighborLookupDOWNCallback, |
| 3604 | VOS_MODULE_ID_SME, pMac); |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 3605 | #ifdef FEATURE_WLAN_LFR |
| 3606 | pNeighborRoamInfo->lookupDOWNRssi = 0; |
| 3607 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3608 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 3609 | { |
| 3610 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3611 | 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] | 3612 | } |
| 3613 | |
| 3614 | |
| 3615 | return vosStatus; |
| 3616 | } |
| 3617 | |
| 3618 | /* --------------------------------------------------------------------------- |
| 3619 | |
| 3620 | \fn csrNeighborRoamNeighborLookupDownEvent |
| 3621 | |
| 3622 | \brief This function is called as soon as TL indicates that the current AP's |
| 3623 | RSSI falls below the current eighbor lookup threshold. Here, we transition to |
| 3624 | REPORT_QUERY for 11r association and CFG_CHAN_LIST_SCAN state if the assoc is |
| 3625 | a non-11R association. |
| 3626 | |
| 3627 | \param pMac - The handle returned by macOpen. |
| 3628 | |
| 3629 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3630 | |
| 3631 | ---------------------------------------------------------------------------*/ |
| 3632 | VOS_STATUS csrNeighborRoamNeighborLookupDownEvent(tpAniSirGlobal pMac) |
| 3633 | { |
| 3634 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3635 | VOS_STATUS vosStatus = VOS_STATUS_SUCCESS; |
| 3636 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 3637 | |
| 3638 | switch (pNeighborRoamInfo->neighborRoamState) |
| 3639 | { |
| 3640 | case eCSR_NEIGHBOR_ROAM_STATE_CONNECTED: |
| 3641 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3642 | 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] | 3643 | pNeighborRoamInfo->currentNeighborLookupThreshold * (-1)); |
| 3644 | /* De-register Neighbor Lookup threshold callback with TL */ |
| 3645 | vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1), |
| 3646 | WLANTL_HO_THRESHOLD_DOWN, |
| 3647 | csrNeighborRoamNeighborLookupDOWNCallback, |
| 3648 | VOS_MODULE_ID_SME); |
| 3649 | |
| 3650 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 3651 | { |
| 3652 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3653 | 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] | 3654 | } |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 3655 | #ifdef FEATURE_WLAN_LFR |
| 3656 | if (!csrRoamIsFastRoamEnabled(pMac,pMac->roam.neighborRoamInfo.csrSessionId)) |
| 3657 | { |
| 3658 | smsLog(pMac, LOGE, FL("Received when fast roam is disabled. Ignore it")); |
| 3659 | return eHAL_STATUS_SUCCESS; |
| 3660 | } |
| 3661 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3662 | |
| 3663 | #if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI |
| 3664 | if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled)) |
| 3665 | { |
| 3666 | |
| 3667 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state")); |
| 3668 | vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac); |
| 3669 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 3670 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3671 | smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3672 | return vosStatus; |
| 3673 | } |
| 3674 | /* Increment the neighbor report retry count after sending the neighbor request successfully */ |
| 3675 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++; |
| 3676 | pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE; |
| 3677 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY) |
| 3678 | } |
| 3679 | else |
| 3680 | #endif |
| 3681 | { |
| 3682 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Non 11R or CCX Association:Neighbor Lookup Down event received in CONNECTED state")); |
| 3683 | |
| 3684 | vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac); |
| 3685 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 3686 | { |
Madan Mohan Koyyalamudi | 4450acc | 2012-11-15 17:24:31 -0800 | [diff] [blame] | 3687 | NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("csrNeighborRoamTransitToCFGChanScan failed" |
| 3688 | " with status=%d"), vosStatus); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3689 | return vosStatus; |
| 3690 | } |
| 3691 | } |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3692 | 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] | 3693 | /* Register Neighbor Lookup threshold callback with TL for UP event now */ |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 3694 | vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, |
| 3695 | (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3696 | WLANTL_HO_THRESHOLD_UP, |
| 3697 | csrNeighborRoamNeighborLookupUPCallback, |
| 3698 | VOS_MODULE_ID_SME, pMac); |
| 3699 | if(!VOS_IS_STATUS_SUCCESS(vosStatus)) |
| 3700 | { |
| 3701 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3702 | 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] | 3703 | } |
| 3704 | break; |
| 3705 | default: |
| 3706 | smsLog(pMac, LOGE, FL("DOWN event received in invalid state %d..Ignoring..."), pNeighborRoamInfo->neighborRoamState); |
| 3707 | break; |
| 3708 | |
| 3709 | } |
| 3710 | return vosStatus; |
| 3711 | } |
| 3712 | |
| 3713 | /* --------------------------------------------------------------------------- |
| 3714 | |
| 3715 | \fn csrNeighborRoamNeighborLookupUPCallback |
| 3716 | |
| 3717 | \brief This function is registered with TL to indicate whenever the RSSI |
| 3718 | gets better than the neighborLookup RSSI Threshold |
| 3719 | |
| 3720 | \param pAdapter - VOS Context |
| 3721 | trafficStatus - UP/DOWN indication from TL |
| 3722 | pUserCtxt - Parameter for callback registered during callback registration. Should be pMac |
| 3723 | |
| 3724 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3725 | |
| 3726 | ---------------------------------------------------------------------------*/ |
| 3727 | VOS_STATUS csrNeighborRoamNeighborLookupUPCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification, |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 3728 | v_PVOID_t pUserCtxt, |
| 3729 | v_S7_t avgRssi) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3730 | { |
| 3731 | tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt ); |
| 3732 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3733 | VOS_STATUS vosStatus = eHAL_STATUS_SUCCESS; |
| 3734 | |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 3735 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Neighbor Lookup UP indication callback called with notification %d Reported RSSI = %d"), |
| 3736 | rssiNotification, |
| 3737 | avgRssi); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3738 | |
| 3739 | if(!csrIsConnStateConnectedInfra(pMac, pNeighborRoamInfo->csrSessionId)) |
| 3740 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3741 | smsLog(pMac, LOGW, "Ignoring the indication as we are not connected"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3742 | return VOS_STATUS_SUCCESS; |
| 3743 | } |
| 3744 | |
| 3745 | VOS_ASSERT(WLANTL_HO_THRESHOLD_UP == rssiNotification); |
| 3746 | vosStatus = csrNeighborRoamNeighborLookupUpEvent(pMac); |
| 3747 | return vosStatus; |
| 3748 | } |
| 3749 | |
| 3750 | /* --------------------------------------------------------------------------- |
| 3751 | |
| 3752 | \fn csrNeighborRoamNeighborLookupDOWNCallback |
| 3753 | |
| 3754 | \brief This function is registered with TL to indicate whenever the RSSI |
| 3755 | falls below the current neighborLookup RSSI Threshold |
| 3756 | |
| 3757 | \param pAdapter - VOS Context |
| 3758 | trafficStatus - UP/DOWN indication from TL |
| 3759 | pUserCtxt - Parameter for callback registered during callback registration. Should be pMac |
| 3760 | |
| 3761 | \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3762 | |
| 3763 | ---------------------------------------------------------------------------*/ |
| 3764 | VOS_STATUS csrNeighborRoamNeighborLookupDOWNCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification, |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 3765 | v_PVOID_t pUserCtxt, |
| 3766 | v_S7_t avgRssi) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3767 | { |
| 3768 | tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt ); |
| 3769 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3770 | VOS_STATUS vosStatus = eHAL_STATUS_SUCCESS; |
| 3771 | |
Srinivas | daaec71 | 2012-12-12 15:59:44 -0800 | [diff] [blame] | 3772 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Neighbor Lookup DOWN indication callback called with notification %d Reported RSSI = %d"), |
| 3773 | rssiNotification, |
| 3774 | avgRssi); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3775 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 3776 | #ifdef FEATURE_WLAN_LFR |
| 3777 | pNeighborRoamInfo->lookupDOWNRssi = avgRssi; |
| 3778 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3779 | if(!csrIsConnStateConnectedInfra(pMac, pNeighborRoamInfo->csrSessionId)) |
| 3780 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 3781 | smsLog(pMac, LOGW, "Ignoring the indication as we are not connected"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3782 | return VOS_STATUS_SUCCESS; |
| 3783 | } |
| 3784 | |
| 3785 | VOS_ASSERT(WLANTL_HO_THRESHOLD_DOWN == rssiNotification); |
| 3786 | vosStatus = csrNeighborRoamNeighborLookupDownEvent(pMac); |
| 3787 | |
| 3788 | return vosStatus; |
| 3789 | } |
| 3790 | |
| 3791 | #ifdef RSSI_HACK |
| 3792 | extern int dumpCmdRSSI; |
| 3793 | #endif |
| 3794 | |
| 3795 | /* --------------------------------------------------------------------------- |
| 3796 | |
| 3797 | \fn csrNeighborRoamIndicateDisconnect |
| 3798 | |
| 3799 | \brief This function is called by CSR as soon as the station disconnects from |
| 3800 | the AP. This function does the necessary cleanup of neighbor roam data |
| 3801 | structures. Neighbor roam state transitions to INIT state whenever this |
| 3802 | function is called except if the current state is REASSOCIATING |
| 3803 | |
| 3804 | \param pMac - The handle returned by macOpen. |
| 3805 | sessionId - CSR session id that got disconnected |
| 3806 | |
| 3807 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3808 | |
| 3809 | ---------------------------------------------------------------------------*/ |
| 3810 | eHalStatus csrNeighborRoamIndicateDisconnect(tpAniSirGlobal pMac, tANI_U8 sessionId) |
| 3811 | { |
| 3812 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 3813 | #ifdef FEATURE_WLAN_LFR |
| 3814 | tCsrRoamConnectedProfile *pPrevProfile = &pNeighborRoamInfo->prevConnProfile; |
| 3815 | #endif |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 3816 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3817 | |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 3818 | smsLog(pMac, LOGE, FL("Disconnect indication on session %d in state %d"), |
| 3819 | sessionId, pNeighborRoamInfo->neighborRoamState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3820 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 3821 | #ifdef FEATURE_WLAN_LFR |
| 3822 | /*Free the current previous profile and move the current profile to prev profile.*/ |
| 3823 | csrRoamFreeConnectProfile(pMac, pPrevProfile); |
| 3824 | csrRoamGetConnectProfile(pMac, sessionId, pPrevProfile); |
| 3825 | #endif |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 3826 | if (NULL != pSession) |
| 3827 | { |
| 3828 | if (NULL != pSession->pCurRoamProfile) |
| 3829 | { |
| 3830 | if (VOS_STA_MODE != pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona) |
| 3831 | { |
| 3832 | smsLog(pMac, LOGE, FL("Ignoring Disconnect indication received from a non STA persona." |
| 3833 | "sessionId: %d, csrPersonna %d"), sessionId, |
| 3834 | (int)pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona); |
| 3835 | return eHAL_STATUS_SUCCESS; |
| 3836 | } |
| 3837 | } |
| 3838 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 3839 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3840 | #ifdef FEATURE_WLAN_CCX |
| 3841 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3842 | if (pSession->connectedProfile.isCCXAssoc) |
| 3843 | { |
| 3844 | vos_mem_copy(&pSession->prevApSSID, &pSession->connectedProfile.SSID, sizeof(tSirMacSSid)); |
| 3845 | vos_mem_copy(pSession->prevApBssid, pSession->connectedProfile.bssid, sizeof(tSirMacAddr)); |
| 3846 | pSession->prevOpChannel = pSession->connectedProfile.operationChannel; |
| 3847 | pSession->isPrevApInfoValid = TRUE; |
| 3848 | pSession->roamTS1 = vos_timer_get_system_time(); |
| 3849 | |
| 3850 | } |
| 3851 | } |
| 3852 | #endif |
| 3853 | |
| 3854 | #ifdef RSSI_HACK |
| 3855 | dumpCmdRSSI = -40; |
| 3856 | #endif |
| 3857 | switch (pNeighborRoamInfo->neighborRoamState) |
| 3858 | { |
| 3859 | case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING: |
| 3860 | // Stop scan and neighbor refresh timers. |
| 3861 | // These are indeed not required when we are in reassociating |
| 3862 | // state. |
| 3863 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 3864 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 3865 | palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer); |
Madan Mohan Koyyalamudi | 5ad3dff | 2012-10-21 11:32:02 -0700 | [diff] [blame] | 3866 | if (!CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId )) { |
| 3867 | /* |
| 3868 | * Disconnect indication during Disassoc Handoff sub-state |
| 3869 | * is received when we are trying to disconnect with the old |
| 3870 | * AP during roam. BUT, if receive a disconnect indication |
| 3871 | * outside of Disassoc Handoff sub-state, then it means that |
| 3872 | * this is a genuine disconnect and we need to clean up. |
| 3873 | * Otherwise, we will be stuck in reassoc state which will |
| 3874 | * in-turn block scans (see csrIsScanAllowed). |
| 3875 | */ |
| 3876 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT); |
| 3877 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3878 | break; |
| 3879 | |
| 3880 | case eCSR_NEIGHBOR_ROAM_STATE_INIT: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3881 | csrNeighborRoamResetInitStateControlInfo(pMac); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 3882 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 3883 | if(!pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 3884 | { |
| 3885 | #endif |
| 3886 | csrNeighborRoamDeregAllRssiIndication(pMac); |
| 3887 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 3888 | } |
| 3889 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3890 | break; |
| 3891 | |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 3892 | case eCSR_NEIGHBOR_ROAM_STATE_CONNECTED: |
| 3893 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT) |
| 3894 | csrNeighborRoamResetConnectedStateControlInfo(pMac); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 3895 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 3896 | if(!pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 3897 | { |
| 3898 | #endif |
| 3899 | csrNeighborRoamDeregAllRssiIndication(pMac); |
| 3900 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 3901 | } |
| 3902 | #endif |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 3903 | break; |
| 3904 | |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 3905 | case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN: |
| 3906 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT); |
| 3907 | csrNeighborRoamResetCfgListChanScanControlInfo(pMac); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 3908 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 3909 | if (!pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 3910 | { |
| 3911 | #endif |
| 3912 | csrNeighborRoamDeregAllRssiIndication(pMac); |
| 3913 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 3914 | } |
| 3915 | #endif |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 3916 | break; |
| 3917 | |
| 3918 | case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE: |
| 3919 | /* Stop pre-auth to reassoc interval timer */ |
| 3920 | palTimerStop(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer); |
Madan Mohan Koyyalamudi | 4f292df | 2012-09-18 17:27:40 -0700 | [diff] [blame] | 3921 | case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN: |
| 3922 | case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING: |
| 3923 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT) |
Madan Mohan Koyyalamudi | edee8aa | 2012-10-15 15:36:40 -0700 | [diff] [blame] | 3924 | csrNeighborRoamResetPreauthControlInfo(pMac); |
Madan Mohan Koyyalamudi | 4f292df | 2012-09-18 17:27:40 -0700 | [diff] [blame] | 3925 | csrNeighborRoamResetReportScanStateControlInfo(pMac); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 3926 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 3927 | if (!pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 3928 | { |
| 3929 | #endif |
| 3930 | csrNeighborRoamDeregAllRssiIndication(pMac); |
| 3931 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 3932 | } |
| 3933 | #endif |
Madan Mohan Koyyalamudi | 4f292df | 2012-09-18 17:27:40 -0700 | [diff] [blame] | 3934 | break; |
| 3935 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3936 | default: |
Madan Mohan Koyyalamudi | 5695b50 | 2012-09-24 14:21:12 -0700 | [diff] [blame] | 3937 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Received disconnect event in state %d"), pNeighborRoamInfo->neighborRoamState); |
| 3938 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Transitioning to INIT state")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3939 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT) |
Madan Mohan Koyyalamudi | 4f292df | 2012-09-18 17:27:40 -0700 | [diff] [blame] | 3940 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3941 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 3942 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 3943 | /*Inform the Firmware to STOP Scanning as the host has a disconnect.*/ |
| 3944 | if (csrRoamIsStaMode(pMac, sessionId)) |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 3945 | { |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 3946 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_STOP, REASON_DISCONNECTED); |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 3947 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 3948 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3949 | return eHAL_STATUS_SUCCESS; |
| 3950 | } |
| 3951 | |
| 3952 | /* --------------------------------------------------------------------------- |
| 3953 | |
| 3954 | \fn csrNeighborRoamIndicateConnect |
| 3955 | |
| 3956 | \brief This function is called by CSR as soon as the station connects to an AP. |
| 3957 | This initializes all the necessary data structures related to the |
| 3958 | associated AP and transitions the state to CONNECTED state |
| 3959 | |
| 3960 | \param pMac - The handle returned by macOpen. |
| 3961 | sessionId - CSR session id that got connected |
| 3962 | vosStatus - connect status SUCCESS/FAILURE |
| 3963 | |
| 3964 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 3965 | |
| 3966 | ---------------------------------------------------------------------------*/ |
| 3967 | eHalStatus csrNeighborRoamIndicateConnect(tpAniSirGlobal pMac, tANI_U8 sessionId, VOS_STATUS vosStatus) |
| 3968 | { |
| 3969 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 3970 | eHalStatus status = eHAL_STATUS_SUCCESS; |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 3971 | VOS_STATUS vstatus; |
| 3972 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 3973 | #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] | 3974 | int init_ft_flag = FALSE; |
| 3975 | #endif |
| 3976 | |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 3977 | 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] | 3978 | |
Dhanashri Atre | 9ae0dd1 | 2013-05-02 11:11:05 -0700 | [diff] [blame] | 3979 | // Bail out if this is NOT a STA persona or if a concurrent session is running |
| 3980 | if ((pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona != VOS_STA_MODE)|| |
| 3981 | csrIsConcurrentSessionRunning(pMac)) |
| 3982 | { |
| 3983 | smsLog(pMac, LOGE, FL("Ignoring Connect indication received from a non STA persona." |
| 3984 | "sessionId: %d, csrPersonna %d, is multisession %d"), |
| 3985 | sessionId, |
| 3986 | (int)pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona, |
| 3987 | csrIsConcurrentSessionRunning(pMac)); |
| 3988 | return eHAL_STATUS_SUCCESS; |
| 3989 | } |
| 3990 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3991 | switch (pNeighborRoamInfo->neighborRoamState) |
| 3992 | { |
| 3993 | case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING: |
| 3994 | if (VOS_STATUS_SUCCESS != vosStatus) |
| 3995 | { |
| 3996 | /* Just transition the state to INIT state. Rest of the clean up happens when we get next connect indication */ |
| 3997 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT) |
| 3998 | break; |
| 3999 | } |
| 4000 | /* Fall through if the status is SUCCESS */ |
| 4001 | case eCSR_NEIGHBOR_ROAM_STATE_INIT: |
| 4002 | /* Reset all the data structures here */ |
| 4003 | csrNeighborRoamResetInitStateControlInfo(pMac); |
| 4004 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4005 | pNeighborRoamInfo->csrSessionId = sessionId; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 4006 | |
| 4007 | #ifdef FEATURE_WLAN_LFR |
| 4008 | /* |
| 4009 | * Initialize the occupied list ONLY if we are |
| 4010 | * transitioning from INIT state to CONNECTED state. |
| 4011 | */ |
| 4012 | if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState) |
| 4013 | csrInitOccupiedChannelsList(pMac); |
| 4014 | #endif |
| 4015 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED); |
| 4016 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4017 | vos_mem_copy(pNeighborRoamInfo->currAPbssid, |
| 4018 | pMac->roam.roamSession[sessionId].connectedProfile.bssid, sizeof(tCsrBssid)); |
| 4019 | pNeighborRoamInfo->currAPoperationChannel = pMac->roam.roamSession[sessionId].connectedProfile.operationChannel; |
| 4020 | pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac; |
| 4021 | pNeighborRoamInfo->neighborScanTimerInfo.sessionId = sessionId; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 4022 | pNeighborRoamInfo->currentNeighborLookupThreshold = |
| 4023 | pNeighborRoamInfo->cfgParams.neighborLookupThreshold; |
| 4024 | #ifdef FEATURE_WLAN_LFR |
| 4025 | pNeighborRoamInfo->uEmptyScanCount = 0; |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 4026 | pNeighborRoamInfo->lookupDOWNRssi = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 4027 | pNeighborRoamInfo->uScanMode = DEFAULT_SCAN; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 4028 | #endif |
| 4029 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4030 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4031 | #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] | 4032 | /* Now we can clear the preauthDone that was saved as we are connected afresh */ |
| 4033 | csrNeighborRoamFreeRoamableBSSList(pMac, &pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList); |
| 4034 | #endif |
| 4035 | |
| 4036 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4037 | // Based on the auth scheme tell if we are 11r |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 4038 | if ( csrIsAuthType11r( pMac->roam.roamSession[sessionId].connectedProfile.AuthType, |
| 4039 | pMac->roam.roamSession[sessionId].connectedProfile.MDID.mdiePresent)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4040 | { |
| 4041 | if (pMac->roam.configParam.isFastTransitionEnabled) |
| 4042 | init_ft_flag = TRUE; |
| 4043 | pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_TRUE; |
| 4044 | } |
| 4045 | else |
| 4046 | pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_FALSE; |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 4047 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("11rAssoc is = %d"), pNeighborRoamInfo->is11rAssoc); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4048 | #endif |
| 4049 | |
| 4050 | #ifdef FEATURE_WLAN_CCX |
| 4051 | // Based on the auth scheme tell if we are 11r |
| 4052 | if (pMac->roam.roamSession[sessionId].connectedProfile.isCCXAssoc) |
| 4053 | { |
| 4054 | if (pMac->roam.configParam.isFastTransitionEnabled) |
| 4055 | init_ft_flag = TRUE; |
| 4056 | pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_TRUE; |
| 4057 | } |
| 4058 | else |
| 4059 | pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_FALSE; |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 4060 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("isCCXAssoc is = %d ft = %d"), |
| 4061 | pNeighborRoamInfo->isCCXAssoc, init_ft_flag); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4062 | |
| 4063 | #endif |
| 4064 | |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4065 | #ifdef FEATURE_WLAN_LFR |
| 4066 | // If "Legacy Fast Roaming" is enabled |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 4067 | if (csrRoamIsFastRoamEnabled(pMac, sessionId)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4068 | { |
| 4069 | init_ft_flag = TRUE; |
| 4070 | } |
| 4071 | #endif |
| 4072 | |
| 4073 | #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] | 4074 | if ( init_ft_flag == TRUE ) |
| 4075 | { |
| 4076 | /* Initialize all the data structures needed for the 11r FT Preauth */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4077 | pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0; |
| 4078 | csrNeighborRoamPurgePreauthFailedList(pMac); |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4079 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 4080 | if (pMac->roam.configParam.isRoamOffloadScanEnabled) |
| 4081 | { |
| 4082 | /*If this is not a INFRA type BSS, then do not send the command |
| 4083 | * down to firmware.Do not send the START command for other session |
| 4084 | * connections.*/ |
| 4085 | if(csrRoamIsStaMode(pMac, sessionId)) |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 4086 | { |
| 4087 | pNeighborRoamInfo->uOsRequestedHandoff = 0; |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4088 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_START, REASON_CONNECT); |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 4089 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4090 | } else { |
| 4091 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4092 | |
| 4093 | NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"), pNeighborRoamInfo->currentNeighborLookupThreshold); |
| 4094 | /* Register Neighbor Lookup threshold callback with TL for DOWN event only */ |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4095 | vstatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4096 | WLANTL_HO_THRESHOLD_DOWN, |
| 4097 | csrNeighborRoamNeighborLookupDOWNCallback, |
| 4098 | VOS_MODULE_ID_SME, pMac); |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 4099 | #ifdef FEATURE_WLAN_LFR |
| 4100 | pNeighborRoamInfo->lookupDOWNRssi = 0; |
| 4101 | #endif |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 4102 | if(!VOS_IS_STATUS_SUCCESS(vstatus)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4103 | { |
| 4104 | //err msg |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4105 | 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] | 4106 | status = eHAL_STATUS_FAILURE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4107 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4108 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 4109 | } |
| 4110 | #endif /* WLAN_FEATURE_ROAM_SCAN_OFFLOAD */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4111 | } |
| 4112 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4113 | break; |
| 4114 | default: |
| 4115 | smsLog(pMac, LOGE, FL("Connect event received in invalid state %d..Ignoring..."), pNeighborRoamInfo->neighborRoamState); |
| 4116 | break; |
| 4117 | } |
| 4118 | return status; |
| 4119 | } |
| 4120 | |
| 4121 | |
| 4122 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4123 | /* --------------------------------------------------------------------------- |
| 4124 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4125 | \fn csrNeighborRoamPurgePreauthFailedList |
| 4126 | |
| 4127 | \brief This function purges all the MAC addresses in the pre-auth fail list |
| 4128 | |
| 4129 | \param pMac - The handle returned by macOpen. |
| 4130 | |
| 4131 | \return VOID |
| 4132 | |
| 4133 | ---------------------------------------------------------------------------*/ |
| 4134 | void csrNeighborRoamPurgePreauthFailedList(tpAniSirGlobal pMac) |
| 4135 | { |
| 4136 | tANI_U8 i; |
| 4137 | |
| 4138 | for (i = 0; i < pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.numMACAddress; i++) |
| 4139 | { |
| 4140 | vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.macAddress[i], sizeof(tSirMacAddr)); |
| 4141 | } |
| 4142 | pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.numMACAddress = 0; |
| 4143 | |
| 4144 | return; |
| 4145 | } |
| 4146 | |
| 4147 | /* --------------------------------------------------------------------------- |
| 4148 | |
| 4149 | \fn csrNeighborRoamInit11rAssocInfo |
| 4150 | |
| 4151 | \brief This function initializes 11r related neighbor roam data structures |
| 4152 | |
| 4153 | \param pMac - The handle returned by macOpen. |
| 4154 | |
| 4155 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 4156 | |
| 4157 | ---------------------------------------------------------------------------*/ |
| 4158 | eHalStatus csrNeighborRoamInit11rAssocInfo(tpAniSirGlobal pMac) |
| 4159 | { |
| 4160 | eHalStatus status; |
| 4161 | tpCsr11rAssocNeighborInfo pFTRoamInfo = &pMac->roam.neighborRoamInfo.FTRoamInfo; |
| 4162 | |
| 4163 | pMac->roam.neighborRoamInfo.is11rAssoc = eANI_BOOLEAN_FALSE; |
| 4164 | pMac->roam.neighborRoamInfo.cfgParams.maxNeighborRetries = pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries; |
| 4165 | pFTRoamInfo->neighborReportTimeout = CSR_NEIGHBOR_ROAM_REPORT_QUERY_TIMEOUT; |
| 4166 | pFTRoamInfo->PEPreauthRespTimeout = CSR_NEIGHBOR_ROAM_PREAUTH_RSP_WAIT_MULTIPLIER * pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod; |
| 4167 | pFTRoamInfo->neighborRptPending = eANI_BOOLEAN_FALSE; |
| 4168 | pFTRoamInfo->preauthRspPending = eANI_BOOLEAN_FALSE; |
| 4169 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4170 | pMac->roam.neighborRoamInfo.FTRoamInfo.currentNeighborRptRetryNum = 0; |
| 4171 | pMac->roam.neighborRoamInfo.FTRoamInfo.numBssFromNeighborReport = 0; |
| 4172 | vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.neighboReportBssInfo, |
| 4173 | sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT); |
| 4174 | |
| 4175 | |
| 4176 | status = csrLLOpen(pMac->hHdd, &pFTRoamInfo->preAuthDoneList); |
| 4177 | if (eHAL_STATUS_SUCCESS != status) |
| 4178 | { |
| 4179 | smsLog(pMac, LOGE, FL("LL Open of preauth done AP List failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4180 | return eHAL_STATUS_RESOURCES; |
| 4181 | } |
| 4182 | return status; |
| 4183 | } |
| 4184 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 4185 | |
| 4186 | /* --------------------------------------------------------------------------- |
| 4187 | |
| 4188 | \fn csrNeighborRoamInit |
| 4189 | |
| 4190 | \brief This function initializes neighbor roam data structures |
| 4191 | |
| 4192 | \param pMac - The handle returned by macOpen. |
| 4193 | |
| 4194 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 4195 | |
| 4196 | ---------------------------------------------------------------------------*/ |
| 4197 | eHalStatus csrNeighborRoamInit(tpAniSirGlobal pMac) |
| 4198 | { |
| 4199 | eHalStatus status; |
| 4200 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 4201 | |
| 4202 | pNeighborRoamInfo->neighborRoamState = eCSR_NEIGHBOR_ROAM_STATE_CLOSED; |
| 4203 | pNeighborRoamInfo->prevNeighborRoamState = eCSR_NEIGHBOR_ROAM_STATE_CLOSED; |
| 4204 | pNeighborRoamInfo->csrSessionId = CSR_SESSION_ID_INVALID; |
| 4205 | pNeighborRoamInfo->cfgParams.maxChannelScanTime = pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime; |
| 4206 | pNeighborRoamInfo->cfgParams.minChannelScanTime = pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime; |
| 4207 | pNeighborRoamInfo->cfgParams.maxNeighborRetries = 0; |
| 4208 | pNeighborRoamInfo->cfgParams.neighborLookupThreshold = pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold; |
| 4209 | pNeighborRoamInfo->cfgParams.neighborReassocThreshold = pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold; |
| 4210 | pNeighborRoamInfo->cfgParams.neighborScanPeriod = pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod; |
| 4211 | pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod = pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 4212 | pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod = pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod; |
| 4213 | |
| 4214 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) |
| 4215 | pNeighborRoamInfo->cfgParams.countryChannelInfo.revision = SME_KR_25; |
| 4216 | pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.ChannelList = NULL; |
| 4217 | pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels = 0; |
| 4218 | |
| 4219 | if (0 == strncmp(pMac->scan.countryCodeCurrent, "KR", 2)) |
| 4220 | { |
| 4221 | csrInitCountryValidChannelList(pMac, SME_KR_25); |
| 4222 | } |
| 4223 | #endif |
| 4224 | |
| 4225 | pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4226 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; |
| 4227 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 4228 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4229 | vos_mem_malloc(pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels); |
| 4230 | |
| 4231 | if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 4232 | { |
| 4233 | smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed")); |
| 4234 | return eHAL_STATUS_RESOURCES; |
| 4235 | } |
| 4236 | |
| 4237 | /* Update the roam global structure from CFG */ |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 4238 | palCopyMemory(pMac->hHdd, pNeighborRoamInfo->cfgParams.channelInfo.ChannelList, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4239 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList, |
| 4240 | pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels); |
| 4241 | |
| 4242 | vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0); |
| 4243 | pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 4244 | #ifdef FEATURE_WLAN_LFR |
Srikant Kuppa | 866893f | 2012-12-27 17:28:14 -0800 | [diff] [blame] | 4245 | pNeighborRoamInfo->lookupDOWNRssi = 0; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 4246 | pNeighborRoamInfo->uEmptyScanCount = 0; |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 4247 | pNeighborRoamInfo->uScanMode = DEFAULT_SCAN; |
Madan Mohan Koyyalamudi | dd3c966 | 2012-11-09 17:39:30 -0800 | [diff] [blame] | 4248 | palZeroMemory(pMac->hHdd, &pNeighborRoamInfo->prevConnProfile, |
| 4249 | sizeof(tCsrRoamConnectedProfile)); |
| 4250 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4251 | pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE; |
| 4252 | |
| 4253 | pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac; |
| 4254 | pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 4255 | status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->neighborScanTimer, |
| 4256 | csrNeighborRoamNeighborScanTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo); |
| 4257 | |
| 4258 | if (eHAL_STATUS_SUCCESS != status) |
| 4259 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 4260 | smsLog(pMac, LOGE, FL("Neighbor scan timer allocation failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4261 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 4262 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
| 4263 | return eHAL_STATUS_RESOURCES; |
| 4264 | } |
| 4265 | |
| 4266 | status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->neighborResultsRefreshTimer, |
| 4267 | csrNeighborRoamResultsRefreshTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo); |
| 4268 | |
| 4269 | if (eHAL_STATUS_SUCCESS != status) |
| 4270 | { |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 4271 | smsLog(pMac, LOGE, FL("Neighbor results refresh timer allocation failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4272 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 4273 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
| 4274 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 4275 | return eHAL_STATUS_RESOURCES; |
| 4276 | } |
| 4277 | |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 4278 | status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->emptyScanRefreshTimer, |
| 4279 | csrNeighborRoamEmptyScanRefreshTimerCallback, |
| 4280 | (void *)&pNeighborRoamInfo->neighborScanTimerInfo); |
| 4281 | |
| 4282 | if (eHAL_STATUS_SUCCESS != status) |
| 4283 | { |
| 4284 | smsLog(pMac, LOGE, FL("Empty scan refresh timer allocation failed")); |
| 4285 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 4286 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
| 4287 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 4288 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer); |
| 4289 | return eHAL_STATUS_RESOURCES; |
| 4290 | } |
| 4291 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4292 | status = csrLLOpen(pMac->hHdd, &pNeighborRoamInfo->roamableAPList); |
| 4293 | if (eHAL_STATUS_SUCCESS != status) |
| 4294 | { |
| 4295 | smsLog(pMac, LOGE, FL("LL Open of roamable AP List failed")); |
| 4296 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 4297 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
| 4298 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 4299 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 4300 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4301 | return eHAL_STATUS_RESOURCES; |
| 4302 | } |
| 4303 | |
| 4304 | pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX; |
| 4305 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0; |
| 4306 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
| 4307 | pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE; |
| 4308 | pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE; |
| 4309 | |
| 4310 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4311 | status = csrNeighborRoamInit11rAssocInfo(pMac); |
| 4312 | if (eHAL_STATUS_SUCCESS != status) |
| 4313 | { |
| 4314 | smsLog(pMac, LOGE, FL("LL Open of roamable AP List failed")); |
| 4315 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 4316 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
| 4317 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 4318 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 4319 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4320 | csrLLClose(&pNeighborRoamInfo->roamableAPList); |
| 4321 | return eHAL_STATUS_RESOURCES; |
| 4322 | } |
| 4323 | #endif |
| 4324 | /* Initialize this with the current tick count */ |
| 4325 | pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); |
| 4326 | |
| 4327 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT) |
| 4328 | |
| 4329 | return eHAL_STATUS_SUCCESS; |
| 4330 | } |
| 4331 | |
| 4332 | /* --------------------------------------------------------------------------- |
| 4333 | |
| 4334 | \fn csrNeighborRoamClose |
| 4335 | |
| 4336 | \brief This function closes/frees all the neighbor roam data structures |
| 4337 | |
| 4338 | \param pMac - The handle returned by macOpen. |
| 4339 | |
| 4340 | \return VOID |
| 4341 | |
| 4342 | ---------------------------------------------------------------------------*/ |
| 4343 | void csrNeighborRoamClose(tpAniSirGlobal pMac) |
| 4344 | { |
| 4345 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 4346 | |
| 4347 | if (eCSR_NEIGHBOR_ROAM_STATE_CLOSED == pNeighborRoamInfo->neighborRoamState) |
| 4348 | { |
Madan Mohan Koyyalamudi | 8b7f1e6 | 2012-10-05 14:56:51 -0700 | [diff] [blame] | 4349 | smsLog(pMac, LOGW, FL("Neighbor Roam Algorithm Already Closed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4350 | return; |
| 4351 | } |
| 4352 | |
| 4353 | if (pNeighborRoamInfo->cfgParams.channelInfo.ChannelList) |
| 4354 | vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList); |
| 4355 | |
| 4356 | pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL; |
| 4357 | |
| 4358 | pNeighborRoamInfo->neighborScanTimerInfo.pMac = NULL; |
| 4359 | pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID; |
| 4360 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer); |
| 4361 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer); |
Srinivas Girigowda | de69741 | 2013-02-14 16:31:48 -0800 | [diff] [blame] | 4362 | palTimerFree(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4363 | |
| 4364 | /* Should free up the nodes in the list before closing the double Linked list */ |
| 4365 | csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList); |
| 4366 | csrLLClose(&pNeighborRoamInfo->roamableAPList); |
| 4367 | |
| 4368 | if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList) |
| 4369 | { |
| 4370 | vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList); |
| 4371 | } |
| 4372 | |
| 4373 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
| 4374 | pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX; |
| 4375 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0; |
| 4376 | pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL; |
| 4377 | pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE; |
| 4378 | pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE; |
| 4379 | |
| 4380 | /* Free the profile.. */ |
| 4381 | csrReleaseProfile(pMac, &pNeighborRoamInfo->csrNeighborRoamProfile); |
Sandeep P | c4818ef | 2012-12-13 14:19:25 -0800 | [diff] [blame] | 4382 | #ifdef FEATURE_WLAN_LFR |
Sandeep P | c2b00f6 | 2012-12-12 16:44:44 -0800 | [diff] [blame] | 4383 | csrRoamFreeConnectProfile(pMac, &pNeighborRoamInfo->prevConnProfile); |
Sandeep P | c4818ef | 2012-12-13 14:19:25 -0800 | [diff] [blame] | 4384 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4385 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4386 | pMac->roam.neighborRoamInfo.FTRoamInfo.currentNeighborRptRetryNum = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4387 | pMac->roam.neighborRoamInfo.FTRoamInfo.numBssFromNeighborReport = 0; |
| 4388 | vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.neighboReportBssInfo, |
| 4389 | sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT); |
| 4390 | csrNeighborRoamFreeRoamableBSSList(pMac, &pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList); |
| 4391 | csrLLClose(&pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList); |
| 4392 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 4393 | |
| 4394 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CLOSED) |
| 4395 | |
| 4396 | return; |
| 4397 | } |
| 4398 | |
| 4399 | /* --------------------------------------------------------------------------- |
| 4400 | |
| 4401 | \fn csrNeighborRoamRequestHandoff |
| 4402 | |
| 4403 | \brief This function triggers actual switching from one AP to the new AP. |
| 4404 | It issues disassociate with reason code as Handoff and CSR as a part of |
| 4405 | handling disassoc rsp, issues reassociate to the new AP |
| 4406 | |
| 4407 | \param pMac - The handle returned by macOpen. |
| 4408 | |
| 4409 | \return VOID |
| 4410 | |
| 4411 | ---------------------------------------------------------------------------*/ |
| 4412 | void csrNeighborRoamRequestHandoff(tpAniSirGlobal pMac) |
| 4413 | { |
| 4414 | |
| 4415 | tCsrRoamInfo roamInfo; |
| 4416 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 4417 | tANI_U32 sessionId = pNeighborRoamInfo->csrSessionId; |
| 4418 | tCsrNeighborRoamBSSInfo handoffNode; |
| 4419 | extern void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeDisassocRsp ); |
| 4420 | tANI_U32 roamId = 0; |
| 4421 | |
| 4422 | if (pMac->roam.neighborRoamInfo.neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE) |
| 4423 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4424 | 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] | 4425 | pMac->roam.neighborRoamInfo.neighborRoamState); |
| 4426 | return; |
| 4427 | } |
| 4428 | |
| 4429 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 4430 | csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId, &roamInfo, roamId, eCSR_ROAM_FT_START, |
| 4431 | eSIR_SME_SUCCESS); |
| 4432 | |
| 4433 | vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo)); |
| 4434 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING) |
| 4435 | |
| 4436 | csrNeighborRoamGetHandoffAPInfo(pMac, &handoffNode); |
Varun Reddy Yeturu | f68abd6 | 2013-02-11 14:05:06 -0800 | [diff] [blame] | 4437 | VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, |
| 4438 | FL("HANDOFF CANDIDATE BSSID %02x:%02x:%02x:%02x:%02x:%02x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4439 | handoffNode.pBssDescription->bssId[0], |
| 4440 | handoffNode.pBssDescription->bssId[1], |
| 4441 | handoffNode.pBssDescription->bssId[2], |
| 4442 | handoffNode.pBssDescription->bssId[3], |
| 4443 | handoffNode.pBssDescription->bssId[4], |
| 4444 | handoffNode.pBssDescription->bssId[5]); |
| 4445 | |
| 4446 | /* Free the profile.. Just to make sure we dont leak memory here */ |
| 4447 | csrReleaseProfile(pMac, &pNeighborRoamInfo->csrNeighborRoamProfile); |
| 4448 | /* Create the Handoff AP profile. Copy the currently connected profile and update only the BSSID and channel number |
| 4449 | This should happen before issuing disconnect */ |
| 4450 | csrRoamCopyConnectedProfile(pMac, pNeighborRoamInfo->csrSessionId, &pNeighborRoamInfo->csrNeighborRoamProfile); |
| 4451 | vos_mem_copy(pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, handoffNode.pBssDescription->bssId, sizeof(tSirMacAddr)); |
| 4452 | pNeighborRoamInfo->csrNeighborRoamProfile.ChannelInfo.ChannelList[0] = handoffNode.pBssDescription->channelId; |
| 4453 | |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4454 | NEIGHBOR_ROAM_DEBUG(pMac, LOGW, " csrRoamHandoffRequested: disassociating with current AP"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4455 | |
| 4456 | if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_HANDOFF))) |
| 4457 | { |
Kiran Kumar Lokere | 3334fbb | 2013-03-07 12:36:05 -0800 | [diff] [blame] | 4458 | smsLog(pMac, LOGW, "csrRoamHandoffRequested: fail to issue disassociate"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4459 | return; |
| 4460 | } |
| 4461 | |
| 4462 | //notify HDD for handoff, providing the BSSID too |
| 4463 | roamInfo.reasonCode = eCsrRoamReasonBetterAP; |
| 4464 | |
| 4465 | vos_mem_copy(roamInfo.bssid, |
| 4466 | handoffNode.pBssDescription->bssId, |
| 4467 | sizeof( tCsrBssid )); |
| 4468 | |
| 4469 | csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE); |
| 4470 | |
| 4471 | |
| 4472 | return; |
| 4473 | } |
| 4474 | |
| 4475 | /* --------------------------------------------------------------------------- |
| 4476 | |
| 4477 | \fn csrNeighborRoamIsHandoffInProgress |
| 4478 | |
| 4479 | \brief This function returns whether handoff is in progress or not based on |
| 4480 | the current neighbor roam state |
| 4481 | |
| 4482 | \param pMac - The handle returned by macOpen. |
| 4483 | is11rReassoc - Return whether reassoc is of type 802.11r reassoc |
| 4484 | |
| 4485 | \return eANI_BOOLEAN_TRUE if reassoc in progress, eANI_BOOLEAN_FALSE otherwise |
| 4486 | |
| 4487 | ---------------------------------------------------------------------------*/ |
| 4488 | tANI_BOOLEAN csrNeighborRoamIsHandoffInProgress(tpAniSirGlobal pMac) |
| 4489 | { |
| 4490 | if (eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING == pMac->roam.neighborRoamInfo.neighborRoamState) |
| 4491 | return eANI_BOOLEAN_TRUE; |
| 4492 | |
| 4493 | return eANI_BOOLEAN_FALSE; |
| 4494 | } |
| 4495 | |
Madan Mohan Koyyalamudi | 5e32b96 | 2012-11-28 16:07:55 -0800 | [diff] [blame] | 4496 | #if defined(WLAN_FEATURE_VOWIFI_11R) || defined(WLAN_FEATURE_NEIGHBOR_ROAMING) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4497 | /* --------------------------------------------------------------------------- |
| 4498 | |
| 4499 | \fn csrNeighborRoamIs11rAssoc |
| 4500 | |
| 4501 | \brief This function returns whether the current association is a 11r assoc or not |
| 4502 | |
| 4503 | \param pMac - The handle returned by macOpen. |
| 4504 | |
| 4505 | \return eANI_BOOLEAN_TRUE if current assoc is 11r, eANI_BOOLEAN_FALSE otherwise |
| 4506 | |
| 4507 | ---------------------------------------------------------------------------*/ |
| 4508 | tANI_BOOLEAN csrNeighborRoamIs11rAssoc(tpAniSirGlobal pMac) |
| 4509 | { |
| 4510 | return pMac->roam.neighborRoamInfo.is11rAssoc; |
| 4511 | } |
| 4512 | #endif /* WLAN_FEATURE_VOWIFI_11R */ |
| 4513 | |
| 4514 | |
| 4515 | /* --------------------------------------------------------------------------- |
| 4516 | |
| 4517 | \fn csrNeighborRoamGetHandoffAPInfo |
| 4518 | |
| 4519 | \brief This function returns the best possible AP for handoff. For 11R case, it |
| 4520 | returns the 1st entry from pre-auth done list. For non-11r case, it returns |
| 4521 | the 1st entry from roamable AP list |
| 4522 | |
| 4523 | \param pMac - The handle returned by macOpen. |
| 4524 | pHandoffNode - AP node that is the handoff candidate returned |
| 4525 | |
| 4526 | \return VOID |
| 4527 | |
| 4528 | ---------------------------------------------------------------------------*/ |
| 4529 | void csrNeighborRoamGetHandoffAPInfo(tpAniSirGlobal pMac, tpCsrNeighborRoamBSSInfo pHandoffNode) |
| 4530 | { |
| 4531 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 4532 | tpCsrNeighborRoamBSSInfo pBssNode; |
| 4533 | |
| 4534 | VOS_ASSERT(NULL != pHandoffNode); |
| 4535 | |
| 4536 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 4537 | if (pNeighborRoamInfo->is11rAssoc) |
| 4538 | { |
| 4539 | /* Always the BSS info in the head is the handoff candidate */ |
| 4540 | pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL); |
| 4541 | NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList)); |
| 4542 | } |
| 4543 | else |
| 4544 | #endif |
| 4545 | #ifdef FEATURE_WLAN_CCX |
| 4546 | if (pNeighborRoamInfo->isCCXAssoc) |
| 4547 | { |
| 4548 | /* Always the BSS info in the head is the handoff candidate */ |
| 4549 | pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL); |
| 4550 | NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList)); |
| 4551 | } |
| 4552 | else |
| 4553 | #endif |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4554 | #ifdef FEATURE_WLAN_LFR |
Madan Mohan Koyyalamudi | 03aae5f | 2012-11-28 01:51:22 +0530 | [diff] [blame] | 4555 | if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID)) |
Jeff Johnson | 04dd8a8 | 2012-06-29 20:41:40 -0700 | [diff] [blame] | 4556 | { |
| 4557 | /* Always the BSS info in the head is the handoff candidate */ |
| 4558 | pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL); |
| 4559 | NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList)); |
| 4560 | } |
| 4561 | else |
| 4562 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4563 | { |
| 4564 | pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL); |
| 4565 | NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->roamableAPList)); |
| 4566 | } |
| 4567 | vos_mem_copy(pHandoffNode, pBssNode, sizeof(tCsrNeighborRoamBSSInfo)); |
| 4568 | |
| 4569 | return; |
| 4570 | } |
| 4571 | |
| 4572 | /* --------------------------------------------------------------------------- |
| 4573 | \brief This function returns TRUE if preauth is completed |
| 4574 | |
| 4575 | \param pMac - The handle returned by macOpen. |
| 4576 | |
| 4577 | \return boolean |
| 4578 | |
| 4579 | ---------------------------------------------------------------------------*/ |
| 4580 | tANI_BOOLEAN csrNeighborRoamStatePreauthDone(tpAniSirGlobal pMac) |
| 4581 | { |
| 4582 | return (pMac->roam.neighborRoamInfo.neighborRoamState == |
| 4583 | eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE); |
| 4584 | } |
| 4585 | |
| 4586 | /* --------------------------------------------------------------------------- |
| 4587 | \brief In the event that we are associated with AP1 and we have |
| 4588 | completed pre auth with AP2. Then we receive a deauth/disassoc from |
| 4589 | AP1. |
| 4590 | At this point neighbor roam is in pre auth done state, pre auth timer |
| 4591 | is running. We now handle this case by stopping timer and clearing |
| 4592 | the pre-auth state. We basically clear up and just go to disconnected |
| 4593 | state. |
| 4594 | |
| 4595 | \param pMac - The handle returned by macOpen. |
| 4596 | |
| 4597 | \return boolean |
| 4598 | ---------------------------------------------------------------------------*/ |
| 4599 | void csrNeighborRoamTranistionPreauthDoneToDisconnected(tpAniSirGlobal pMac) |
| 4600 | { |
| 4601 | if (pMac->roam.neighborRoamInfo.neighborRoamState != |
| 4602 | eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE) return; |
| 4603 | |
| 4604 | // Stop timer |
| 4605 | palTimerStop(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer); |
| 4606 | |
| 4607 | // Transition to init state |
| 4608 | CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT) |
| 4609 | } |
| 4610 | |
Srikant Kuppa | fef66a7 | 2013-01-30 17:32:44 -0800 | [diff] [blame] | 4611 | /* --------------------------------------------------------------------------- |
Srikant Kuppa | a3ed0a3 | 2013-02-20 07:24:43 -0800 | [diff] [blame] | 4612 | \brief This function returns TRUE if background scan triggered by |
| 4613 | LFR is in progress. |
Srikant Kuppa | fef66a7 | 2013-01-30 17:32:44 -0800 | [diff] [blame] | 4614 | |
| 4615 | \param halHandle - The handle from HDD context. |
| 4616 | |
| 4617 | \return boolean |
| 4618 | |
| 4619 | ---------------------------------------------------------------------------*/ |
| 4620 | tANI_BOOLEAN csrNeighborRoamScanRspPending (tHalHandle hHal) |
| 4621 | { |
| 4622 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4623 | return (pMac->roam.neighborRoamInfo.scanRspPending); |
| 4624 | } |
| 4625 | |
Srinivas Girigowda | a553c46 | 2013-03-07 19:42:52 -0800 | [diff] [blame] | 4626 | /* --------------------------------------------------------------------------- |
| 4627 | \brief This function returns TRUE if STA is in the middle of roaming states |
| 4628 | |
| 4629 | \param halHandle - The handle from HDD context. |
| 4630 | |
| 4631 | \return boolean |
| 4632 | |
| 4633 | ---------------------------------------------------------------------------*/ |
| 4634 | tANI_BOOLEAN csrNeighborMiddleOfRoaming (tHalHandle hHal) |
| 4635 | { |
| 4636 | tpAniSirGlobal pMac = PMAC_STRUCT(hHal); |
| 4637 | tANI_BOOLEAN val = (eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING == pMac->roam.neighborRoamInfo.neighborRoamState) || |
| 4638 | (eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING == pMac->roam.neighborRoamInfo.neighborRoamState) || |
| 4639 | (eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE == pMac->roam.neighborRoamInfo.neighborRoamState) || |
| 4640 | (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pMac->roam.neighborRoamInfo.neighborRoamState) || |
| 4641 | (eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN == pMac->roam.neighborRoamInfo.neighborRoamState); |
| 4642 | return (val); |
| 4643 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4644 | #ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
| 4645 | /* --------------------------------------------------------------------------- |
Srinivas Girigowda | a553c46 | 2013-03-07 19:42:52 -0800 | [diff] [blame] | 4646 | |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4647 | \fn csrNeighborRoamCandidateFoundIndHdlr |
| 4648 | |
| 4649 | \brief This function is called by CSR as soon as TL posts the candidate |
| 4650 | found indication to SME via MC thread |
| 4651 | |
| 4652 | \param pMac - The handle returned by macOpen. |
| 4653 | pMsg - Msg sent by PE |
| 4654 | |
| 4655 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 4656 | |
| 4657 | ---------------------------------------------------------------------------*/ |
| 4658 | eHalStatus csrNeighborRoamCandidateFoundIndHdlr(tpAniSirGlobal pMac, void* pMsg) |
| 4659 | { |
| 4660 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 4661 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4662 | /* we must be in connected state, if not ignore it */ |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 4663 | if ((eCSR_NEIGHBOR_ROAM_STATE_CONNECTED != pNeighborRoamInfo->neighborRoamState) |
| 4664 | || (pNeighborRoamInfo->uOsRequestedHandoff)) |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4665 | { |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 4666 | 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] | 4667 | status = eHAL_STATUS_FAILURE; |
| 4668 | } |
| 4669 | else |
| 4670 | { |
| 4671 | /* We are about to start a fresh scan cycle, |
| 4672 | * purge non-P2P results from the past */ |
| 4673 | csrScanFlushSelectiveResult(pMac, VOS_FALSE); |
| 4674 | /* Once it gets the candidates found indication from PE, will issue a scan |
| 4675 | - req to PE with “freshScan” in scanreq structure set as follows: |
| 4676 | 0x42 - Return & purge LFR scan results |
| 4677 | */ |
| 4678 | status = csrScanRequestLfrResult(pMac, pNeighborRoamInfo->csrSessionId, |
| 4679 | csrNeighborRoamScanResultRequestCallback, pMac); |
| 4680 | } |
| 4681 | |
| 4682 | return status; |
| 4683 | } |
Varun Reddy Yeturu | cc661d2 | 2013-05-20 11:47:10 -0700 | [diff] [blame] | 4684 | |
| 4685 | /* --------------------------------------------------------------------------- |
| 4686 | |
| 4687 | \fn csrNeighborRoamProcessHandoffReq |
| 4688 | |
| 4689 | \brief This function is called start with the handoff process. First do a |
| 4690 | SSID scan for the BSSID provided |
| 4691 | |
| 4692 | \param pMac - The handle returned by macOpen. |
| 4693 | |
| 4694 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 4695 | |
| 4696 | ---------------------------------------------------------------------------*/ |
| 4697 | eHalStatus csrNeighborRoamProcessHandoffReq(tpAniSirGlobal pMac) |
| 4698 | { |
| 4699 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 4700 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4701 | tANI_U32 roamId; |
| 4702 | tCsrRoamProfile *pProfile = NULL; |
| 4703 | tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pNeighborRoamInfo->csrSessionId ); |
| 4704 | tANI_U8 i = 0; |
| 4705 | |
| 4706 | do |
| 4707 | { |
| 4708 | roamId = GET_NEXT_ROAM_ID(&pMac->roam); |
| 4709 | status = palAllocateMemory(pMac->hHdd, (void **)&pProfile, sizeof(tCsrRoamProfile)); |
| 4710 | if(!HAL_STATUS_SUCCESS(status)) |
| 4711 | { |
| 4712 | smsLog(pMac, LOGE, FL("Memory alloc failed")); |
| 4713 | break; |
| 4714 | } |
| 4715 | palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamProfile)); |
| 4716 | status = csrRoamCopyProfile(pMac, pProfile, pSession->pCurRoamProfile); |
| 4717 | if(!HAL_STATUS_SUCCESS(status)) |
| 4718 | { |
| 4719 | smsLog(pMac, LOGE, FL("Profile copy failed")); |
| 4720 | break; |
| 4721 | } |
| 4722 | |
| 4723 | //Add the BSSID & Channel |
| 4724 | pProfile->BSSIDs.numOfBSSIDs = 1; |
| 4725 | pProfile->BSSIDs.bssid = vos_mem_malloc(sizeof(tSirMacAddr) * pProfile->BSSIDs.numOfBSSIDs); |
| 4726 | if (NULL == pProfile->BSSIDs.bssid) |
| 4727 | { |
| 4728 | smsLog(pMac, LOGE, FL("mem alloc failed for BSSID")); |
| 4729 | status = eHAL_STATUS_FAILURE; |
| 4730 | break; |
| 4731 | } |
| 4732 | |
| 4733 | vos_mem_zero(pProfile->BSSIDs.bssid, sizeof(tSirMacAddr) * pProfile->BSSIDs.numOfBSSIDs); |
| 4734 | |
| 4735 | /* Populate the BSSID from handoff info received from HDD */ |
| 4736 | for (i = 0; i < pProfile->BSSIDs.numOfBSSIDs; i++) |
| 4737 | { |
| 4738 | vos_mem_copy(&pProfile->BSSIDs.bssid[i], |
| 4739 | pNeighborRoamInfo->handoffReqInfo.bssid, sizeof(tSirMacAddr)); |
| 4740 | } |
| 4741 | |
| 4742 | pProfile->ChannelInfo.numOfChannels = 1; |
| 4743 | pProfile->ChannelInfo.ChannelList = |
| 4744 | vos_mem_malloc(sizeof(*pProfile->ChannelInfo.ChannelList) * |
| 4745 | pProfile->ChannelInfo.numOfChannels); |
| 4746 | if (NULL == pProfile->ChannelInfo.ChannelList) |
| 4747 | { |
| 4748 | smsLog(pMac, LOGE, FL("mem alloc failed for ChannelList")); |
| 4749 | status = eHAL_STATUS_FAILURE; |
| 4750 | break; |
| 4751 | } |
| 4752 | pProfile->ChannelInfo.ChannelList[0] = pNeighborRoamInfo->handoffReqInfo.channel; |
| 4753 | |
| 4754 | //clean up csr cache first |
| 4755 | //csrScanFlushSelectiveResult(pMac, VOS_FALSE); |
| 4756 | //do a SSID scan |
| 4757 | status = csrScanForSSID(pMac, pNeighborRoamInfo->csrSessionId, pProfile, roamId, FALSE); |
| 4758 | if(!HAL_STATUS_SUCCESS(status)) |
| 4759 | { |
| 4760 | smsLog(pMac, LOGE, FL("SSID scan failed")); |
| 4761 | } |
| 4762 | }while(0); |
| 4763 | |
| 4764 | if(NULL != pProfile) |
| 4765 | { |
| 4766 | csrReleaseProfile(pMac, pProfile); |
| 4767 | palFreeMemory(pMac->hHdd, pProfile); |
| 4768 | } |
| 4769 | |
| 4770 | return status; |
| 4771 | } |
| 4772 | |
| 4773 | /* --------------------------------------------------------------------------- |
| 4774 | |
| 4775 | \fn csrNeighborRoamSssidScanDone |
| 4776 | |
| 4777 | \brief This function is called once SSID scan is done. If SSID scan failed |
| 4778 | to find our candidate add an entry to csr scan cache ourself before starting |
| 4779 | the handoff process |
| 4780 | |
| 4781 | \param pMac - The handle returned by macOpen. |
| 4782 | |
| 4783 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 4784 | |
| 4785 | ---------------------------------------------------------------------------*/ |
| 4786 | eHalStatus csrNeighborRoamSssidScanDone(tpAniSirGlobal pMac, eHalStatus status) |
| 4787 | { |
| 4788 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 4789 | eHalStatus hstatus; |
| 4790 | |
| 4791 | smsLog(pMac, LOGE, FL("called ")); |
| 4792 | |
| 4793 | /* we must be in connected state, if not ignore it */ |
| 4794 | if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED != pNeighborRoamInfo->neighborRoamState) |
| 4795 | { |
| 4796 | smsLog(pMac, LOGE, FL("Received in not CONNECTED state. Ignore it")); |
| 4797 | return eHAL_STATUS_FAILURE; |
| 4798 | } |
| 4799 | |
| 4800 | //if SSID scan failed to find our candidate add an entry to csr scan cache ourself |
| 4801 | if(!HAL_STATUS_SUCCESS(status)) |
| 4802 | { |
| 4803 | smsLog(pMac, LOGE, FL("Add an entry to csr scan cache")); |
| 4804 | hstatus = csrScanCreateEntryInScanCache(pMac, pNeighborRoamInfo->csrSessionId, |
| 4805 | pNeighborRoamInfo->handoffReqInfo.bssid, |
| 4806 | pNeighborRoamInfo->handoffReqInfo.channel); |
| 4807 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 4808 | { |
| 4809 | smsLog(pMac, LOGE, FL("csrScanCreateEntryInScanCache failed with status %d"), hstatus); |
| 4810 | return eHAL_STATUS_FAILURE; |
| 4811 | } |
| 4812 | } |
| 4813 | |
| 4814 | /* Now we have completed scanning for the candidate provided by HDD. Let move on to HO*/ |
| 4815 | hstatus = csrNeighborRoamProcessScanComplete(pMac); |
| 4816 | |
| 4817 | if (eHAL_STATUS_SUCCESS != hstatus) |
| 4818 | { |
| 4819 | smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus); |
| 4820 | return eHAL_STATUS_FAILURE; |
| 4821 | } |
| 4822 | return eHAL_STATUS_SUCCESS; |
| 4823 | } |
| 4824 | |
| 4825 | /* --------------------------------------------------------------------------- |
| 4826 | |
| 4827 | \fn csrNeighborRoamHandoffReqHdlr |
| 4828 | |
| 4829 | \brief This function is called by CSR as soon as it gets a handoff request |
| 4830 | to SME via MC thread |
| 4831 | |
| 4832 | \param pMac - The handle returned by macOpen. |
| 4833 | pMsg - Msg sent by HDD |
| 4834 | |
| 4835 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 4836 | |
| 4837 | ---------------------------------------------------------------------------*/ |
| 4838 | eHalStatus csrNeighborRoamHandoffReqHdlr(tpAniSirGlobal pMac, void* pMsg) |
| 4839 | { |
| 4840 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 4841 | tAniHandoffReq *pHandoffReqInfo; |
| 4842 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4843 | /* we must be in connected state, if not ignore it */ |
| 4844 | if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED != pNeighborRoamInfo->neighborRoamState) |
| 4845 | { |
| 4846 | smsLog(pMac, LOGE, FL("Received in not CONNECTED state. Ignore it")); |
| 4847 | status = eHAL_STATUS_FAILURE; |
| 4848 | } |
| 4849 | else |
| 4850 | { |
| 4851 | //save the handoff info came from HDD as part of the reassoc req |
| 4852 | pHandoffReqInfo = (tAniHandoffReq *)pMsg; |
| 4853 | if (NULL != pHandoffReqInfo) |
| 4854 | { |
| 4855 | //sanity check |
| 4856 | if (VOS_FALSE == vos_mem_compare(pHandoffReqInfo->bssid, |
| 4857 | pNeighborRoamInfo->currAPbssid, |
| 4858 | sizeof(tSirMacAddr))) |
| 4859 | { |
| 4860 | |
| 4861 | pNeighborRoamInfo->handoffReqInfo.channel = pHandoffReqInfo->channel; |
| 4862 | vos_mem_copy(pNeighborRoamInfo->handoffReqInfo.bssid, |
| 4863 | pHandoffReqInfo->bssid, |
| 4864 | 6); |
| 4865 | pNeighborRoamInfo->uOsRequestedHandoff = 1; |
| 4866 | status = csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_STOP, |
| 4867 | REASON_OS_REQUESTED_ROAMING_NOW); |
| 4868 | if (eHAL_STATUS_SUCCESS != status) |
| 4869 | { |
| 4870 | smsLog(pMac, LOGE, FL("csrRoamOffloadScan failed")); |
| 4871 | pNeighborRoamInfo->uOsRequestedHandoff = 0; |
| 4872 | } |
| 4873 | } |
| 4874 | else |
| 4875 | { |
| 4876 | smsLog(pMac, LOGE, FL("Received req has same BSSID as current AP!!")); |
| 4877 | status = eHAL_STATUS_FAILURE; |
| 4878 | } |
| 4879 | } |
| 4880 | else |
| 4881 | { |
| 4882 | smsLog(pMac, LOGE, FL("Received msg is NULL")); |
| 4883 | status = eHAL_STATUS_FAILURE; |
| 4884 | } |
| 4885 | } |
| 4886 | |
| 4887 | return status; |
| 4888 | } |
| 4889 | |
| 4890 | /* --------------------------------------------------------------------------- |
| 4891 | |
| 4892 | \fn csrNeighborRoamProceedWithHandoffReq |
| 4893 | |
| 4894 | \brief This function is called by CSR as soon as it gets rsp back for |
| 4895 | ROAM_SCAN_OFFLOAD_STOP with reason REASON_OS_REQUESTED_ROAMING_NOW |
| 4896 | |
| 4897 | \param pMac - The handle returned by macOpen. |
| 4898 | |
| 4899 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 4900 | |
| 4901 | ---------------------------------------------------------------------------*/ |
| 4902 | eHalStatus csrNeighborRoamProceedWithHandoffReq(tpAniSirGlobal pMac) |
| 4903 | { |
| 4904 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 4905 | eHalStatus status = eHAL_STATUS_SUCCESS; |
| 4906 | /* we must be in connected state, if not ignore it */ |
| 4907 | if ((eCSR_NEIGHBOR_ROAM_STATE_CONNECTED != pNeighborRoamInfo->neighborRoamState) |
| 4908 | || (!pNeighborRoamInfo->uOsRequestedHandoff)) |
| 4909 | { |
| 4910 | smsLog(pMac, LOGE, FL("Received in not CONNECTED state or uOsRequestedHandoff is not set. Ignore it")); |
| 4911 | status = eHAL_STATUS_FAILURE; |
| 4912 | } |
| 4913 | else |
| 4914 | { |
| 4915 | //Let's go ahead with handoff |
| 4916 | status = csrNeighborRoamProcessHandoffReq(pMac); |
| 4917 | } |
| 4918 | if(!HAL_STATUS_SUCCESS(status)) |
| 4919 | { |
| 4920 | pNeighborRoamInfo->uOsRequestedHandoff = 0; |
| 4921 | } |
| 4922 | return status; |
| 4923 | } |
| 4924 | |
| 4925 | /* --------------------------------------------------------------------------- |
| 4926 | |
| 4927 | \fn csrNeighborRoamRestartLfrScan |
| 4928 | |
| 4929 | \brief This function is called if HDD requested handoff failed for some |
| 4930 | reason. Restart the LFR logic at that point. |
| 4931 | |
| 4932 | \param pMac - The handle returned by macOpen. |
| 4933 | |
| 4934 | \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise |
| 4935 | |
| 4936 | ---------------------------------------------------------------------------*/ |
| 4937 | eHalStatus csrNeighborRoamRestartLfrScan(tpAniSirGlobal pMac) |
| 4938 | { |
| 4939 | tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo; |
| 4940 | pNeighborRoamInfo->uOsRequestedHandoff = 0; |
| 4941 | /* There is no candidate or We are not roaming Now. |
| 4942 | * Inform the FW to restart Roam Offload Scan */ |
| 4943 | csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_RESTART, REASON_NO_CAND_FOUND_OR_NOT_ROAMING_NOW); |
| 4944 | |
| 4945 | return eHAL_STATUS_SUCCESS; |
| 4946 | } |
Varun Reddy Yeturu | d0a3f25 | 2013-04-15 21:58:13 -0700 | [diff] [blame] | 4947 | #endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4948 | #endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */ |