blob: 5810b8462ac189d415ad717749298cbb01cfc1c0 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * 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 Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
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 Johnson295189b2012-06-20 16:38:30 -070042/** ------------------------------------------------------------------------- *
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---------- --- --------------------------------------------------------
6708/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 Koyyalamudiedee8aa2012-10-15 15:36:40 -070096static void csrNeighborRoamResetChannelInfo(tpCsrNeighborRoamChannelInfo rChInfo);
97static void csrNeighborRoamResetCfgListChanScanControlInfo(tpAniSirGlobal pMac);
98static void csrNeighborRoamResetPreauthControlInfo(tpAniSirGlobal pMac);
99static void csrNeighborRoamDeregAllRssiIndication(tpAniSirGlobal pMac);
100
Jeff Johnson295189b2012-06-20 16:38:30 -0700101VOS_STATUS csrNeighborRoamNeighborLookupUPCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
Srinivasdaaec712012-12-12 15:59:44 -0800102 v_PVOID_t pUserCtxt,
103 v_S7_t avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -0700104VOS_STATUS csrNeighborRoamNeighborLookupDOWNCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
Srinivasdaaec712012-12-12 15:59:44 -0800105 v_PVOID_t pUserCtxt,
106 v_S7_t avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -0700107void csrNeighborRoamRRMNeighborReportResult(void *context, VOS_STATUS vosStatus);
108eHalStatus csrRoamCopyConnectedProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pDstProfile );
109
110#ifdef WLAN_FEATURE_VOWIFI_11R
111static eHalStatus csrNeighborRoamIssuePreauthReq(tpAniSirGlobal pMac);
112VOS_STATUS csrNeighborRoamIssueNeighborRptRequest(tpAniSirGlobal pMac);
113#endif
114
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800115#define ROAM_STATE_RETURN_STRING( str )\
116 case ( ( str ) ): return( #str )
117
118
119v_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 Johnson295189b2012-06-20 16:38:30 -0700138/* 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 Yeturuf68abd62013-02-11 14:05:06 -0800143 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 Johnson295189b2012-06-20 16:38:30 -0700147}
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---------------------------------------------------------------------------*/
162void 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---------------------------------------------------------------------------*/
191tANI_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 Lokere3334fbb2013-03-07 12:36:05 -0800199 smsLog(pMac, LOGE, FL("Removing neighbor BSS node from list failed. Current count = %d"), csrLLCount(pList));
Jeff Johnson295189b2012-06-20 16:38:30 -0700200
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---------------------------------------------------------------------------*/
217tpCsrNeighborRoamBSSInfo 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---------------------------------------------------------------------------*/
254void csrNeighborRoamFreeRoamableBSSList(tpAniSirGlobal pMac, tDblLinkList *pList)
255{
256 tpCsrNeighborRoamBSSInfo pResult = NULL;
257
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800258 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Emptying the BSS list. Current count = %d"), csrLLCount(pList));
Jeff Johnson295189b2012-06-20 16:38:30 -0700259
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 Koyyalamudi62b55b02012-12-03 16:45:39 -0800269static void csrNeighborRoamTriggerHandoff(tpAniSirGlobal pMac,
270 tpCsrNeighborRoamControlInfo pNeighborRoamInfo)
271{
272#ifdef WLAN_FEATURE_VOWIFI_11R
273 if (pNeighborRoamInfo->is11rAssoc)
274 {
275 if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
276 {
277 csrNeighborRoamIssuePreauthReq(pMac);
278 }
279 else
280 {
281 smsLog(pMac, LOGE, FL("11R Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState);
282 VOS_ASSERT(0);
283 }
284 }
285 else
286#endif
287
288#ifdef FEATURE_WLAN_CCX
289 if (pNeighborRoamInfo->isCCXAssoc)
290 {
291 if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
292 {
293 csrNeighborRoamIssuePreauthReq(pMac);
294 }
295 else
296 {
297 smsLog(pMac, LOGE, FL("CCX Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState);
298 VOS_ASSERT(0);
299 }
300 }
301 else
302#endif
303#ifdef FEATURE_WLAN_LFR
304 if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID))
305 {
306 if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
307 {
308 csrNeighborRoamIssuePreauthReq(pMac);
309 }
310 else
311 {
312 smsLog(pMac, LOGE, FL("LFR Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState);
313 VOS_ASSERT(0);
314 }
315 }
316 else
317#endif
318 {
319 if (eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN == pNeighborRoamInfo->neighborRoamState)
320 {
321 csrNeighborRoamRequestHandoff(pMac);
322 }
323 else
324 {
325 smsLog(pMac, LOGE, FL("Non-11R Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState);
326 VOS_ASSERT(0);
327 }
328 }
329}
330
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700331VOS_STATUS csrNeighborRoamUpdateFastRoamingEnabled(tpAniSirGlobal pMac, const v_BOOL_t fastRoamEnabled)
332{
333 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
334 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
335
336 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
337 {
338 if (VOS_TRUE == fastRoamEnabled)
339 {
340 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"),
341 pNeighborRoamInfo->currentNeighborLookupThreshold);
342 /* Register Neighbor Lookup threshold callback with TL for DOWN event only */
343 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
344 WLANTL_HO_THRESHOLD_DOWN,
345 csrNeighborRoamNeighborLookupDOWNCallback,
346 VOS_MODULE_ID_SME, pMac);
347 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
348 {
349 //err msg
350 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d"), vosStatus);
351 vosStatus = VOS_STATUS_E_FAILURE;
352 }
353 }
354 else if (VOS_FALSE == fastRoamEnabled)
355 {
356 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in CONNECTED state, so deregister all events"));
357 /* De-register existing lookup UP/DOWN, Rssi indications */
358 csrNeighborRoamDeregAllRssiIndication(pMac);
359 }
360 }
361 else if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
362 {
363 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in INIT state, Nothing to do"));
364 }
365 else
366 {
367 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Unexpected state %d, returning failure"), pNeighborRoamInfo->neighborRoamState);
368 vosStatus = VOS_STATUS_E_FAILURE;
369 }
370 return vosStatus;
371}
372
373#ifdef FEATURE_WLAN_CCX
374VOS_STATUS csrNeighborRoamUpdateCcxModeEnabled(tpAniSirGlobal pMac, const v_BOOL_t ccxMode)
375{
376 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
377 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
378
379 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
380 {
381 if (VOS_TRUE == ccxMode)
382 {
383 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"),
384 pNeighborRoamInfo->currentNeighborLookupThreshold);
385 /* Register Neighbor Lookup threshold callback with TL for DOWN event only */
386 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
387 WLANTL_HO_THRESHOLD_DOWN,
388 csrNeighborRoamNeighborLookupDOWNCallback,
389 VOS_MODULE_ID_SME, pMac);
390 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
391 {
392 //err msg
393 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d"), vosStatus);
394 vosStatus = VOS_STATUS_E_FAILURE;
395 }
396 }
397 else if (VOS_FALSE == ccxMode)
398 {
399 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in CONNECTED state, so deregister all events"));
400 /* De-register existing lookup UP/DOWN, Rssi indications */
401 csrNeighborRoamDeregAllRssiIndication(pMac);
402 }
403 }
404 else if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
405 {
406 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in INIT state, Nothing to do"));
407 }
408 else
409 {
410 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Unexpected state %d, returning failure"), pNeighborRoamInfo->neighborRoamState);
411 vosStatus = VOS_STATUS_E_FAILURE;
412 }
413 return vosStatus;
414}
415
416#endif
417
418
Srinivas Girigowdade697412013-02-14 16:31:48 -0800419VOS_STATUS csrNeighborRoamSetLookupRssiThreshold(tpAniSirGlobal pMac, v_U8_t neighborLookupRssiThreshold)
420{
421 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
422 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
423
424 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
425 {
426 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in CONNECTED state, so deregister all and re-register for DOWN event again"));
427 /* De-register existing lookup UP/DOWN, Rssi indications */
428 csrNeighborRoamDeregAllRssiIndication(pMac);
429 pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold = neighborLookupRssiThreshold;
430 pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold;
431
432 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"), pNeighborRoamInfo->currentNeighborLookupThreshold);
433 /* Register Neighbor Lookup threshold callback with TL for DOWN event only */
434 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
435 WLANTL_HO_THRESHOLD_DOWN,
436 csrNeighborRoamNeighborLookupDOWNCallback,
437 VOS_MODULE_ID_SME, pMac);
438 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
439 {
440 //err msg
441 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d"), vosStatus);
442 vosStatus = VOS_STATUS_E_FAILURE;
443 }
444 }
445 else if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
446 {
447 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in INIT state, safe to set lookupRssi threshold"));
448 pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold = neighborLookupRssiThreshold;
449 pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold;
450 }
451 else
452 {
453 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Unexpected state %d, returning failure"), pNeighborRoamInfo->neighborRoamState);
454 vosStatus = VOS_STATUS_E_FAILURE;
455 }
456 return vosStatus;
457}
458
Jeff Johnson295189b2012-06-20 16:38:30 -0700459/* ---------------------------------------------------------------------------
460
461 \fn csrNeighborRoamReassocIndCallback
462
463 \brief Reassoc callback invoked by TL on crossing the registered re-assoc threshold.
464 Directly triggere HO in case of non-11r association
465 In case of 11R association, triggers a pre-auth eventually followed by actual HO
466
467 \param pAdapter - VOS Context
468 trafficStatus - UP/DOWN indication from TL
469 pUserCtxt - Parameter for callback registered during callback registration. Should be pMac
470
471 \return VOID
472
473---------------------------------------------------------------------------*/
474VOS_STATUS csrNeighborRoamReassocIndCallback(v_PVOID_t pAdapter,
475 v_U8_t trafficStatus,
Srinivasdaaec712012-12-12 15:59:44 -0800476 v_PVOID_t pUserCtxt,
477 v_S7_t avgRssi)
Jeff Johnson295189b2012-06-20 16:38:30 -0700478{
479 tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt );
480 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
481 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
482
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800483 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event reassoc callback with TL. Threshold RSSI = %d Reported RSSI = %d"),
Srinivasdaaec712012-12-12 15:59:44 -0800484 pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
485 avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -0700486
487 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
488 WLANTL_HO_THRESHOLD_DOWN,
489 csrNeighborRoamReassocIndCallback,
490 VOS_MODULE_ID_SME);
491
492 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
493 {
494 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800495 smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 }
497
Srinivasdaaec712012-12-12 15:59:44 -0800498 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Rcvd reassoc notification-deregister UP indication. Threshold RSSI = %d Reported RSSI = %d"),
499 NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1), avgRssi);
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -0800500 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
501 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
502 WLANTL_HO_THRESHOLD_UP,
503 csrNeighborRoamNeighborLookupUPCallback,
504 VOS_MODULE_ID_SME);
Jeff Johnson295189b2012-06-20 16:38:30 -0700505
506 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
507 {
508 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800509 smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamNeighborLookupUPCallback with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700510 }
511
512 /* We dont need to run this timer any more. */
513 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -0800514 palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -0700515
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800516 csrNeighborRoamTriggerHandoff(pMac, pNeighborRoamInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700517
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 return VOS_STATUS_SUCCESS;
519}
520
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700521/*CleanUP Routines*/
522static void csrNeighborRoamResetChannelInfo(tpCsrNeighborRoamChannelInfo rChInfo)
523{
524 if ((rChInfo->IAPPNeighborListReceived == FALSE) &&
525 (rChInfo->currentChannelListInfo.numOfChannels))
526 {
527 rChInfo->currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX;
528 rChInfo->currentChannelListInfo.numOfChannels = 0;
529
530 if (rChInfo->currentChannelListInfo.ChannelList)
531 vos_mem_free(rChInfo->currentChannelListInfo.ChannelList);
532
533 rChInfo->currentChannelListInfo.ChannelList = NULL;
534 rChInfo->chanListScanInProgress = eANI_BOOLEAN_FALSE;
535 }
536 else
537 {
538 rChInfo->currentChanIndex = 0;
539 rChInfo->chanListScanInProgress = eANI_BOOLEAN_TRUE;
540 }
541}
542
543static void csrNeighborRoamResetCfgListChanScanControlInfo(tpAniSirGlobal pMac)
544{
545 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
546
547 /* Stop neighbor scan timer */
548 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
549
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -0700550 /* Stop neighbor scan results refresh timer */
551 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
552
Srinivas Girigowdade697412013-02-14 16:31:48 -0800553 /* Stop empty scan results refresh timer */
554 palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
555
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700556 /* Abort any ongoing scan */
557 if (eANI_BOOLEAN_TRUE == pNeighborRoamInfo->scanRspPending)
558 {
559 csrScanAbortMacScan(pMac);
560 }
561 pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE;
562
563 /* Reset roam channel list information */
564 csrNeighborRoamResetChannelInfo(&pNeighborRoamInfo->roamChannelInfo);
565}
566
567static void csrNeighborRoamResetPreauthControlInfo(tpAniSirGlobal pMac)
568{
569 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
570
571#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
572 pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700573 /* Purge pre-auth fail list */
574 csrNeighborRoamPurgePreauthFailedList(pMac);
575#endif
576
577 pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_FALSE;
578 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
579#ifdef WLAN_FEATURE_VOWIFI_11R
580 /* Do not free up the preauth done list here */
581 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
582 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE;
583 pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0;
584 vos_mem_zero(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700585#endif
586}
587
588static void csrNeighborRoamDeregAllRssiIndication(tpAniSirGlobal pMac)
589{
590 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
591 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
592
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800593 NEIGHBOR_ROAM_DEBUG(pMac, LOG2,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700594 FL("Deregister neighbor lookup UP callback with TL. RSSI = %d"),
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -0800595 NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1));
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700596
597 /* Deregister reassoc callback. Ignore return status */
598 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -0800599 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700600 WLANTL_HO_THRESHOLD_UP,
601 csrNeighborRoamNeighborLookupUPCallback,
602 VOS_MODULE_ID_SME);
603
604 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
605 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800606 smsLog(pMac, LOGW,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700607 FL("Couldn't deregister csrNeighborRoamNeighborLookupUPCallback "
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800608 "with TL: Status = %d"), vosStatus);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700609 }
610
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800611 NEIGHBOR_ROAM_DEBUG(pMac, LOG2,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700612 FL("Deregistering reassoc DOWN callback with TL. RSSI = %d"),
613 pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
614
615 /* Deregister reassoc callback. Ignore return status */
616 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
617 (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
618 WLANTL_HO_THRESHOLD_DOWN,
619 csrNeighborRoamReassocIndCallback,
620 VOS_MODULE_ID_SME);
621
622 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
623 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800624 smsLog(pMac, LOGW,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700625 FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with "
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800626 "TL: Status = %d"), vosStatus);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700627 }
628
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800629 NEIGHBOR_ROAM_DEBUG(pMac, LOG2,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700630 FL("Deregistering neighborLookup DOWN callback with TL. RSSI = %d"),
631 pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
632
633 /* Deregister neighbor lookup callback. Ignore return status */
634 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
635 (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
636 WLANTL_HO_THRESHOLD_DOWN,
637 csrNeighborRoamNeighborLookupDOWNCallback,
638 VOS_MODULE_ID_SME);
639
640 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
641 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800642 smsLog(pMac, LOGW,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700643 FL(" Couldn't deregister csrNeighborRoamNeighborLookupDOWNCallback "
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800644 "with TL: Status = %d"), vosStatus);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700645 }
646
647 /* Reset thresholds only after deregistering DOWN event from TL */
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700648 pNeighborRoamInfo->currentNeighborLookupThreshold =
649 pNeighborRoamInfo->cfgParams.neighborLookupThreshold;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -0800650#ifdef FEATURE_WLAN_LFR
651 pNeighborRoamInfo->uEmptyScanCount = 0;
Srikant Kuppa866893f2012-12-27 17:28:14 -0800652 pNeighborRoamInfo->lookupDOWNRssi = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -0800653 pNeighborRoamInfo->uScanMode = DEFAULT_SCAN;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -0800654#endif
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700655}
656
Jeff Johnson295189b2012-06-20 16:38:30 -0700657/* ---------------------------------------------------------------------------
658
659 \fn csrNeighborRoamResetConnectedStateControlInfo
660
661 \brief This function will reset the neighbor roam control info data structures.
662 This function should be invoked whenever we move to CONNECTED state from
663 any state other than INIT state
664
665 \param pMac - The handle returned by macOpen.
666
667 \return VOID
668
669---------------------------------------------------------------------------*/
670void csrNeighborRoamResetConnectedStateControlInfo(tpAniSirGlobal pMac)
671{
672 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
673
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700674 csrNeighborRoamResetChannelInfo(&pNeighborRoamInfo->roamChannelInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700675 csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700676
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700677 /* We dont need to run this timer any more. */
678 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -0800679 palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -0700680
681#ifdef WLAN_FEATURE_VOWIFI_11R
682 /* Do not free up the preauth done list here */
683 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
684 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE;
685 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
686 pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0;
687 pNeighborRoamInfo->FTRoamInfo.preauthRspPending = 0;
688 vos_mem_zero(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
Jeff Johnson295189b2012-06-20 16:38:30 -0700689#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700690}
691
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -0700692void csrNeighborRoamResetReportScanStateControlInfo(tpAniSirGlobal pMac)
Jeff Johnson295189b2012-06-20 16:38:30 -0700693{
694 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700695 pNeighborRoamInfo->csrSessionId = CSR_SESSION_ID_INVALID;
696 vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0);
697 pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
698 pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
Jeff Johnson295189b2012-06-20 16:38:30 -0700699#ifdef FEATURE_WLAN_CCX
700 pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_FALSE;
701 pNeighborRoamInfo->isVOAdmitted = eANI_BOOLEAN_FALSE;
702 pNeighborRoamInfo->MinQBssLoadRequired = 0;
703#endif
Madan Mohan Koyyalamudi595208a2012-10-05 12:48:38 -0700704
705 /* Stop scan refresh timer */
706 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -0800707 /* Stop empty scan results refresh timer */
708 palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700709 /* Purge roamable AP list */
710 csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700711 return;
712}
713
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -0700714/* ---------------------------------------------------------------------------
715
716 \fn csrNeighborRoamResetInitStateControlInfo
717
718 \brief This function will reset the neighbor roam control info data structures.
719 This function should be invoked whenever we move to CONNECTED state from
720 INIT state
721
722 \param pMac - The handle returned by macOpen.
723
724 \return VOID
725
726---------------------------------------------------------------------------*/
727void csrNeighborRoamResetInitStateControlInfo(tpAniSirGlobal pMac)
728{
729 csrNeighborRoamResetConnectedStateControlInfo(pMac);
730
731 /* In addition to the above resets, we should clear off the curAPBssId/Session ID in the timers */
732 csrNeighborRoamResetReportScanStateControlInfo(pMac);
733}
734
735
736
Jeff Johnson295189b2012-06-20 16:38:30 -0700737#ifdef WLAN_FEATURE_VOWIFI_11R
738/* ---------------------------------------------------------------------------
739
740 \fn csrNeighborRoamBssIdScanFilter
741
742 \brief This API is used to prepare a filter to obtain scan results when
743 we complete the scan in the REPORT_SCAN state after receiving a
744 valid neighbor report from AP. This filter includes BSSIDs received from
745 the neighbor report from the AP in addition to the other filter parameters
746 created from connected profile
747
748 \param pMac - The handle returned by macOpen.
749 pScanFilter - Scan filter to be filled and returned
750
751 \return eHAL_STATUS_SUCCESS on succesful filter creation, corresponding error
752 code otherwise
753
754---------------------------------------------------------------------------*/
755static eHalStatus csrNeighborRoamBssIdScanFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter)
756{
757 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
758 tANI_U8 i = 0;
759
760 VOS_ASSERT(pScanFilter != NULL);
Gopichand Nakkalad5a904e2013-03-29 01:07:54 +0530761 if (pScanFilter == NULL)
762 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700763 vos_mem_zero(pScanFilter, sizeof(tCsrScanResultFilter));
764
765 pScanFilter->BSSIDs.numOfBSSIDs = pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport;
766 pScanFilter->BSSIDs.bssid = vos_mem_malloc(sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs);
767 if (NULL == pScanFilter->BSSIDs.bssid)
768 {
769 smsLog(pMac, LOGE, FL("Scan Filter BSSID mem alloc failed"));
770 return eHAL_STATUS_FAILED_ALLOC;
771 }
772
773 vos_mem_zero(pScanFilter->BSSIDs.bssid, sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs);
774
775 /* Populate the BSSID from Neighbor BSS info received from neighbor report */
776 for (i = 0; i < pScanFilter->BSSIDs.numOfBSSIDs; i++)
777 {
778 vos_mem_copy(&pScanFilter->BSSIDs.bssid[i],
779 pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[i].neighborBssId, sizeof(tSirMacAddr));
780 }
781
782 /* Fill other general scan filter params */
783 return csrNeighborRoamPrepareScanProfileFilter(pMac, pScanFilter);
784}
785
786/* ---------------------------------------------------------------------------
787
788 \fn csrNeighborRoamPurgePreauthFailList
789
790 \brief This function empties the preauth fail list
791
792 \param pMac - The handle returned by macOpen.
793
794 \return VOID
795
796---------------------------------------------------------------------------*/
797void csrNeighborRoamPurgePreauthFailList(tpAniSirGlobal pMac)
798{
799 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
800
801 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Purging the preauth fail list"));
802 while (pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress)
803 {
804 vos_mem_zero(pNeighborRoamInfo->FTRoamInfo.preAuthFailList.macAddress[pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress-1],
805 sizeof(tSirMacAddr));
806 pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress--;
807 }
808 return;
809}
810
811/* ---------------------------------------------------------------------------
812
813 \fn csrNeighborRoamAddBssIdToPreauthFailList
814
815 \brief This function adds the given BSSID to the Preauth fail list
816
817 \param pMac - The handle returned by macOpen.
818 bssId - BSSID to be added to the preauth fail list
819
820 \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise
821
822---------------------------------------------------------------------------*/
823eHalStatus csrNeighborRoamAddBssIdToPreauthFailList(tpAniSirGlobal pMac, tSirMacAddr bssId)
824{
825 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
826
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800827 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL(" Added BSSID %02x:%02x:%02x:%02x:%02x:%02x to Preauth failed list"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700828 bssId[0], bssId[1], bssId[2], bssId[3], bssId[4], bssId[5]);
829
830
831 if ((pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress + 1) >
832 MAX_NUM_PREAUTH_FAIL_LIST_ADDRESS)
833 {
834 smsLog(pMac, LOGE, FL("Preauth fail list already full.. Cannot add new one"));
835 return eHAL_STATUS_FAILURE;
836 }
837 vos_mem_copy(pNeighborRoamInfo->FTRoamInfo.preAuthFailList.macAddress[pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress],
838 bssId, sizeof(tSirMacAddr));
839 pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress++;
840
841 return eHAL_STATUS_SUCCESS;
842}
843
844/* ---------------------------------------------------------------------------
845
846 \fn csrNeighborRoamIsPreauthCandidate
847
848 \brief This function checks whether the given MAC address is already
849 present in the preauth fail list and returns TRUE/FALSE accordingly
850
851 \param pMac - The handle returned by macOpen.
852
853 \return eANI_BOOLEAN_TRUE if preauth candidate, eANI_BOOLEAN_FALSE otherwise
854
855---------------------------------------------------------------------------*/
856tANI_BOOLEAN csrNeighborRoamIsPreauthCandidate(tpAniSirGlobal pMac, tSirMacAddr bssId)
857{
858 tANI_U8 i = 0;
859 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
860
861 if (0 == pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress)
862 return eANI_BOOLEAN_TRUE;
863
864 for (i = 0; i < pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress; i++)
865 {
866 if (VOS_TRUE == vos_mem_compare(pNeighborRoamInfo->FTRoamInfo.preAuthFailList.macAddress[i],
867 bssId, sizeof(tSirMacAddr)))
868 {
869 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("BSSID %02x:%02x:%02x:%02x:%02x:%02x already present in preauth fail list"),
870 bssId[0], bssId[1], bssId[2], bssId[3], bssId[4], bssId[5]);
871 return eANI_BOOLEAN_FALSE;
872 }
873 }
874
875 return eANI_BOOLEAN_TRUE;
876}
877
878/* ---------------------------------------------------------------------------
879
880 \fn csrNeighborRoamIssuePreauthReq
881
882 \brief This function issues preauth request to PE with the 1st AP entry in the
883 roamable AP list
884
885 \param pMac - The handle returned by macOpen.
886
887 \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise
888
889---------------------------------------------------------------------------*/
890static eHalStatus csrNeighborRoamIssuePreauthReq(tpAniSirGlobal pMac)
891{
892 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
893 eHalStatus status = eHAL_STATUS_SUCCESS;
894 tpCsrNeighborRoamBSSInfo pNeighborBssNode;
895
896 /* This must not be true here */
897 VOS_ASSERT(pNeighborRoamInfo->FTRoamInfo.preauthRspPending == eANI_BOOLEAN_FALSE);
898
899 /* Issue Preauth request to PE here */
900 /* Need to issue the preauth request with the BSSID that is there in the head of the roamable AP list */
901 /* Parameters that should be passed are BSSID, Channel number and the neighborScanPeriod(probably) */
902 /* If roamableAPList gets empty, should transition to REPORT_SCAN state */
903 pNeighborBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL);
904
905 if (NULL == pNeighborBssNode)
906 {
907 smsLog(pMac, LOG1, FL("Roamable AP list is empty.. "));
908 return eHAL_STATUS_FAILURE;
909 }
910 else
911 {
Madan Mohan Koyyalamudi286b60e2012-10-11 12:59:07 -0700912 status = csrRoamEnqueuePreauth(pMac, pNeighborRoamInfo->csrSessionId, pNeighborBssNode->pBssDescription,
913 eCsrPerformPreauth, eANI_BOOLEAN_TRUE);
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +0530914
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800915 smsLog(pMac, LOG1, FL("Before Pre-Auth: BSSID %02x:%02x:%02x:%02x:%02x:%02x, Ch:%d"),
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +0530916 pNeighborBssNode->pBssDescription->bssId[0],
917 pNeighborBssNode->pBssDescription->bssId[1],
918 pNeighborBssNode->pBssDescription->bssId[2],
919 pNeighborBssNode->pBssDescription->bssId[3],
920 pNeighborBssNode->pBssDescription->bssId[4],
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800921 pNeighborBssNode->pBssDescription->bssId[5],
922 (int)pNeighborBssNode->pBssDescription->channelId);
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +0530923
Jeff Johnson295189b2012-06-20 16:38:30 -0700924 if (eHAL_STATUS_SUCCESS != status)
925 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800926 smsLog(pMac, LOGE, FL("Send Preauth request to PE failed with status %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -0700927 return status;
928 }
929 }
930
931 pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_TRUE;
932
933 /* Increment the preauth retry count */
934 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries++;
935
936 /* Transition the state to preauthenticating */
937 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING)
Jeff Johnson295189b2012-06-20 16:38:30 -0700938
939 return status;
940}
941
942/* ---------------------------------------------------------------------------
943
944 \fn csrNeighborRoamPreauthRspHandler
945
946 \brief This function handle the Preauth response from PE
947 Every preauth is allowed max 3 tries if it fails. If a bssid failed
948 for more than MAX_TRIES, we will remove it from the list and try
949 with the next node in the roamable AP list and add the BSSID to pre-auth failed
950 list. If no more entries present in
951 roamable AP list, transition to REPORT_SCAN state
952
953 \param pMac - The handle returned by macOpen.
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800954 limStatus - eSIR_SUCCESS/eSIR_FAILURE/eSIR_LIM_MAX_STA_REACHED_ERROR/
955 eSIT_LIM_AUTH_RSP_TIMEOUT status from PE
Jeff Johnson295189b2012-06-20 16:38:30 -0700956
Madan Mohan Koyyalamudi7a579cc2012-10-21 11:25:39 -0700957 \return eHAL_STATUS_SUCCESS on success (i.e. pre-auth processed),
958 eHAL_STATUS_FAILURE otherwise
Jeff Johnson295189b2012-06-20 16:38:30 -0700959
960---------------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800961eHalStatus csrNeighborRoamPreauthRspHandler(tpAniSirGlobal pMac, tSirRetStatus limStatus)
Jeff Johnson295189b2012-06-20 16:38:30 -0700962{
963 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
964 eHalStatus status = eHAL_STATUS_SUCCESS;
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800965 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Madan Mohan Koyyalamudi7a579cc2012-10-21 11:25:39 -0700966 eHalStatus preauthProcessed = eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700967 tpCsrNeighborRoamBSSInfo pPreauthRspNode = NULL;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700968
969 if (eANI_BOOLEAN_FALSE == pNeighborRoamInfo->FTRoamInfo.preauthRspPending)
970 {
971
972 /* This can happen when we disconnect immediately
973 * after sending a pre-auth request. During processing
974 * of the disconnect command, we would have reset
975 * preauthRspPending and transitioned to INIT state.
976 */
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800977 NEIGHBOR_ROAM_DEBUG(pMac, LOGW,
978 FL("Unexpected pre-auth response in state %d"),
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700979 pNeighborRoamInfo->neighborRoamState);
Madan Mohan Koyyalamudi7a579cc2012-10-21 11:25:39 -0700980 preauthProcessed = eHAL_STATUS_FAILURE;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700981 goto DEQ_PREAUTH;
982 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700983
984 // We can receive it in these 2 states.
Jeff Johnson295189b2012-06-20 16:38:30 -0700985 if ((pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING) &&
986 (pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN))
987 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800988 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Preauth response received in state %d"),
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700989 pNeighborRoamInfo->neighborRoamState);
Madan Mohan Koyyalamudi7a579cc2012-10-21 11:25:39 -0700990 preauthProcessed = eHAL_STATUS_FAILURE;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700991 goto DEQ_PREAUTH;
Jeff Johnson295189b2012-06-20 16:38:30 -0700992 }
993
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800994 pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700995
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800996 if (eSIR_SUCCESS == limStatus)
Jeff Johnson295189b2012-06-20 16:38:30 -0700997 {
998 pPreauthRspNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL);
999 }
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001000 if ((eSIR_SUCCESS == limStatus) && (NULL != pPreauthRspNode))
Jeff Johnson295189b2012-06-20 16:38:30 -07001001 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001002 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Preauth completed successfully after %d tries"), pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries);
Jeff Johnson295189b2012-06-20 16:38:30 -07001003
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001004 smsLog(pMac, LOG1, FL("After Pre-Auth: BSSID %02x:%02x:%02x:%02x:%02x:%02x, Ch:%d"),
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05301005 pPreauthRspNode->pBssDescription->bssId[0],
1006 pPreauthRspNode->pBssDescription->bssId[1],
1007 pPreauthRspNode->pBssDescription->bssId[2],
1008 pPreauthRspNode->pBssDescription->bssId[3],
1009 pPreauthRspNode->pBssDescription->bssId[4],
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001010 pPreauthRspNode->pBssDescription->bssId[5],
1011 (int)pPreauthRspNode->pBssDescription->channelId);
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05301012
Jeff Johnson295189b2012-06-20 16:38:30 -07001013 /* Preauth competer successfully. Insert the preauthenticated node to tail of preAuthDoneList */
1014 csrNeighborRoamRemoveRoamableAPListEntry(pMac, &pNeighborRoamInfo->roamableAPList, pPreauthRspNode);
1015 csrLLInsertTail(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, &pPreauthRspNode->List, LL_ACCESS_LOCK);
1016
1017 /* Pre-auth completed successfully. Transition to PREAUTH Done state */
1018 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE)
1019 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
1020
1021 /* The caller of this function would start a timer and by the time it expires, supplicant should
1022 have provided the updated FTIEs to SME. So, when it expires, handoff will be triggered then */
1023 }
1024 else
1025 {
1026 tpCsrNeighborRoamBSSInfo pNeighborBssNode = NULL;
1027 tListElem *pEntry;
1028
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001029 smsLog(pMac, LOGE, FL("Preauth failed retry number %d, status = 0x%x"),
1030 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries, limStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07001031
1032 /* Preauth failed. Add the bssId to the preAuth failed list MAC Address. Also remove the AP from roamable AP list */
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001033 if ((pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries >=
1034 CSR_NEIGHBOR_ROAM_MAX_NUM_PREAUTH_RETRIES) ||
1035 (eSIR_LIM_MAX_STA_REACHED_ERROR == limStatus))
Jeff Johnson295189b2012-06-20 16:38:30 -07001036 {
1037 /* We are going to remove the node as it fails for more than MAX tries. Reset this count to 0 */
1038 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
1039
1040 /* The one in the head of the list should be one with which we issued pre-auth and failed */
1041 pEntry = csrLLRemoveHead(&pNeighborRoamInfo->roamableAPList, LL_ACCESS_LOCK);
1042 if(pEntry)
1043 {
1044 pNeighborBssNode = GET_BASE_ADDR(pEntry, tCsrNeighborRoamBSSInfo, List);
1045 /* Add the BSSID to pre-auth fail list */
1046 status = csrNeighborRoamAddBssIdToPreauthFailList(pMac, pNeighborBssNode->pBssDescription->bssId);
1047 /* Now we can free this node */
1048 csrNeighborRoamFreeNeighborRoamBSSNode(pMac, pNeighborBssNode);
1049 }
1050 }
1051
1052 /* Issue preauth request for the same/next entry */
1053 if (eHAL_STATUS_SUCCESS == csrNeighborRoamIssuePreauthReq(pMac))
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001054 goto DEQ_PREAUTH;
Jeff Johnson295189b2012-06-20 16:38:30 -07001055
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001056 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN);
1057
1058 /* Register Neighbor Lookup threshold callback with TL for UP event now */
1059 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("No more pre-auth candidates-"
1060 "register UP indication with TL. RSSI = %d,"), NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1));
1061
1062 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext,
1063 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
1064 WLANTL_HO_THRESHOLD_UP,
1065 csrNeighborRoamNeighborLookupUPCallback,
1066 VOS_MODULE_ID_SME, pMac);
1067 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1068 {
1069 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001070 smsLog(pMac, LOGE, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback UP event with TL: Status = %d"), status);
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001071 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001072
1073 /* Start the neighbor results refresh timer and transition to REPORT_SCAN state to perform scan again */
1074 status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer,
1075 pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT,
1076 eANI_BOOLEAN_FALSE);
1077 if (eHAL_STATUS_SUCCESS != status)
1078 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001079 smsLog(pMac, LOGE, FL("Neighbor results refresh timer start failed with status %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001080 }
1081 }
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001082
1083DEQ_PREAUTH:
1084 csrRoamDequeuePreauth(pMac);
Madan Mohan Koyyalamudi7a579cc2012-10-21 11:25:39 -07001085 return preauthProcessed;
Jeff Johnson295189b2012-06-20 16:38:30 -07001086}
1087#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */
1088
1089/* ---------------------------------------------------------------------------
1090
1091 \fn csrNeighborRoamPrepareScanProfileFilter
1092
1093 \brief This function creates a scan filter based on the currently connected profile.
1094 Based on this filter, scan results are obtained
1095
1096 \param pMac - The handle returned by macOpen.
1097 pScanFilter - Populated scan filter based on the connected profile
1098
1099 \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise
1100
1101---------------------------------------------------------------------------*/
1102eHalStatus csrNeighborRoamPrepareScanProfileFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter)
1103{
1104 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1105 tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId;
1106 tCsrRoamConnectedProfile *pCurProfile = &pMac->roam.roamSession[sessionId].connectedProfile;
1107 tANI_U8 i = 0;
1108
1109 VOS_ASSERT(pScanFilter != NULL);
Gopichand Nakkalad5a904e2013-03-29 01:07:54 +05301110 if (pScanFilter == NULL)
1111 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001112
1113 vos_mem_zero(pScanFilter, sizeof(tCsrScanResultFilter));
1114
1115 /* We dont want to set BSSID based Filter */
1116 pScanFilter->BSSIDs.numOfBSSIDs = 0;
1117
1118 /* Populate all the information from the connected profile */
1119 pScanFilter->SSIDs.numOfSSIDs = 1;
1120 pScanFilter->SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo));
1121 if (NULL == pScanFilter->SSIDs.SSIDList)
1122 {
1123 smsLog(pMac, LOGE, FL("Scan Filter SSID mem alloc failed"));
1124 return eHAL_STATUS_FAILED_ALLOC;
1125 }
1126 pScanFilter->SSIDs.SSIDList->handoffPermitted = 1;
1127 pScanFilter->SSIDs.SSIDList->ssidHidden = 0;
1128 pScanFilter->SSIDs.SSIDList->SSID.length = pCurProfile->SSID.length;
1129 vos_mem_copy((void *)pScanFilter->SSIDs.SSIDList->SSID.ssId, (void *)pCurProfile->SSID.ssId, pCurProfile->SSID.length);
1130
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001131 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Filtering for SSID %s from scan results.. SSID Length = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001132 pScanFilter->SSIDs.SSIDList->SSID.ssId, pScanFilter->SSIDs.SSIDList->SSID.length);
1133 pScanFilter->authType.numEntries = 1;
1134 pScanFilter->authType.authType[0] = pCurProfile->AuthType;
1135
1136 pScanFilter->EncryptionType.numEntries = 1; //This must be 1
1137 pScanFilter->EncryptionType.encryptionType[0] = pCurProfile->EncryptionType;
1138
1139 pScanFilter->mcEncryptionType.numEntries = 1;
1140 pScanFilter->mcEncryptionType.encryptionType[0] = pCurProfile->mcEncryptionType;
1141
1142 pScanFilter->BSSType = pCurProfile->BSSType;
1143
1144 /* We are intrested only in the scan results on channels that we scanned */
1145 pScanFilter->ChannelInfo.numOfChannels = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels;
1146 pScanFilter->ChannelInfo.ChannelList = vos_mem_malloc(pScanFilter->ChannelInfo.numOfChannels * sizeof(tANI_U8));
1147 if (NULL == pScanFilter->ChannelInfo.ChannelList)
1148 {
1149 smsLog(pMac, LOGE, FL("Scan Filter Channel list mem alloc failed"));
1150 vos_mem_free(pScanFilter->SSIDs.SSIDList);
1151 pScanFilter->SSIDs.SSIDList = NULL;
1152 return eHAL_STATUS_FAILED_ALLOC;
1153 }
1154 for (i = 0; i < pScanFilter->ChannelInfo.numOfChannels; i++)
1155 {
1156 pScanFilter->ChannelInfo.ChannelList[i] = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i];
1157 }
1158
1159#ifdef WLAN_FEATURE_VOWIFI_11R
1160 if (pNeighborRoamInfo->is11rAssoc)
1161 {
1162 /* MDIE should be added as a part of profile. This should be added as a part of filter as well */
1163 pScanFilter->MDID.mdiePresent = pCurProfile->MDID.mdiePresent;
1164 pScanFilter->MDID.mobilityDomain = pCurProfile->MDID.mobilityDomain;
1165 }
1166#endif
1167
1168 return eHAL_STATUS_SUCCESS;
1169}
1170
Jeff Johnson43971f52012-07-17 12:26:56 -07001171tANI_U32 csrGetCurrentAPRssi(tpAniSirGlobal pMac, tScanResultHandle *pScanResultList)
1172{
1173 tCsrScanResultInfo *pScanResult;
1174 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda2efea0e2013-01-24 17:40:41 -08001175#ifdef FEATURE_WLAN_LFR
1176 tANI_U32 CurrAPRssi = pNeighborRoamInfo->lookupDOWNRssi;
1177#else
1178 /* We are setting this as default value to make sure we return this value,
1179 when we do not see this AP in the scan result for some reason.However,it is
1180 less likely that we are associated to an AP and do not see it in the scan list */
1181 tANI_U32 CurrAPRssi = -125;
1182#endif
Jeff Johnson43971f52012-07-17 12:26:56 -07001183
1184 while (NULL != (pScanResult = csrScanResultGetNext(pMac, *pScanResultList)))
1185 {
1186
1187 if (VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId,
1188 pNeighborRoamInfo->currAPbssid, sizeof(tSirMacAddr)))
1189 {
1190 /* We got a match with the currently associated AP.
1191 * Capture the RSSI value and complete the while loop.
1192 * The while loop is completed in order to make the current entry go back to NULL,
1193 * and in the next while loop, it properly starts searching from the head of the list.
1194 * TODO: Can also try setting the current entry directly to NULL as soon as we find the new AP*/
1195
1196 CurrAPRssi = (int)pScanResult->BssDescriptor.rssi * (-1) ;
1197
1198 } else {
1199 continue;
1200 }
1201 }
1202
1203 return CurrAPRssi;
1204
1205}
1206
Jeff Johnson295189b2012-06-20 16:38:30 -07001207/* ---------------------------------------------------------------------------
1208
1209 \fn csrNeighborRoamProcessScanResults
1210
1211 \brief This function extracts scan results, sorts on the basis of neighbor score(todo).
1212 Assumed that the results are already sorted by RSSI by csrScanGetResult
1213
1214 \param pMac - The handle returned by macOpen.
1215 pScanResultList - Scan result result obtained from csrScanGetResult()
1216
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001217 \return tANI_BOOLEAN - return TRUE if we have a candidate we can immediately
1218 roam to. Otherwise, return FALSE.
Jeff Johnson295189b2012-06-20 16:38:30 -07001219
1220---------------------------------------------------------------------------*/
1221
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001222static tANI_BOOLEAN csrNeighborRoamProcessScanResults(tpAniSirGlobal pMac,
1223 tScanResultHandle *pScanResultList)
Jeff Johnson295189b2012-06-20 16:38:30 -07001224{
1225 tCsrScanResultInfo *pScanResult;
1226 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1227 tpCsrNeighborRoamBSSInfo pBssInfo;
Jeff Johnson43971f52012-07-17 12:26:56 -07001228 tANI_U32 CurrAPRssi;
1229 tANI_U8 RoamRssiDiff = pMac->roam.configParam.RoamRssiDiff;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001230#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
1231 tANI_U8 immediateRoamRssiDiff = pMac->roam.configParam.nImmediateRoamRssiDiff;
1232#endif
1233 tANI_BOOLEAN roamNow = eANI_BOOLEAN_FALSE;
Jeff Johnson43971f52012-07-17 12:26:56 -07001234
1235 /***************************************************************
1236 * Find out the Current AP RSSI and keep it handy to check if
1237 * it is better than the RSSI of the AP which we are
1238 * going to roam.If so, we are going to continue with the
1239 * current AP.
1240 ***************************************************************/
1241 CurrAPRssi = csrGetCurrentAPRssi(pMac, pScanResultList);
Jeff Johnson295189b2012-06-20 16:38:30 -07001242
1243 /* Expecting the scan result already to be in the sorted order based on the RSSI */
1244 /* Based on the previous state we need to check whether the list should be sorted again taking neighbor score into consideration */
1245 /* If previous state is CFG_CHAN_LIST_SCAN, there should not be any neighbor score associated with any of the BSS.
1246 If the previous state is REPORT_QUERY, then there will be neighbor score for each of the APs */
1247 /* 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
1248 and rssi score are in the same order. This will be taken care later */
1249
1250 while (NULL != (pScanResult = csrScanResultGetNext(pMac, *pScanResultList)))
1251 {
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001252 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
1253 FL("Scan result: BSSID %02x:%02x:%02x:%02x:%02x:%02x (Rssi %d, Ch:%d)"),
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001254 pScanResult->BssDescriptor.bssId[0],
1255 pScanResult->BssDescriptor.bssId[1],
1256 pScanResult->BssDescriptor.bssId[2],
1257 pScanResult->BssDescriptor.bssId[3],
1258 pScanResult->BssDescriptor.bssId[4],
1259 pScanResult->BssDescriptor.bssId[5],
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001260 abs(pScanResult->BssDescriptor.rssi),
1261 pScanResult->BssDescriptor.channelId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001262
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001263 if (VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001264 pNeighborRoamInfo->currAPbssid, sizeof(tSirMacAddr)))
1265 {
Jeff Johnson43971f52012-07-17 12:26:56 -07001266 /* currently associated AP. Do not have this in the roamable AP list */
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001267 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001268 "SKIP-currently associated AP");
Jeff Johnson295189b2012-06-20 16:38:30 -07001269 continue;
1270 }
1271
Jeff Johnson43971f52012-07-17 12:26:56 -07001272 /* This condition is to ensure to roam to an AP with better RSSI. if the value of RoamRssiDiff is Zero, this feature
1273 * is disabled and we continue to roam without any check*/
1274 if(RoamRssiDiff > 0)
1275 {
Madan Mohan Koyyalamudif553b742012-12-03 16:37:39 -08001276 /*
1277 * If RSSI is lower than the lookup threshold, then continue.
1278 */
1279 if (abs(pScanResult->BssDescriptor.rssi) >
1280 pNeighborRoamInfo->currentNeighborLookupThreshold)
1281 {
1282 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001283 "%s: [INFOLOG] new ap rssi (%d) lower than lookup threshold (%d)",
Madan Mohan Koyyalamudif553b742012-12-03 16:37:39 -08001284 __func__, (int)pScanResult->BssDescriptor.rssi * (-1),
1285 (int)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
1286 continue;
1287 }
1288
Jeff Johnson43971f52012-07-17 12:26:56 -07001289 if (abs(CurrAPRssi) < abs(pScanResult->BssDescriptor.rssi))
1290 {
1291 /*Do not roam to an AP with worse RSSI than the current*/
1292 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001293 "%s: [INFOLOG]Current AP rssi=%d new ap rssi worse=%d", __func__,
Jeff Johnson43971f52012-07-17 12:26:56 -07001294 CurrAPRssi,
1295 (int)pScanResult->BssDescriptor.rssi * (-1) );
1296 continue;
1297 } else {
1298 /*Do not roam to an AP which is having better RSSI than the current AP, but still less than the
1299 * margin that is provided by user from the ini file (RoamRssiDiff)*/
1300 if (abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)) < RoamRssiDiff)
1301 {
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001302 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001303 "%s: [INFOLOG]Current AP rssi=%d new ap rssi=%d not good enough, roamRssiDiff=%d", __func__,
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001304 CurrAPRssi,
1305 (int)pScanResult->BssDescriptor.rssi * (-1),
1306 RoamRssiDiff);
Jeff Johnson43971f52012-07-17 12:26:56 -07001307 continue;
1308 }
1309 else {
1310 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001311 "%s: [INFOLOG]Current AP rssi=%d new ap rssi better=%d", __func__,
Jeff Johnson43971f52012-07-17 12:26:56 -07001312 CurrAPRssi,
1313 (int)pScanResult->BssDescriptor.rssi * (-1) );
1314 }
1315 }
1316 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001317
1318#ifdef WLAN_FEATURE_VOWIFI_11R
1319 if (pNeighborRoamInfo->is11rAssoc)
1320 {
1321 if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId))
1322 {
1323 smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring"));
1324 continue;
1325 }
1326 }
1327#endif /* WLAN_FEATURE_VOWIFI_11R */
1328
1329#ifdef FEATURE_WLAN_CCX
1330 if (pNeighborRoamInfo->isCCXAssoc)
1331 {
1332 if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId))
1333 {
1334 smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring"));
1335 continue;
1336 }
1337 }
1338 if ((pScanResult->BssDescriptor.QBSSLoad_present) &&
1339 (pScanResult->BssDescriptor.QBSSLoad_avail))
1340 {
1341 if (pNeighborRoamInfo->isVOAdmitted)
1342 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001343 smsLog(pMac, LOG1, FL("New AP has %x BW available"), (unsigned int)pScanResult->BssDescriptor.QBSSLoad_avail);
1344 smsLog(pMac, LOG1, FL("We need %x BW available"),(unsigned int)pNeighborRoamInfo->MinQBssLoadRequired);
Jeff Johnson295189b2012-06-20 16:38:30 -07001345 if (pScanResult->BssDescriptor.QBSSLoad_avail < pNeighborRoamInfo->MinQBssLoadRequired)
1346 {
1347 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001348 "[INFOLOG]BSSID : %02x:%02x:%02x:%02x:%02x:%02x has no bandwidth ignoring..not adding to roam list",
Jeff Johnson295189b2012-06-20 16:38:30 -07001349 pScanResult->BssDescriptor.bssId[0],
1350 pScanResult->BssDescriptor.bssId[1],
1351 pScanResult->BssDescriptor.bssId[2],
1352 pScanResult->BssDescriptor.bssId[3],
1353 pScanResult->BssDescriptor.bssId[4],
1354 pScanResult->BssDescriptor.bssId[5]);
1355 continue;
1356 }
1357 }
1358 }
1359 else
1360 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001361 smsLog(pMac, LOGE, FL("No QBss %x %x"), (unsigned int)pScanResult->BssDescriptor.QBSSLoad_avail, (unsigned int)pScanResult->BssDescriptor.QBSSLoad_present);
Jeff Johnson295189b2012-06-20 16:38:30 -07001362 if (pNeighborRoamInfo->isVOAdmitted)
1363 {
1364 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001365 "[INFOLOG]BSSID : %02x:%02x:%02x:%02x:%02x:%02x has no QBSSLoad IE, ignoring..not adding to roam list",
Jeff Johnson295189b2012-06-20 16:38:30 -07001366 pScanResult->BssDescriptor.bssId[0],
1367 pScanResult->BssDescriptor.bssId[1],
1368 pScanResult->BssDescriptor.bssId[2],
1369 pScanResult->BssDescriptor.bssId[3],
1370 pScanResult->BssDescriptor.bssId[4],
1371 pScanResult->BssDescriptor.bssId[5]);
1372 continue;
1373 }
1374 }
1375#endif /* FEATURE_WLAN_CCX */
1376
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001377#ifdef FEATURE_WLAN_LFR
1378 // If we are supporting legacy roaming, and
1379 // if the candidate is on the "pre-auth failed" list, ignore it.
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05301380 if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001381 {
1382 if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId))
1383 {
1384 smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring"));
1385 continue;
1386 }
1387 }
1388#endif /* FEATURE_WLAN_LFR */
1389
Jeff Johnson295189b2012-06-20 16:38:30 -07001390 /* If the received timestamp in BSS description is earlier than the scan request timestamp, skip
1391 * this result */
1392 if (pNeighborRoamInfo->scanRequestTimeStamp >= pScanResult->BssDescriptor.nReceivedTime)
1393 {
1394 smsLog(pMac, LOGE, FL("Ignoring BSS as it is older than the scan request timestamp"));
1395 continue;
1396 }
1397
1398 pBssInfo = vos_mem_malloc(sizeof(tCsrNeighborRoamBSSInfo));
1399 if (NULL == pBssInfo)
1400 {
1401 smsLog(pMac, LOGE, FL("Memory allocation for Neighbor Roam BSS Info failed.. Just ignoring"));
1402 continue;
1403 }
1404
1405 pBssInfo->pBssDescription = vos_mem_malloc(pScanResult->BssDescriptor.length + sizeof(pScanResult->BssDescriptor.length));
1406 if (pBssInfo->pBssDescription != NULL)
1407 {
1408 vos_mem_copy(pBssInfo->pBssDescription, &pScanResult->BssDescriptor,
1409 pScanResult->BssDescriptor.length + sizeof(pScanResult->BssDescriptor.length));
1410 }
1411 else
1412 {
1413 smsLog(pMac, LOGE, FL("Memory allocation for Neighbor Roam BSS Descriptor failed.. Just ignoring"));
1414 vos_mem_free(pBssInfo);
1415 continue;
1416
1417 }
1418 pBssInfo->apPreferenceVal = 10; //some value for now. Need to calculate the actual score based on RSSI and neighbor AP score
1419
1420 /* Just add to the end of the list as it is already sorted by RSSI */
1421 csrLLInsertTail(&pNeighborRoamInfo->roamableAPList, &pBssInfo->List, LL_ACCESS_LOCK);
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001422
1423#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Srikant Kuppa866893f2012-12-27 17:28:14 -08001424 if (abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)) >= immediateRoamRssiDiff)
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001425 {
1426 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
1427 "%s: [INFOLOG] potential candidate to roam immediately (diff=%d, expected=%d)",
1428 __func__, abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)),
1429 immediateRoamRssiDiff);
1430 roamNow = eANI_BOOLEAN_TRUE;
1431 }
1432#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001433 }
1434
1435 /* 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 */
1436 csrScanResultPurge(pMac, *pScanResultList);
1437
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001438 return roamNow;
Jeff Johnson295189b2012-06-20 16:38:30 -07001439}
1440
1441/* ---------------------------------------------------------------------------
1442
1443 \fn csrNeighborRoamHandleEmptyScanResult
1444
1445 \brief This function will be invoked in CFG_CHAN_LIST_SCAN state when
1446 there are no valid APs in the scan result for roaming. This means
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001447 our AP is the best and no other AP is around. No point in scanning
Jeff Johnson295189b2012-06-20 16:38:30 -07001448 again and again. Performing the following here.
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001449 1. Stop the neighbor scan timer.
1450 2a. If this is the first time we encountered empty scan, then
1451 re-register with TL with modified lookup threshold.
1452 2b. Else if this is the second time we encountered empty scan,
1453 then start neighbor scan results refresh timer (20s).
1454 2c. Else, nothing more to do.
1455 NOTE: In LFR, channels selected for scanning is dervied from
1456 the occuped channel list. Scan cycle following one which
1457 yielded empty results is split into two halves: (i) scan on
1458 channels in the occupied list, and (ii) scan on channels not
1459 in the occupied list. This helps converging faster (while
1460 looking for candidates in the occupied list first), and also,
1461 adds channels to the occupied channel list upon finding candidates
1462 matching SSID profile of interest.
1463
1464 uEmptyScanCount Comments
1465 eFirstEmptyScan Previous scan was done on channels in the
1466 occupied list and yielded potential candidates.
1467 This scan cycle was likely triggered through
1468 receipt of lookup DOWN notification event.
1469 eSecondEmptyScan Previous scan was done on channels in the
1470 occupied list and yielded no candidates. This scan
1471 cycle was triggered through RSSI notification
1472 with modified lookup threshold.
1473 eThirdEmptyScan Previous scan was done on channels NOT in
1474 the occupied list and yielded no candidates. This
1475 scan cycle was triggered immediately after scanning
1476 channels in the occupied list and no candidates
1477 were found.
1478 eFourthEmptyScan Previous scan was done on channels in the
1479 occupied list and yielded no candidates. This scan
1480 cycle was triggered upon expiry of
1481 neighborScanResultsRefreshPeriod (=20s).
1482 eFifthEmptyScan Previous scan was done on channels NOT in
1483 the occupied list and yielded no candidates. This
1484 scan cycle was triggered immediately after scanning
1485 channels in the occupied list and no candidates
1486 were found.
1487
1488 [1], [2,3] and [4,5] together form one discrete set of scan cycle.
Jeff Johnson295189b2012-06-20 16:38:30 -07001489
1490 \param pMac - The handle returned by macOpen.
1491
1492 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
1493
1494---------------------------------------------------------------------------*/
1495static VOS_STATUS csrNeighborRoamHandleEmptyScanResult(tpAniSirGlobal pMac)
1496{
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001497 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001498 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1499 eHalStatus status = eHAL_STATUS_SUCCESS;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001500#ifdef FEATURE_WLAN_LFR
1501 tANI_BOOLEAN performPeriodicScan =
1502 (pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod) ? TRUE : FALSE;
1503#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001504
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001505 /* Stop neighbor scan timer */
Jeff Johnson295189b2012-06-20 16:38:30 -07001506 status = palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001507 if (eHAL_STATUS_SUCCESS != status)
Jeff Johnson295189b2012-06-20 16:38:30 -07001508 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001509 smsLog(pMac, LOGW, FL("stopping neighborScanTimer failed with status %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001510 }
1511
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001512 /*
1513 * Increase the neighbor lookup threshold by 3 dB
1514 * after every scan cycle. NOTE: uEmptyScanCount
1515 * would be either 1, 3 or 5 at the end of every
1516 * scan cycle.
1517 */
1518#ifdef FEATURE_WLAN_LFR
1519 if ((++pNeighborRoamInfo->uEmptyScanCount) > eFifthEmptyScan)
1520 {
1521 pNeighborRoamInfo->uEmptyScanCount = eFifthEmptyScan;
1522 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08001523 if ((abs(pNeighborRoamInfo->lookupDOWNRssi) >
1524 abs(pNeighborRoamInfo->cfgParams.neighborReassocThreshold)) &&
1525 ((pNeighborRoamInfo->uEmptyScanCount == eSecondEmptyScan) ||
1526 (pNeighborRoamInfo->uEmptyScanCount == eFourthEmptyScan)))
1527 {
1528 /*
1529 * If the scan was triggered due to lookupDOWNRssi > reassoc threshold,
1530 * then it would be a contiguous scan on all valid non-DFS channels.
1531 * In this mode, there is no need to trigger an immediate scan upon
1532 * empty scan results for the second and fourth time (which would
1533 * be equivalent to scanning on channels in non-occupied list).
1534 * Incrementing uEmptyScanCount will correspond to skipping this step.
1535 * NOTE: double increment of uEmptyScanCount corresponds to completion
1536 * of scans on all valid channels.
1537 */
1538 ++pNeighborRoamInfo->uEmptyScanCount;
1539 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Extra increment of empty scan count (=%d)"
1540 " in contiguous scan mode", pNeighborRoamInfo->uEmptyScanCount);
1541 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001542#endif
1543 if (((pNeighborRoamInfo->currentNeighborLookupThreshold+3) <
1544 pNeighborRoamInfo->cfgParams.neighborReassocThreshold)
1545#ifdef FEATURE_WLAN_LFR
1546 && ((pNeighborRoamInfo->uEmptyScanCount % 2) == 1)
1547#endif
1548 )
1549 {
1550 pNeighborRoamInfo->currentNeighborLookupThreshold += 3;
1551 }
1552
Jeff Johnson295189b2012-06-20 16:38:30 -07001553#ifdef WLAN_FEATURE_VOWIFI_11R
1554 /* Clear off the old neighbor report details */
1555 vos_mem_zero(&pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
1556#endif
1557
Srikant Kuppa866893f2012-12-27 17:28:14 -08001558 /* Transition to CONNECTED state */
1559 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED);
1560
1561 /* Reset all the necessary variables before transitioning to the CONNECTED state */
1562 csrNeighborRoamResetConnectedStateControlInfo(pMac);
1563
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001564#ifdef FEATURE_WLAN_LFR
1565 if (pNeighborRoamInfo->uEmptyScanCount == eFirstEmptyScan)
1566 {
1567#endif
1568 /* Empty scan results for the first time */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001569 /* Re-register neighbor lookup DOWN threshold callback with TL */
1570 NEIGHBOR_ROAM_DEBUG(pMac, LOGE,
1571 FL("Registering DOWN event neighbor lookup callback with TL for RSSI = %d"),
1572 pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
1573
1574 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext,
1575 (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
1576 WLANTL_HO_THRESHOLD_DOWN,
1577 csrNeighborRoamNeighborLookupDOWNCallback,
1578 VOS_MODULE_ID_SME, pMac);
1579
1580 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1581 {
1582 smsLog(pMac, LOGW,
1583 FL("Couldn't re-register csrNeighborRoamNeighborLookupDOWNCallback"
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001584 " with TL: Status = %d"), status);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001585 }
1586#ifdef FEATURE_WLAN_LFR
Srikant Kuppa866893f2012-12-27 17:28:14 -08001587 pNeighborRoamInfo->lookupDOWNRssi = 0;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001588 }
1589 else if ((pNeighborRoamInfo->uEmptyScanCount == eSecondEmptyScan) ||
1590 (pNeighborRoamInfo->uEmptyScanCount == eFourthEmptyScan))
1591 {
1592 /* Empty scan results for the second or fourth time */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001593
1594 /* Immediately scan on channels in non-occupied list */
1595 csrNeighborRoamTransitToCFGChanScan(pMac);
1596 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08001597 else if (pNeighborRoamInfo->uEmptyScanCount >= eThirdEmptyScan)
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001598 {
1599 /* Empty scan results for the third time */
Srinivas Girigowdade697412013-02-14 16:31:48 -08001600 if (performPeriodicScan)
1601 {
1602 smsLog(pMac, LOGE, FL("Performing periodic scan, uEmptyScanCount=%d"),
1603 pNeighborRoamInfo->uEmptyScanCount);
Srikant Kuppa866893f2012-12-27 17:28:14 -08001604
Srinivas Girigowdade697412013-02-14 16:31:48 -08001605 /*
1606 * Set uEmptyScanCount to MAX so that we always enter this
1607 * condition on subsequent empty scan results
1608 */
1609 pNeighborRoamInfo->uEmptyScanCount = eMaxEmptyScan;
1610
1611 /* From here on, ONLY scan on channels in the occupied list */
1612 pNeighborRoamInfo->uScanMode = SPLIT_SCAN_OCCUPIED_LIST;
1613
1614 /* Start empty scan refresh timer */
1615 if (eHAL_STATUS_SUCCESS !=
1616 palTimerStart(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer,
1617 pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod * PAL_TIMER_TO_MS_UNIT,
1618 eANI_BOOLEAN_FALSE))
1619 {
1620 smsLog(pMac, LOGE, FL("Empty scan refresh timer failed to start (%d)"),
1621 status);
1622 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
1623 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07001624 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001625 vosStatus = VOS_STATUS_E_FAILURE;
1626 }
1627 else
1628 {
1629 smsLog(pMac, LOGE, FL("Empty scan refresh timer started (%ld ms)"),
1630 (pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod));
1631 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001632 }
1633 else
1634 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08001635 /* Start neighbor scan results refresh timer */
1636 if (eHAL_STATUS_SUCCESS !=
1637 palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer,
1638 pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT,
1639 eANI_BOOLEAN_FALSE))
1640 {
1641 smsLog(pMac, LOGE, FL("Neighbor results refresh timer failed to start (%d)"),
1642 status);
1643 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
1644 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07001645 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001646 vosStatus = VOS_STATUS_E_FAILURE;
1647 }
1648 else
1649 {
1650 smsLog(pMac, LOG2, FL("Neighbor results refresh timer started (%ld ms)"),
1651 (pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT));
1652 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001653 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001654 }
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001655
Srinivas Girigowdade697412013-02-14 16:31:48 -08001656 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Neighbor roam empty scan count=%d scan mode=%d",
1657 pNeighborRoamInfo->uEmptyScanCount, pNeighborRoamInfo->uScanMode);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001658#endif
1659 return vosStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07001660}
1661
Jeff Johnson295189b2012-06-20 16:38:30 -07001662
Srikant Kuppa866893f2012-12-27 17:28:14 -08001663static eHalStatus csrNeighborRoamProcessScanComplete (tpAniSirGlobal pMac)
Jeff Johnson295189b2012-06-20 16:38:30 -07001664{
Jeff Johnson295189b2012-06-20 16:38:30 -07001665 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001666 tCsrScanResultFilter scanFilter;
1667 tScanResultHandle scanResult;
1668 tANI_U32 tempVal = 0;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001669 tANI_BOOLEAN roamNow = eANI_BOOLEAN_FALSE;
Srikant Kuppa866893f2012-12-27 17:28:14 -08001670 eHalStatus hstatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07001671
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001672#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001673 /* If the state is REPORT_SCAN, then this must be the scan after the REPORT_QUERY state. So, we
1674 should use the BSSID filter made out of neighbor reports */
1675 if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
1676 {
Jeff Johnson43971f52012-07-17 12:26:56 -07001677 hstatus = csrNeighborRoamBssIdScanFilter(pMac, &scanFilter);
1678 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("11R or CCX Association: Prepare scan filter status with neighbor AP = %d"), hstatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07001679 tempVal = 1;
1680 }
1681 else
1682#endif
1683 {
Jeff Johnson43971f52012-07-17 12:26:56 -07001684 hstatus = csrNeighborRoamPrepareScanProfileFilter(pMac, &scanFilter);
1685 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("11R/CCX/Other Association: Prepare scan to find neighbor AP filter status = %d"), hstatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07001686 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001687 if (eHAL_STATUS_SUCCESS != hstatus)
Jeff Johnson295189b2012-06-20 16:38:30 -07001688 {
1689 smsLog(pMac, LOGE, FL("Scan Filter preparation failed for Assoc type %d.. Bailing out.."), tempVal);
1690 return eHAL_STATUS_FAILURE;
1691 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001692 hstatus = csrScanGetResult(pMac, &scanFilter, &scanResult);
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05301693 if (hstatus != eHAL_STATUS_SUCCESS)
1694 {
1695 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Get Scan Result status code %d"), hstatus);
1696 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001697 /* Process the scan results and update roamable AP list */
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001698 roamNow = csrNeighborRoamProcessScanResults(pMac, &scanResult);
Jeff Johnson295189b2012-06-20 16:38:30 -07001699
1700 /* Free the scan filter */
1701 csrFreeScanFilter(pMac, &scanFilter);
1702
1703 tempVal = csrLLCount(&pNeighborRoamInfo->roamableAPList);
1704
1705 switch(pNeighborRoamInfo->neighborRoamState)
1706 {
1707 case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:
1708 if (tempVal)
1709 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001710#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001711 /*
1712 * Since there are non-zero candidates found
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001713 * after the scan, reset empty scan count.
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001714 */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001715 pNeighborRoamInfo->uEmptyScanCount = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001716 pNeighborRoamInfo->uScanMode = DEFAULT_SCAN;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001717#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001718#ifdef WLAN_FEATURE_VOWIFI_11R
1719 /* If this is a non-11r association, then we can register the reassoc callback here as we have some
1720 APs in the roamable AP list */
1721 if (pNeighborRoamInfo->is11rAssoc)
1722 {
1723 /* Valid APs are found after scan. Now we can initiate pre-authentication */
1724 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
1725 }
1726 else
1727#endif
1728#ifdef FEATURE_WLAN_CCX
1729 /* If this is a non-11r association, then we can register the reassoc callback here as we have some
1730 APs in the roamable AP list */
1731 if (pNeighborRoamInfo->isCCXAssoc)
1732 {
1733 /* Valid APs are found after scan. Now we can initiate pre-authentication */
1734 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
1735 }
1736 else
1737#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001738#ifdef FEATURE_WLAN_LFR
1739 /* If LFR is enabled, then we can register the reassoc callback here as we have some
1740 APs in the roamable AP list */
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05301741 if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001742 {
1743 /* Valid APs are found after scan. Now we can initiate pre-authentication */
1744 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
1745 }
1746 else
1747#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001748 {
1749
1750 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Completed scanning of CFG CHAN LIST in non-11r association. Registering reassoc callback"));
1751 /* Nothing much to do now. Will continue to remain in this state in case of non-11r association */
1752 /* Stop the timer. But how long the roamable AP list will be valid in here. At some point of time, we
1753 need to restart the CFG CHAN list scan procedure if reassoc callback is not invoked from TL
1754 within certain duration */
1755
1756// palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
1757 }
1758 }
1759 else
1760 {
Madan Mohan Koyyalamudib40e5582012-10-11 16:48:42 -07001761 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("No candidate found after scanning in state %d.. "), pNeighborRoamInfo->neighborRoamState);
1762 /* Handle it appropriately */
1763 csrNeighborRoamHandleEmptyScanResult(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001764 }
1765 break;
1766#ifdef WLAN_FEATURE_VOWIFI_11R
1767 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
1768 if (!tempVal)
1769 {
1770 smsLog(pMac, LOGE, FL("No candidate found after scanning in state %d.. "), pNeighborRoamInfo->neighborRoamState);
1771 /* Stop the timer here as the same timer will be started again in CFG_CHAN_SCAN_STATE */
1772 csrNeighborRoamTransitToCFGChanScan(pMac);
1773 }
1774 break;
1775#endif /* WLAN_FEATURE_VOWIFI_11R */
1776 default:
1777 // Can come only in INIT state. Where in we are associated, we sent scan and user
1778 // in the meantime decides to disassoc, we will be in init state and still received call
1779 // back issued. Should not come here in any other state, printing just in case
1780 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001781 "%s: [INFOLOG] State %d", __func__, (pNeighborRoamInfo->neighborRoamState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001782
1783 // Lets just exit out silently.
1784 return eHAL_STATUS_SUCCESS;
1785 }
1786
1787 if (tempVal)
1788 {
1789 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
1790
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001791 if (roamNow)
1792 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001793 NEIGHBOR_ROAM_DEBUG(pMac, LOG2,
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001794 FL("Immediate roam-deregister UP indication. RSSI = %d"),
1795 NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1));
1796
1797 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
1798 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
1799 WLANTL_HO_THRESHOLD_UP,
1800 csrNeighborRoamNeighborLookupUPCallback,
1801 VOS_MODULE_ID_SME);
1802
1803 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1804 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001805 smsLog(pMac, LOGW,
1806 FL("Couldn't deregister lookup UP callback with TL: Status = %d"), vosStatus);
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001807 }
1808
1809 csrNeighborRoamTriggerHandoff(pMac, pNeighborRoamInfo);
1810 return eHAL_STATUS_SUCCESS;
1811 }
1812
Srikant Kuppa866893f2012-12-27 17:28:14 -08001813 hstatus = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer,
1814 pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT,
1815 eANI_BOOLEAN_FALSE);
1816
Jeff Johnson295189b2012-06-20 16:38:30 -07001817 /* This timer should be started before registering the Reassoc callback with TL. This is because, it is very likely
1818 * that the callback getting called immediately and the timer would never be stopped when pre-auth is in progress */
Srikant Kuppa866893f2012-12-27 17:28:14 -08001819 if (eHAL_STATUS_SUCCESS != hstatus)
Jeff Johnson295189b2012-06-20 16:38:30 -07001820 {
Srikant Kuppa866893f2012-12-27 17:28:14 -08001821 smsLog(pMac, LOGE, FL("Neighbor results refresh timer failed to start, status = %d"), hstatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07001822 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
1823 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07001824 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Jeff Johnson43971f52012-07-17 12:26:56 -07001825 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001826 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001827
Jeff Johnson295189b2012-06-20 16:38:30 -07001828 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event Reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
1829 /* Register a reassoc Indication callback */
1830 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
1831 WLANTL_HO_THRESHOLD_DOWN,
1832 csrNeighborRoamReassocIndCallback,
1833 VOS_MODULE_ID_SME, pMac);
1834
1835 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1836 {
1837 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001838 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamReassocIndCallback with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07001839 }
1840
1841 }
Srikant Kuppa866893f2012-12-27 17:28:14 -08001842
1843 return eHAL_STATUS_SUCCESS;
1844
1845}
1846
1847
1848/* ---------------------------------------------------------------------------
1849
1850 \fn csrNeighborRoamScanRequestCallback
1851
1852 \brief This function is the callback function registered in csrScanRequest() to
1853 indicate the completion of scan. If scan is completed for all the channels in
1854 the channel list, this function gets the scan result and starts the refresh results
1855 timer to avoid having stale results. If scan is not completed on all the channels,
1856 it restarts the neighbor scan timer which on expiry issues scan on the next
1857 channel
1858
1859 \param halHandle - The handle returned by macOpen.
1860 pContext - not used
1861 scanId - not used
1862 status - not used
1863
1864 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
1865
1866---------------------------------------------------------------------------*/
1867static eHalStatus csrNeighborRoamScanRequestCallback(tHalHandle halHandle, void *pContext,
1868 tANI_U32 scanId, eCsrScanStatus status)
1869{
1870 tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle;
1871 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1872 tANI_U8 currentChanIndex;
1873 eHalStatus hstatus;
1874
1875 pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE;
1876
1877 /* This can happen when we receive a UP event from TL in any of the scan states. Silently ignore it */
1878 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
1879 {
1880 smsLog(pMac, LOGE, FL("Received in CONNECTED state. Must be because a UP event from TL after issuing scan request. Ignore it"));
1881 return eHAL_STATUS_SUCCESS;
1882 }
1883
1884 /* -1 is done because the chanIndex would have got incremented after issuing a successful scan request */
1885 currentChanIndex = (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex) ? (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex - 1) : 0;
1886
1887 /* Validate inputs */
1888 if (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList) {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001889 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("csrNeighborRoamScanRequestCallback received for Channel = %d, ChanIndex = %d"),
Srikant Kuppa866893f2012-12-27 17:28:14 -08001890 pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList[currentChanIndex], currentChanIndex);
1891 }
1892 else
1893 {
1894 smsLog(pMac, LOG1, FL("Received during clean-up. Silently ignore scan completion event."));
1895 return eHAL_STATUS_SUCCESS;
1896 }
1897
1898 if (eANI_BOOLEAN_FALSE == pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress)
1899 {
1900 /* Scan is completed in the CFG_CHAN_SCAN state. We can transition to REPORT_SCAN state
1901 just to get the results and perform PREAUTH */
1902 /* Now we have completed scanning the channel list. We have get the result by applying appropriate filter
1903 sort the results based on neighborScore and RSSI and select the best candidate out of the list */
1904 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Channel list scan completed. Current chan index = %d"), currentChanIndex);
1905 VOS_ASSERT(pNeighborRoamInfo->roamChannelInfo.currentChanIndex == 0);
1906
1907 hstatus = csrNeighborRoamProcessScanComplete(pMac);
1908
1909 if (eHAL_STATUS_SUCCESS != hstatus)
1910 {
1911 smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus);
1912 return eHAL_STATUS_FAILURE;
1913 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001914 }
1915 else
1916 {
1917
1918 /* Restart the timer for the next scan sequence as scanning is not over */
Jeff Johnson43971f52012-07-17 12:26:56 -07001919 hstatus = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer,
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT,
1921 eANI_BOOLEAN_FALSE);
1922
Jeff Johnson43971f52012-07-17 12:26:56 -07001923 if (eHAL_STATUS_SUCCESS != hstatus)
Jeff Johnson295189b2012-06-20 16:38:30 -07001924 {
1925 /* Timer start failed.. Should we ASSERT here??? */
1926 smsLog(pMac, LOGE, FL("Neighbor scan PAL Timer start failed, status = %d, Ignoring state transition"), status);
1927 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
1928 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07001929 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Jeff Johnson43971f52012-07-17 12:26:56 -07001930 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001931 }
1932 }
1933 return eHAL_STATUS_SUCCESS;
1934}
1935
Srikant Kuppa866893f2012-12-27 17:28:14 -08001936#ifdef FEATURE_WLAN_LFR
1937static eHalStatus csrNeighborRoamContiguousScanRequestCallback(tHalHandle halHandle,
1938 void *pContext, tANI_U32 scanId, eCsrScanStatus status)
1939{
1940 tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle;
1941 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1942 eHalStatus hstatus = eHAL_STATUS_SUCCESS;
1943
1944 pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE;
1945
1946 /* This can happen when we receive a UP event from TL in any of the scan states. Silently ignore it */
1947 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
1948 {
1949 smsLog(pMac, LOGE, FL("Received in CONNECTED state. Must be because a UP event from TL after issuing scan request. Ignore it"));
1950 return eHAL_STATUS_SUCCESS;
1951 }
1952
Srinivas Girigowdade697412013-02-14 16:31:48 -08001953 if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
1954 {
1955 smsLog(pMac, LOGE, FL("Received in INIT state. Must have disconnected. Ignore it"));
1956 return eHAL_STATUS_SUCCESS;
1957 }
1958
Srikant Kuppa866893f2012-12-27 17:28:14 -08001959 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "%s: process scan results", __func__);
1960 hstatus = csrNeighborRoamProcessScanComplete(pMac);
1961
1962 if (eHAL_STATUS_SUCCESS != hstatus)
1963 {
1964 smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus);
1965 }
1966
1967 return hstatus;
1968}
1969#endif
1970
Jeff Johnson295189b2012-06-20 16:38:30 -07001971/* ---------------------------------------------------------------------------
1972
1973 \fn csrNeighborRoamIssueBgScanRequest
1974
1975 \brief This function issues CSR scan request after populating all the BG scan params
1976 passed
1977
1978 \param pMac - The handle returned by macOpen.
1979 pBgScanParams - Params that need to be populated into csr Scan request
1980
1981 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
1982
1983---------------------------------------------------------------------------*/
Srikant Kuppa866893f2012-12-27 17:28:14 -08001984eHalStatus csrNeighborRoamIssueBgScanRequest(tpAniSirGlobal pMac,
1985 tCsrBGScanRequest *pBgScanParams,
1986 csrScanCompleteCallback callbackfn)
Jeff Johnson295189b2012-06-20 16:38:30 -07001987{
1988 eHalStatus status = eHAL_STATUS_SUCCESS;
1989 tANI_U32 scanId;
1990 tCsrScanRequest scanReq;
1991 tANI_U8 channel;
1992
Srikant Kuppa866893f2012-12-27 17:28:14 -08001993 if (1 == pBgScanParams->ChannelInfo.numOfChannels)
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001994 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Channel = %d, ChanIndex = %d"),
Srikant Kuppa866893f2012-12-27 17:28:14 -08001995 pBgScanParams->ChannelInfo.ChannelList[0],
1996 pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07001997
1998 //send down the scan req for 1 channel on the associated SSID
1999 palZeroMemory(pMac->hHdd, &scanReq, sizeof(tCsrScanRequest));
2000 /* Fill in the SSID Info */
2001 scanReq.SSIDs.numOfSSIDs = 1;
2002 scanReq.SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo) * scanReq.SSIDs.numOfSSIDs);
2003 if(NULL == scanReq.SSIDs.SSIDList)
2004 {
2005 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002006 smsLog(pMac, LOGE, FL("Couldn't allocate memory for the SSID..Freeing memory allocated for Channel List"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002007 return eHAL_STATUS_FAILURE;
2008 }
2009 vos_mem_zero(scanReq.SSIDs.SSIDList, sizeof(tCsrSSIDInfo) * scanReq.SSIDs.numOfSSIDs);
2010
2011 scanReq.SSIDs.SSIDList[0].handoffPermitted = eANI_BOOLEAN_TRUE;
2012 scanReq.SSIDs.SSIDList[0].ssidHidden = eANI_BOOLEAN_TRUE;
2013 vos_mem_copy((void *)&scanReq.SSIDs.SSIDList[0].SSID, (void *)&pBgScanParams->SSID, sizeof(pBgScanParams->SSID));
2014
2015 scanReq.ChannelInfo.numOfChannels = pBgScanParams->ChannelInfo.numOfChannels;
Srikant Kuppa866893f2012-12-27 17:28:14 -08002016 if (1 == pBgScanParams->ChannelInfo.numOfChannels)
2017 {
2018 channel = pBgScanParams->ChannelInfo.ChannelList[0];
2019 scanReq.ChannelInfo.ChannelList = &channel;
2020 }
2021 else
2022 {
2023 scanReq.ChannelInfo.ChannelList = pBgScanParams->ChannelInfo.ChannelList;
2024 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002025
2026 scanReq.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
2027 scanReq.scanType = eSIR_ACTIVE_SCAN;
2028 scanReq.requestType = eCSR_SCAN_HO_BG_SCAN;
2029 scanReq.maxChnTime = pBgScanParams->maxChnTime;
2030 scanReq.minChnTime = pBgScanParams->minChnTime;
2031 status = csrScanRequest(pMac, CSR_SESSION_ID_INVALID, &scanReq,
Srikant Kuppa866893f2012-12-27 17:28:14 -08002032 &scanId, callbackfn, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002033 if (eHAL_STATUS_SUCCESS != status)
2034 {
2035 smsLog(pMac, LOGE, FL("CSR Scan Request failed with status %d"), status);
2036 vos_mem_free(scanReq.SSIDs.SSIDList);
2037 return status;
2038 }
2039 pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_TRUE;
2040
2041 vos_mem_free(scanReq.SSIDs.SSIDList);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002042 if (1 == pBgScanParams->ChannelInfo.numOfChannels)
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002043 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Channel List Address = %08x, Actual index = %d"),
Srikant Kuppa866893f2012-12-27 17:28:14 -08002044 &pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList[0],
2045 pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex);
2046
Jeff Johnson295189b2012-06-20 16:38:30 -07002047 return status;
2048}
2049
Srikant Kuppa866893f2012-12-27 17:28:14 -08002050static void csrNeighborRoamFillNonChannelBgScanParams (tpAniSirGlobal pMac,
2051 tpCsrBGScanRequest bgScanParams)
2052{
2053 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2054 tANI_U8 broadcastBssid[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
2055
2056 vos_mem_copy(bgScanParams->bssid, broadcastBssid, sizeof(tCsrBssid));
2057 bgScanParams->SSID.length = pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length;
2058 vos_mem_copy(bgScanParams->SSID.ssId,
2059 pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.ssId,
2060 pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length);
2061
2062 bgScanParams->minChnTime = pNeighborRoamInfo->cfgParams.minChannelScanTime;
2063 bgScanParams->maxChnTime = pNeighborRoamInfo->cfgParams.maxChannelScanTime;
2064}
2065
Jeff Johnson295189b2012-06-20 16:38:30 -07002066/* ---------------------------------------------------------------------------
2067
2068 \fn csrNeighborRoamPerformBgScan
2069
2070 \brief This function is invoked on every expiry of neighborScanTimer till all
2071 the channels in the channel list are scanned. It populates necessary
2072 parameters for BG scan and calls appropriate AP to invoke the CSR scan
2073 request
2074
2075 \param pMac - The handle returned by macOpen.
2076
2077 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
2078
2079---------------------------------------------------------------------------*/
2080eHalStatus csrNeighborRoamPerformBgScan(tpAniSirGlobal pMac)
2081{
2082 eHalStatus status = eHAL_STATUS_SUCCESS;
2083 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2084 tCsrBGScanRequest bgScanParams;
Jeff Johnson295189b2012-06-20 16:38:30 -07002085 tANI_U8 channel = 0;
2086
2087 if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
2088 {
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05302089 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Channel List Address = %08x"), &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[0]);
Jeff Johnson295189b2012-06-20 16:38:30 -07002090 }
2091 else
2092 {
2093 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Channel List Empty"));
Jeff Johnson902c9832012-12-10 14:28:09 -08002094 // Go back and restart. Mostly timer start failure has occurred.
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 // When timer start is declared a failure, then we delete the list.
2096 // Should not happen now as we stop and then only start the scan timer.
2097 // still handle the unlikely case.
2098 csrNeighborRoamHandleEmptyScanResult(pMac);
2099 return status;
2100 }
2101 /* Need to perform scan here before getting the list */
Srikant Kuppa866893f2012-12-27 17:28:14 -08002102
2103 palZeroMemory(pMac->hHdd, &bgScanParams, sizeof(tCsrBGScanRequest));
Jeff Johnson295189b2012-06-20 16:38:30 -07002104
2105 channel = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[pNeighborRoamInfo->roamChannelInfo.currentChanIndex];
2106 bgScanParams.ChannelInfo.numOfChannels = 1;
2107 bgScanParams.ChannelInfo.ChannelList = &channel;
2108
Srikant Kuppa866893f2012-12-27 17:28:14 -08002109 csrNeighborRoamFillNonChannelBgScanParams(pMac, &bgScanParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002110
Srikant Kuppa866893f2012-12-27 17:28:14 -08002111 status = csrNeighborRoamIssueBgScanRequest(pMac, &bgScanParams,
2112 csrNeighborRoamScanRequestCallback);
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 if (eHAL_STATUS_SUCCESS != status)
2114 {
2115 smsLog(pMac, LOGE, FL("Issue of BG Scan request failed: Status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07002116 }
2117
2118 pNeighborRoamInfo->roamChannelInfo.currentChanIndex++;
2119 if (pNeighborRoamInfo->roamChannelInfo.currentChanIndex >=
2120 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels)
2121 {
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05302122 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Completed scanning channels in Channel List: CurrChanIndex = %d, Num Channels = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002123 pNeighborRoamInfo->roamChannelInfo.currentChanIndex,
2124 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels);
2125 /* We have completed scanning all the channels */
2126 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
2127 /* We are no longer scanning the channel list. Next timer firing should be used to get the scan results
2128 and select the best AP in the list */
2129 if (eANI_BOOLEAN_TRUE == pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress)
2130 {
2131 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
2132 }
2133 }
2134
Gopichand Nakkalac7b1d3e2012-12-31 14:07:19 -08002135 if (eHAL_STATUS_SUCCESS != status)
2136 {
2137 /*
2138 * If the status is not success, we need to call the callback
2139 * routine so that the state machine does not get stuck.
2140 */
2141 csrNeighborRoamScanRequestCallback(pMac, NULL, 0, eCSR_SCAN_FAILURE);
2142 }
2143
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 return status;
2145}
2146
Srikant Kuppa866893f2012-12-27 17:28:14 -08002147#ifdef FEATURE_WLAN_LFR
2148eHalStatus csrNeighborRoamPerformContiguousBgScan(tpAniSirGlobal pMac)
2149{
2150 eHalStatus status = eHAL_STATUS_SUCCESS;
2151 tCsrBGScanRequest bgScanParams;
2152 int numOfChannels = 0, i = 0;
2153 tANI_U8 *channelList = NULL;
Srinivas Girigowdade697412013-02-14 16:31:48 -08002154 tANI_U8 *pInChannelList = NULL;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002155 tANI_U8 tmpChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
Srikant Kuppa866893f2012-12-27 17:28:14 -08002156
2157 palZeroMemory(pMac->hHdd, &bgScanParams, sizeof(tCsrBGScanRequest));
2158
2159 /* Contiguously scan all channels from valid list */
2160 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "%s: get valid channel list", __func__);
Srinivas Girigowdade697412013-02-14 16:31:48 -08002161
2162 if (NULL != pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.ChannelList)
Srikant Kuppa866893f2012-12-27 17:28:14 -08002163 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08002164 /* this list is filled only if the country code is set to KR */
2165 numOfChannels = pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels;
2166 pInChannelList = pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.ChannelList;
Srikant Kuppa866893f2012-12-27 17:28:14 -08002167 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08002168 else
2169 {
2170 numOfChannels = sizeof(pMac->roam.validChannelList);
2171
2172 if(!HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac,
2173 (tANI_U8 *)pMac->roam.validChannelList,
2174 (tANI_U32 *) &numOfChannels)))
2175 {
2176 smsLog(pMac, LOGE, FL("Could not get valid channel list"));
2177 return eHAL_STATUS_FAILURE;
2178 }
2179 pInChannelList = pMac->roam.validChannelList;
2180 }
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002181
2182 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
2183 {
2184 csrNeighborRoamChannelsFilterByCurrentBand(
2185 pMac,
2186 pInChannelList,
2187 numOfChannels,
2188 tmpChannelList,
2189 &numOfChannels);
2190 pInChannelList = tmpChannelList;
2191 }
2192
Srikant Kuppa866893f2012-12-27 17:28:14 -08002193 channelList = vos_mem_malloc( numOfChannels );
2194 if( NULL == channelList )
2195 {
2196 smsLog(pMac, LOGE, FL("could not allocate memory for channelList"));
2197 return eHAL_STATUS_FAILURE;
2198 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08002199 vos_mem_copy(channelList, (tANI_U8 *)pInChannelList,
Srikant Kuppa866893f2012-12-27 17:28:14 -08002200 numOfChannels * sizeof(tANI_U8));
2201
2202 bgScanParams.ChannelInfo.numOfChannels = numOfChannels;
2203 bgScanParams.ChannelInfo.ChannelList = channelList;
2204 for (i = 0; i < numOfChannels; i++)
2205 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002206 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "%s: valid channel list = %d",
Srikant Kuppa866893f2012-12-27 17:28:14 -08002207 __func__, bgScanParams.ChannelInfo.ChannelList[i]);
2208 }
2209 csrNeighborRoamFillNonChannelBgScanParams(pMac, &bgScanParams);
2210
2211 status = csrNeighborRoamIssueBgScanRequest(pMac, &bgScanParams,
2212 csrNeighborRoamContiguousScanRequestCallback);
2213
2214 vos_mem_free( channelList );
2215
2216 if (eHAL_STATUS_SUCCESS != status)
2217 {
2218 smsLog(pMac, LOGE, FL("Issue of BG Scan request failed: Status = %d"), status);
2219 }
2220
2221 return status;
2222}
2223#endif
2224
Jeff Johnson295189b2012-06-20 16:38:30 -07002225/* ---------------------------------------------------------------------------
2226
2227 \fn csrNeighborRoamNeighborScanTimerCallback
2228
2229 \brief This function is the neighbor scan timer callback function. It invokes
2230 the BG scan request based on the current and previous states
2231
2232 \param pv - CSR timer context info which includes pMac and session ID
2233
2234 \return VOID
2235
2236---------------------------------------------------------------------------*/
2237void csrNeighborRoamNeighborScanTimerCallback(void *pv)
2238{
2239 tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv;
2240 tpAniSirGlobal pMac = pInfo->pMac;
2241 tANI_U32 sessionId = pInfo->sessionId;
2242 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2243
2244 // check if bg scan is on going, no need to send down the new params if true
2245 if(eANI_BOOLEAN_TRUE == pNeighborRoamInfo->scanRspPending)
2246 {
2247 //msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002248 smsLog(pMac, LOGW, FL("Already BgScanRsp is Pending"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002249 return;
2250 }
2251
2252 VOS_ASSERT(sessionId == pNeighborRoamInfo->csrSessionId);
2253
2254 switch (pNeighborRoamInfo->neighborRoamState)
2255 {
2256#ifdef WLAN_FEATURE_VOWIFI_11R
2257 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2258 switch(pNeighborRoamInfo->prevNeighborRoamState)
2259 {
2260 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY:
2261 csrNeighborRoamPerformBgScan(pMac);
2262 break;
2263 default:
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002264 smsLog(pMac, LOGE, FL("Neighbor scan callback received in state %d, prev state = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002265 pNeighborRoamInfo->neighborRoamState, pNeighborRoamInfo->prevNeighborRoamState);
2266 break;
2267 }
2268 break;
2269#endif /* WLAN_FEATURE_VOWIFI_11R */
2270 case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:
2271 csrNeighborRoamPerformBgScan(pMac);
2272 break;
2273 default:
2274 break;
2275 }
2276 return;
2277}
2278
Srinivas Girigowdade697412013-02-14 16:31:48 -08002279void csrNeighborRoamEmptyScanRefreshTimerCallback(void *context)
2280{
2281 tCsrTimerInfo *pInfo = (tCsrTimerInfo *)context;
2282 tpAniSirGlobal pMac = pInfo->pMac;
2283 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
2284 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2285
2286 /* Reset all the variables just as no scan had happened before */
2287 csrNeighborRoamResetConnectedStateControlInfo(pMac);
2288
2289#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
2290 if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled))
2291 {
2292 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state"));
2293 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
2294 if (VOS_STATUS_SUCCESS != vosStatus)
2295 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002296 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Srinivas Girigowdade697412013-02-14 16:31:48 -08002297 return;
2298 }
2299 /* Increment the neighbor report retry count after sending the neighbor request successfully */
2300 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
2301 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
2302 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY)
2303 }
2304 else
2305#endif
2306 {
2307 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Non 11R or CCX Association:empty scan refresh timer expired"));
2308 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
2309 if (VOS_STATUS_SUCCESS != vosStatus)
2310 {
2311 return;
2312 }
2313 }
2314 return;
2315}
2316
Jeff Johnson295189b2012-06-20 16:38:30 -07002317/* ---------------------------------------------------------------------------
2318
2319 \fn csrNeighborRoamResultsRefreshTimerCallback
2320
2321 \brief This function is the timer callback function for results refresh timer.
2322 When this is invoked, it is as good as down event received from TL. So,
2323 clear off the roamable AP list and start the scan procedure based on 11R
2324 or non-11R association
2325
2326 \param context - CSR timer context info which includes pMac and session ID
2327
2328 \return VOID
2329
2330---------------------------------------------------------------------------*/
2331void csrNeighborRoamResultsRefreshTimerCallback(void *context)
2332{
2333 tCsrTimerInfo *pInfo = (tCsrTimerInfo *)context;
2334 tpAniSirGlobal pMac = pInfo->pMac;
2335 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
2336 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2337
2338 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
2339
2340 /* Deregister reassoc callback. Ignore return status */
2341 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
2342 WLANTL_HO_THRESHOLD_DOWN,
2343 csrNeighborRoamReassocIndCallback,
2344 VOS_MODULE_ID_SME);
2345
2346 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
2347 {
2348 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002349 smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002350 }
2351
2352 /* Reset all the variables just as no scan had happened before */
2353 csrNeighborRoamResetConnectedStateControlInfo(pMac);
2354
2355#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
2356 if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled))
2357 {
2358 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state"));
2359 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
2360 if (VOS_STATUS_SUCCESS != vosStatus)
2361 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002362 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002363 return;
2364 }
2365 /* Increment the neighbor report retry count after sending the neighbor request successfully */
2366 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
2367 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
2368 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY)
2369 }
2370 else
2371#endif
2372 {
Srikant Kuppa866893f2012-12-27 17:28:14 -08002373 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Non 11R or CCX Association:results refresh timer expired"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002374 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
2375 if (VOS_STATUS_SUCCESS != vosStatus)
2376 {
2377 return;
2378 }
2379 }
2380 return;
2381}
2382
2383#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
2384/* ---------------------------------------------------------------------------
2385
2386 \fn csrNeighborRoamIssueNeighborRptRequest
2387
2388 \brief This function is invoked when TL issues a down event and the current assoc
2389 is a 11R association. It invokes SME RRM API to issue the neighbor request to
2390 the currently associated AP with the current SSID
2391
2392 \param pMac - The handle returned by macOpen.
2393
2394 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2395
2396---------------------------------------------------------------------------*/
2397VOS_STATUS csrNeighborRoamIssueNeighborRptRequest(tpAniSirGlobal pMac)
2398{
2399 tRrmNeighborRspCallbackInfo callbackInfo;
2400 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2401 tRrmNeighborReq neighborReq;
2402
2403
2404 neighborReq.no_ssid = 0;
2405
2406 /* Fill in the SSID */
2407 neighborReq.ssid.length = pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length;
2408 vos_mem_copy(neighborReq.ssid.ssId, pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.ssId,
2409 pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length);
2410
2411 callbackInfo.neighborRspCallback = csrNeighborRoamRRMNeighborReportResult;
2412 callbackInfo.neighborRspCallbackContext = pMac;
2413 callbackInfo.timeout = pNeighborRoamInfo->FTRoamInfo.neighborReportTimeout;
2414
2415 return sme_NeighborReportRequest(pMac,(tANI_U8) pNeighborRoamInfo->csrSessionId, &neighborReq, &callbackInfo);
2416}
2417
2418/* ---------------------------------------------------------------------------
2419
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002420 \fn csrNeighborRoamChannelsFilterByCurrentBand
2421
2422 \brief This function is used to filter out the channels
2423 based on the currently associated AP channel
2424
2425 \param pMac - The handle returned by macOpen.
2426 \param pInputChannelList - The input channel list
2427 \param inputNumOfChannels - The number of channels in input channel list
2428 \param pOutputChannelList - The output channel list
2429 \param outputNumOfChannels - The number of channels in output channel list
2430 \param pMergedOutputNumOfChannels - The final number of channels in the output channel list.
2431
2432 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2433
2434---------------------------------------------------------------------------*/
2435
2436VOS_STATUS csrNeighborRoamChannelsFilterByCurrentBand(
2437 tpAniSirGlobal pMac,
2438 tANI_U8* pInputChannelList,
2439 int inputNumOfChannels,
2440 tANI_U8* pOutputChannelList,
2441 int* pMergedOutputNumOfChannels
2442 )
2443{
2444 int i = 0;
2445 int numChannels = 0;
2446 tANI_U8 currAPoperationChannel = pMac->roam.neighborRoamInfo.currAPoperationChannel;
2447 // Check for NULL pointer
2448 if (!pInputChannelList) return eHAL_STATUS_E_NULL_VALUE;
2449
2450 // Check for NULL pointer
2451 if (!pOutputChannelList) return eHAL_STATUS_E_NULL_VALUE;
2452
2453 for (i = 0; i < inputNumOfChannels; i++)
2454 {
2455 if (GetRFBand(currAPoperationChannel) == GetRFBand(pInputChannelList[i]))
2456 {
2457 pOutputChannelList[numChannels] = pInputChannelList[i];
2458 numChannels++;
2459 }
2460 }
2461
2462 // Return final number of channels
2463 *pMergedOutputNumOfChannels = numChannels;
2464
2465 return eHAL_STATUS_SUCCESS;
2466}
2467
2468/* ---------------------------------------------------------------------------
2469
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002470 \fn csrNeighborRoamMergeChannelLists
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002471
2472 \brief This function is used to merge two channel list.
2473 NB: If called with outputNumOfChannels == 0, this routines
2474 simply copies the input channel list to the output channel list.
2475
2476 \param pMac - The handle returned by macOpen.
2477 \param pInputChannelList - The addtional channels to merge in to the "merged" channels list.
2478 \param inputNumOfChannels - The number of additional channels.
2479 \param pOutputChannelList - The place to put the "merged" channel list.
2480 \param outputNumOfChannels - The original number of channels in the "merged" channels list.
2481 \param pMergedOutputNumOfChannels - The final number of channels in the "merged" channel list.
2482
2483 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2484
2485---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002486VOS_STATUS csrNeighborRoamMergeChannelLists(
2487 tpAniSirGlobal pMac,
2488 tANI_U8 *pInputChannelList,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002489 int inputNumOfChannels,
2490 tANI_U8 *pOutputChannelList,
2491 int outputNumOfChannels,
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002492 int *pMergedOutputNumOfChannels
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002493 )
2494{
2495 int i = 0;
2496 int j = 0;
2497 int numChannels = outputNumOfChannels;
2498
2499 // Check for NULL pointer
2500 if (!pInputChannelList) return eHAL_STATUS_E_NULL_VALUE;
2501
2502 // Check for NULL pointer
2503 if (!pOutputChannelList) return eHAL_STATUS_E_NULL_VALUE;
2504
2505 // Add the "new" channels in the input list to the end of the output list.
2506 for (i = 0; i < inputNumOfChannels; i++)
2507 {
2508 for (j = 0; j < outputNumOfChannels; j++)
2509 {
2510 if (pInputChannelList[i] == pOutputChannelList[j])
2511 break;
2512 }
2513 if (j == outputNumOfChannels)
2514 {
2515 if (pInputChannelList[i])
2516 {
Madan Mohan Koyyalamudif5c368b2012-12-06 13:10:13 -08002517 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002518 "%s: [INFOLOG] Adding extra %d to Neighbor channel list", __func__,
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002519 pInputChannelList[i]);
2520 pOutputChannelList[numChannels] = pInputChannelList[i];
2521 numChannels++;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002522 }
2523 }
2524 }
2525
2526 // Return final number of channels
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002527 *pMergedOutputNumOfChannels = numChannels;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002528
2529 return eHAL_STATUS_SUCCESS;
2530}
2531
2532/* ---------------------------------------------------------------------------
2533
Jeff Johnson295189b2012-06-20 16:38:30 -07002534 \fn csrNeighborRoamCreateChanListFromNeighborReport
2535
2536 \brief This function is invoked when neighbor report is received for the
2537 neighbor request. Based on the channels present in the neighbor report,
2538 it generates channel list which will be used in REPORT_SCAN state to
2539 scan for these neighbor APs
2540
2541 \param pMac - The handle returned by macOpen.
2542
2543 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2544
2545---------------------------------------------------------------------------*/
2546VOS_STATUS csrNeighborRoamCreateChanListFromNeighborReport(tpAniSirGlobal pMac)
2547{
2548 tpRrmNeighborReportDesc pNeighborBssDesc;
2549 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002550 tANI_U8 numChannels = 0, i = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002551 tANI_U8 channelList[MAX_BSS_IN_NEIGHBOR_RPT];
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002552#if 0
2553 eHalStatus status = eHAL_STATUS_SUCCESS;
2554#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002555
2556 /* This should always start from 0 whenever we create a channel list out of neighbor AP list */
2557 pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0;
2558
2559 pNeighborBssDesc = smeRrmGetFirstBssEntryFromNeighborCache(pMac);
2560
2561 while (pNeighborBssDesc)
2562 {
2563 if (pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport >= MAX_BSS_IN_NEIGHBOR_RPT) break;
2564
2565 /* Update the neighbor BSS Info in the 11r FT Roam Info */
2566 pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].channelNum =
2567 pNeighborBssDesc->pNeighborBssDescription->channel;
2568 pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].neighborScore =
2569 (tANI_U8)pNeighborBssDesc->roamScore;
2570 vos_mem_copy(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].neighborBssId,
2571 pNeighborBssDesc->pNeighborBssDescription->bssId, sizeof(tSirMacAddr));
2572 pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport++;
2573
2574 /* Saving the channel list non-redundantly */
2575 if (numChannels > 0)
2576 {
2577 for (i = 0; i < numChannels; i++)
2578 {
2579 if (pNeighborBssDesc->pNeighborBssDescription->channel == channelList[i])
2580 break;
2581 }
2582
2583 }
2584 if (i == numChannels)
2585 {
2586 if (pNeighborBssDesc->pNeighborBssDescription->channel)
2587 {
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002588 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
2589 {
2590 // Make sure to add only if its the same band
2591 if (GetRFBand(pNeighborRoamInfo->currAPoperationChannel) ==
2592 GetRFBand(pNeighborBssDesc->pNeighborBssDescription->channel))
2593 {
2594 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2595 "%s: [INFOLOG] Adding %d to Neighbor channel list (Same band)\n", __func__,
2596 pNeighborBssDesc->pNeighborBssDescription->channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07002597 channelList[numChannels] = pNeighborBssDesc->pNeighborBssDescription->channel;
2598 numChannels++;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002599 }
2600 }
2601 else
2602 {
2603 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2604 "%s: [INFOLOG] Adding %d to Neighbor channel list\n", __func__,
2605 pNeighborBssDesc->pNeighborBssDescription->channel);
2606 channelList[numChannels] = pNeighborBssDesc->pNeighborBssDescription->channel;
2607 numChannels++;
2608 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002609 }
2610 }
2611
2612 pNeighborBssDesc = smeRrmGetNextBssEntryFromNeighborCache(pMac, pNeighborBssDesc);
2613 }
2614
2615 if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
2616 {
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002617#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07002618 // Before we free the existing channel list for a safety net make sure
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002619 // we have a union of the IAPP and the already existing list.
2620 status = csrNeighborRoamMergeChannelLists(
2621 pMac,
2622 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList,
2623 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels,
2624 channelList,
2625 numChannels,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002626 &numChannels );
2627#endif
2628
Jeff Johnson295189b2012-06-20 16:38:30 -07002629 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
2630 }
2631
2632 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07002633 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002634 /* Store the obtained channel list to the Neighbor Control data structure */
2635 if (numChannels)
2636 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = vos_mem_malloc((numChannels) * sizeof(tANI_U8));
2637 if (NULL == pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
2638 {
2639 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed.. TL event ignored"));
2640 return VOS_STATUS_E_RESOURCES;
2641 }
2642
2643 vos_mem_copy(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList,
2644 channelList, (numChannels) * sizeof(tANI_U8));
2645 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = numChannels;
2646 if (numChannels)
2647 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002648 smsLog(pMac, LOG1, FL("IAPP Neighbor list callback received as expected in state %d."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002649 pNeighborRoamInfo->neighborRoamState);
2650 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_TRUE;
2651 }
2652 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
2653 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE;
2654
2655 return VOS_STATUS_SUCCESS;
2656}
2657
2658/* ---------------------------------------------------------------------------
2659
2660 \fn csrNeighborRoamRRMNeighborReportResult
2661
2662 \brief This function is the neighbor report callback that will be invoked by
2663 SME RRM on receiving a neighbor report or of neighbor report is not
2664 received after timeout. On receiving a valid report, it generates a
2665 channel list from the neighbor report and starts the
2666 neighbor scan timer
2667
2668 \param context - The handle returned by macOpen.
2669 vosStatus - Status of the callback(SUCCESS/FAILURE)
2670
2671 \return VOID
2672
2673---------------------------------------------------------------------------*/
2674void csrNeighborRoamRRMNeighborReportResult(void *context, VOS_STATUS vosStatus)
2675{
2676 tpAniSirGlobal pMac = PMAC_STRUCT(context);
2677 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2678 eHalStatus status = eHAL_STATUS_SUCCESS;
2679
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002680 smsLog(pMac, LOG1, FL("Neighbor report result callback with status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002681 switch (pNeighborRoamInfo->neighborRoamState)
2682 {
2683 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY:
2684 /* Reset the report pending variable */
2685 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE;
2686 if (VOS_STATUS_SUCCESS == vosStatus)
2687 {
2688 /* Need to create channel list based on the neighbor AP list and transition to REPORT_SCAN state */
2689 vosStatus = csrNeighborRoamCreateChanListFromNeighborReport(pMac);
2690 if (VOS_STATUS_SUCCESS == vosStatus)
2691 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002692 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Channel List created from Neighbor report, Transitioning to NEIGHBOR_SCAN state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002693 }
2694
2695 /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */
2696 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
2697
2698 /* Now ready for neighbor scan based on the channel list created */
2699 /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is
2700 what palTimerStart expects */
2701 status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer,
2702 pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT,
2703 eANI_BOOLEAN_FALSE);
2704 if (eHAL_STATUS_SUCCESS != status)
2705 {
2706 /* Timer start failed.. Should we ASSERT here??? */
2707 smsLog(pMac, LOGE, FL("PAL Timer start for neighbor scan timer failed, status = %d, Ignoring state transition"), status);
2708 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
2709 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07002710 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002711 return;
2712 }
2713 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
2714 /* Neighbor scan timer started. Transition to REPORT_SCAN state */
2715 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
2716 }
2717 else
2718 {
2719 /* Neighbor report timeout happened in SME RRM. We can try sending more neighbor requests until we
2720 reach the maxNeighborRetries or receiving a successful neighbor response */
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002721 smsLog(pMac, LOGE, FL("Neighbor report result failed after %d retries, MAX RETRIES = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002722 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum, pNeighborRoamInfo->cfgParams.maxNeighborRetries);
2723 if (pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum >=
2724 pNeighborRoamInfo->cfgParams.maxNeighborRetries)
2725 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002726 smsLog(pMac, LOGE, FL("Bailing out to CFG Channel list scan.. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002727 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
2728 if (VOS_STATUS_SUCCESS != vosStatus)
2729 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002730 smsLog(pMac, LOGE, FL("Transit to CFG Channel list scan state failed with status %d "), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002731 return;
2732 }
2733 /* We transitioned to different state now. Reset the Neighbor report retry count */
2734 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
2735 }
2736 else
2737 {
2738 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
2739 if (VOS_STATUS_SUCCESS != vosStatus)
2740 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002741 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002742 return;
2743 }
2744 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
2745 /* Increment the neighbor report retry count after sending the neighbor request successfully */
2746 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
2747 }
2748 }
2749 break;
2750 default:
2751 smsLog(pMac, LOGE, FL("Neighbor result callback not expected in state %d, Ignoring.."), pNeighborRoamInfo->neighborRoamState);
2752 break;
2753 }
2754 return;
2755}
2756#endif /* WLAN_FEATURE_VOWIFI_11R */
2757
2758
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002759#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002760tANI_BOOLEAN csrNeighborRoamIsSsidAndSecurityMatch(
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002761 tpAniSirGlobal pMac,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002762 tCsrRoamConnectedProfile *pCurProfile,
2763 tSirBssDescription *pBssDesc,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002764 tDot11fBeaconIEs *pIes)
2765{
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002766 tCsrAuthList authType;
2767 tCsrEncryptionList uCEncryptionType;
2768 tCsrEncryptionList mCEncryptionType;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002769 tANI_BOOLEAN fMatch = FALSE;
2770
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002771 authType.numEntries = 1;
2772 authType.authType[0] = pCurProfile->AuthType;
2773 uCEncryptionType.numEntries = 1;
2774 uCEncryptionType.encryptionType[0] = pCurProfile->EncryptionType;
2775 mCEncryptionType.numEntries = 1;
2776 mCEncryptionType.encryptionType[0] = pCurProfile->mcEncryptionType;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002777
2778 if( pIes )
2779 {
2780 if(pIes->SSID.present)
2781 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002782 fMatch = csrIsSsidMatch( pMac,
2783 (void *)pCurProfile->SSID.ssId, pCurProfile->SSID.length,
2784 pIes->SSID.ssid, pIes->SSID.num_ssid,
2785 eANI_BOOLEAN_TRUE );
2786 if(TRUE == fMatch)
2787 {
2788 fMatch = csrIsSecurityMatch( pMac, &authType, &uCEncryptionType,
2789 &mCEncryptionType, pBssDesc, pIes, NULL, NULL, NULL );
2790 return (fMatch);
2791 }
2792 else
2793 {
2794 return (fMatch);
2795 }
2796
2797 }
2798 else
2799 {
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002800 return FALSE; // Treat a missing SSID as a non-match.
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002801 }
2802 }
2803 else
2804 {
2805 return FALSE; // Again, treat missing pIes as a non-match.
2806 }
2807}
2808
2809tANI_BOOLEAN csrNeighborRoamIsNewConnectedProfile(
2810 tpAniSirGlobal pMac)
2811{
2812 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2813 tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId;
2814 tCsrRoamConnectedProfile *pCurrProfile = NULL;
2815 tCsrRoamConnectedProfile *pPrevProfile = NULL;
2816 tDot11fBeaconIEs *pIes = NULL;
2817 tSirBssDescription *pBssDesc = NULL;
2818 tANI_BOOLEAN fNew = TRUE;
2819
2820 if(!(pMac->roam.roamSession && CSR_IS_SESSION_VALID(pMac, sessionId)))
2821 {
2822 return (fNew);
2823 }
2824
2825 pCurrProfile = &pMac->roam.roamSession[sessionId].connectedProfile;
2826 if( !pCurrProfile )
2827 {
2828 return (fNew);
2829}
2830
2831 pPrevProfile = &pNeighborRoamInfo->prevConnProfile;
2832 if( !pPrevProfile )
2833 {
2834 return (fNew);
2835 }
2836
2837 pBssDesc = pPrevProfile->pBssDesc;
2838 if (pBssDesc)
2839 {
2840 if (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac,
2841 pBssDesc, &pIes)) &&
2842 csrNeighborRoamIsSsidAndSecurityMatch(pMac, pCurrProfile, pBssDesc, pIes))
2843 {
2844 fNew = FALSE;
2845 }
2846 if (pIes) {
2847 palFreeMemory(pMac->hHdd, pIes);
2848 }
2849 }
2850
2851 if (fNew)
2852 {
2853 smsLog(pMac, LOG1, FL("Prev roam profile did not match current"));
2854 csrRoamFreeConnectProfile(pMac, pPrevProfile);
2855 csrRoamGetConnectProfile(pMac, sessionId, pPrevProfile);
2856 }
2857 else
2858 {
2859 smsLog(pMac, LOG1, FL("Prev roam profile matches current"));
2860 }
2861
2862 return (fNew);
2863}
2864
2865tANI_BOOLEAN csrNeighborRoamConnectedProfileMatch(
2866 tpAniSirGlobal pMac,
2867 tCsrScanResult *pResult,
2868 tDot11fBeaconIEs *pIes)
2869{
2870 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2871 tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId;
2872 tCsrRoamConnectedProfile *pCurProfile = NULL;
2873 tSirBssDescription *pBssDesc = &pResult->Result.BssDescriptor;
2874
2875 if( !(pMac->roam.roamSession
2876 && CSR_IS_SESSION_VALID(pMac, sessionId)))
2877 {
2878 return FALSE;
2879 }
2880
2881 pCurProfile = &pMac->roam.roamSession[sessionId].connectedProfile;
2882
2883 if( !pCurProfile)
2884 {
2885 return FALSE;
2886 }
2887
2888 return csrNeighborRoamIsSsidAndSecurityMatch(pMac, pCurProfile, pBssDesc, pIes);
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002889}
2890
2891/* ---------------------------------------------------------------------------
2892
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002893 \fn csrNeighborRoamPrepareNonOccupiedChannelList
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002894
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002895 \brief This function is used to prepare a channel list that is derived from
2896 the list of valid channels and does not include those in the occupied
2897 list.
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002898
2899 \param pMac - The handle returned by macOpen.
2900 \param pInputChannelList - The default channels list.
2901 \param numOfChannels - The number of channels in the default channels list.
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002902 \param pOutputChannelList - The place to put the non-occupied channel list.
2903 \param pOutputNumOfChannels - The number of channels in the non-occupied channel list.
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002904
2905 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2906
2907---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002908VOS_STATUS csrNeighborRoamPrepareNonOccupiedChannelList(
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002909 tpAniSirGlobal pMac,
2910 tANI_U8 *pInputChannelList,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002911 int numOfChannels,
2912 tANI_U8 *pOutputChannelList,
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002913 int *pOutputNumOfChannels
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002914 )
2915{
2916 int i = 0;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002917 int outputNumOfChannels = 0; // Clear the output number of channels
2918 tANI_U8 numOccupiedChannels = pMac->scan.occupiedChannels.numChannels;
2919 tANI_U8 *pOccupiedChannelList = pMac->scan.occupiedChannels.channelList;
2920
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002921 for (i = 0; i < numOfChannels; i++)
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002922 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002923 if (!csrIsChannelPresentInList(pOccupiedChannelList, numOccupiedChannels,
2924 pInputChannelList[i]))
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002925 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002926 pOutputChannelList[outputNumOfChannels++] = pInputChannelList[i];
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002927 }
2928 }
2929
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002930 smsLog(pMac, LOG2, FL("Number of channels in the valid channel list=%d; "
2931 "Number of channels in the non-occupied list list=%d"),
2932 numOfChannels, outputNumOfChannels);
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002933
2934 // Return the number of channels
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002935 *pOutputNumOfChannels = outputNumOfChannels;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002936
2937 return eHAL_STATUS_SUCCESS;
2938}
2939#endif /* FEATURE_WLAN_LFR */
2940
Jeff Johnson295189b2012-06-20 16:38:30 -07002941/* ---------------------------------------------------------------------------
2942
2943 \fn csrNeighborRoamTransitToCFGChanScan
2944
2945 \brief This function is called whenever there is a transition to CFG chan scan
2946 state from any state. It frees up the current channel list and allocates
2947 a new memory for the channels received from CFG item. It then starts the
2948 neighbor scan timer to perform the scan on each channel one by one
2949
2950 \param pMac - The handle returned by macOpen.
2951
2952 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2953
2954---------------------------------------------------------------------------*/
2955VOS_STATUS csrNeighborRoamTransitToCFGChanScan(tpAniSirGlobal pMac)
2956{
2957 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2958 eHalStatus status = eHAL_STATUS_SUCCESS;
2959 int i = 0;
2960 int numOfChannels = 0;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002961 tANI_U8 channelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002962 tpCsrChannelInfo currChannelListInfo;
2963
2964 currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002965
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002966 if (
Jeff Johnson295189b2012-06-20 16:38:30 -07002967#ifdef FEATURE_WLAN_CCX
2968 ((pNeighborRoamInfo->isCCXAssoc) &&
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002969 (pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == eANI_BOOLEAN_FALSE)) ||
Jeff Johnson295189b2012-06-20 16:38:30 -07002970 (pNeighborRoamInfo->isCCXAssoc == eANI_BOOLEAN_FALSE) ||
2971#endif // CCX
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002972 currChannelListInfo->numOfChannels == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07002973 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002974 smsLog(pMac, LOGW, FL("Building channel list to scan"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002975
2976
2977 /* Free up the channel list and allocate a new memory. This is because we dont know how much
2978 was allocated last time. If we directly copy more number of bytes than allocated earlier, this might
2979 result in memory corruption */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002980 if (NULL != currChannelListInfo->ChannelList)
Jeff Johnson295189b2012-06-20 16:38:30 -07002981 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002982 vos_mem_free(currChannelListInfo->ChannelList);
2983 currChannelListInfo->ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07002984 currChannelListInfo->numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002985 }
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002986
2987 // Now obtain the contents for "channelList" (the "default valid channel list") from EITHER
2988 // the gNeighborScanChannelList in "cfg.ini", OR the actual "valid channel list" information formed by CSR.
2989 if (0 != pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels)
Jeff Johnson295189b2012-06-20 16:38:30 -07002990 {
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002991 // Copy the "default valid channel list" (channelList) from the gNeighborScanChannelList in "cfg.ini".
2992 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, "Using the channel list from cfg.ini");
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002993 status = csrNeighborRoamMergeChannelLists(
2994 pMac,
2995 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList,
2996 pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels,
2997 channelList,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002998 0, //NB: If 0, simply copy the input channel list to the output list.
2999 &numOfChannels );
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003000
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003001 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
3002 {
3003 csrNeighborRoamChannelsFilterByCurrentBand(
3004 pMac,
3005 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList,
3006 pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels,
3007 channelList,
3008 &numOfChannels);
3009 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003010
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003011 currChannelListInfo->ChannelList =
3012 vos_mem_malloc(numOfChannels*sizeof(tANI_U8));
3013 if (NULL == currChannelListInfo->ChannelList)
3014 {
3015 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed"));
3016 return VOS_STATUS_E_RESOURCES;
3017 }
3018
3019 vos_mem_copy(currChannelListInfo->ChannelList,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003020 channelList, numOfChannels * sizeof(tANI_U8));
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003021 }
Srikant Kuppa866893f2012-12-27 17:28:14 -08003022#ifdef FEATURE_WLAN_LFR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003023 else if ((pNeighborRoamInfo->uScanMode == DEFAULT_SCAN) &&
3024 (abs(pNeighborRoamInfo->lookupDOWNRssi) >
3025 abs(pNeighborRoamInfo->cfgParams.neighborReassocThreshold)))
Srikant Kuppa866893f2012-12-27 17:28:14 -08003026 {
3027 /*
3028 * Trigger a contiguous scan on all channels when the
3029 * RSSI in the lookup DOWN notification is below reassoc
3030 * threshold. This will help us find the best available
3031 * candidate and also update the channel cache.
3032 */
3033 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "Triggering contiguous scan "
3034 "(lookupDOWNRssi=%d,reassocThreshold=%d)",
3035 pNeighborRoamInfo->lookupDOWNRssi,
3036 pNeighborRoamInfo->cfgParams.neighborReassocThreshold*(-1));
3037
3038 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
3039
3040 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3041
3042 /* We are about to start a fresh scan cycle,
3043 * purge non-P2P results from the past */
3044 csrScanFlushSelectiveResult(pMac, VOS_FALSE);
3045
3046 csrNeighborRoamPerformContiguousBgScan(pMac);
3047
3048 /* Transition to CFG_CHAN_LIST_SCAN */
3049 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN);
3050
3051 return VOS_STATUS_SUCCESS;
3052 }
3053#endif
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003054 else
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003055 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003056 numOfChannels = pMac->scan.occupiedChannels.numChannels;
3057 if (numOfChannels
3058#ifdef FEATURE_WLAN_LFR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003059 && ((pNeighborRoamInfo->uScanMode == SPLIT_SCAN_OCCUPIED_LIST) ||
3060 (pNeighborRoamInfo->uEmptyScanCount == 0) ||
3061 ((pNeighborRoamInfo->uEmptyScanCount % 2) == 1))
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003062#endif
3063 )
Jeff Johnson295189b2012-06-20 16:38:30 -07003064 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003065 /*
3066 * Always scan channels in the occupied channel list
3067 * before scanning on the non-occupied list.
3068 */
Srinivas Girigowdade697412013-02-14 16:31:48 -08003069 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Switching to occupied channel list"
3070#ifdef FEATURE_WLAN_LFR
3071 "-uScanMode=%d, uEmptyScanCount=%d",
3072 pNeighborRoamInfo->uScanMode,
3073 pNeighborRoamInfo->uEmptyScanCount
3074#endif
3075 );
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003076 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
3077 {
3078 csrNeighborRoamChannelsFilterByCurrentBand(
3079 pMac,
3080 pMac->scan.occupiedChannels.channelList,
3081 numOfChannels,
3082 channelList,
3083 &numOfChannels);
3084 }
3085 else
3086 {
3087 vos_mem_copy(channelList,
3088 pMac->scan.occupiedChannels.channelList,
3089 numOfChannels * sizeof(tANI_U8));
3090 }
3091
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003092 VOS_ASSERT(currChannelListInfo->ChannelList == NULL);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003093 currChannelListInfo->ChannelList = vos_mem_malloc(numOfChannels * sizeof(tANI_U8));
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003094
3095 if (NULL == currChannelListInfo->ChannelList)
3096 {
3097 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed"));
3098 return VOS_STATUS_E_RESOURCES;
3099 }
3100 vos_mem_copy(currChannelListInfo->ChannelList,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003101 channelList,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003102 numOfChannels * sizeof(tANI_U8));
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003103 }
3104 else
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003105 {
3106 /* Scan all channels from non-occupied list */
3107 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Get valid channel list");
3108 numOfChannels = sizeof(pMac->roam.validChannelList);
3109
3110 if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac,
3111 (tANI_U8 *)pMac->roam.validChannelList,
3112 (tANI_U32 *) &numOfChannels)))
3113 {
3114#ifdef FEATURE_WLAN_LFR
3115 /*
3116 * Prepare non-occupied channel list (channelList)
3117 * from the actual "valid channel list" information
3118 * formed by CSR.
3119 */
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05303120 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, "Switching to non-occupied channel list");
Srinivas Girigowdade697412013-02-14 16:31:48 -08003121 status = csrNeighborRoamPrepareNonOccupiedChannelList(pMac,
3122 (tANI_U8 *)pMac->roam.validChannelList,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003123 numOfChannels,
3124 channelList,
3125 &numOfChannels);
3126#else
3127 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Merging channel list");
3128 status = csrNeighborRoamMergeChannelLists(
3129 pMac,
3130 (tANI_U8 *)pMac->roam.validChannelList,
3131 numOfChannels, // The number of channels in the validChannelList
3132 channelList,
3133 0, //NB: If 0, simply copy the input channel list to the output list.
3134 &numOfChannels ); // The final number of channels in the output list. Will be numOfChannels
3135#endif
3136 }
3137 else
3138 {
3139 smsLog(pMac, LOGE, FL("Could not get valid channel list"));
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003140 return VOS_STATUS_E_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003141 }
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003142
3143 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
3144 {
3145 csrNeighborRoamChannelsFilterByCurrentBand(
3146 pMac,
3147 (tANI_U8 *)pMac->roam.validChannelList,
3148 numOfChannels,
3149 channelList,
3150 &numOfChannels);
3151 }
3152
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003153 currChannelListInfo->ChannelList =
3154 vos_mem_malloc(numOfChannels*sizeof(tANI_U8));
3155
3156 if (NULL == currChannelListInfo->ChannelList)
3157 {
3158 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed"));
3159 return VOS_STATUS_E_RESOURCES;
3160 }
3161#ifdef FEATURE_WLAN_LFR
3162 vos_mem_copy(currChannelListInfo->ChannelList,
3163 channelList, numOfChannels * sizeof(tANI_U8));
3164#else
3165 vos_mem_copy(currChannelListInfo->ChannelList,
3166 (tANI_U8 *)pMac->roam.validChannelList,
3167 numOfChannels * sizeof(tANI_U8));
3168#endif
3169 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003170 }
3171
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003172 /* Adjust for the actual number that are used */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003173 currChannelListInfo->numOfChannels = numOfChannels;
Srikant Kuppa866893f2012-12-27 17:28:14 -08003174 NEIGHBOR_ROAM_DEBUG(pMac, LOGW,
3175 "Number of channels from CFG (or) (non-)occupied list=%d",
3176 currChannelListInfo->numOfChannels);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003177 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07003178 {
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05303179 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "Channel List from CFG (or) (non-)occupied list"
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003180 "= %d", currChannelListInfo->ChannelList[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003181 }
3182 }
3183
3184 /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */
3185 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
3186
3187 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3188 /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is
3189 what palTimerStart expects */
3190 status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer,
3191 pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT,
3192 eANI_BOOLEAN_FALSE);
3193
3194 if (eHAL_STATUS_SUCCESS != status)
3195 {
3196 /* Timer start failed.. */
3197 smsLog(pMac, LOGE, FL("Neighbor scan PAL Timer start failed, status = %d, Ignoring state transition"), status);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003198 vos_mem_free(currChannelListInfo->ChannelList);
3199 currChannelListInfo->ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07003200 currChannelListInfo->numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003201 return VOS_STATUS_E_FAILURE;
3202 }
3203
3204 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
3205 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE;
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05303206 /* We are about to start a fresh scan cycle,
3207 * purge non-P2P results from the past */
3208 csrScanFlushSelectiveResult(pMac, VOS_FALSE);
James Zmuda5ba36d02013-03-14 17:39:07 -07003209
3210 /* We are about to start a fresh scan cycle,
3211 * purge failed pre-auth results from the past */
3212 csrNeighborRoamPurgePreauthFailedList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003213
3214 /* Transition to CFG_CHAN_LIST_SCAN_STATE */
3215 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN)
3216
3217 return VOS_STATUS_SUCCESS;
3218}
3219
3220/* ---------------------------------------------------------------------------
3221
3222 \fn csrNeighborRoamNeighborLookupUpEvent
3223
3224 \brief This function is called as soon as TL indicates that the current AP's
3225 RSSI is better than the neighbor lookup threshold. Here, we transition to
3226 CONNECTED state and reset all the scan parameters
3227
3228 \param pMac - The handle returned by macOpen.
3229
3230 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3231
3232---------------------------------------------------------------------------*/
3233VOS_STATUS csrNeighborRoamNeighborLookupUpEvent(tpAniSirGlobal pMac)
3234{
3235 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3236 VOS_STATUS vosStatus;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07003237 csrNeighborRoamDeregAllRssiIndication(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003238
Jeff Johnson295189b2012-06-20 16:38:30 -07003239 /* Recheck whether the below check is needed. */
3240 if (pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)
3241 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)
Jeff Johnsone7245742012-09-05 17:12:55 -07003242
3243 /* Reset all the neighbor roam info control variables. Free all the allocated memory. It is like we are just associated now */
3244 csrNeighborRoamResetConnectedStateControlInfo(pMac);
3245
Jeff Johnson295189b2012-06-20 16:38:30 -07003246
3247 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event neighbor lookup callback with TL. RSSI = %d,"), pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
3248 /* Register Neighbor Lookup threshold callback with TL for DOWN event now */
3249 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
3250 WLANTL_HO_THRESHOLD_DOWN,
3251 csrNeighborRoamNeighborLookupDOWNCallback,
3252 VOS_MODULE_ID_SME, pMac);
Srikant Kuppa866893f2012-12-27 17:28:14 -08003253#ifdef FEATURE_WLAN_LFR
3254 pNeighborRoamInfo->lookupDOWNRssi = 0;
3255#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003256 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
3257 {
3258 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003259 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback DOWN event with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003260 }
3261
3262
3263 return vosStatus;
3264}
3265
3266/* ---------------------------------------------------------------------------
3267
3268 \fn csrNeighborRoamNeighborLookupDownEvent
3269
3270 \brief This function is called as soon as TL indicates that the current AP's
3271 RSSI falls below the current eighbor lookup threshold. Here, we transition to
3272 REPORT_QUERY for 11r association and CFG_CHAN_LIST_SCAN state if the assoc is
3273 a non-11R association.
3274
3275 \param pMac - The handle returned by macOpen.
3276
3277 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3278
3279---------------------------------------------------------------------------*/
3280VOS_STATUS csrNeighborRoamNeighborLookupDownEvent(tpAniSirGlobal pMac)
3281{
3282 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3283 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
3284 eHalStatus status = eHAL_STATUS_SUCCESS;
3285
3286 switch (pNeighborRoamInfo->neighborRoamState)
3287 {
3288 case eCSR_NEIGHBOR_ROAM_STATE_CONNECTED:
3289
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003290 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event neighbor lookup callback with TL. RSSI = %d,"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003291 pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
3292 /* De-register Neighbor Lookup threshold callback with TL */
3293 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
3294 WLANTL_HO_THRESHOLD_DOWN,
3295 csrNeighborRoamNeighborLookupDOWNCallback,
3296 VOS_MODULE_ID_SME);
3297
3298 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
3299 {
3300 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003301 smsLog(pMac, LOGW, FL(" Couldn't Deregister csrNeighborRoamNeighborLookupCallback DOWN event from TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003302 }
3303
3304
3305#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
3306 if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled))
3307 {
3308
3309 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state"));
3310 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
3311 if (VOS_STATUS_SUCCESS != vosStatus)
3312 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003313 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003314 return vosStatus;
3315 }
3316 /* Increment the neighbor report retry count after sending the neighbor request successfully */
3317 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
3318 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
3319 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY)
3320 }
3321 else
3322#endif
3323 {
3324 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Non 11R or CCX Association:Neighbor Lookup Down event received in CONNECTED state"));
3325
3326 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
3327 if (VOS_STATUS_SUCCESS != vosStatus)
3328 {
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08003329 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("csrNeighborRoamTransitToCFGChanScan failed"
3330 " with status=%d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003331 return vosStatus;
3332 }
3333 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003334 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering UP event neighbor lookup callback with TL. RSSI = %d,"), NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1));
Jeff Johnson295189b2012-06-20 16:38:30 -07003335 /* Register Neighbor Lookup threshold callback with TL for UP event now */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003336 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext,
3337 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
Jeff Johnson295189b2012-06-20 16:38:30 -07003338 WLANTL_HO_THRESHOLD_UP,
3339 csrNeighborRoamNeighborLookupUPCallback,
3340 VOS_MODULE_ID_SME, pMac);
3341 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
3342 {
3343 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003344 smsLog(pMac, LOGE, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback UP event with TL: Status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 }
3346 break;
3347 default:
3348 smsLog(pMac, LOGE, FL("DOWN event received in invalid state %d..Ignoring..."), pNeighborRoamInfo->neighborRoamState);
3349 break;
3350
3351 }
3352 return vosStatus;
3353}
3354
3355/* ---------------------------------------------------------------------------
3356
3357 \fn csrNeighborRoamNeighborLookupUPCallback
3358
3359 \brief This function is registered with TL to indicate whenever the RSSI
3360 gets better than the neighborLookup RSSI Threshold
3361
3362 \param pAdapter - VOS Context
3363 trafficStatus - UP/DOWN indication from TL
3364 pUserCtxt - Parameter for callback registered during callback registration. Should be pMac
3365
3366 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3367
3368---------------------------------------------------------------------------*/
3369VOS_STATUS csrNeighborRoamNeighborLookupUPCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
Srinivasdaaec712012-12-12 15:59:44 -08003370 v_PVOID_t pUserCtxt,
3371 v_S7_t avgRssi)
Jeff Johnson295189b2012-06-20 16:38:30 -07003372{
3373 tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt );
3374 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3375 VOS_STATUS vosStatus = eHAL_STATUS_SUCCESS;
3376
Srinivasdaaec712012-12-12 15:59:44 -08003377 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Neighbor Lookup UP indication callback called with notification %d Reported RSSI = %d"),
3378 rssiNotification,
3379 avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -07003380
3381 if(!csrIsConnStateConnectedInfra(pMac, pNeighborRoamInfo->csrSessionId))
3382 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003383 smsLog(pMac, LOGW, "Ignoring the indication as we are not connected");
Jeff Johnson295189b2012-06-20 16:38:30 -07003384 return VOS_STATUS_SUCCESS;
3385 }
3386
3387 VOS_ASSERT(WLANTL_HO_THRESHOLD_UP == rssiNotification);
3388 vosStatus = csrNeighborRoamNeighborLookupUpEvent(pMac);
3389 return vosStatus;
3390}
3391
3392/* ---------------------------------------------------------------------------
3393
3394 \fn csrNeighborRoamNeighborLookupDOWNCallback
3395
3396 \brief This function is registered with TL to indicate whenever the RSSI
3397 falls below the current neighborLookup RSSI Threshold
3398
3399 \param pAdapter - VOS Context
3400 trafficStatus - UP/DOWN indication from TL
3401 pUserCtxt - Parameter for callback registered during callback registration. Should be pMac
3402
3403 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3404
3405---------------------------------------------------------------------------*/
3406VOS_STATUS csrNeighborRoamNeighborLookupDOWNCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
Srinivasdaaec712012-12-12 15:59:44 -08003407 v_PVOID_t pUserCtxt,
3408 v_S7_t avgRssi)
Jeff Johnson295189b2012-06-20 16:38:30 -07003409{
3410 tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt );
3411 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3412 VOS_STATUS vosStatus = eHAL_STATUS_SUCCESS;
3413
Srinivasdaaec712012-12-12 15:59:44 -08003414 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Neighbor Lookup DOWN indication callback called with notification %d Reported RSSI = %d"),
3415 rssiNotification,
3416 avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -07003417
Srikant Kuppa866893f2012-12-27 17:28:14 -08003418#ifdef FEATURE_WLAN_LFR
3419 pNeighborRoamInfo->lookupDOWNRssi = avgRssi;
3420#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003421 if(!csrIsConnStateConnectedInfra(pMac, pNeighborRoamInfo->csrSessionId))
3422 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003423 smsLog(pMac, LOGW, "Ignoring the indication as we are not connected");
Jeff Johnson295189b2012-06-20 16:38:30 -07003424 return VOS_STATUS_SUCCESS;
3425 }
3426
3427 VOS_ASSERT(WLANTL_HO_THRESHOLD_DOWN == rssiNotification);
3428 vosStatus = csrNeighborRoamNeighborLookupDownEvent(pMac);
3429
3430 return vosStatus;
3431}
3432
3433#ifdef RSSI_HACK
3434extern int dumpCmdRSSI;
3435#endif
3436
3437/* ---------------------------------------------------------------------------
3438
3439 \fn csrNeighborRoamIndicateDisconnect
3440
3441 \brief This function is called by CSR as soon as the station disconnects from
3442 the AP. This function does the necessary cleanup of neighbor roam data
3443 structures. Neighbor roam state transitions to INIT state whenever this
3444 function is called except if the current state is REASSOCIATING
3445
3446 \param pMac - The handle returned by macOpen.
3447 sessionId - CSR session id that got disconnected
3448
3449 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
3450
3451---------------------------------------------------------------------------*/
3452eHalStatus csrNeighborRoamIndicateDisconnect(tpAniSirGlobal pMac, tANI_U8 sessionId)
3453{
3454 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3455
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003456 smsLog(pMac, LOGE, FL("Disconnect indication on session %d in state %d (sub-state %d)"),
Madan Mohan Koyyalamudi5ad3dff2012-10-21 11:32:02 -07003457 sessionId, pNeighborRoamInfo->neighborRoamState,
3458 pMac->roam.curSubState[sessionId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003459
3460#ifdef FEATURE_WLAN_CCX
3461 {
3462 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId);
3463 if (pSession->connectedProfile.isCCXAssoc)
3464 {
3465 vos_mem_copy(&pSession->prevApSSID, &pSession->connectedProfile.SSID, sizeof(tSirMacSSid));
3466 vos_mem_copy(pSession->prevApBssid, pSession->connectedProfile.bssid, sizeof(tSirMacAddr));
3467 pSession->prevOpChannel = pSession->connectedProfile.operationChannel;
3468 pSession->isPrevApInfoValid = TRUE;
3469 pSession->roamTS1 = vos_timer_get_system_time();
3470
3471 }
3472 }
3473#endif
3474
3475#ifdef RSSI_HACK
3476 dumpCmdRSSI = -40;
3477#endif
3478 switch (pNeighborRoamInfo->neighborRoamState)
3479 {
3480 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
3481 // Stop scan and neighbor refresh timers.
3482 // These are indeed not required when we are in reassociating
3483 // state.
3484 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3485 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -08003486 palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Madan Mohan Koyyalamudi5ad3dff2012-10-21 11:32:02 -07003487 if (!CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId )) {
3488 /*
3489 * Disconnect indication during Disassoc Handoff sub-state
3490 * is received when we are trying to disconnect with the old
3491 * AP during roam. BUT, if receive a disconnect indication
3492 * outside of Disassoc Handoff sub-state, then it means that
3493 * this is a genuine disconnect and we need to clean up.
3494 * Otherwise, we will be stuck in reassoc state which will
3495 * in-turn block scans (see csrIsScanAllowed).
3496 */
3497 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT);
3498 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003499 break;
3500
3501 case eCSR_NEIGHBOR_ROAM_STATE_INIT:
Jeff Johnson295189b2012-06-20 16:38:30 -07003502 csrNeighborRoamResetInitStateControlInfo(pMac);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07003503 csrNeighborRoamDeregAllRssiIndication(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003504 break;
3505
Srikant Kuppa866893f2012-12-27 17:28:14 -08003506 case eCSR_NEIGHBOR_ROAM_STATE_CONNECTED:
3507 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
3508 csrNeighborRoamResetConnectedStateControlInfo(pMac);
3509 csrNeighborRoamDeregAllRssiIndication(pMac);
3510 break;
3511
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07003512 case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:
3513 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT);
3514 csrNeighborRoamResetCfgListChanScanControlInfo(pMac);
3515 csrNeighborRoamDeregAllRssiIndication(pMac);
3516 break;
3517
3518 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
3519 /* Stop pre-auth to reassoc interval timer */
3520 palTimerStop(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer);
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07003521 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
3522 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
3523 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07003524 csrNeighborRoamResetPreauthControlInfo(pMac);
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07003525 csrNeighborRoamResetReportScanStateControlInfo(pMac);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07003526 csrNeighborRoamDeregAllRssiIndication(pMac);
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07003527 break;
3528
Jeff Johnson295189b2012-06-20 16:38:30 -07003529 default:
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07003530 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Received disconnect event in state %d"), pNeighborRoamInfo->neighborRoamState);
3531 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Transitioning to INIT state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003532 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07003533 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003534 }
3535 return eHAL_STATUS_SUCCESS;
3536}
3537
3538/* ---------------------------------------------------------------------------
3539
3540 \fn csrNeighborRoamIndicateConnect
3541
3542 \brief This function is called by CSR as soon as the station connects to an AP.
3543 This initializes all the necessary data structures related to the
3544 associated AP and transitions the state to CONNECTED state
3545
3546 \param pMac - The handle returned by macOpen.
3547 sessionId - CSR session id that got connected
3548 vosStatus - connect status SUCCESS/FAILURE
3549
3550 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
3551
3552---------------------------------------------------------------------------*/
3553eHalStatus csrNeighborRoamIndicateConnect(tpAniSirGlobal pMac, tANI_U8 sessionId, VOS_STATUS vosStatus)
3554{
3555 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3556 eHalStatus status = eHAL_STATUS_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07003557 VOS_STATUS vstatus;
3558
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003559#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003560 int init_ft_flag = FALSE;
3561#endif
3562
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07003563 smsLog(pMac, LOG2, FL("Connect indication received with session id %d in state %d"), sessionId, pNeighborRoamInfo->neighborRoamState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003564
3565 switch (pNeighborRoamInfo->neighborRoamState)
3566 {
3567 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
3568 if (VOS_STATUS_SUCCESS != vosStatus)
3569 {
3570 /* Just transition the state to INIT state. Rest of the clean up happens when we get next connect indication */
3571 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
3572 break;
3573 }
3574 /* Fall through if the status is SUCCESS */
3575 case eCSR_NEIGHBOR_ROAM_STATE_INIT:
3576 /* Reset all the data structures here */
3577 csrNeighborRoamResetInitStateControlInfo(pMac);
3578
Jeff Johnson295189b2012-06-20 16:38:30 -07003579 pNeighborRoamInfo->csrSessionId = sessionId;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003580
3581#ifdef FEATURE_WLAN_LFR
3582 /*
3583 * Initialize the occupied list ONLY if we are
3584 * transitioning from INIT state to CONNECTED state.
3585 */
3586 if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
3587 csrInitOccupiedChannelsList(pMac);
3588#endif
3589 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED);
3590
Jeff Johnson295189b2012-06-20 16:38:30 -07003591 vos_mem_copy(pNeighborRoamInfo->currAPbssid,
3592 pMac->roam.roamSession[sessionId].connectedProfile.bssid, sizeof(tCsrBssid));
3593 pNeighborRoamInfo->currAPoperationChannel = pMac->roam.roamSession[sessionId].connectedProfile.operationChannel;
3594 pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
3595 pNeighborRoamInfo->neighborScanTimerInfo.sessionId = sessionId;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003596 pNeighborRoamInfo->currentNeighborLookupThreshold =
3597 pNeighborRoamInfo->cfgParams.neighborLookupThreshold;
3598#ifdef FEATURE_WLAN_LFR
3599 pNeighborRoamInfo->uEmptyScanCount = 0;
Srikant Kuppa866893f2012-12-27 17:28:14 -08003600 pNeighborRoamInfo->lookupDOWNRssi = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08003601 pNeighborRoamInfo->uScanMode = DEFAULT_SCAN;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003602#endif
3603
Jeff Johnson295189b2012-06-20 16:38:30 -07003604
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003605#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003606 /* Now we can clear the preauthDone that was saved as we are connected afresh */
3607 csrNeighborRoamFreeRoamableBSSList(pMac, &pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
3608#endif
3609
3610#ifdef WLAN_FEATURE_VOWIFI_11R
3611 // Based on the auth scheme tell if we are 11r
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003612 if ( csrIsAuthType11r( pMac->roam.roamSession[sessionId].connectedProfile.AuthType,
3613 pMac->roam.roamSession[sessionId].connectedProfile.MDID.mdiePresent))
Jeff Johnson295189b2012-06-20 16:38:30 -07003614 {
3615 if (pMac->roam.configParam.isFastTransitionEnabled)
3616 init_ft_flag = TRUE;
3617 pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_TRUE;
3618 }
3619 else
3620 pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07003621 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("11rAssoc is = %d"), pNeighborRoamInfo->is11rAssoc);
Jeff Johnson295189b2012-06-20 16:38:30 -07003622#endif
3623
3624#ifdef FEATURE_WLAN_CCX
3625 // Based on the auth scheme tell if we are 11r
3626 if (pMac->roam.roamSession[sessionId].connectedProfile.isCCXAssoc)
3627 {
3628 if (pMac->roam.configParam.isFastTransitionEnabled)
3629 init_ft_flag = TRUE;
3630 pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_TRUE;
3631 }
3632 else
3633 pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07003634 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("isCCXAssoc is = %d ft = %d"),
3635 pNeighborRoamInfo->isCCXAssoc, init_ft_flag);
Jeff Johnson295189b2012-06-20 16:38:30 -07003636
3637#endif
3638
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003639#ifdef FEATURE_WLAN_LFR
3640 // If "Legacy Fast Roaming" is enabled
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05303641 if (csrRoamIsFastRoamEnabled(pMac, sessionId))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003642 {
3643 init_ft_flag = TRUE;
3644 }
3645#endif
3646
3647#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003648 if ( init_ft_flag == TRUE )
3649 {
3650 /* Initialize all the data structures needed for the 11r FT Preauth */
Jeff Johnson295189b2012-06-20 16:38:30 -07003651 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
3652 csrNeighborRoamPurgePreauthFailedList(pMac);
3653
3654 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"), pNeighborRoamInfo->currentNeighborLookupThreshold);
3655 /* Register Neighbor Lookup threshold callback with TL for DOWN event only */
Jeff Johnson43971f52012-07-17 12:26:56 -07003656 vstatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
Jeff Johnson295189b2012-06-20 16:38:30 -07003657 WLANTL_HO_THRESHOLD_DOWN,
3658 csrNeighborRoamNeighborLookupDOWNCallback,
3659 VOS_MODULE_ID_SME, pMac);
Srikant Kuppa866893f2012-12-27 17:28:14 -08003660#ifdef FEATURE_WLAN_LFR
3661 pNeighborRoamInfo->lookupDOWNRssi = 0;
3662#endif
Jeff Johnson43971f52012-07-17 12:26:56 -07003663 if(!VOS_IS_STATUS_SUCCESS(vstatus))
Jeff Johnson295189b2012-06-20 16:38:30 -07003664 {
3665 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003666 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d"), vstatus);
Jeff Johnson43971f52012-07-17 12:26:56 -07003667 status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003668 }
3669 }
3670#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003671 break;
3672 default:
3673 smsLog(pMac, LOGE, FL("Connect event received in invalid state %d..Ignoring..."), pNeighborRoamInfo->neighborRoamState);
3674 break;
3675 }
3676 return status;
3677}
3678
3679
3680#ifdef WLAN_FEATURE_VOWIFI_11R
3681/* ---------------------------------------------------------------------------
3682
Jeff Johnson295189b2012-06-20 16:38:30 -07003683 \fn csrNeighborRoamPurgePreauthFailedList
3684
3685 \brief This function purges all the MAC addresses in the pre-auth fail list
3686
3687 \param pMac - The handle returned by macOpen.
3688
3689 \return VOID
3690
3691---------------------------------------------------------------------------*/
3692void csrNeighborRoamPurgePreauthFailedList(tpAniSirGlobal pMac)
3693{
3694 tANI_U8 i;
3695
3696 for (i = 0; i < pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.numMACAddress; i++)
3697 {
3698 vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.macAddress[i], sizeof(tSirMacAddr));
3699 }
3700 pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.numMACAddress = 0;
3701
3702 return;
3703}
3704
3705/* ---------------------------------------------------------------------------
3706
3707 \fn csrNeighborRoamInit11rAssocInfo
3708
3709 \brief This function initializes 11r related neighbor roam data structures
3710
3711 \param pMac - The handle returned by macOpen.
3712
3713 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
3714
3715---------------------------------------------------------------------------*/
3716eHalStatus csrNeighborRoamInit11rAssocInfo(tpAniSirGlobal pMac)
3717{
3718 eHalStatus status;
3719 tpCsr11rAssocNeighborInfo pFTRoamInfo = &pMac->roam.neighborRoamInfo.FTRoamInfo;
3720
3721 pMac->roam.neighborRoamInfo.is11rAssoc = eANI_BOOLEAN_FALSE;
3722 pMac->roam.neighborRoamInfo.cfgParams.maxNeighborRetries = pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries;
3723 pFTRoamInfo->neighborReportTimeout = CSR_NEIGHBOR_ROAM_REPORT_QUERY_TIMEOUT;
3724 pFTRoamInfo->PEPreauthRespTimeout = CSR_NEIGHBOR_ROAM_PREAUTH_RSP_WAIT_MULTIPLIER * pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
3725 pFTRoamInfo->neighborRptPending = eANI_BOOLEAN_FALSE;
3726 pFTRoamInfo->preauthRspPending = eANI_BOOLEAN_FALSE;
3727
Jeff Johnson295189b2012-06-20 16:38:30 -07003728 pMac->roam.neighborRoamInfo.FTRoamInfo.currentNeighborRptRetryNum = 0;
3729 pMac->roam.neighborRoamInfo.FTRoamInfo.numBssFromNeighborReport = 0;
3730 vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.neighboReportBssInfo,
3731 sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
3732
3733
3734 status = csrLLOpen(pMac->hHdd, &pFTRoamInfo->preAuthDoneList);
3735 if (eHAL_STATUS_SUCCESS != status)
3736 {
3737 smsLog(pMac, LOGE, FL("LL Open of preauth done AP List failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003738 return eHAL_STATUS_RESOURCES;
3739 }
3740 return status;
3741}
3742#endif /* WLAN_FEATURE_VOWIFI_11R */
3743
3744/* ---------------------------------------------------------------------------
3745
3746 \fn csrNeighborRoamInit
3747
3748 \brief This function initializes neighbor roam data structures
3749
3750 \param pMac - The handle returned by macOpen.
3751
3752 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
3753
3754---------------------------------------------------------------------------*/
3755eHalStatus csrNeighborRoamInit(tpAniSirGlobal pMac)
3756{
3757 eHalStatus status;
3758 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3759
3760 pNeighborRoamInfo->neighborRoamState = eCSR_NEIGHBOR_ROAM_STATE_CLOSED;
3761 pNeighborRoamInfo->prevNeighborRoamState = eCSR_NEIGHBOR_ROAM_STATE_CLOSED;
3762 pNeighborRoamInfo->csrSessionId = CSR_SESSION_ID_INVALID;
3763 pNeighborRoamInfo->cfgParams.maxChannelScanTime = pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime;
3764 pNeighborRoamInfo->cfgParams.minChannelScanTime = pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime;
3765 pNeighborRoamInfo->cfgParams.maxNeighborRetries = 0;
3766 pNeighborRoamInfo->cfgParams.neighborLookupThreshold = pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
3767 pNeighborRoamInfo->cfgParams.neighborReassocThreshold = pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold;
3768 pNeighborRoamInfo->cfgParams.neighborScanPeriod = pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod;
3769 pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod = pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
Srinivas Girigowdade697412013-02-14 16:31:48 -08003770 pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod = pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
3771
3772#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
3773 pNeighborRoamInfo->cfgParams.countryChannelInfo.revision = SME_KR_25;
3774 pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.ChannelList = NULL;
3775 pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels = 0;
3776
3777 if (0 == strncmp(pMac->scan.countryCodeCurrent, "KR", 2))
3778 {
3779 csrInitCountryValidChannelList(pMac, SME_KR_25);
3780 }
3781#endif
3782
3783 pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels =
Jeff Johnson295189b2012-06-20 16:38:30 -07003784 pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels;
3785
Srinivas Girigowdade697412013-02-14 16:31:48 -08003786 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList =
Jeff Johnson295189b2012-06-20 16:38:30 -07003787 vos_mem_malloc(pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels);
3788
3789 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
3790 {
3791 smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed"));
3792 return eHAL_STATUS_RESOURCES;
3793 }
3794
3795 /* Update the roam global structure from CFG */
Srinivas Girigowdade697412013-02-14 16:31:48 -08003796 palCopyMemory(pMac->hHdd, pNeighborRoamInfo->cfgParams.channelInfo.ChannelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07003797 pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList,
3798 pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels);
3799
3800 vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0);
3801 pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003802#ifdef FEATURE_WLAN_LFR
Srikant Kuppa866893f2012-12-27 17:28:14 -08003803 pNeighborRoamInfo->lookupDOWNRssi = 0;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003804 pNeighborRoamInfo->uEmptyScanCount = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08003805 pNeighborRoamInfo->uScanMode = DEFAULT_SCAN;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003806 palZeroMemory(pMac->hHdd, &pNeighborRoamInfo->prevConnProfile,
3807 sizeof(tCsrRoamConnectedProfile));
3808#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003809 pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE;
3810
3811 pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
3812 pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
3813 status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->neighborScanTimer,
3814 csrNeighborRoamNeighborScanTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
3815
3816 if (eHAL_STATUS_SUCCESS != status)
3817 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08003818 smsLog(pMac, LOGE, FL("Neighbor scan timer allocation failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003819 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
3820 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
3821 return eHAL_STATUS_RESOURCES;
3822 }
3823
3824 status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->neighborResultsRefreshTimer,
3825 csrNeighborRoamResultsRefreshTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
3826
3827 if (eHAL_STATUS_SUCCESS != status)
3828 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08003829 smsLog(pMac, LOGE, FL("Neighbor results refresh timer allocation failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003830 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
3831 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
3832 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3833 return eHAL_STATUS_RESOURCES;
3834 }
3835
Srinivas Girigowdade697412013-02-14 16:31:48 -08003836 status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->emptyScanRefreshTimer,
3837 csrNeighborRoamEmptyScanRefreshTimerCallback,
3838 (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
3839
3840 if (eHAL_STATUS_SUCCESS != status)
3841 {
3842 smsLog(pMac, LOGE, FL("Empty scan refresh timer allocation failed"));
3843 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
3844 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
3845 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3846 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
3847 return eHAL_STATUS_RESOURCES;
3848 }
3849
Jeff Johnson295189b2012-06-20 16:38:30 -07003850 status = csrLLOpen(pMac->hHdd, &pNeighborRoamInfo->roamableAPList);
3851 if (eHAL_STATUS_SUCCESS != status)
3852 {
3853 smsLog(pMac, LOGE, FL("LL Open of roamable AP List failed"));
3854 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
3855 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
3856 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3857 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -08003858 palTimerFree(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07003859 return eHAL_STATUS_RESOURCES;
3860 }
3861
3862 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX;
3863 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
3864 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
3865 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
3866 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
3867
3868#ifdef WLAN_FEATURE_VOWIFI_11R
3869 status = csrNeighborRoamInit11rAssocInfo(pMac);
3870 if (eHAL_STATUS_SUCCESS != status)
3871 {
3872 smsLog(pMac, LOGE, FL("LL Open of roamable AP List failed"));
3873 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
3874 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
3875 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3876 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -08003877 palTimerFree(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07003878 csrLLClose(&pNeighborRoamInfo->roamableAPList);
3879 return eHAL_STATUS_RESOURCES;
3880 }
3881#endif
3882 /* Initialize this with the current tick count */
3883 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
3884
3885 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
3886
3887 return eHAL_STATUS_SUCCESS;
3888}
3889
3890/* ---------------------------------------------------------------------------
3891
3892 \fn csrNeighborRoamClose
3893
3894 \brief This function closes/frees all the neighbor roam data structures
3895
3896 \param pMac - The handle returned by macOpen.
3897
3898 \return VOID
3899
3900---------------------------------------------------------------------------*/
3901void csrNeighborRoamClose(tpAniSirGlobal pMac)
3902{
3903 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3904
3905 if (eCSR_NEIGHBOR_ROAM_STATE_CLOSED == pNeighborRoamInfo->neighborRoamState)
3906 {
Madan Mohan Koyyalamudi8b7f1e62012-10-05 14:56:51 -07003907 smsLog(pMac, LOGW, FL("Neighbor Roam Algorithm Already Closed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003908 return;
3909 }
3910
3911 if (pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
3912 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
3913
3914 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
3915
3916 pNeighborRoamInfo->neighborScanTimerInfo.pMac = NULL;
3917 pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
3918 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3919 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -08003920 palTimerFree(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07003921
3922 /* Should free up the nodes in the list before closing the double Linked list */
3923 csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList);
3924 csrLLClose(&pNeighborRoamInfo->roamableAPList);
3925
3926 if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
3927 {
3928 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
3929 }
3930
3931 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
3932 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX;
3933 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
3934 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
3935 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
3936 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
3937
3938 /* Free the profile.. */
3939 csrReleaseProfile(pMac, &pNeighborRoamInfo->csrNeighborRoamProfile);
Sandeep Pc4818ef2012-12-13 14:19:25 -08003940#ifdef FEATURE_WLAN_LFR
Sandeep Pc2b00f62012-12-12 16:44:44 -08003941 csrRoamFreeConnectProfile(pMac, &pNeighborRoamInfo->prevConnProfile);
Sandeep Pc4818ef2012-12-13 14:19:25 -08003942#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003943#ifdef WLAN_FEATURE_VOWIFI_11R
3944 pMac->roam.neighborRoamInfo.FTRoamInfo.currentNeighborRptRetryNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003945 pMac->roam.neighborRoamInfo.FTRoamInfo.numBssFromNeighborReport = 0;
3946 vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.neighboReportBssInfo,
3947 sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
3948 csrNeighborRoamFreeRoamableBSSList(pMac, &pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
3949 csrLLClose(&pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
3950#endif /* WLAN_FEATURE_VOWIFI_11R */
3951
3952 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CLOSED)
3953
3954 return;
3955}
3956
3957/* ---------------------------------------------------------------------------
3958
3959 \fn csrNeighborRoamRequestHandoff
3960
3961 \brief This function triggers actual switching from one AP to the new AP.
3962 It issues disassociate with reason code as Handoff and CSR as a part of
3963 handling disassoc rsp, issues reassociate to the new AP
3964
3965 \param pMac - The handle returned by macOpen.
3966
3967 \return VOID
3968
3969---------------------------------------------------------------------------*/
3970void csrNeighborRoamRequestHandoff(tpAniSirGlobal pMac)
3971{
3972
3973 tCsrRoamInfo roamInfo;
3974 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3975 tANI_U32 sessionId = pNeighborRoamInfo->csrSessionId;
3976 tCsrNeighborRoamBSSInfo handoffNode;
3977 extern void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeDisassocRsp );
3978 tANI_U32 roamId = 0;
3979
3980 if (pMac->roam.neighborRoamInfo.neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE)
3981 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003982 smsLog(pMac, LOGE, FL("Roam requested when Neighbor roam is in %d state"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003983 pMac->roam.neighborRoamInfo.neighborRoamState);
3984 return;
3985 }
3986
3987 vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo));
3988 csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId, &roamInfo, roamId, eCSR_ROAM_FT_START,
3989 eSIR_SME_SUCCESS);
3990
3991 vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo));
3992 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING)
3993
3994 csrNeighborRoamGetHandoffAPInfo(pMac, &handoffNode);
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08003995 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
3996 FL("HANDOFF CANDIDATE BSSID %02x:%02x:%02x:%02x:%02x:%02x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003997 handoffNode.pBssDescription->bssId[0],
3998 handoffNode.pBssDescription->bssId[1],
3999 handoffNode.pBssDescription->bssId[2],
4000 handoffNode.pBssDescription->bssId[3],
4001 handoffNode.pBssDescription->bssId[4],
4002 handoffNode.pBssDescription->bssId[5]);
4003
4004 /* Free the profile.. Just to make sure we dont leak memory here */
4005 csrReleaseProfile(pMac, &pNeighborRoamInfo->csrNeighborRoamProfile);
4006 /* Create the Handoff AP profile. Copy the currently connected profile and update only the BSSID and channel number
4007 This should happen before issuing disconnect */
4008 csrRoamCopyConnectedProfile(pMac, pNeighborRoamInfo->csrSessionId, &pNeighborRoamInfo->csrNeighborRoamProfile);
4009 vos_mem_copy(pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, handoffNode.pBssDescription->bssId, sizeof(tSirMacAddr));
4010 pNeighborRoamInfo->csrNeighborRoamProfile.ChannelInfo.ChannelList[0] = handoffNode.pBssDescription->channelId;
4011
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004012 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, " csrRoamHandoffRequested: disassociating with current AP");
Jeff Johnson295189b2012-06-20 16:38:30 -07004013
4014 if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_HANDOFF)))
4015 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004016 smsLog(pMac, LOGW, "csrRoamHandoffRequested: fail to issue disassociate");
Jeff Johnson295189b2012-06-20 16:38:30 -07004017 return;
4018 }
4019
4020 //notify HDD for handoff, providing the BSSID too
4021 roamInfo.reasonCode = eCsrRoamReasonBetterAP;
4022
4023 vos_mem_copy(roamInfo.bssid,
4024 handoffNode.pBssDescription->bssId,
4025 sizeof( tCsrBssid ));
4026
4027 csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE);
4028
4029
4030 return;
4031}
4032
4033/* ---------------------------------------------------------------------------
4034
4035 \fn csrNeighborRoamIsHandoffInProgress
4036
4037 \brief This function returns whether handoff is in progress or not based on
4038 the current neighbor roam state
4039
4040 \param pMac - The handle returned by macOpen.
4041 is11rReassoc - Return whether reassoc is of type 802.11r reassoc
4042
4043 \return eANI_BOOLEAN_TRUE if reassoc in progress, eANI_BOOLEAN_FALSE otherwise
4044
4045---------------------------------------------------------------------------*/
4046tANI_BOOLEAN csrNeighborRoamIsHandoffInProgress(tpAniSirGlobal pMac)
4047{
4048 if (eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING == pMac->roam.neighborRoamInfo.neighborRoamState)
4049 return eANI_BOOLEAN_TRUE;
4050
4051 return eANI_BOOLEAN_FALSE;
4052}
4053
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08004054#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(WLAN_FEATURE_NEIGHBOR_ROAMING)
Jeff Johnson295189b2012-06-20 16:38:30 -07004055/* ---------------------------------------------------------------------------
4056
4057 \fn csrNeighborRoamIs11rAssoc
4058
4059 \brief This function returns whether the current association is a 11r assoc or not
4060
4061 \param pMac - The handle returned by macOpen.
4062
4063 \return eANI_BOOLEAN_TRUE if current assoc is 11r, eANI_BOOLEAN_FALSE otherwise
4064
4065---------------------------------------------------------------------------*/
4066tANI_BOOLEAN csrNeighborRoamIs11rAssoc(tpAniSirGlobal pMac)
4067{
4068 return pMac->roam.neighborRoamInfo.is11rAssoc;
4069}
4070#endif /* WLAN_FEATURE_VOWIFI_11R */
4071
4072
4073/* ---------------------------------------------------------------------------
4074
4075 \fn csrNeighborRoamGetHandoffAPInfo
4076
4077 \brief This function returns the best possible AP for handoff. For 11R case, it
4078 returns the 1st entry from pre-auth done list. For non-11r case, it returns
4079 the 1st entry from roamable AP list
4080
4081 \param pMac - The handle returned by macOpen.
4082 pHandoffNode - AP node that is the handoff candidate returned
4083
4084 \return VOID
4085
4086---------------------------------------------------------------------------*/
4087void csrNeighborRoamGetHandoffAPInfo(tpAniSirGlobal pMac, tpCsrNeighborRoamBSSInfo pHandoffNode)
4088{
4089 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4090 tpCsrNeighborRoamBSSInfo pBssNode;
4091
4092 VOS_ASSERT(NULL != pHandoffNode);
4093
4094#ifdef WLAN_FEATURE_VOWIFI_11R
4095 if (pNeighborRoamInfo->is11rAssoc)
4096 {
4097 /* Always the BSS info in the head is the handoff candidate */
4098 pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL);
4099 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList));
4100 }
4101 else
4102#endif
4103#ifdef FEATURE_WLAN_CCX
4104 if (pNeighborRoamInfo->isCCXAssoc)
4105 {
4106 /* Always the BSS info in the head is the handoff candidate */
4107 pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL);
4108 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList));
4109 }
4110 else
4111#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004112#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05304113 if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004114 {
4115 /* Always the BSS info in the head is the handoff candidate */
4116 pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL);
4117 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList));
4118 }
4119 else
4120#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004121 {
4122 pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL);
4123 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->roamableAPList));
4124 }
4125 vos_mem_copy(pHandoffNode, pBssNode, sizeof(tCsrNeighborRoamBSSInfo));
4126
4127 return;
4128}
4129
4130/* ---------------------------------------------------------------------------
4131 \brief This function returns TRUE if preauth is completed
4132
4133 \param pMac - The handle returned by macOpen.
4134
4135 \return boolean
4136
4137---------------------------------------------------------------------------*/
4138tANI_BOOLEAN csrNeighborRoamStatePreauthDone(tpAniSirGlobal pMac)
4139{
4140 return (pMac->roam.neighborRoamInfo.neighborRoamState ==
4141 eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE);
4142}
4143
4144/* ---------------------------------------------------------------------------
4145 \brief In the event that we are associated with AP1 and we have
4146 completed pre auth with AP2. Then we receive a deauth/disassoc from
4147 AP1.
4148 At this point neighbor roam is in pre auth done state, pre auth timer
4149 is running. We now handle this case by stopping timer and clearing
4150 the pre-auth state. We basically clear up and just go to disconnected
4151 state.
4152
4153 \param pMac - The handle returned by macOpen.
4154
4155 \return boolean
4156---------------------------------------------------------------------------*/
4157void csrNeighborRoamTranistionPreauthDoneToDisconnected(tpAniSirGlobal pMac)
4158{
4159 if (pMac->roam.neighborRoamInfo.neighborRoamState !=
4160 eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE) return;
4161
4162 // Stop timer
4163 palTimerStop(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer);
4164
4165 // Transition to init state
4166 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
4167}
4168
Srikant Kuppafef66a72013-01-30 17:32:44 -08004169/* ---------------------------------------------------------------------------
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08004170 \brief This function returns TRUE if background scan triggered by
4171 LFR is in progress.
Srikant Kuppafef66a72013-01-30 17:32:44 -08004172
4173 \param halHandle - The handle from HDD context.
4174
4175 \return boolean
4176
4177---------------------------------------------------------------------------*/
4178tANI_BOOLEAN csrNeighborRoamScanRspPending (tHalHandle hHal)
4179{
4180 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4181 return (pMac->roam.neighborRoamInfo.scanRspPending);
4182}
4183
Srinivas Girigowdaa553c462013-03-07 19:42:52 -08004184/* ---------------------------------------------------------------------------
4185 \brief This function returns TRUE if STA is in the middle of roaming states
4186
4187 \param halHandle - The handle from HDD context.
4188
4189 \return boolean
4190
4191---------------------------------------------------------------------------*/
4192tANI_BOOLEAN csrNeighborMiddleOfRoaming (tHalHandle hHal)
4193{
4194 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4195 tANI_BOOLEAN val = (eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4196 (eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4197 (eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4198 (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4199 (eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN == pMac->roam.neighborRoamInfo.neighborRoamState);
4200 return (val);
4201}
4202
Jeff Johnson295189b2012-06-20 16:38:30 -07004203#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */