blob: 140a05680347b40b126268aa57636d3ccd138ae5 [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
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05301131 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Filtering from scan results for"
1132 "SSID = 0x%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx\nSSID Length = %d"),
1133 pScanFilter->SSIDs.SSIDList->SSID.ssId[0],
1134 pScanFilter->SSIDs.SSIDList->SSID.ssId[4],
1135 pScanFilter->SSIDs.SSIDList->SSID.ssId[8],
1136 pScanFilter->SSIDs.SSIDList->SSID.ssId[12],
1137 pScanFilter->SSIDs.SSIDList->SSID.ssId[16],
1138 pScanFilter->SSIDs.SSIDList->SSID.ssId[20],
1139 pScanFilter->SSIDs.SSIDList->SSID.ssId[24],
1140 pScanFilter->SSIDs.SSIDList->SSID.ssId[28],
1141 pScanFilter->SSIDs.SSIDList->SSID.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001142 pScanFilter->authType.numEntries = 1;
1143 pScanFilter->authType.authType[0] = pCurProfile->AuthType;
1144
1145 pScanFilter->EncryptionType.numEntries = 1; //This must be 1
1146 pScanFilter->EncryptionType.encryptionType[0] = pCurProfile->EncryptionType;
1147
1148 pScanFilter->mcEncryptionType.numEntries = 1;
1149 pScanFilter->mcEncryptionType.encryptionType[0] = pCurProfile->mcEncryptionType;
1150
1151 pScanFilter->BSSType = pCurProfile->BSSType;
1152
1153 /* We are intrested only in the scan results on channels that we scanned */
1154 pScanFilter->ChannelInfo.numOfChannels = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels;
1155 pScanFilter->ChannelInfo.ChannelList = vos_mem_malloc(pScanFilter->ChannelInfo.numOfChannels * sizeof(tANI_U8));
1156 if (NULL == pScanFilter->ChannelInfo.ChannelList)
1157 {
1158 smsLog(pMac, LOGE, FL("Scan Filter Channel list mem alloc failed"));
1159 vos_mem_free(pScanFilter->SSIDs.SSIDList);
1160 pScanFilter->SSIDs.SSIDList = NULL;
1161 return eHAL_STATUS_FAILED_ALLOC;
1162 }
1163 for (i = 0; i < pScanFilter->ChannelInfo.numOfChannels; i++)
1164 {
1165 pScanFilter->ChannelInfo.ChannelList[i] = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i];
1166 }
1167
1168#ifdef WLAN_FEATURE_VOWIFI_11R
1169 if (pNeighborRoamInfo->is11rAssoc)
1170 {
1171 /* MDIE should be added as a part of profile. This should be added as a part of filter as well */
1172 pScanFilter->MDID.mdiePresent = pCurProfile->MDID.mdiePresent;
1173 pScanFilter->MDID.mobilityDomain = pCurProfile->MDID.mobilityDomain;
1174 }
1175#endif
1176
1177 return eHAL_STATUS_SUCCESS;
1178}
1179
Jeff Johnson43971f52012-07-17 12:26:56 -07001180tANI_U32 csrGetCurrentAPRssi(tpAniSirGlobal pMac, tScanResultHandle *pScanResultList)
1181{
1182 tCsrScanResultInfo *pScanResult;
1183 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda2efea0e2013-01-24 17:40:41 -08001184#ifdef FEATURE_WLAN_LFR
1185 tANI_U32 CurrAPRssi = pNeighborRoamInfo->lookupDOWNRssi;
1186#else
1187 /* We are setting this as default value to make sure we return this value,
1188 when we do not see this AP in the scan result for some reason.However,it is
1189 less likely that we are associated to an AP and do not see it in the scan list */
1190 tANI_U32 CurrAPRssi = -125;
1191#endif
Jeff Johnson43971f52012-07-17 12:26:56 -07001192
1193 while (NULL != (pScanResult = csrScanResultGetNext(pMac, *pScanResultList)))
1194 {
1195
1196 if (VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId,
1197 pNeighborRoamInfo->currAPbssid, sizeof(tSirMacAddr)))
1198 {
1199 /* We got a match with the currently associated AP.
1200 * Capture the RSSI value and complete the while loop.
1201 * The while loop is completed in order to make the current entry go back to NULL,
1202 * and in the next while loop, it properly starts searching from the head of the list.
1203 * TODO: Can also try setting the current entry directly to NULL as soon as we find the new AP*/
1204
1205 CurrAPRssi = (int)pScanResult->BssDescriptor.rssi * (-1) ;
1206
1207 } else {
1208 continue;
1209 }
1210 }
1211
1212 return CurrAPRssi;
1213
1214}
1215
Jeff Johnson295189b2012-06-20 16:38:30 -07001216/* ---------------------------------------------------------------------------
1217
1218 \fn csrNeighborRoamProcessScanResults
1219
1220 \brief This function extracts scan results, sorts on the basis of neighbor score(todo).
1221 Assumed that the results are already sorted by RSSI by csrScanGetResult
1222
1223 \param pMac - The handle returned by macOpen.
1224 pScanResultList - Scan result result obtained from csrScanGetResult()
1225
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001226 \return tANI_BOOLEAN - return TRUE if we have a candidate we can immediately
1227 roam to. Otherwise, return FALSE.
Jeff Johnson295189b2012-06-20 16:38:30 -07001228
1229---------------------------------------------------------------------------*/
1230
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001231static tANI_BOOLEAN csrNeighborRoamProcessScanResults(tpAniSirGlobal pMac,
1232 tScanResultHandle *pScanResultList)
Jeff Johnson295189b2012-06-20 16:38:30 -07001233{
1234 tCsrScanResultInfo *pScanResult;
1235 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1236 tpCsrNeighborRoamBSSInfo pBssInfo;
Jeff Johnson43971f52012-07-17 12:26:56 -07001237 tANI_U32 CurrAPRssi;
1238 tANI_U8 RoamRssiDiff = pMac->roam.configParam.RoamRssiDiff;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001239#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
1240 tANI_U8 immediateRoamRssiDiff = pMac->roam.configParam.nImmediateRoamRssiDiff;
1241#endif
1242 tANI_BOOLEAN roamNow = eANI_BOOLEAN_FALSE;
Jeff Johnson43971f52012-07-17 12:26:56 -07001243
1244 /***************************************************************
1245 * Find out the Current AP RSSI and keep it handy to check if
1246 * it is better than the RSSI of the AP which we are
1247 * going to roam.If so, we are going to continue with the
1248 * current AP.
1249 ***************************************************************/
1250 CurrAPRssi = csrGetCurrentAPRssi(pMac, pScanResultList);
Jeff Johnson295189b2012-06-20 16:38:30 -07001251
1252 /* Expecting the scan result already to be in the sorted order based on the RSSI */
1253 /* Based on the previous state we need to check whether the list should be sorted again taking neighbor score into consideration */
1254 /* If previous state is CFG_CHAN_LIST_SCAN, there should not be any neighbor score associated with any of the BSS.
1255 If the previous state is REPORT_QUERY, then there will be neighbor score for each of the APs */
1256 /* 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
1257 and rssi score are in the same order. This will be taken care later */
1258
1259 while (NULL != (pScanResult = csrScanResultGetNext(pMac, *pScanResultList)))
1260 {
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001261 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
1262 FL("Scan result: BSSID %02x:%02x:%02x:%02x:%02x:%02x (Rssi %d, Ch:%d)"),
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001263 pScanResult->BssDescriptor.bssId[0],
1264 pScanResult->BssDescriptor.bssId[1],
1265 pScanResult->BssDescriptor.bssId[2],
1266 pScanResult->BssDescriptor.bssId[3],
1267 pScanResult->BssDescriptor.bssId[4],
1268 pScanResult->BssDescriptor.bssId[5],
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001269 abs(pScanResult->BssDescriptor.rssi),
1270 pScanResult->BssDescriptor.channelId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001271
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001272 if (VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001273 pNeighborRoamInfo->currAPbssid, sizeof(tSirMacAddr)))
1274 {
Jeff Johnson43971f52012-07-17 12:26:56 -07001275 /* currently associated AP. Do not have this in the roamable AP list */
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001276 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001277 "SKIP-currently associated AP");
Jeff Johnson295189b2012-06-20 16:38:30 -07001278 continue;
1279 }
1280
Jeff Johnson43971f52012-07-17 12:26:56 -07001281 /* This condition is to ensure to roam to an AP with better RSSI. if the value of RoamRssiDiff is Zero, this feature
1282 * is disabled and we continue to roam without any check*/
1283 if(RoamRssiDiff > 0)
1284 {
Madan Mohan Koyyalamudif553b742012-12-03 16:37:39 -08001285 /*
1286 * If RSSI is lower than the lookup threshold, then continue.
1287 */
1288 if (abs(pScanResult->BssDescriptor.rssi) >
1289 pNeighborRoamInfo->currentNeighborLookupThreshold)
1290 {
1291 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001292 "%s: [INFOLOG] new ap rssi (%d) lower than lookup threshold (%d)",
Madan Mohan Koyyalamudif553b742012-12-03 16:37:39 -08001293 __func__, (int)pScanResult->BssDescriptor.rssi * (-1),
1294 (int)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
1295 continue;
1296 }
1297
Jeff Johnson43971f52012-07-17 12:26:56 -07001298 if (abs(CurrAPRssi) < abs(pScanResult->BssDescriptor.rssi))
1299 {
1300 /*Do not roam to an AP with worse RSSI than the current*/
1301 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001302 "%s: [INFOLOG]Current AP rssi=%d new ap rssi worse=%d", __func__,
Jeff Johnson43971f52012-07-17 12:26:56 -07001303 CurrAPRssi,
1304 (int)pScanResult->BssDescriptor.rssi * (-1) );
1305 continue;
1306 } else {
1307 /*Do not roam to an AP which is having better RSSI than the current AP, but still less than the
1308 * margin that is provided by user from the ini file (RoamRssiDiff)*/
1309 if (abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)) < RoamRssiDiff)
1310 {
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001311 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001312 "%s: [INFOLOG]Current AP rssi=%d new ap rssi=%d not good enough, roamRssiDiff=%d", __func__,
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001313 CurrAPRssi,
1314 (int)pScanResult->BssDescriptor.rssi * (-1),
1315 RoamRssiDiff);
Jeff Johnson43971f52012-07-17 12:26:56 -07001316 continue;
1317 }
1318 else {
1319 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001320 "%s: [INFOLOG]Current AP rssi=%d new ap rssi better=%d", __func__,
Jeff Johnson43971f52012-07-17 12:26:56 -07001321 CurrAPRssi,
1322 (int)pScanResult->BssDescriptor.rssi * (-1) );
1323 }
1324 }
1325 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001326
1327#ifdef WLAN_FEATURE_VOWIFI_11R
1328 if (pNeighborRoamInfo->is11rAssoc)
1329 {
1330 if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId))
1331 {
1332 smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring"));
1333 continue;
1334 }
1335 }
1336#endif /* WLAN_FEATURE_VOWIFI_11R */
1337
1338#ifdef FEATURE_WLAN_CCX
1339 if (pNeighborRoamInfo->isCCXAssoc)
1340 {
1341 if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId))
1342 {
1343 smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring"));
1344 continue;
1345 }
1346 }
1347 if ((pScanResult->BssDescriptor.QBSSLoad_present) &&
1348 (pScanResult->BssDescriptor.QBSSLoad_avail))
1349 {
1350 if (pNeighborRoamInfo->isVOAdmitted)
1351 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001352 smsLog(pMac, LOG1, FL("New AP has %x BW available"), (unsigned int)pScanResult->BssDescriptor.QBSSLoad_avail);
1353 smsLog(pMac, LOG1, FL("We need %x BW available"),(unsigned int)pNeighborRoamInfo->MinQBssLoadRequired);
Jeff Johnson295189b2012-06-20 16:38:30 -07001354 if (pScanResult->BssDescriptor.QBSSLoad_avail < pNeighborRoamInfo->MinQBssLoadRequired)
1355 {
1356 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001357 "[INFOLOG]BSSID : %02x:%02x:%02x:%02x:%02x:%02x has no bandwidth ignoring..not adding to roam list",
Jeff Johnson295189b2012-06-20 16:38:30 -07001358 pScanResult->BssDescriptor.bssId[0],
1359 pScanResult->BssDescriptor.bssId[1],
1360 pScanResult->BssDescriptor.bssId[2],
1361 pScanResult->BssDescriptor.bssId[3],
1362 pScanResult->BssDescriptor.bssId[4],
1363 pScanResult->BssDescriptor.bssId[5]);
1364 continue;
1365 }
1366 }
1367 }
1368 else
1369 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001370 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 -07001371 if (pNeighborRoamInfo->isVOAdmitted)
1372 {
1373 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001374 "[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 -07001375 pScanResult->BssDescriptor.bssId[0],
1376 pScanResult->BssDescriptor.bssId[1],
1377 pScanResult->BssDescriptor.bssId[2],
1378 pScanResult->BssDescriptor.bssId[3],
1379 pScanResult->BssDescriptor.bssId[4],
1380 pScanResult->BssDescriptor.bssId[5]);
1381 continue;
1382 }
1383 }
1384#endif /* FEATURE_WLAN_CCX */
1385
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001386#ifdef FEATURE_WLAN_LFR
1387 // If we are supporting legacy roaming, and
1388 // if the candidate is on the "pre-auth failed" list, ignore it.
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05301389 if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001390 {
1391 if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId))
1392 {
1393 smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring"));
1394 continue;
1395 }
1396 }
1397#endif /* FEATURE_WLAN_LFR */
1398
Jeff Johnson295189b2012-06-20 16:38:30 -07001399 /* If the received timestamp in BSS description is earlier than the scan request timestamp, skip
1400 * this result */
1401 if (pNeighborRoamInfo->scanRequestTimeStamp >= pScanResult->BssDescriptor.nReceivedTime)
1402 {
1403 smsLog(pMac, LOGE, FL("Ignoring BSS as it is older than the scan request timestamp"));
1404 continue;
1405 }
1406
1407 pBssInfo = vos_mem_malloc(sizeof(tCsrNeighborRoamBSSInfo));
1408 if (NULL == pBssInfo)
1409 {
1410 smsLog(pMac, LOGE, FL("Memory allocation for Neighbor Roam BSS Info failed.. Just ignoring"));
1411 continue;
1412 }
1413
1414 pBssInfo->pBssDescription = vos_mem_malloc(pScanResult->BssDescriptor.length + sizeof(pScanResult->BssDescriptor.length));
1415 if (pBssInfo->pBssDescription != NULL)
1416 {
1417 vos_mem_copy(pBssInfo->pBssDescription, &pScanResult->BssDescriptor,
1418 pScanResult->BssDescriptor.length + sizeof(pScanResult->BssDescriptor.length));
1419 }
1420 else
1421 {
1422 smsLog(pMac, LOGE, FL("Memory allocation for Neighbor Roam BSS Descriptor failed.. Just ignoring"));
1423 vos_mem_free(pBssInfo);
1424 continue;
1425
1426 }
1427 pBssInfo->apPreferenceVal = 10; //some value for now. Need to calculate the actual score based on RSSI and neighbor AP score
1428
1429 /* Just add to the end of the list as it is already sorted by RSSI */
1430 csrLLInsertTail(&pNeighborRoamInfo->roamableAPList, &pBssInfo->List, LL_ACCESS_LOCK);
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001431
1432#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Srikant Kuppa866893f2012-12-27 17:28:14 -08001433 if (abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)) >= immediateRoamRssiDiff)
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001434 {
1435 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
1436 "%s: [INFOLOG] potential candidate to roam immediately (diff=%d, expected=%d)",
1437 __func__, abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)),
1438 immediateRoamRssiDiff);
1439 roamNow = eANI_BOOLEAN_TRUE;
1440 }
1441#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001442 }
1443
1444 /* 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 */
1445 csrScanResultPurge(pMac, *pScanResultList);
1446
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001447 return roamNow;
Jeff Johnson295189b2012-06-20 16:38:30 -07001448}
1449
1450/* ---------------------------------------------------------------------------
1451
1452 \fn csrNeighborRoamHandleEmptyScanResult
1453
1454 \brief This function will be invoked in CFG_CHAN_LIST_SCAN state when
1455 there are no valid APs in the scan result for roaming. This means
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001456 our AP is the best and no other AP is around. No point in scanning
Jeff Johnson295189b2012-06-20 16:38:30 -07001457 again and again. Performing the following here.
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001458 1. Stop the neighbor scan timer.
1459 2a. If this is the first time we encountered empty scan, then
1460 re-register with TL with modified lookup threshold.
1461 2b. Else if this is the second time we encountered empty scan,
1462 then start neighbor scan results refresh timer (20s).
1463 2c. Else, nothing more to do.
1464 NOTE: In LFR, channels selected for scanning is dervied from
1465 the occuped channel list. Scan cycle following one which
1466 yielded empty results is split into two halves: (i) scan on
1467 channels in the occupied list, and (ii) scan on channels not
1468 in the occupied list. This helps converging faster (while
1469 looking for candidates in the occupied list first), and also,
1470 adds channels to the occupied channel list upon finding candidates
1471 matching SSID profile of interest.
1472
1473 uEmptyScanCount Comments
1474 eFirstEmptyScan Previous scan was done on channels in the
1475 occupied list and yielded potential candidates.
1476 This scan cycle was likely triggered through
1477 receipt of lookup DOWN notification event.
1478 eSecondEmptyScan Previous scan was done on channels in the
1479 occupied list and yielded no candidates. This scan
1480 cycle was triggered through RSSI notification
1481 with modified lookup threshold.
1482 eThirdEmptyScan 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 eFourthEmptyScan Previous scan was done on channels in the
1488 occupied list and yielded no candidates. This scan
1489 cycle was triggered upon expiry of
1490 neighborScanResultsRefreshPeriod (=20s).
1491 eFifthEmptyScan Previous scan was done on channels NOT in
1492 the occupied list and yielded no candidates. This
1493 scan cycle was triggered immediately after scanning
1494 channels in the occupied list and no candidates
1495 were found.
1496
1497 [1], [2,3] and [4,5] together form one discrete set of scan cycle.
Jeff Johnson295189b2012-06-20 16:38:30 -07001498
1499 \param pMac - The handle returned by macOpen.
1500
1501 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
1502
1503---------------------------------------------------------------------------*/
1504static VOS_STATUS csrNeighborRoamHandleEmptyScanResult(tpAniSirGlobal pMac)
1505{
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001506 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001507 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1508 eHalStatus status = eHAL_STATUS_SUCCESS;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001509#ifdef FEATURE_WLAN_LFR
1510 tANI_BOOLEAN performPeriodicScan =
1511 (pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod) ? TRUE : FALSE;
1512#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001513
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001514 /* Stop neighbor scan timer */
Jeff Johnson295189b2012-06-20 16:38:30 -07001515 status = palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001516 if (eHAL_STATUS_SUCCESS != status)
Jeff Johnson295189b2012-06-20 16:38:30 -07001517 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001518 smsLog(pMac, LOGW, FL("stopping neighborScanTimer failed with status %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001519 }
1520
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001521 /*
1522 * Increase the neighbor lookup threshold by 3 dB
1523 * after every scan cycle. NOTE: uEmptyScanCount
1524 * would be either 1, 3 or 5 at the end of every
1525 * scan cycle.
1526 */
1527#ifdef FEATURE_WLAN_LFR
1528 if ((++pNeighborRoamInfo->uEmptyScanCount) > eFifthEmptyScan)
1529 {
1530 pNeighborRoamInfo->uEmptyScanCount = eFifthEmptyScan;
1531 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08001532 if ((abs(pNeighborRoamInfo->lookupDOWNRssi) >
1533 abs(pNeighborRoamInfo->cfgParams.neighborReassocThreshold)) &&
1534 ((pNeighborRoamInfo->uEmptyScanCount == eSecondEmptyScan) ||
1535 (pNeighborRoamInfo->uEmptyScanCount == eFourthEmptyScan)))
1536 {
1537 /*
1538 * If the scan was triggered due to lookupDOWNRssi > reassoc threshold,
1539 * then it would be a contiguous scan on all valid non-DFS channels.
1540 * In this mode, there is no need to trigger an immediate scan upon
1541 * empty scan results for the second and fourth time (which would
1542 * be equivalent to scanning on channels in non-occupied list).
1543 * Incrementing uEmptyScanCount will correspond to skipping this step.
1544 * NOTE: double increment of uEmptyScanCount corresponds to completion
1545 * of scans on all valid channels.
1546 */
1547 ++pNeighborRoamInfo->uEmptyScanCount;
1548 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Extra increment of empty scan count (=%d)"
1549 " in contiguous scan mode", pNeighborRoamInfo->uEmptyScanCount);
1550 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001551#endif
1552 if (((pNeighborRoamInfo->currentNeighborLookupThreshold+3) <
1553 pNeighborRoamInfo->cfgParams.neighborReassocThreshold)
1554#ifdef FEATURE_WLAN_LFR
1555 && ((pNeighborRoamInfo->uEmptyScanCount % 2) == 1)
1556#endif
1557 )
1558 {
1559 pNeighborRoamInfo->currentNeighborLookupThreshold += 3;
1560 }
1561
Jeff Johnson295189b2012-06-20 16:38:30 -07001562#ifdef WLAN_FEATURE_VOWIFI_11R
1563 /* Clear off the old neighbor report details */
1564 vos_mem_zero(&pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
1565#endif
1566
Srikant Kuppa866893f2012-12-27 17:28:14 -08001567 /* Transition to CONNECTED state */
1568 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED);
1569
1570 /* Reset all the necessary variables before transitioning to the CONNECTED state */
1571 csrNeighborRoamResetConnectedStateControlInfo(pMac);
1572
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001573#ifdef FEATURE_WLAN_LFR
1574 if (pNeighborRoamInfo->uEmptyScanCount == eFirstEmptyScan)
1575 {
1576#endif
1577 /* Empty scan results for the first time */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001578 /* Re-register neighbor lookup DOWN threshold callback with TL */
1579 NEIGHBOR_ROAM_DEBUG(pMac, LOGE,
1580 FL("Registering DOWN event neighbor lookup callback with TL for RSSI = %d"),
1581 pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
1582
1583 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext,
1584 (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
1585 WLANTL_HO_THRESHOLD_DOWN,
1586 csrNeighborRoamNeighborLookupDOWNCallback,
1587 VOS_MODULE_ID_SME, pMac);
1588
1589 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1590 {
1591 smsLog(pMac, LOGW,
1592 FL("Couldn't re-register csrNeighborRoamNeighborLookupDOWNCallback"
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001593 " with TL: Status = %d"), status);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001594 }
1595#ifdef FEATURE_WLAN_LFR
Srikant Kuppa866893f2012-12-27 17:28:14 -08001596 pNeighborRoamInfo->lookupDOWNRssi = 0;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001597 }
1598 else if ((pNeighborRoamInfo->uEmptyScanCount == eSecondEmptyScan) ||
1599 (pNeighborRoamInfo->uEmptyScanCount == eFourthEmptyScan))
1600 {
1601 /* Empty scan results for the second or fourth time */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001602
1603 /* Immediately scan on channels in non-occupied list */
1604 csrNeighborRoamTransitToCFGChanScan(pMac);
1605 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08001606 else if (pNeighborRoamInfo->uEmptyScanCount >= eThirdEmptyScan)
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001607 {
1608 /* Empty scan results for the third time */
Srinivas Girigowdade697412013-02-14 16:31:48 -08001609 if (performPeriodicScan)
1610 {
1611 smsLog(pMac, LOGE, FL("Performing periodic scan, uEmptyScanCount=%d"),
1612 pNeighborRoamInfo->uEmptyScanCount);
Srikant Kuppa866893f2012-12-27 17:28:14 -08001613
Srinivas Girigowdade697412013-02-14 16:31:48 -08001614 /*
1615 * Set uEmptyScanCount to MAX so that we always enter this
1616 * condition on subsequent empty scan results
1617 */
1618 pNeighborRoamInfo->uEmptyScanCount = eMaxEmptyScan;
1619
1620 /* From here on, ONLY scan on channels in the occupied list */
1621 pNeighborRoamInfo->uScanMode = SPLIT_SCAN_OCCUPIED_LIST;
1622
1623 /* Start empty scan refresh timer */
1624 if (eHAL_STATUS_SUCCESS !=
1625 palTimerStart(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer,
1626 pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod * PAL_TIMER_TO_MS_UNIT,
1627 eANI_BOOLEAN_FALSE))
1628 {
1629 smsLog(pMac, LOGE, FL("Empty scan refresh timer failed to start (%d)"),
1630 status);
1631 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
1632 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07001633 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001634 vosStatus = VOS_STATUS_E_FAILURE;
1635 }
1636 else
1637 {
1638 smsLog(pMac, LOGE, FL("Empty scan refresh timer started (%ld ms)"),
1639 (pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod));
1640 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001641 }
1642 else
1643 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08001644 /* Start neighbor scan results refresh timer */
1645 if (eHAL_STATUS_SUCCESS !=
1646 palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer,
1647 pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT,
1648 eANI_BOOLEAN_FALSE))
1649 {
1650 smsLog(pMac, LOGE, FL("Neighbor results refresh timer failed to start (%d)"),
1651 status);
1652 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
1653 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07001654 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001655 vosStatus = VOS_STATUS_E_FAILURE;
1656 }
1657 else
1658 {
1659 smsLog(pMac, LOG2, FL("Neighbor results refresh timer started (%ld ms)"),
1660 (pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT));
1661 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001662 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001663 }
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001664
Srinivas Girigowdade697412013-02-14 16:31:48 -08001665 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Neighbor roam empty scan count=%d scan mode=%d",
1666 pNeighborRoamInfo->uEmptyScanCount, pNeighborRoamInfo->uScanMode);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001667#endif
1668 return vosStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07001669}
1670
Jeff Johnson295189b2012-06-20 16:38:30 -07001671
Srikant Kuppa866893f2012-12-27 17:28:14 -08001672static eHalStatus csrNeighborRoamProcessScanComplete (tpAniSirGlobal pMac)
Jeff Johnson295189b2012-06-20 16:38:30 -07001673{
Jeff Johnson295189b2012-06-20 16:38:30 -07001674 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001675 tCsrScanResultFilter scanFilter;
1676 tScanResultHandle scanResult;
1677 tANI_U32 tempVal = 0;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001678 tANI_BOOLEAN roamNow = eANI_BOOLEAN_FALSE;
Srikant Kuppa866893f2012-12-27 17:28:14 -08001679 eHalStatus hstatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07001680
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001681#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001682 /* If the state is REPORT_SCAN, then this must be the scan after the REPORT_QUERY state. So, we
1683 should use the BSSID filter made out of neighbor reports */
1684 if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
1685 {
Jeff Johnson43971f52012-07-17 12:26:56 -07001686 hstatus = csrNeighborRoamBssIdScanFilter(pMac, &scanFilter);
1687 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 -07001688 tempVal = 1;
1689 }
1690 else
1691#endif
1692 {
Jeff Johnson43971f52012-07-17 12:26:56 -07001693 hstatus = csrNeighborRoamPrepareScanProfileFilter(pMac, &scanFilter);
1694 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 -07001695 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001696 if (eHAL_STATUS_SUCCESS != hstatus)
Jeff Johnson295189b2012-06-20 16:38:30 -07001697 {
1698 smsLog(pMac, LOGE, FL("Scan Filter preparation failed for Assoc type %d.. Bailing out.."), tempVal);
1699 return eHAL_STATUS_FAILURE;
1700 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001701 hstatus = csrScanGetResult(pMac, &scanFilter, &scanResult);
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05301702 if (hstatus != eHAL_STATUS_SUCCESS)
1703 {
1704 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Get Scan Result status code %d"), hstatus);
1705 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001706 /* Process the scan results and update roamable AP list */
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001707 roamNow = csrNeighborRoamProcessScanResults(pMac, &scanResult);
Jeff Johnson295189b2012-06-20 16:38:30 -07001708
1709 /* Free the scan filter */
1710 csrFreeScanFilter(pMac, &scanFilter);
1711
1712 tempVal = csrLLCount(&pNeighborRoamInfo->roamableAPList);
1713
1714 switch(pNeighborRoamInfo->neighborRoamState)
1715 {
1716 case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:
1717 if (tempVal)
1718 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001719#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001720 /*
1721 * Since there are non-zero candidates found
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001722 * after the scan, reset empty scan count.
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001723 */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001724 pNeighborRoamInfo->uEmptyScanCount = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001725 pNeighborRoamInfo->uScanMode = DEFAULT_SCAN;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001726#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001727#ifdef WLAN_FEATURE_VOWIFI_11R
1728 /* If this is a non-11r association, then we can register the reassoc callback here as we have some
1729 APs in the roamable AP list */
1730 if (pNeighborRoamInfo->is11rAssoc)
1731 {
1732 /* Valid APs are found after scan. Now we can initiate pre-authentication */
1733 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
1734 }
1735 else
1736#endif
1737#ifdef FEATURE_WLAN_CCX
1738 /* If this is a non-11r association, then we can register the reassoc callback here as we have some
1739 APs in the roamable AP list */
1740 if (pNeighborRoamInfo->isCCXAssoc)
1741 {
1742 /* Valid APs are found after scan. Now we can initiate pre-authentication */
1743 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
1744 }
1745 else
1746#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001747#ifdef FEATURE_WLAN_LFR
1748 /* If LFR is enabled, then we can register the reassoc callback here as we have some
1749 APs in the roamable AP list */
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05301750 if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001751 {
1752 /* Valid APs are found after scan. Now we can initiate pre-authentication */
1753 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
1754 }
1755 else
1756#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001757 {
1758
1759 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Completed scanning of CFG CHAN LIST in non-11r association. Registering reassoc callback"));
1760 /* Nothing much to do now. Will continue to remain in this state in case of non-11r association */
1761 /* Stop the timer. But how long the roamable AP list will be valid in here. At some point of time, we
1762 need to restart the CFG CHAN list scan procedure if reassoc callback is not invoked from TL
1763 within certain duration */
1764
1765// palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
1766 }
1767 }
1768 else
1769 {
Madan Mohan Koyyalamudib40e5582012-10-11 16:48:42 -07001770 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("No candidate found after scanning in state %d.. "), pNeighborRoamInfo->neighborRoamState);
1771 /* Handle it appropriately */
1772 csrNeighborRoamHandleEmptyScanResult(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001773 }
1774 break;
1775#ifdef WLAN_FEATURE_VOWIFI_11R
1776 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
1777 if (!tempVal)
1778 {
1779 smsLog(pMac, LOGE, FL("No candidate found after scanning in state %d.. "), pNeighborRoamInfo->neighborRoamState);
1780 /* Stop the timer here as the same timer will be started again in CFG_CHAN_SCAN_STATE */
1781 csrNeighborRoamTransitToCFGChanScan(pMac);
1782 }
1783 break;
1784#endif /* WLAN_FEATURE_VOWIFI_11R */
1785 default:
1786 // Can come only in INIT state. Where in we are associated, we sent scan and user
1787 // in the meantime decides to disassoc, we will be in init state and still received call
1788 // back issued. Should not come here in any other state, printing just in case
1789 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001790 "%s: [INFOLOG] State %d", __func__, (pNeighborRoamInfo->neighborRoamState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001791
1792 // Lets just exit out silently.
1793 return eHAL_STATUS_SUCCESS;
1794 }
1795
1796 if (tempVal)
1797 {
1798 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
1799
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001800 if (roamNow)
1801 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001802 NEIGHBOR_ROAM_DEBUG(pMac, LOG2,
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001803 FL("Immediate roam-deregister UP indication. RSSI = %d"),
1804 NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1));
1805
1806 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
1807 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
1808 WLANTL_HO_THRESHOLD_UP,
1809 csrNeighborRoamNeighborLookupUPCallback,
1810 VOS_MODULE_ID_SME);
1811
1812 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1813 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001814 smsLog(pMac, LOGW,
1815 FL("Couldn't deregister lookup UP callback with TL: Status = %d"), vosStatus);
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001816 }
1817
1818 csrNeighborRoamTriggerHandoff(pMac, pNeighborRoamInfo);
1819 return eHAL_STATUS_SUCCESS;
1820 }
1821
Srikant Kuppa866893f2012-12-27 17:28:14 -08001822 hstatus = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer,
1823 pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT,
1824 eANI_BOOLEAN_FALSE);
1825
Jeff Johnson295189b2012-06-20 16:38:30 -07001826 /* This timer should be started before registering the Reassoc callback with TL. This is because, it is very likely
1827 * 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 -08001828 if (eHAL_STATUS_SUCCESS != hstatus)
Jeff Johnson295189b2012-06-20 16:38:30 -07001829 {
Srikant Kuppa866893f2012-12-27 17:28:14 -08001830 smsLog(pMac, LOGE, FL("Neighbor results refresh timer failed to start, status = %d"), hstatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07001831 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
1832 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07001833 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Jeff Johnson43971f52012-07-17 12:26:56 -07001834 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001835 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001836
Jeff Johnson295189b2012-06-20 16:38:30 -07001837 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event Reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
1838 /* Register a reassoc Indication callback */
1839 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
1840 WLANTL_HO_THRESHOLD_DOWN,
1841 csrNeighborRoamReassocIndCallback,
1842 VOS_MODULE_ID_SME, pMac);
1843
1844 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1845 {
1846 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001847 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamReassocIndCallback with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07001848 }
1849
1850 }
Srikant Kuppa866893f2012-12-27 17:28:14 -08001851
1852 return eHAL_STATUS_SUCCESS;
1853
1854}
1855
1856
1857/* ---------------------------------------------------------------------------
1858
1859 \fn csrNeighborRoamScanRequestCallback
1860
1861 \brief This function is the callback function registered in csrScanRequest() to
1862 indicate the completion of scan. If scan is completed for all the channels in
1863 the channel list, this function gets the scan result and starts the refresh results
1864 timer to avoid having stale results. If scan is not completed on all the channels,
1865 it restarts the neighbor scan timer which on expiry issues scan on the next
1866 channel
1867
1868 \param halHandle - The handle returned by macOpen.
1869 pContext - not used
1870 scanId - not used
1871 status - not used
1872
1873 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
1874
1875---------------------------------------------------------------------------*/
1876static eHalStatus csrNeighborRoamScanRequestCallback(tHalHandle halHandle, void *pContext,
1877 tANI_U32 scanId, eCsrScanStatus status)
1878{
1879 tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle;
1880 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1881 tANI_U8 currentChanIndex;
1882 eHalStatus hstatus;
1883
1884 pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE;
1885
1886 /* This can happen when we receive a UP event from TL in any of the scan states. Silently ignore it */
1887 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
1888 {
1889 smsLog(pMac, LOGE, FL("Received in CONNECTED state. Must be because a UP event from TL after issuing scan request. Ignore it"));
1890 return eHAL_STATUS_SUCCESS;
1891 }
1892
1893 /* -1 is done because the chanIndex would have got incremented after issuing a successful scan request */
1894 currentChanIndex = (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex) ? (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex - 1) : 0;
1895
1896 /* Validate inputs */
1897 if (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList) {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001898 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("csrNeighborRoamScanRequestCallback received for Channel = %d, ChanIndex = %d"),
Srikant Kuppa866893f2012-12-27 17:28:14 -08001899 pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList[currentChanIndex], currentChanIndex);
1900 }
1901 else
1902 {
1903 smsLog(pMac, LOG1, FL("Received during clean-up. Silently ignore scan completion event."));
1904 return eHAL_STATUS_SUCCESS;
1905 }
1906
1907 if (eANI_BOOLEAN_FALSE == pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress)
1908 {
1909 /* Scan is completed in the CFG_CHAN_SCAN state. We can transition to REPORT_SCAN state
1910 just to get the results and perform PREAUTH */
1911 /* Now we have completed scanning the channel list. We have get the result by applying appropriate filter
1912 sort the results based on neighborScore and RSSI and select the best candidate out of the list */
1913 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Channel list scan completed. Current chan index = %d"), currentChanIndex);
1914 VOS_ASSERT(pNeighborRoamInfo->roamChannelInfo.currentChanIndex == 0);
1915
1916 hstatus = csrNeighborRoamProcessScanComplete(pMac);
1917
1918 if (eHAL_STATUS_SUCCESS != hstatus)
1919 {
1920 smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus);
1921 return eHAL_STATUS_FAILURE;
1922 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001923 }
1924 else
1925 {
1926
1927 /* Restart the timer for the next scan sequence as scanning is not over */
Jeff Johnson43971f52012-07-17 12:26:56 -07001928 hstatus = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer,
Jeff Johnson295189b2012-06-20 16:38:30 -07001929 pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT,
1930 eANI_BOOLEAN_FALSE);
1931
Jeff Johnson43971f52012-07-17 12:26:56 -07001932 if (eHAL_STATUS_SUCCESS != hstatus)
Jeff Johnson295189b2012-06-20 16:38:30 -07001933 {
1934 /* Timer start failed.. Should we ASSERT here??? */
1935 smsLog(pMac, LOGE, FL("Neighbor scan PAL Timer start failed, status = %d, Ignoring state transition"), status);
1936 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
1937 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07001938 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Jeff Johnson43971f52012-07-17 12:26:56 -07001939 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001940 }
1941 }
1942 return eHAL_STATUS_SUCCESS;
1943}
1944
Srikant Kuppa866893f2012-12-27 17:28:14 -08001945#ifdef FEATURE_WLAN_LFR
1946static eHalStatus csrNeighborRoamContiguousScanRequestCallback(tHalHandle halHandle,
1947 void *pContext, tANI_U32 scanId, eCsrScanStatus status)
1948{
1949 tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle;
1950 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1951 eHalStatus hstatus = eHAL_STATUS_SUCCESS;
1952
1953 pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE;
1954
1955 /* This can happen when we receive a UP event from TL in any of the scan states. Silently ignore it */
1956 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
1957 {
1958 smsLog(pMac, LOGE, FL("Received in CONNECTED state. Must be because a UP event from TL after issuing scan request. Ignore it"));
1959 return eHAL_STATUS_SUCCESS;
1960 }
1961
Srinivas Girigowdade697412013-02-14 16:31:48 -08001962 if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
1963 {
1964 smsLog(pMac, LOGE, FL("Received in INIT state. Must have disconnected. Ignore it"));
1965 return eHAL_STATUS_SUCCESS;
1966 }
1967
Srikant Kuppa866893f2012-12-27 17:28:14 -08001968 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "%s: process scan results", __func__);
1969 hstatus = csrNeighborRoamProcessScanComplete(pMac);
1970
1971 if (eHAL_STATUS_SUCCESS != hstatus)
1972 {
1973 smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus);
1974 }
1975
1976 return hstatus;
1977}
1978#endif
1979
Jeff Johnson295189b2012-06-20 16:38:30 -07001980/* ---------------------------------------------------------------------------
1981
1982 \fn csrNeighborRoamIssueBgScanRequest
1983
1984 \brief This function issues CSR scan request after populating all the BG scan params
1985 passed
1986
1987 \param pMac - The handle returned by macOpen.
1988 pBgScanParams - Params that need to be populated into csr Scan request
1989
1990 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
1991
1992---------------------------------------------------------------------------*/
Srikant Kuppa866893f2012-12-27 17:28:14 -08001993eHalStatus csrNeighborRoamIssueBgScanRequest(tpAniSirGlobal pMac,
1994 tCsrBGScanRequest *pBgScanParams,
1995 csrScanCompleteCallback callbackfn)
Jeff Johnson295189b2012-06-20 16:38:30 -07001996{
1997 eHalStatus status = eHAL_STATUS_SUCCESS;
1998 tANI_U32 scanId;
1999 tCsrScanRequest scanReq;
2000 tANI_U8 channel;
2001
Srikant Kuppa866893f2012-12-27 17:28:14 -08002002 if (1 == pBgScanParams->ChannelInfo.numOfChannels)
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002003 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Channel = %d, ChanIndex = %d"),
Srikant Kuppa866893f2012-12-27 17:28:14 -08002004 pBgScanParams->ChannelInfo.ChannelList[0],
2005 pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07002006
2007 //send down the scan req for 1 channel on the associated SSID
2008 palZeroMemory(pMac->hHdd, &scanReq, sizeof(tCsrScanRequest));
2009 /* Fill in the SSID Info */
2010 scanReq.SSIDs.numOfSSIDs = 1;
2011 scanReq.SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo) * scanReq.SSIDs.numOfSSIDs);
2012 if(NULL == scanReq.SSIDs.SSIDList)
2013 {
2014 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002015 smsLog(pMac, LOGE, FL("Couldn't allocate memory for the SSID..Freeing memory allocated for Channel List"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 return eHAL_STATUS_FAILURE;
2017 }
2018 vos_mem_zero(scanReq.SSIDs.SSIDList, sizeof(tCsrSSIDInfo) * scanReq.SSIDs.numOfSSIDs);
2019
2020 scanReq.SSIDs.SSIDList[0].handoffPermitted = eANI_BOOLEAN_TRUE;
2021 scanReq.SSIDs.SSIDList[0].ssidHidden = eANI_BOOLEAN_TRUE;
2022 vos_mem_copy((void *)&scanReq.SSIDs.SSIDList[0].SSID, (void *)&pBgScanParams->SSID, sizeof(pBgScanParams->SSID));
2023
2024 scanReq.ChannelInfo.numOfChannels = pBgScanParams->ChannelInfo.numOfChannels;
Srikant Kuppa866893f2012-12-27 17:28:14 -08002025 if (1 == pBgScanParams->ChannelInfo.numOfChannels)
2026 {
2027 channel = pBgScanParams->ChannelInfo.ChannelList[0];
2028 scanReq.ChannelInfo.ChannelList = &channel;
2029 }
2030 else
2031 {
2032 scanReq.ChannelInfo.ChannelList = pBgScanParams->ChannelInfo.ChannelList;
2033 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002034
2035 scanReq.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
2036 scanReq.scanType = eSIR_ACTIVE_SCAN;
2037 scanReq.requestType = eCSR_SCAN_HO_BG_SCAN;
2038 scanReq.maxChnTime = pBgScanParams->maxChnTime;
2039 scanReq.minChnTime = pBgScanParams->minChnTime;
2040 status = csrScanRequest(pMac, CSR_SESSION_ID_INVALID, &scanReq,
Srikant Kuppa866893f2012-12-27 17:28:14 -08002041 &scanId, callbackfn, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002042 if (eHAL_STATUS_SUCCESS != status)
2043 {
2044 smsLog(pMac, LOGE, FL("CSR Scan Request failed with status %d"), status);
2045 vos_mem_free(scanReq.SSIDs.SSIDList);
2046 return status;
2047 }
2048 pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_TRUE;
2049
2050 vos_mem_free(scanReq.SSIDs.SSIDList);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002051 if (1 == pBgScanParams->ChannelInfo.numOfChannels)
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002052 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Channel List Address = %08x, Actual index = %d"),
Srikant Kuppa866893f2012-12-27 17:28:14 -08002053 &pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList[0],
2054 pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex);
2055
Jeff Johnson295189b2012-06-20 16:38:30 -07002056 return status;
2057}
2058
Srikant Kuppa866893f2012-12-27 17:28:14 -08002059static void csrNeighborRoamFillNonChannelBgScanParams (tpAniSirGlobal pMac,
2060 tpCsrBGScanRequest bgScanParams)
2061{
2062 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2063 tANI_U8 broadcastBssid[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
2064
2065 vos_mem_copy(bgScanParams->bssid, broadcastBssid, sizeof(tCsrBssid));
2066 bgScanParams->SSID.length = pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length;
2067 vos_mem_copy(bgScanParams->SSID.ssId,
2068 pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.ssId,
2069 pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length);
2070
2071 bgScanParams->minChnTime = pNeighborRoamInfo->cfgParams.minChannelScanTime;
2072 bgScanParams->maxChnTime = pNeighborRoamInfo->cfgParams.maxChannelScanTime;
2073}
2074
Jeff Johnson295189b2012-06-20 16:38:30 -07002075/* ---------------------------------------------------------------------------
2076
2077 \fn csrNeighborRoamPerformBgScan
2078
2079 \brief This function is invoked on every expiry of neighborScanTimer till all
2080 the channels in the channel list are scanned. It populates necessary
2081 parameters for BG scan and calls appropriate AP to invoke the CSR scan
2082 request
2083
2084 \param pMac - The handle returned by macOpen.
2085
2086 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
2087
2088---------------------------------------------------------------------------*/
2089eHalStatus csrNeighborRoamPerformBgScan(tpAniSirGlobal pMac)
2090{
2091 eHalStatus status = eHAL_STATUS_SUCCESS;
2092 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2093 tCsrBGScanRequest bgScanParams;
Jeff Johnson295189b2012-06-20 16:38:30 -07002094 tANI_U8 channel = 0;
2095
2096 if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
2097 {
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05302098 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Channel List Address = %08x"), &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[0]);
Jeff Johnson295189b2012-06-20 16:38:30 -07002099 }
2100 else
2101 {
2102 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Channel List Empty"));
Jeff Johnson902c9832012-12-10 14:28:09 -08002103 // Go back and restart. Mostly timer start failure has occurred.
Jeff Johnson295189b2012-06-20 16:38:30 -07002104 // When timer start is declared a failure, then we delete the list.
2105 // Should not happen now as we stop and then only start the scan timer.
2106 // still handle the unlikely case.
2107 csrNeighborRoamHandleEmptyScanResult(pMac);
2108 return status;
2109 }
2110 /* Need to perform scan here before getting the list */
Srikant Kuppa866893f2012-12-27 17:28:14 -08002111
2112 palZeroMemory(pMac->hHdd, &bgScanParams, sizeof(tCsrBGScanRequest));
Jeff Johnson295189b2012-06-20 16:38:30 -07002113
2114 channel = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[pNeighborRoamInfo->roamChannelInfo.currentChanIndex];
2115 bgScanParams.ChannelInfo.numOfChannels = 1;
2116 bgScanParams.ChannelInfo.ChannelList = &channel;
2117
Srikant Kuppa866893f2012-12-27 17:28:14 -08002118 csrNeighborRoamFillNonChannelBgScanParams(pMac, &bgScanParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002119
Srikant Kuppa866893f2012-12-27 17:28:14 -08002120 status = csrNeighborRoamIssueBgScanRequest(pMac, &bgScanParams,
2121 csrNeighborRoamScanRequestCallback);
Jeff Johnson295189b2012-06-20 16:38:30 -07002122 if (eHAL_STATUS_SUCCESS != status)
2123 {
2124 smsLog(pMac, LOGE, FL("Issue of BG Scan request failed: Status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07002125 }
2126
2127 pNeighborRoamInfo->roamChannelInfo.currentChanIndex++;
2128 if (pNeighborRoamInfo->roamChannelInfo.currentChanIndex >=
2129 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels)
2130 {
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05302131 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Completed scanning channels in Channel List: CurrChanIndex = %d, Num Channels = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002132 pNeighborRoamInfo->roamChannelInfo.currentChanIndex,
2133 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels);
2134 /* We have completed scanning all the channels */
2135 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
2136 /* We are no longer scanning the channel list. Next timer firing should be used to get the scan results
2137 and select the best AP in the list */
2138 if (eANI_BOOLEAN_TRUE == pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress)
2139 {
2140 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
2141 }
2142 }
2143
Gopichand Nakkalac7b1d3e2012-12-31 14:07:19 -08002144 if (eHAL_STATUS_SUCCESS != status)
2145 {
2146 /*
2147 * If the status is not success, we need to call the callback
2148 * routine so that the state machine does not get stuck.
2149 */
2150 csrNeighborRoamScanRequestCallback(pMac, NULL, 0, eCSR_SCAN_FAILURE);
2151 }
2152
Jeff Johnson295189b2012-06-20 16:38:30 -07002153 return status;
2154}
2155
Srikant Kuppa866893f2012-12-27 17:28:14 -08002156#ifdef FEATURE_WLAN_LFR
2157eHalStatus csrNeighborRoamPerformContiguousBgScan(tpAniSirGlobal pMac)
2158{
2159 eHalStatus status = eHAL_STATUS_SUCCESS;
2160 tCsrBGScanRequest bgScanParams;
2161 int numOfChannels = 0, i = 0;
2162 tANI_U8 *channelList = NULL;
Srinivas Girigowdade697412013-02-14 16:31:48 -08002163 tANI_U8 *pInChannelList = NULL;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002164 tANI_U8 tmpChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
Srikant Kuppa866893f2012-12-27 17:28:14 -08002165
2166 palZeroMemory(pMac->hHdd, &bgScanParams, sizeof(tCsrBGScanRequest));
2167
2168 /* Contiguously scan all channels from valid list */
2169 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "%s: get valid channel list", __func__);
Srinivas Girigowdade697412013-02-14 16:31:48 -08002170
2171 if (NULL != pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.ChannelList)
Srikant Kuppa866893f2012-12-27 17:28:14 -08002172 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08002173 /* this list is filled only if the country code is set to KR */
2174 numOfChannels = pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels;
2175 pInChannelList = pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.ChannelList;
Srikant Kuppa866893f2012-12-27 17:28:14 -08002176 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08002177 else
2178 {
2179 numOfChannels = sizeof(pMac->roam.validChannelList);
2180
2181 if(!HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac,
2182 (tANI_U8 *)pMac->roam.validChannelList,
2183 (tANI_U32 *) &numOfChannels)))
2184 {
2185 smsLog(pMac, LOGE, FL("Could not get valid channel list"));
2186 return eHAL_STATUS_FAILURE;
2187 }
2188 pInChannelList = pMac->roam.validChannelList;
2189 }
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002190
2191 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
2192 {
2193 csrNeighborRoamChannelsFilterByCurrentBand(
2194 pMac,
2195 pInChannelList,
2196 numOfChannels,
2197 tmpChannelList,
2198 &numOfChannels);
2199 pInChannelList = tmpChannelList;
2200 }
2201
Srikant Kuppa866893f2012-12-27 17:28:14 -08002202 channelList = vos_mem_malloc( numOfChannels );
2203 if( NULL == channelList )
2204 {
2205 smsLog(pMac, LOGE, FL("could not allocate memory for channelList"));
2206 return eHAL_STATUS_FAILURE;
2207 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08002208 vos_mem_copy(channelList, (tANI_U8 *)pInChannelList,
Srikant Kuppa866893f2012-12-27 17:28:14 -08002209 numOfChannels * sizeof(tANI_U8));
2210
2211 bgScanParams.ChannelInfo.numOfChannels = numOfChannels;
2212 bgScanParams.ChannelInfo.ChannelList = channelList;
2213 for (i = 0; i < numOfChannels; i++)
2214 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002215 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "%s: valid channel list = %d",
Srikant Kuppa866893f2012-12-27 17:28:14 -08002216 __func__, bgScanParams.ChannelInfo.ChannelList[i]);
2217 }
2218 csrNeighborRoamFillNonChannelBgScanParams(pMac, &bgScanParams);
2219
2220 status = csrNeighborRoamIssueBgScanRequest(pMac, &bgScanParams,
2221 csrNeighborRoamContiguousScanRequestCallback);
2222
2223 vos_mem_free( channelList );
2224
2225 if (eHAL_STATUS_SUCCESS != status)
2226 {
2227 smsLog(pMac, LOGE, FL("Issue of BG Scan request failed: Status = %d"), status);
2228 }
2229
2230 return status;
2231}
2232#endif
2233
Jeff Johnson295189b2012-06-20 16:38:30 -07002234/* ---------------------------------------------------------------------------
2235
2236 \fn csrNeighborRoamNeighborScanTimerCallback
2237
2238 \brief This function is the neighbor scan timer callback function. It invokes
2239 the BG scan request based on the current and previous states
2240
2241 \param pv - CSR timer context info which includes pMac and session ID
2242
2243 \return VOID
2244
2245---------------------------------------------------------------------------*/
2246void csrNeighborRoamNeighborScanTimerCallback(void *pv)
2247{
2248 tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv;
2249 tpAniSirGlobal pMac = pInfo->pMac;
2250 tANI_U32 sessionId = pInfo->sessionId;
2251 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2252
2253 // check if bg scan is on going, no need to send down the new params if true
2254 if(eANI_BOOLEAN_TRUE == pNeighborRoamInfo->scanRspPending)
2255 {
2256 //msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002257 smsLog(pMac, LOGW, FL("Already BgScanRsp is Pending"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 return;
2259 }
2260
2261 VOS_ASSERT(sessionId == pNeighborRoamInfo->csrSessionId);
2262
2263 switch (pNeighborRoamInfo->neighborRoamState)
2264 {
2265#ifdef WLAN_FEATURE_VOWIFI_11R
2266 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2267 switch(pNeighborRoamInfo->prevNeighborRoamState)
2268 {
2269 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY:
2270 csrNeighborRoamPerformBgScan(pMac);
2271 break;
2272 default:
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002273 smsLog(pMac, LOGE, FL("Neighbor scan callback received in state %d, prev state = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002274 pNeighborRoamInfo->neighborRoamState, pNeighborRoamInfo->prevNeighborRoamState);
2275 break;
2276 }
2277 break;
2278#endif /* WLAN_FEATURE_VOWIFI_11R */
2279 case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:
2280 csrNeighborRoamPerformBgScan(pMac);
2281 break;
2282 default:
2283 break;
2284 }
2285 return;
2286}
2287
Srinivas Girigowdade697412013-02-14 16:31:48 -08002288void csrNeighborRoamEmptyScanRefreshTimerCallback(void *context)
2289{
2290 tCsrTimerInfo *pInfo = (tCsrTimerInfo *)context;
2291 tpAniSirGlobal pMac = pInfo->pMac;
2292 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
2293 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2294
2295 /* Reset all the variables just as no scan had happened before */
2296 csrNeighborRoamResetConnectedStateControlInfo(pMac);
2297
2298#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
2299 if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled))
2300 {
2301 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state"));
2302 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
2303 if (VOS_STATUS_SUCCESS != vosStatus)
2304 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002305 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Srinivas Girigowdade697412013-02-14 16:31:48 -08002306 return;
2307 }
2308 /* Increment the neighbor report retry count after sending the neighbor request successfully */
2309 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
2310 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
2311 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY)
2312 }
2313 else
2314#endif
2315 {
2316 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Non 11R or CCX Association:empty scan refresh timer expired"));
2317 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
2318 if (VOS_STATUS_SUCCESS != vosStatus)
2319 {
2320 return;
2321 }
2322 }
2323 return;
2324}
2325
Jeff Johnson295189b2012-06-20 16:38:30 -07002326/* ---------------------------------------------------------------------------
2327
2328 \fn csrNeighborRoamResultsRefreshTimerCallback
2329
2330 \brief This function is the timer callback function for results refresh timer.
2331 When this is invoked, it is as good as down event received from TL. So,
2332 clear off the roamable AP list and start the scan procedure based on 11R
2333 or non-11R association
2334
2335 \param context - CSR timer context info which includes pMac and session ID
2336
2337 \return VOID
2338
2339---------------------------------------------------------------------------*/
2340void csrNeighborRoamResultsRefreshTimerCallback(void *context)
2341{
2342 tCsrTimerInfo *pInfo = (tCsrTimerInfo *)context;
2343 tpAniSirGlobal pMac = pInfo->pMac;
2344 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
2345 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2346
2347 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
2348
2349 /* Deregister reassoc callback. Ignore return status */
2350 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
2351 WLANTL_HO_THRESHOLD_DOWN,
2352 csrNeighborRoamReassocIndCallback,
2353 VOS_MODULE_ID_SME);
2354
2355 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
2356 {
2357 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002358 smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002359 }
2360
2361 /* Reset all the variables just as no scan had happened before */
2362 csrNeighborRoamResetConnectedStateControlInfo(pMac);
2363
2364#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
2365 if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled))
2366 {
2367 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state"));
2368 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
2369 if (VOS_STATUS_SUCCESS != vosStatus)
2370 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002371 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002372 return;
2373 }
2374 /* Increment the neighbor report retry count after sending the neighbor request successfully */
2375 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
2376 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
2377 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY)
2378 }
2379 else
2380#endif
2381 {
Srikant Kuppa866893f2012-12-27 17:28:14 -08002382 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Non 11R or CCX Association:results refresh timer expired"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002383 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
2384 if (VOS_STATUS_SUCCESS != vosStatus)
2385 {
2386 return;
2387 }
2388 }
2389 return;
2390}
2391
2392#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
2393/* ---------------------------------------------------------------------------
2394
2395 \fn csrNeighborRoamIssueNeighborRptRequest
2396
2397 \brief This function is invoked when TL issues a down event and the current assoc
2398 is a 11R association. It invokes SME RRM API to issue the neighbor request to
2399 the currently associated AP with the current SSID
2400
2401 \param pMac - The handle returned by macOpen.
2402
2403 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2404
2405---------------------------------------------------------------------------*/
2406VOS_STATUS csrNeighborRoamIssueNeighborRptRequest(tpAniSirGlobal pMac)
2407{
2408 tRrmNeighborRspCallbackInfo callbackInfo;
2409 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2410 tRrmNeighborReq neighborReq;
2411
2412
2413 neighborReq.no_ssid = 0;
2414
2415 /* Fill in the SSID */
2416 neighborReq.ssid.length = pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length;
2417 vos_mem_copy(neighborReq.ssid.ssId, pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.ssId,
2418 pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length);
2419
2420 callbackInfo.neighborRspCallback = csrNeighborRoamRRMNeighborReportResult;
2421 callbackInfo.neighborRspCallbackContext = pMac;
2422 callbackInfo.timeout = pNeighborRoamInfo->FTRoamInfo.neighborReportTimeout;
2423
2424 return sme_NeighborReportRequest(pMac,(tANI_U8) pNeighborRoamInfo->csrSessionId, &neighborReq, &callbackInfo);
2425}
2426
2427/* ---------------------------------------------------------------------------
2428
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002429 \fn csrNeighborRoamChannelsFilterByCurrentBand
2430
2431 \brief This function is used to filter out the channels
2432 based on the currently associated AP channel
2433
2434 \param pMac - The handle returned by macOpen.
2435 \param pInputChannelList - The input channel list
2436 \param inputNumOfChannels - The number of channels in input channel list
2437 \param pOutputChannelList - The output channel list
2438 \param outputNumOfChannels - The number of channels in output channel list
2439 \param pMergedOutputNumOfChannels - The final number of channels in the output channel list.
2440
2441 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2442
2443---------------------------------------------------------------------------*/
2444
2445VOS_STATUS csrNeighborRoamChannelsFilterByCurrentBand(
2446 tpAniSirGlobal pMac,
2447 tANI_U8* pInputChannelList,
2448 int inputNumOfChannels,
2449 tANI_U8* pOutputChannelList,
2450 int* pMergedOutputNumOfChannels
2451 )
2452{
2453 int i = 0;
2454 int numChannels = 0;
2455 tANI_U8 currAPoperationChannel = pMac->roam.neighborRoamInfo.currAPoperationChannel;
2456 // Check for NULL pointer
2457 if (!pInputChannelList) return eHAL_STATUS_E_NULL_VALUE;
2458
2459 // Check for NULL pointer
2460 if (!pOutputChannelList) return eHAL_STATUS_E_NULL_VALUE;
2461
2462 for (i = 0; i < inputNumOfChannels; i++)
2463 {
2464 if (GetRFBand(currAPoperationChannel) == GetRFBand(pInputChannelList[i]))
2465 {
2466 pOutputChannelList[numChannels] = pInputChannelList[i];
2467 numChannels++;
2468 }
2469 }
2470
2471 // Return final number of channels
2472 *pMergedOutputNumOfChannels = numChannels;
2473
2474 return eHAL_STATUS_SUCCESS;
2475}
2476
2477/* ---------------------------------------------------------------------------
2478
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002479 \fn csrNeighborRoamMergeChannelLists
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002480
2481 \brief This function is used to merge two channel list.
2482 NB: If called with outputNumOfChannels == 0, this routines
2483 simply copies the input channel list to the output channel list.
2484
2485 \param pMac - The handle returned by macOpen.
2486 \param pInputChannelList - The addtional channels to merge in to the "merged" channels list.
2487 \param inputNumOfChannels - The number of additional channels.
2488 \param pOutputChannelList - The place to put the "merged" channel list.
2489 \param outputNumOfChannels - The original number of channels in the "merged" channels list.
2490 \param pMergedOutputNumOfChannels - The final number of channels in the "merged" channel list.
2491
2492 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2493
2494---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002495VOS_STATUS csrNeighborRoamMergeChannelLists(
2496 tpAniSirGlobal pMac,
2497 tANI_U8 *pInputChannelList,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002498 int inputNumOfChannels,
2499 tANI_U8 *pOutputChannelList,
2500 int outputNumOfChannels,
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002501 int *pMergedOutputNumOfChannels
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002502 )
2503{
2504 int i = 0;
2505 int j = 0;
2506 int numChannels = outputNumOfChannels;
2507
2508 // Check for NULL pointer
2509 if (!pInputChannelList) return eHAL_STATUS_E_NULL_VALUE;
2510
2511 // Check for NULL pointer
2512 if (!pOutputChannelList) return eHAL_STATUS_E_NULL_VALUE;
2513
2514 // Add the "new" channels in the input list to the end of the output list.
2515 for (i = 0; i < inputNumOfChannels; i++)
2516 {
2517 for (j = 0; j < outputNumOfChannels; j++)
2518 {
2519 if (pInputChannelList[i] == pOutputChannelList[j])
2520 break;
2521 }
2522 if (j == outputNumOfChannels)
2523 {
2524 if (pInputChannelList[i])
2525 {
Madan Mohan Koyyalamudif5c368b2012-12-06 13:10:13 -08002526 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002527 "%s: [INFOLOG] Adding extra %d to Neighbor channel list", __func__,
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002528 pInputChannelList[i]);
2529 pOutputChannelList[numChannels] = pInputChannelList[i];
2530 numChannels++;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002531 }
2532 }
2533 }
2534
2535 // Return final number of channels
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002536 *pMergedOutputNumOfChannels = numChannels;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002537
2538 return eHAL_STATUS_SUCCESS;
2539}
2540
2541/* ---------------------------------------------------------------------------
2542
Jeff Johnson295189b2012-06-20 16:38:30 -07002543 \fn csrNeighborRoamCreateChanListFromNeighborReport
2544
2545 \brief This function is invoked when neighbor report is received for the
2546 neighbor request. Based on the channels present in the neighbor report,
2547 it generates channel list which will be used in REPORT_SCAN state to
2548 scan for these neighbor APs
2549
2550 \param pMac - The handle returned by macOpen.
2551
2552 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2553
2554---------------------------------------------------------------------------*/
2555VOS_STATUS csrNeighborRoamCreateChanListFromNeighborReport(tpAniSirGlobal pMac)
2556{
2557 tpRrmNeighborReportDesc pNeighborBssDesc;
2558 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002559 tANI_U8 numChannels = 0, i = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002560 tANI_U8 channelList[MAX_BSS_IN_NEIGHBOR_RPT];
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002561#if 0
2562 eHalStatus status = eHAL_STATUS_SUCCESS;
2563#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002564
2565 /* This should always start from 0 whenever we create a channel list out of neighbor AP list */
2566 pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0;
2567
2568 pNeighborBssDesc = smeRrmGetFirstBssEntryFromNeighborCache(pMac);
2569
2570 while (pNeighborBssDesc)
2571 {
2572 if (pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport >= MAX_BSS_IN_NEIGHBOR_RPT) break;
2573
2574 /* Update the neighbor BSS Info in the 11r FT Roam Info */
2575 pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].channelNum =
2576 pNeighborBssDesc->pNeighborBssDescription->channel;
2577 pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].neighborScore =
2578 (tANI_U8)pNeighborBssDesc->roamScore;
2579 vos_mem_copy(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].neighborBssId,
2580 pNeighborBssDesc->pNeighborBssDescription->bssId, sizeof(tSirMacAddr));
2581 pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport++;
2582
2583 /* Saving the channel list non-redundantly */
2584 if (numChannels > 0)
2585 {
2586 for (i = 0; i < numChannels; i++)
2587 {
2588 if (pNeighborBssDesc->pNeighborBssDescription->channel == channelList[i])
2589 break;
2590 }
2591
2592 }
2593 if (i == numChannels)
2594 {
2595 if (pNeighborBssDesc->pNeighborBssDescription->channel)
2596 {
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002597 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
2598 {
2599 // Make sure to add only if its the same band
2600 if (GetRFBand(pNeighborRoamInfo->currAPoperationChannel) ==
2601 GetRFBand(pNeighborBssDesc->pNeighborBssDescription->channel))
2602 {
2603 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2604 "%s: [INFOLOG] Adding %d to Neighbor channel list (Same band)\n", __func__,
2605 pNeighborBssDesc->pNeighborBssDescription->channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07002606 channelList[numChannels] = pNeighborBssDesc->pNeighborBssDescription->channel;
2607 numChannels++;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002608 }
2609 }
2610 else
2611 {
2612 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2613 "%s: [INFOLOG] Adding %d to Neighbor channel list\n", __func__,
2614 pNeighborBssDesc->pNeighborBssDescription->channel);
2615 channelList[numChannels] = pNeighborBssDesc->pNeighborBssDescription->channel;
2616 numChannels++;
2617 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002618 }
2619 }
2620
2621 pNeighborBssDesc = smeRrmGetNextBssEntryFromNeighborCache(pMac, pNeighborBssDesc);
2622 }
2623
2624 if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
2625 {
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002626#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07002627 // Before we free the existing channel list for a safety net make sure
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002628 // we have a union of the IAPP and the already existing list.
2629 status = csrNeighborRoamMergeChannelLists(
2630 pMac,
2631 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList,
2632 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels,
2633 channelList,
2634 numChannels,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002635 &numChannels );
2636#endif
2637
Jeff Johnson295189b2012-06-20 16:38:30 -07002638 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
2639 }
2640
2641 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07002642 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002643 /* Store the obtained channel list to the Neighbor Control data structure */
2644 if (numChannels)
2645 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = vos_mem_malloc((numChannels) * sizeof(tANI_U8));
2646 if (NULL == pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
2647 {
2648 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed.. TL event ignored"));
2649 return VOS_STATUS_E_RESOURCES;
2650 }
2651
2652 vos_mem_copy(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList,
2653 channelList, (numChannels) * sizeof(tANI_U8));
2654 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = numChannels;
2655 if (numChannels)
2656 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002657 smsLog(pMac, LOG1, FL("IAPP Neighbor list callback received as expected in state %d."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002658 pNeighborRoamInfo->neighborRoamState);
2659 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_TRUE;
2660 }
2661 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
2662 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE;
2663
2664 return VOS_STATUS_SUCCESS;
2665}
2666
2667/* ---------------------------------------------------------------------------
2668
2669 \fn csrNeighborRoamRRMNeighborReportResult
2670
2671 \brief This function is the neighbor report callback that will be invoked by
2672 SME RRM on receiving a neighbor report or of neighbor report is not
2673 received after timeout. On receiving a valid report, it generates a
2674 channel list from the neighbor report and starts the
2675 neighbor scan timer
2676
2677 \param context - The handle returned by macOpen.
2678 vosStatus - Status of the callback(SUCCESS/FAILURE)
2679
2680 \return VOID
2681
2682---------------------------------------------------------------------------*/
2683void csrNeighborRoamRRMNeighborReportResult(void *context, VOS_STATUS vosStatus)
2684{
2685 tpAniSirGlobal pMac = PMAC_STRUCT(context);
2686 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2687 eHalStatus status = eHAL_STATUS_SUCCESS;
2688
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002689 smsLog(pMac, LOG1, FL("Neighbor report result callback with status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002690 switch (pNeighborRoamInfo->neighborRoamState)
2691 {
2692 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY:
2693 /* Reset the report pending variable */
2694 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE;
2695 if (VOS_STATUS_SUCCESS == vosStatus)
2696 {
2697 /* Need to create channel list based on the neighbor AP list and transition to REPORT_SCAN state */
2698 vosStatus = csrNeighborRoamCreateChanListFromNeighborReport(pMac);
2699 if (VOS_STATUS_SUCCESS == vosStatus)
2700 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002701 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Channel List created from Neighbor report, Transitioning to NEIGHBOR_SCAN state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002702 }
2703
2704 /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */
2705 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
2706
2707 /* Now ready for neighbor scan based on the channel list created */
2708 /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is
2709 what palTimerStart expects */
2710 status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer,
2711 pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT,
2712 eANI_BOOLEAN_FALSE);
2713 if (eHAL_STATUS_SUCCESS != status)
2714 {
2715 /* Timer start failed.. Should we ASSERT here??? */
2716 smsLog(pMac, LOGE, FL("PAL Timer start for neighbor scan timer failed, status = %d, Ignoring state transition"), status);
2717 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
2718 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07002719 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002720 return;
2721 }
2722 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
2723 /* Neighbor scan timer started. Transition to REPORT_SCAN state */
2724 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
2725 }
2726 else
2727 {
2728 /* Neighbor report timeout happened in SME RRM. We can try sending more neighbor requests until we
2729 reach the maxNeighborRetries or receiving a successful neighbor response */
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002730 smsLog(pMac, LOGE, FL("Neighbor report result failed after %d retries, MAX RETRIES = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002731 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum, pNeighborRoamInfo->cfgParams.maxNeighborRetries);
2732 if (pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum >=
2733 pNeighborRoamInfo->cfgParams.maxNeighborRetries)
2734 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002735 smsLog(pMac, LOGE, FL("Bailing out to CFG Channel list scan.. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002736 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
2737 if (VOS_STATUS_SUCCESS != vosStatus)
2738 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002739 smsLog(pMac, LOGE, FL("Transit to CFG Channel list scan state failed with status %d "), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002740 return;
2741 }
2742 /* We transitioned to different state now. Reset the Neighbor report retry count */
2743 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
2744 }
2745 else
2746 {
2747 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
2748 if (VOS_STATUS_SUCCESS != vosStatus)
2749 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002750 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002751 return;
2752 }
2753 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
2754 /* Increment the neighbor report retry count after sending the neighbor request successfully */
2755 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
2756 }
2757 }
2758 break;
2759 default:
2760 smsLog(pMac, LOGE, FL("Neighbor result callback not expected in state %d, Ignoring.."), pNeighborRoamInfo->neighborRoamState);
2761 break;
2762 }
2763 return;
2764}
2765#endif /* WLAN_FEATURE_VOWIFI_11R */
2766
2767
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002768#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002769tANI_BOOLEAN csrNeighborRoamIsSsidAndSecurityMatch(
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002770 tpAniSirGlobal pMac,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002771 tCsrRoamConnectedProfile *pCurProfile,
2772 tSirBssDescription *pBssDesc,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002773 tDot11fBeaconIEs *pIes)
2774{
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002775 tCsrAuthList authType;
2776 tCsrEncryptionList uCEncryptionType;
2777 tCsrEncryptionList mCEncryptionType;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002778 tANI_BOOLEAN fMatch = FALSE;
2779
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002780 authType.numEntries = 1;
2781 authType.authType[0] = pCurProfile->AuthType;
2782 uCEncryptionType.numEntries = 1;
2783 uCEncryptionType.encryptionType[0] = pCurProfile->EncryptionType;
2784 mCEncryptionType.numEntries = 1;
2785 mCEncryptionType.encryptionType[0] = pCurProfile->mcEncryptionType;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002786
2787 if( pIes )
2788 {
2789 if(pIes->SSID.present)
2790 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002791 fMatch = csrIsSsidMatch( pMac,
2792 (void *)pCurProfile->SSID.ssId, pCurProfile->SSID.length,
2793 pIes->SSID.ssid, pIes->SSID.num_ssid,
2794 eANI_BOOLEAN_TRUE );
2795 if(TRUE == fMatch)
2796 {
2797 fMatch = csrIsSecurityMatch( pMac, &authType, &uCEncryptionType,
2798 &mCEncryptionType, pBssDesc, pIes, NULL, NULL, NULL );
2799 return (fMatch);
2800 }
2801 else
2802 {
2803 return (fMatch);
2804 }
2805
2806 }
2807 else
2808 {
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002809 return FALSE; // Treat a missing SSID as a non-match.
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002810 }
2811 }
2812 else
2813 {
2814 return FALSE; // Again, treat missing pIes as a non-match.
2815 }
2816}
2817
2818tANI_BOOLEAN csrNeighborRoamIsNewConnectedProfile(
2819 tpAniSirGlobal pMac)
2820{
2821 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2822 tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId;
2823 tCsrRoamConnectedProfile *pCurrProfile = NULL;
2824 tCsrRoamConnectedProfile *pPrevProfile = NULL;
2825 tDot11fBeaconIEs *pIes = NULL;
2826 tSirBssDescription *pBssDesc = NULL;
2827 tANI_BOOLEAN fNew = TRUE;
2828
2829 if(!(pMac->roam.roamSession && CSR_IS_SESSION_VALID(pMac, sessionId)))
2830 {
2831 return (fNew);
2832 }
2833
2834 pCurrProfile = &pMac->roam.roamSession[sessionId].connectedProfile;
2835 if( !pCurrProfile )
2836 {
2837 return (fNew);
2838}
2839
2840 pPrevProfile = &pNeighborRoamInfo->prevConnProfile;
2841 if( !pPrevProfile )
2842 {
2843 return (fNew);
2844 }
2845
2846 pBssDesc = pPrevProfile->pBssDesc;
2847 if (pBssDesc)
2848 {
2849 if (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac,
2850 pBssDesc, &pIes)) &&
2851 csrNeighborRoamIsSsidAndSecurityMatch(pMac, pCurrProfile, pBssDesc, pIes))
2852 {
2853 fNew = FALSE;
2854 }
2855 if (pIes) {
2856 palFreeMemory(pMac->hHdd, pIes);
2857 }
2858 }
2859
2860 if (fNew)
2861 {
2862 smsLog(pMac, LOG1, FL("Prev roam profile did not match current"));
2863 csrRoamFreeConnectProfile(pMac, pPrevProfile);
2864 csrRoamGetConnectProfile(pMac, sessionId, pPrevProfile);
2865 }
2866 else
2867 {
2868 smsLog(pMac, LOG1, FL("Prev roam profile matches current"));
2869 }
2870
2871 return (fNew);
2872}
2873
2874tANI_BOOLEAN csrNeighborRoamConnectedProfileMatch(
2875 tpAniSirGlobal pMac,
2876 tCsrScanResult *pResult,
2877 tDot11fBeaconIEs *pIes)
2878{
2879 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2880 tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId;
2881 tCsrRoamConnectedProfile *pCurProfile = NULL;
2882 tSirBssDescription *pBssDesc = &pResult->Result.BssDescriptor;
2883
2884 if( !(pMac->roam.roamSession
2885 && CSR_IS_SESSION_VALID(pMac, sessionId)))
2886 {
2887 return FALSE;
2888 }
2889
2890 pCurProfile = &pMac->roam.roamSession[sessionId].connectedProfile;
2891
2892 if( !pCurProfile)
2893 {
2894 return FALSE;
2895 }
2896
2897 return csrNeighborRoamIsSsidAndSecurityMatch(pMac, pCurProfile, pBssDesc, pIes);
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002898}
2899
2900/* ---------------------------------------------------------------------------
2901
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002902 \fn csrNeighborRoamPrepareNonOccupiedChannelList
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002903
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002904 \brief This function is used to prepare a channel list that is derived from
2905 the list of valid channels and does not include those in the occupied
2906 list.
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002907
2908 \param pMac - The handle returned by macOpen.
2909 \param pInputChannelList - The default channels list.
2910 \param numOfChannels - The number of channels in the default channels list.
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002911 \param pOutputChannelList - The place to put the non-occupied channel list.
2912 \param pOutputNumOfChannels - The number of channels in the non-occupied channel list.
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002913
2914 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2915
2916---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002917VOS_STATUS csrNeighborRoamPrepareNonOccupiedChannelList(
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002918 tpAniSirGlobal pMac,
2919 tANI_U8 *pInputChannelList,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002920 int numOfChannels,
2921 tANI_U8 *pOutputChannelList,
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002922 int *pOutputNumOfChannels
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002923 )
2924{
2925 int i = 0;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002926 int outputNumOfChannels = 0; // Clear the output number of channels
2927 tANI_U8 numOccupiedChannels = pMac->scan.occupiedChannels.numChannels;
2928 tANI_U8 *pOccupiedChannelList = pMac->scan.occupiedChannels.channelList;
2929
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002930 for (i = 0; i < numOfChannels; i++)
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002931 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002932 if (!csrIsChannelPresentInList(pOccupiedChannelList, numOccupiedChannels,
2933 pInputChannelList[i]))
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002934 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002935 pOutputChannelList[outputNumOfChannels++] = pInputChannelList[i];
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002936 }
2937 }
2938
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002939 smsLog(pMac, LOG2, FL("Number of channels in the valid channel list=%d; "
2940 "Number of channels in the non-occupied list list=%d"),
2941 numOfChannels, outputNumOfChannels);
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002942
2943 // Return the number of channels
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002944 *pOutputNumOfChannels = outputNumOfChannels;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002945
2946 return eHAL_STATUS_SUCCESS;
2947}
2948#endif /* FEATURE_WLAN_LFR */
2949
Jeff Johnson295189b2012-06-20 16:38:30 -07002950/* ---------------------------------------------------------------------------
2951
2952 \fn csrNeighborRoamTransitToCFGChanScan
2953
2954 \brief This function is called whenever there is a transition to CFG chan scan
2955 state from any state. It frees up the current channel list and allocates
2956 a new memory for the channels received from CFG item. It then starts the
2957 neighbor scan timer to perform the scan on each channel one by one
2958
2959 \param pMac - The handle returned by macOpen.
2960
2961 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2962
2963---------------------------------------------------------------------------*/
2964VOS_STATUS csrNeighborRoamTransitToCFGChanScan(tpAniSirGlobal pMac)
2965{
2966 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2967 eHalStatus status = eHAL_STATUS_SUCCESS;
2968 int i = 0;
2969 int numOfChannels = 0;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002970 tANI_U8 channelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002971 tpCsrChannelInfo currChannelListInfo;
2972
2973 currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002974
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002975 if (
Jeff Johnson295189b2012-06-20 16:38:30 -07002976#ifdef FEATURE_WLAN_CCX
2977 ((pNeighborRoamInfo->isCCXAssoc) &&
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002978 (pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == eANI_BOOLEAN_FALSE)) ||
Jeff Johnson295189b2012-06-20 16:38:30 -07002979 (pNeighborRoamInfo->isCCXAssoc == eANI_BOOLEAN_FALSE) ||
2980#endif // CCX
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002981 currChannelListInfo->numOfChannels == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07002982 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002983 smsLog(pMac, LOGW, FL("Building channel list to scan"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002984
2985
2986 /* Free up the channel list and allocate a new memory. This is because we dont know how much
2987 was allocated last time. If we directly copy more number of bytes than allocated earlier, this might
2988 result in memory corruption */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002989 if (NULL != currChannelListInfo->ChannelList)
Jeff Johnson295189b2012-06-20 16:38:30 -07002990 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08002991 vos_mem_free(currChannelListInfo->ChannelList);
2992 currChannelListInfo->ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07002993 currChannelListInfo->numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002994 }
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002995
2996 // Now obtain the contents for "channelList" (the "default valid channel list") from EITHER
2997 // the gNeighborScanChannelList in "cfg.ini", OR the actual "valid channel list" information formed by CSR.
2998 if (0 != pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels)
Jeff Johnson295189b2012-06-20 16:38:30 -07002999 {
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003000 // Copy the "default valid channel list" (channelList) from the gNeighborScanChannelList in "cfg.ini".
3001 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, "Using the channel list from cfg.ini");
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003002 status = csrNeighborRoamMergeChannelLists(
3003 pMac,
3004 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList,
3005 pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels,
3006 channelList,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003007 0, //NB: If 0, simply copy the input channel list to the output list.
3008 &numOfChannels );
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003009
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003010 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
3011 {
3012 csrNeighborRoamChannelsFilterByCurrentBand(
3013 pMac,
3014 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList,
3015 pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels,
3016 channelList,
3017 &numOfChannels);
3018 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003019
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003020 currChannelListInfo->ChannelList =
3021 vos_mem_malloc(numOfChannels*sizeof(tANI_U8));
3022 if (NULL == currChannelListInfo->ChannelList)
3023 {
3024 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed"));
3025 return VOS_STATUS_E_RESOURCES;
3026 }
3027
3028 vos_mem_copy(currChannelListInfo->ChannelList,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003029 channelList, numOfChannels * sizeof(tANI_U8));
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003030 }
Srikant Kuppa866893f2012-12-27 17:28:14 -08003031#ifdef FEATURE_WLAN_LFR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003032 else if ((pNeighborRoamInfo->uScanMode == DEFAULT_SCAN) &&
3033 (abs(pNeighborRoamInfo->lookupDOWNRssi) >
3034 abs(pNeighborRoamInfo->cfgParams.neighborReassocThreshold)))
Srikant Kuppa866893f2012-12-27 17:28:14 -08003035 {
3036 /*
3037 * Trigger a contiguous scan on all channels when the
3038 * RSSI in the lookup DOWN notification is below reassoc
3039 * threshold. This will help us find the best available
3040 * candidate and also update the channel cache.
3041 */
3042 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "Triggering contiguous scan "
3043 "(lookupDOWNRssi=%d,reassocThreshold=%d)",
3044 pNeighborRoamInfo->lookupDOWNRssi,
3045 pNeighborRoamInfo->cfgParams.neighborReassocThreshold*(-1));
3046
3047 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
3048
3049 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3050
3051 /* We are about to start a fresh scan cycle,
3052 * purge non-P2P results from the past */
3053 csrScanFlushSelectiveResult(pMac, VOS_FALSE);
3054
3055 csrNeighborRoamPerformContiguousBgScan(pMac);
3056
3057 /* Transition to CFG_CHAN_LIST_SCAN */
3058 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN);
3059
3060 return VOS_STATUS_SUCCESS;
3061 }
3062#endif
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003063 else
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003064 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003065 numOfChannels = pMac->scan.occupiedChannels.numChannels;
3066 if (numOfChannels
3067#ifdef FEATURE_WLAN_LFR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003068 && ((pNeighborRoamInfo->uScanMode == SPLIT_SCAN_OCCUPIED_LIST) ||
3069 (pNeighborRoamInfo->uEmptyScanCount == 0) ||
3070 ((pNeighborRoamInfo->uEmptyScanCount % 2) == 1))
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003071#endif
3072 )
Jeff Johnson295189b2012-06-20 16:38:30 -07003073 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003074 /*
3075 * Always scan channels in the occupied channel list
3076 * before scanning on the non-occupied list.
3077 */
Srinivas Girigowdade697412013-02-14 16:31:48 -08003078 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Switching to occupied channel list"
3079#ifdef FEATURE_WLAN_LFR
3080 "-uScanMode=%d, uEmptyScanCount=%d",
3081 pNeighborRoamInfo->uScanMode,
3082 pNeighborRoamInfo->uEmptyScanCount
3083#endif
3084 );
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003085 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
3086 {
3087 csrNeighborRoamChannelsFilterByCurrentBand(
3088 pMac,
3089 pMac->scan.occupiedChannels.channelList,
3090 numOfChannels,
3091 channelList,
3092 &numOfChannels);
3093 }
3094 else
3095 {
3096 vos_mem_copy(channelList,
3097 pMac->scan.occupiedChannels.channelList,
3098 numOfChannels * sizeof(tANI_U8));
3099 }
3100
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003101 VOS_ASSERT(currChannelListInfo->ChannelList == NULL);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003102 currChannelListInfo->ChannelList = vos_mem_malloc(numOfChannels * sizeof(tANI_U8));
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003103
3104 if (NULL == currChannelListInfo->ChannelList)
3105 {
3106 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed"));
3107 return VOS_STATUS_E_RESOURCES;
3108 }
3109 vos_mem_copy(currChannelListInfo->ChannelList,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003110 channelList,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003111 numOfChannels * sizeof(tANI_U8));
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003112 }
3113 else
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003114 {
3115 /* Scan all channels from non-occupied list */
3116 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Get valid channel list");
3117 numOfChannels = sizeof(pMac->roam.validChannelList);
3118
3119 if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac,
3120 (tANI_U8 *)pMac->roam.validChannelList,
3121 (tANI_U32 *) &numOfChannels)))
3122 {
3123#ifdef FEATURE_WLAN_LFR
3124 /*
3125 * Prepare non-occupied channel list (channelList)
3126 * from the actual "valid channel list" information
3127 * formed by CSR.
3128 */
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05303129 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, "Switching to non-occupied channel list");
Srinivas Girigowdade697412013-02-14 16:31:48 -08003130 status = csrNeighborRoamPrepareNonOccupiedChannelList(pMac,
3131 (tANI_U8 *)pMac->roam.validChannelList,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003132 numOfChannels,
3133 channelList,
3134 &numOfChannels);
3135#else
3136 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Merging channel list");
3137 status = csrNeighborRoamMergeChannelLists(
3138 pMac,
3139 (tANI_U8 *)pMac->roam.validChannelList,
3140 numOfChannels, // The number of channels in the validChannelList
3141 channelList,
3142 0, //NB: If 0, simply copy the input channel list to the output list.
3143 &numOfChannels ); // The final number of channels in the output list. Will be numOfChannels
3144#endif
3145 }
3146 else
3147 {
3148 smsLog(pMac, LOGE, FL("Could not get valid channel list"));
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003149 return VOS_STATUS_E_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003150 }
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003151
3152 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
3153 {
3154 csrNeighborRoamChannelsFilterByCurrentBand(
3155 pMac,
3156 (tANI_U8 *)pMac->roam.validChannelList,
3157 numOfChannels,
3158 channelList,
3159 &numOfChannels);
3160 }
3161
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003162 currChannelListInfo->ChannelList =
3163 vos_mem_malloc(numOfChannels*sizeof(tANI_U8));
3164
3165 if (NULL == currChannelListInfo->ChannelList)
3166 {
3167 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed"));
3168 return VOS_STATUS_E_RESOURCES;
3169 }
3170#ifdef FEATURE_WLAN_LFR
3171 vos_mem_copy(currChannelListInfo->ChannelList,
3172 channelList, numOfChannels * sizeof(tANI_U8));
3173#else
3174 vos_mem_copy(currChannelListInfo->ChannelList,
3175 (tANI_U8 *)pMac->roam.validChannelList,
3176 numOfChannels * sizeof(tANI_U8));
3177#endif
3178 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003179 }
3180
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003181 /* Adjust for the actual number that are used */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003182 currChannelListInfo->numOfChannels = numOfChannels;
Srikant Kuppa866893f2012-12-27 17:28:14 -08003183 NEIGHBOR_ROAM_DEBUG(pMac, LOGW,
3184 "Number of channels from CFG (or) (non-)occupied list=%d",
3185 currChannelListInfo->numOfChannels);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003186 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07003187 {
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05303188 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "Channel List from CFG (or) (non-)occupied list"
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003189 "= %d", currChannelListInfo->ChannelList[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003190 }
3191 }
3192
3193 /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */
3194 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
3195
3196 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3197 /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is
3198 what palTimerStart expects */
3199 status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer,
3200 pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT,
3201 eANI_BOOLEAN_FALSE);
3202
3203 if (eHAL_STATUS_SUCCESS != status)
3204 {
3205 /* Timer start failed.. */
3206 smsLog(pMac, LOGE, FL("Neighbor scan PAL Timer start failed, status = %d, Ignoring state transition"), status);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003207 vos_mem_free(currChannelListInfo->ChannelList);
3208 currChannelListInfo->ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07003209 currChannelListInfo->numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003210 return VOS_STATUS_E_FAILURE;
3211 }
3212
3213 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
3214 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE;
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05303215 /* We are about to start a fresh scan cycle,
3216 * purge non-P2P results from the past */
3217 csrScanFlushSelectiveResult(pMac, VOS_FALSE);
James Zmuda5ba36d02013-03-14 17:39:07 -07003218
3219 /* We are about to start a fresh scan cycle,
3220 * purge failed pre-auth results from the past */
3221 csrNeighborRoamPurgePreauthFailedList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003222
3223 /* Transition to CFG_CHAN_LIST_SCAN_STATE */
3224 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN)
3225
3226 return VOS_STATUS_SUCCESS;
3227}
3228
3229/* ---------------------------------------------------------------------------
3230
3231 \fn csrNeighborRoamNeighborLookupUpEvent
3232
3233 \brief This function is called as soon as TL indicates that the current AP's
3234 RSSI is better than the neighbor lookup threshold. Here, we transition to
3235 CONNECTED state and reset all the scan parameters
3236
3237 \param pMac - The handle returned by macOpen.
3238
3239 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3240
3241---------------------------------------------------------------------------*/
3242VOS_STATUS csrNeighborRoamNeighborLookupUpEvent(tpAniSirGlobal pMac)
3243{
3244 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3245 VOS_STATUS vosStatus;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07003246 csrNeighborRoamDeregAllRssiIndication(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003247
Jeff Johnson295189b2012-06-20 16:38:30 -07003248 /* Recheck whether the below check is needed. */
3249 if (pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)
3250 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)
Jeff Johnsone7245742012-09-05 17:12:55 -07003251
3252 /* Reset all the neighbor roam info control variables. Free all the allocated memory. It is like we are just associated now */
3253 csrNeighborRoamResetConnectedStateControlInfo(pMac);
3254
Jeff Johnson295189b2012-06-20 16:38:30 -07003255
3256 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event neighbor lookup callback with TL. RSSI = %d,"), pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
3257 /* Register Neighbor Lookup threshold callback with TL for DOWN event now */
3258 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
3259 WLANTL_HO_THRESHOLD_DOWN,
3260 csrNeighborRoamNeighborLookupDOWNCallback,
3261 VOS_MODULE_ID_SME, pMac);
Srikant Kuppa866893f2012-12-27 17:28:14 -08003262#ifdef FEATURE_WLAN_LFR
3263 pNeighborRoamInfo->lookupDOWNRssi = 0;
3264#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003265 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
3266 {
3267 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003268 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback DOWN event with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003269 }
3270
3271
3272 return vosStatus;
3273}
3274
3275/* ---------------------------------------------------------------------------
3276
3277 \fn csrNeighborRoamNeighborLookupDownEvent
3278
3279 \brief This function is called as soon as TL indicates that the current AP's
3280 RSSI falls below the current eighbor lookup threshold. Here, we transition to
3281 REPORT_QUERY for 11r association and CFG_CHAN_LIST_SCAN state if the assoc is
3282 a non-11R association.
3283
3284 \param pMac - The handle returned by macOpen.
3285
3286 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3287
3288---------------------------------------------------------------------------*/
3289VOS_STATUS csrNeighborRoamNeighborLookupDownEvent(tpAniSirGlobal pMac)
3290{
3291 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3292 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
3293 eHalStatus status = eHAL_STATUS_SUCCESS;
3294
3295 switch (pNeighborRoamInfo->neighborRoamState)
3296 {
3297 case eCSR_NEIGHBOR_ROAM_STATE_CONNECTED:
3298
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003299 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event neighbor lookup callback with TL. RSSI = %d,"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003300 pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
3301 /* De-register Neighbor Lookup threshold callback with TL */
3302 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
3303 WLANTL_HO_THRESHOLD_DOWN,
3304 csrNeighborRoamNeighborLookupDOWNCallback,
3305 VOS_MODULE_ID_SME);
3306
3307 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
3308 {
3309 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003310 smsLog(pMac, LOGW, FL(" Couldn't Deregister csrNeighborRoamNeighborLookupCallback DOWN event from TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003311 }
3312
3313
3314#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
3315 if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled))
3316 {
3317
3318 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state"));
3319 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
3320 if (VOS_STATUS_SUCCESS != vosStatus)
3321 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003322 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003323 return vosStatus;
3324 }
3325 /* Increment the neighbor report retry count after sending the neighbor request successfully */
3326 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
3327 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
3328 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY)
3329 }
3330 else
3331#endif
3332 {
3333 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Non 11R or CCX Association:Neighbor Lookup Down event received in CONNECTED state"));
3334
3335 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
3336 if (VOS_STATUS_SUCCESS != vosStatus)
3337 {
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08003338 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("csrNeighborRoamTransitToCFGChanScan failed"
3339 " with status=%d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003340 return vosStatus;
3341 }
3342 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003343 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 -07003344 /* Register Neighbor Lookup threshold callback with TL for UP event now */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003345 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext,
3346 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
Jeff Johnson295189b2012-06-20 16:38:30 -07003347 WLANTL_HO_THRESHOLD_UP,
3348 csrNeighborRoamNeighborLookupUPCallback,
3349 VOS_MODULE_ID_SME, pMac);
3350 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
3351 {
3352 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003353 smsLog(pMac, LOGE, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback UP event with TL: Status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07003354 }
3355 break;
3356 default:
3357 smsLog(pMac, LOGE, FL("DOWN event received in invalid state %d..Ignoring..."), pNeighborRoamInfo->neighborRoamState);
3358 break;
3359
3360 }
3361 return vosStatus;
3362}
3363
3364/* ---------------------------------------------------------------------------
3365
3366 \fn csrNeighborRoamNeighborLookupUPCallback
3367
3368 \brief This function is registered with TL to indicate whenever the RSSI
3369 gets better than the neighborLookup RSSI Threshold
3370
3371 \param pAdapter - VOS Context
3372 trafficStatus - UP/DOWN indication from TL
3373 pUserCtxt - Parameter for callback registered during callback registration. Should be pMac
3374
3375 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3376
3377---------------------------------------------------------------------------*/
3378VOS_STATUS csrNeighborRoamNeighborLookupUPCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
Srinivasdaaec712012-12-12 15:59:44 -08003379 v_PVOID_t pUserCtxt,
3380 v_S7_t avgRssi)
Jeff Johnson295189b2012-06-20 16:38:30 -07003381{
3382 tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt );
3383 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3384 VOS_STATUS vosStatus = eHAL_STATUS_SUCCESS;
3385
Srinivasdaaec712012-12-12 15:59:44 -08003386 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Neighbor Lookup UP indication callback called with notification %d Reported RSSI = %d"),
3387 rssiNotification,
3388 avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -07003389
3390 if(!csrIsConnStateConnectedInfra(pMac, pNeighborRoamInfo->csrSessionId))
3391 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003392 smsLog(pMac, LOGW, "Ignoring the indication as we are not connected");
Jeff Johnson295189b2012-06-20 16:38:30 -07003393 return VOS_STATUS_SUCCESS;
3394 }
3395
3396 VOS_ASSERT(WLANTL_HO_THRESHOLD_UP == rssiNotification);
3397 vosStatus = csrNeighborRoamNeighborLookupUpEvent(pMac);
3398 return vosStatus;
3399}
3400
3401/* ---------------------------------------------------------------------------
3402
3403 \fn csrNeighborRoamNeighborLookupDOWNCallback
3404
3405 \brief This function is registered with TL to indicate whenever the RSSI
3406 falls below the current neighborLookup RSSI Threshold
3407
3408 \param pAdapter - VOS Context
3409 trafficStatus - UP/DOWN indication from TL
3410 pUserCtxt - Parameter for callback registered during callback registration. Should be pMac
3411
3412 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3413
3414---------------------------------------------------------------------------*/
3415VOS_STATUS csrNeighborRoamNeighborLookupDOWNCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
Srinivasdaaec712012-12-12 15:59:44 -08003416 v_PVOID_t pUserCtxt,
3417 v_S7_t avgRssi)
Jeff Johnson295189b2012-06-20 16:38:30 -07003418{
3419 tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt );
3420 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3421 VOS_STATUS vosStatus = eHAL_STATUS_SUCCESS;
3422
Srinivasdaaec712012-12-12 15:59:44 -08003423 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Neighbor Lookup DOWN indication callback called with notification %d Reported RSSI = %d"),
3424 rssiNotification,
3425 avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -07003426
Srikant Kuppa866893f2012-12-27 17:28:14 -08003427#ifdef FEATURE_WLAN_LFR
3428 pNeighborRoamInfo->lookupDOWNRssi = avgRssi;
3429#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003430 if(!csrIsConnStateConnectedInfra(pMac, pNeighborRoamInfo->csrSessionId))
3431 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003432 smsLog(pMac, LOGW, "Ignoring the indication as we are not connected");
Jeff Johnson295189b2012-06-20 16:38:30 -07003433 return VOS_STATUS_SUCCESS;
3434 }
3435
3436 VOS_ASSERT(WLANTL_HO_THRESHOLD_DOWN == rssiNotification);
3437 vosStatus = csrNeighborRoamNeighborLookupDownEvent(pMac);
3438
3439 return vosStatus;
3440}
3441
3442#ifdef RSSI_HACK
3443extern int dumpCmdRSSI;
3444#endif
3445
3446/* ---------------------------------------------------------------------------
3447
3448 \fn csrNeighborRoamIndicateDisconnect
3449
3450 \brief This function is called by CSR as soon as the station disconnects from
3451 the AP. This function does the necessary cleanup of neighbor roam data
3452 structures. Neighbor roam state transitions to INIT state whenever this
3453 function is called except if the current state is REASSOCIATING
3454
3455 \param pMac - The handle returned by macOpen.
3456 sessionId - CSR session id that got disconnected
3457
3458 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
3459
3460---------------------------------------------------------------------------*/
3461eHalStatus csrNeighborRoamIndicateDisconnect(tpAniSirGlobal pMac, tANI_U8 sessionId)
3462{
3463 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3464
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003465 smsLog(pMac, LOGE, FL("Disconnect indication on session %d in state %d (sub-state %d)"),
Madan Mohan Koyyalamudi5ad3dff2012-10-21 11:32:02 -07003466 sessionId, pNeighborRoamInfo->neighborRoamState,
3467 pMac->roam.curSubState[sessionId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003468
3469#ifdef FEATURE_WLAN_CCX
3470 {
3471 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId);
3472 if (pSession->connectedProfile.isCCXAssoc)
3473 {
3474 vos_mem_copy(&pSession->prevApSSID, &pSession->connectedProfile.SSID, sizeof(tSirMacSSid));
3475 vos_mem_copy(pSession->prevApBssid, pSession->connectedProfile.bssid, sizeof(tSirMacAddr));
3476 pSession->prevOpChannel = pSession->connectedProfile.operationChannel;
3477 pSession->isPrevApInfoValid = TRUE;
3478 pSession->roamTS1 = vos_timer_get_system_time();
3479
3480 }
3481 }
3482#endif
3483
3484#ifdef RSSI_HACK
3485 dumpCmdRSSI = -40;
3486#endif
3487 switch (pNeighborRoamInfo->neighborRoamState)
3488 {
3489 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
3490 // Stop scan and neighbor refresh timers.
3491 // These are indeed not required when we are in reassociating
3492 // state.
3493 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3494 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -08003495 palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Madan Mohan Koyyalamudi5ad3dff2012-10-21 11:32:02 -07003496 if (!CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId )) {
3497 /*
3498 * Disconnect indication during Disassoc Handoff sub-state
3499 * is received when we are trying to disconnect with the old
3500 * AP during roam. BUT, if receive a disconnect indication
3501 * outside of Disassoc Handoff sub-state, then it means that
3502 * this is a genuine disconnect and we need to clean up.
3503 * Otherwise, we will be stuck in reassoc state which will
3504 * in-turn block scans (see csrIsScanAllowed).
3505 */
3506 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT);
3507 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003508 break;
3509
3510 case eCSR_NEIGHBOR_ROAM_STATE_INIT:
Jeff Johnson295189b2012-06-20 16:38:30 -07003511 csrNeighborRoamResetInitStateControlInfo(pMac);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07003512 csrNeighborRoamDeregAllRssiIndication(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003513 break;
3514
Srikant Kuppa866893f2012-12-27 17:28:14 -08003515 case eCSR_NEIGHBOR_ROAM_STATE_CONNECTED:
3516 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
3517 csrNeighborRoamResetConnectedStateControlInfo(pMac);
3518 csrNeighborRoamDeregAllRssiIndication(pMac);
3519 break;
3520
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07003521 case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:
3522 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT);
3523 csrNeighborRoamResetCfgListChanScanControlInfo(pMac);
3524 csrNeighborRoamDeregAllRssiIndication(pMac);
3525 break;
3526
3527 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
3528 /* Stop pre-auth to reassoc interval timer */
3529 palTimerStop(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer);
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07003530 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
3531 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
3532 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07003533 csrNeighborRoamResetPreauthControlInfo(pMac);
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07003534 csrNeighborRoamResetReportScanStateControlInfo(pMac);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07003535 csrNeighborRoamDeregAllRssiIndication(pMac);
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07003536 break;
3537
Jeff Johnson295189b2012-06-20 16:38:30 -07003538 default:
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07003539 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Received disconnect event in state %d"), pNeighborRoamInfo->neighborRoamState);
3540 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Transitioning to INIT state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003541 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07003542 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003543 }
3544 return eHAL_STATUS_SUCCESS;
3545}
3546
3547/* ---------------------------------------------------------------------------
3548
3549 \fn csrNeighborRoamIndicateConnect
3550
3551 \brief This function is called by CSR as soon as the station connects to an AP.
3552 This initializes all the necessary data structures related to the
3553 associated AP and transitions the state to CONNECTED state
3554
3555 \param pMac - The handle returned by macOpen.
3556 sessionId - CSR session id that got connected
3557 vosStatus - connect status SUCCESS/FAILURE
3558
3559 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
3560
3561---------------------------------------------------------------------------*/
3562eHalStatus csrNeighborRoamIndicateConnect(tpAniSirGlobal pMac, tANI_U8 sessionId, VOS_STATUS vosStatus)
3563{
3564 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3565 eHalStatus status = eHAL_STATUS_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07003566 VOS_STATUS vstatus;
3567
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003568#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003569 int init_ft_flag = FALSE;
3570#endif
3571
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07003572 smsLog(pMac, LOG2, FL("Connect indication received with session id %d in state %d"), sessionId, pNeighborRoamInfo->neighborRoamState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003573
3574 switch (pNeighborRoamInfo->neighborRoamState)
3575 {
3576 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
3577 if (VOS_STATUS_SUCCESS != vosStatus)
3578 {
3579 /* Just transition the state to INIT state. Rest of the clean up happens when we get next connect indication */
3580 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
3581 break;
3582 }
3583 /* Fall through if the status is SUCCESS */
3584 case eCSR_NEIGHBOR_ROAM_STATE_INIT:
3585 /* Reset all the data structures here */
3586 csrNeighborRoamResetInitStateControlInfo(pMac);
3587
Jeff Johnson295189b2012-06-20 16:38:30 -07003588 pNeighborRoamInfo->csrSessionId = sessionId;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003589
3590#ifdef FEATURE_WLAN_LFR
3591 /*
3592 * Initialize the occupied list ONLY if we are
3593 * transitioning from INIT state to CONNECTED state.
3594 */
3595 if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
3596 csrInitOccupiedChannelsList(pMac);
3597#endif
3598 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED);
3599
Jeff Johnson295189b2012-06-20 16:38:30 -07003600 vos_mem_copy(pNeighborRoamInfo->currAPbssid,
3601 pMac->roam.roamSession[sessionId].connectedProfile.bssid, sizeof(tCsrBssid));
3602 pNeighborRoamInfo->currAPoperationChannel = pMac->roam.roamSession[sessionId].connectedProfile.operationChannel;
3603 pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
3604 pNeighborRoamInfo->neighborScanTimerInfo.sessionId = sessionId;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003605 pNeighborRoamInfo->currentNeighborLookupThreshold =
3606 pNeighborRoamInfo->cfgParams.neighborLookupThreshold;
3607#ifdef FEATURE_WLAN_LFR
3608 pNeighborRoamInfo->uEmptyScanCount = 0;
Srikant Kuppa866893f2012-12-27 17:28:14 -08003609 pNeighborRoamInfo->lookupDOWNRssi = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08003610 pNeighborRoamInfo->uScanMode = DEFAULT_SCAN;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003611#endif
3612
Jeff Johnson295189b2012-06-20 16:38:30 -07003613
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003614#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003615 /* Now we can clear the preauthDone that was saved as we are connected afresh */
3616 csrNeighborRoamFreeRoamableBSSList(pMac, &pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
3617#endif
3618
3619#ifdef WLAN_FEATURE_VOWIFI_11R
3620 // Based on the auth scheme tell if we are 11r
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08003621 if ( csrIsAuthType11r( pMac->roam.roamSession[sessionId].connectedProfile.AuthType,
3622 pMac->roam.roamSession[sessionId].connectedProfile.MDID.mdiePresent))
Jeff Johnson295189b2012-06-20 16:38:30 -07003623 {
3624 if (pMac->roam.configParam.isFastTransitionEnabled)
3625 init_ft_flag = TRUE;
3626 pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_TRUE;
3627 }
3628 else
3629 pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07003630 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("11rAssoc is = %d"), pNeighborRoamInfo->is11rAssoc);
Jeff Johnson295189b2012-06-20 16:38:30 -07003631#endif
3632
3633#ifdef FEATURE_WLAN_CCX
3634 // Based on the auth scheme tell if we are 11r
3635 if (pMac->roam.roamSession[sessionId].connectedProfile.isCCXAssoc)
3636 {
3637 if (pMac->roam.configParam.isFastTransitionEnabled)
3638 init_ft_flag = TRUE;
3639 pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_TRUE;
3640 }
3641 else
3642 pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07003643 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("isCCXAssoc is = %d ft = %d"),
3644 pNeighborRoamInfo->isCCXAssoc, init_ft_flag);
Jeff Johnson295189b2012-06-20 16:38:30 -07003645
3646#endif
3647
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003648#ifdef FEATURE_WLAN_LFR
3649 // If "Legacy Fast Roaming" is enabled
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05303650 if (csrRoamIsFastRoamEnabled(pMac, sessionId))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003651 {
3652 init_ft_flag = TRUE;
3653 }
3654#endif
3655
3656#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003657 if ( init_ft_flag == TRUE )
3658 {
3659 /* Initialize all the data structures needed for the 11r FT Preauth */
Jeff Johnson295189b2012-06-20 16:38:30 -07003660 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
3661 csrNeighborRoamPurgePreauthFailedList(pMac);
3662
3663 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"), pNeighborRoamInfo->currentNeighborLookupThreshold);
3664 /* Register Neighbor Lookup threshold callback with TL for DOWN event only */
Jeff Johnson43971f52012-07-17 12:26:56 -07003665 vstatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
Jeff Johnson295189b2012-06-20 16:38:30 -07003666 WLANTL_HO_THRESHOLD_DOWN,
3667 csrNeighborRoamNeighborLookupDOWNCallback,
3668 VOS_MODULE_ID_SME, pMac);
Srikant Kuppa866893f2012-12-27 17:28:14 -08003669#ifdef FEATURE_WLAN_LFR
3670 pNeighborRoamInfo->lookupDOWNRssi = 0;
3671#endif
Jeff Johnson43971f52012-07-17 12:26:56 -07003672 if(!VOS_IS_STATUS_SUCCESS(vstatus))
Jeff Johnson295189b2012-06-20 16:38:30 -07003673 {
3674 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003675 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d"), vstatus);
Jeff Johnson43971f52012-07-17 12:26:56 -07003676 status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003677 }
3678 }
3679#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003680 break;
3681 default:
3682 smsLog(pMac, LOGE, FL("Connect event received in invalid state %d..Ignoring..."), pNeighborRoamInfo->neighborRoamState);
3683 break;
3684 }
3685 return status;
3686}
3687
3688
3689#ifdef WLAN_FEATURE_VOWIFI_11R
3690/* ---------------------------------------------------------------------------
3691
Jeff Johnson295189b2012-06-20 16:38:30 -07003692 \fn csrNeighborRoamPurgePreauthFailedList
3693
3694 \brief This function purges all the MAC addresses in the pre-auth fail list
3695
3696 \param pMac - The handle returned by macOpen.
3697
3698 \return VOID
3699
3700---------------------------------------------------------------------------*/
3701void csrNeighborRoamPurgePreauthFailedList(tpAniSirGlobal pMac)
3702{
3703 tANI_U8 i;
3704
3705 for (i = 0; i < pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.numMACAddress; i++)
3706 {
3707 vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.macAddress[i], sizeof(tSirMacAddr));
3708 }
3709 pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.numMACAddress = 0;
3710
3711 return;
3712}
3713
3714/* ---------------------------------------------------------------------------
3715
3716 \fn csrNeighborRoamInit11rAssocInfo
3717
3718 \brief This function initializes 11r related neighbor roam data structures
3719
3720 \param pMac - The handle returned by macOpen.
3721
3722 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
3723
3724---------------------------------------------------------------------------*/
3725eHalStatus csrNeighborRoamInit11rAssocInfo(tpAniSirGlobal pMac)
3726{
3727 eHalStatus status;
3728 tpCsr11rAssocNeighborInfo pFTRoamInfo = &pMac->roam.neighborRoamInfo.FTRoamInfo;
3729
3730 pMac->roam.neighborRoamInfo.is11rAssoc = eANI_BOOLEAN_FALSE;
3731 pMac->roam.neighborRoamInfo.cfgParams.maxNeighborRetries = pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries;
3732 pFTRoamInfo->neighborReportTimeout = CSR_NEIGHBOR_ROAM_REPORT_QUERY_TIMEOUT;
3733 pFTRoamInfo->PEPreauthRespTimeout = CSR_NEIGHBOR_ROAM_PREAUTH_RSP_WAIT_MULTIPLIER * pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
3734 pFTRoamInfo->neighborRptPending = eANI_BOOLEAN_FALSE;
3735 pFTRoamInfo->preauthRspPending = eANI_BOOLEAN_FALSE;
3736
Jeff Johnson295189b2012-06-20 16:38:30 -07003737 pMac->roam.neighborRoamInfo.FTRoamInfo.currentNeighborRptRetryNum = 0;
3738 pMac->roam.neighborRoamInfo.FTRoamInfo.numBssFromNeighborReport = 0;
3739 vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.neighboReportBssInfo,
3740 sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
3741
3742
3743 status = csrLLOpen(pMac->hHdd, &pFTRoamInfo->preAuthDoneList);
3744 if (eHAL_STATUS_SUCCESS != status)
3745 {
3746 smsLog(pMac, LOGE, FL("LL Open of preauth done AP List failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003747 return eHAL_STATUS_RESOURCES;
3748 }
3749 return status;
3750}
3751#endif /* WLAN_FEATURE_VOWIFI_11R */
3752
3753/* ---------------------------------------------------------------------------
3754
3755 \fn csrNeighborRoamInit
3756
3757 \brief This function initializes neighbor roam data structures
3758
3759 \param pMac - The handle returned by macOpen.
3760
3761 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
3762
3763---------------------------------------------------------------------------*/
3764eHalStatus csrNeighborRoamInit(tpAniSirGlobal pMac)
3765{
3766 eHalStatus status;
3767 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3768
3769 pNeighborRoamInfo->neighborRoamState = eCSR_NEIGHBOR_ROAM_STATE_CLOSED;
3770 pNeighborRoamInfo->prevNeighborRoamState = eCSR_NEIGHBOR_ROAM_STATE_CLOSED;
3771 pNeighborRoamInfo->csrSessionId = CSR_SESSION_ID_INVALID;
3772 pNeighborRoamInfo->cfgParams.maxChannelScanTime = pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime;
3773 pNeighborRoamInfo->cfgParams.minChannelScanTime = pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime;
3774 pNeighborRoamInfo->cfgParams.maxNeighborRetries = 0;
3775 pNeighborRoamInfo->cfgParams.neighborLookupThreshold = pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
3776 pNeighborRoamInfo->cfgParams.neighborReassocThreshold = pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold;
3777 pNeighborRoamInfo->cfgParams.neighborScanPeriod = pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod;
3778 pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod = pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
Srinivas Girigowdade697412013-02-14 16:31:48 -08003779 pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod = pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
3780
3781#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
3782 pNeighborRoamInfo->cfgParams.countryChannelInfo.revision = SME_KR_25;
3783 pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.ChannelList = NULL;
3784 pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels = 0;
3785
3786 if (0 == strncmp(pMac->scan.countryCodeCurrent, "KR", 2))
3787 {
3788 csrInitCountryValidChannelList(pMac, SME_KR_25);
3789 }
3790#endif
3791
3792 pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels =
Jeff Johnson295189b2012-06-20 16:38:30 -07003793 pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels;
3794
Srinivas Girigowdade697412013-02-14 16:31:48 -08003795 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList =
Jeff Johnson295189b2012-06-20 16:38:30 -07003796 vos_mem_malloc(pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels);
3797
3798 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
3799 {
3800 smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed"));
3801 return eHAL_STATUS_RESOURCES;
3802 }
3803
3804 /* Update the roam global structure from CFG */
Srinivas Girigowdade697412013-02-14 16:31:48 -08003805 palCopyMemory(pMac->hHdd, pNeighborRoamInfo->cfgParams.channelInfo.ChannelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07003806 pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList,
3807 pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels);
3808
3809 vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0);
3810 pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003811#ifdef FEATURE_WLAN_LFR
Srikant Kuppa866893f2012-12-27 17:28:14 -08003812 pNeighborRoamInfo->lookupDOWNRssi = 0;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003813 pNeighborRoamInfo->uEmptyScanCount = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08003814 pNeighborRoamInfo->uScanMode = DEFAULT_SCAN;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003815 palZeroMemory(pMac->hHdd, &pNeighborRoamInfo->prevConnProfile,
3816 sizeof(tCsrRoamConnectedProfile));
3817#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003818 pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE;
3819
3820 pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
3821 pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
3822 status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->neighborScanTimer,
3823 csrNeighborRoamNeighborScanTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
3824
3825 if (eHAL_STATUS_SUCCESS != status)
3826 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08003827 smsLog(pMac, LOGE, FL("Neighbor scan timer allocation failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003828 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
3829 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
3830 return eHAL_STATUS_RESOURCES;
3831 }
3832
3833 status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->neighborResultsRefreshTimer,
3834 csrNeighborRoamResultsRefreshTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
3835
3836 if (eHAL_STATUS_SUCCESS != status)
3837 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08003838 smsLog(pMac, LOGE, FL("Neighbor results refresh timer allocation failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003839 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
3840 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
3841 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3842 return eHAL_STATUS_RESOURCES;
3843 }
3844
Srinivas Girigowdade697412013-02-14 16:31:48 -08003845 status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->emptyScanRefreshTimer,
3846 csrNeighborRoamEmptyScanRefreshTimerCallback,
3847 (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
3848
3849 if (eHAL_STATUS_SUCCESS != status)
3850 {
3851 smsLog(pMac, LOGE, FL("Empty scan refresh timer allocation failed"));
3852 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
3853 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
3854 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3855 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
3856 return eHAL_STATUS_RESOURCES;
3857 }
3858
Jeff Johnson295189b2012-06-20 16:38:30 -07003859 status = csrLLOpen(pMac->hHdd, &pNeighborRoamInfo->roamableAPList);
3860 if (eHAL_STATUS_SUCCESS != status)
3861 {
3862 smsLog(pMac, LOGE, FL("LL Open of roamable AP List failed"));
3863 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
3864 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
3865 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3866 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -08003867 palTimerFree(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07003868 return eHAL_STATUS_RESOURCES;
3869 }
3870
3871 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX;
3872 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
3873 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
3874 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
3875 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
3876
3877#ifdef WLAN_FEATURE_VOWIFI_11R
3878 status = csrNeighborRoamInit11rAssocInfo(pMac);
3879 if (eHAL_STATUS_SUCCESS != status)
3880 {
3881 smsLog(pMac, LOGE, FL("LL Open of roamable AP List failed"));
3882 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
3883 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
3884 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3885 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -08003886 palTimerFree(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07003887 csrLLClose(&pNeighborRoamInfo->roamableAPList);
3888 return eHAL_STATUS_RESOURCES;
3889 }
3890#endif
3891 /* Initialize this with the current tick count */
3892 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
3893
3894 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
3895
3896 return eHAL_STATUS_SUCCESS;
3897}
3898
3899/* ---------------------------------------------------------------------------
3900
3901 \fn csrNeighborRoamClose
3902
3903 \brief This function closes/frees all the neighbor roam data structures
3904
3905 \param pMac - The handle returned by macOpen.
3906
3907 \return VOID
3908
3909---------------------------------------------------------------------------*/
3910void csrNeighborRoamClose(tpAniSirGlobal pMac)
3911{
3912 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3913
3914 if (eCSR_NEIGHBOR_ROAM_STATE_CLOSED == pNeighborRoamInfo->neighborRoamState)
3915 {
Madan Mohan Koyyalamudi8b7f1e62012-10-05 14:56:51 -07003916 smsLog(pMac, LOGW, FL("Neighbor Roam Algorithm Already Closed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003917 return;
3918 }
3919
3920 if (pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
3921 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
3922
3923 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
3924
3925 pNeighborRoamInfo->neighborScanTimerInfo.pMac = NULL;
3926 pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
3927 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3928 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -08003929 palTimerFree(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07003930
3931 /* Should free up the nodes in the list before closing the double Linked list */
3932 csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList);
3933 csrLLClose(&pNeighborRoamInfo->roamableAPList);
3934
3935 if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
3936 {
3937 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
3938 }
3939
3940 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
3941 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX;
3942 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
3943 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
3944 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
3945 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
3946
3947 /* Free the profile.. */
3948 csrReleaseProfile(pMac, &pNeighborRoamInfo->csrNeighborRoamProfile);
Sandeep Pc4818ef2012-12-13 14:19:25 -08003949#ifdef FEATURE_WLAN_LFR
Sandeep Pc2b00f62012-12-12 16:44:44 -08003950 csrRoamFreeConnectProfile(pMac, &pNeighborRoamInfo->prevConnProfile);
Sandeep Pc4818ef2012-12-13 14:19:25 -08003951#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003952#ifdef WLAN_FEATURE_VOWIFI_11R
3953 pMac->roam.neighborRoamInfo.FTRoamInfo.currentNeighborRptRetryNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003954 pMac->roam.neighborRoamInfo.FTRoamInfo.numBssFromNeighborReport = 0;
3955 vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.neighboReportBssInfo,
3956 sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
3957 csrNeighborRoamFreeRoamableBSSList(pMac, &pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
3958 csrLLClose(&pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
3959#endif /* WLAN_FEATURE_VOWIFI_11R */
3960
3961 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CLOSED)
3962
3963 return;
3964}
3965
3966/* ---------------------------------------------------------------------------
3967
3968 \fn csrNeighborRoamRequestHandoff
3969
3970 \brief This function triggers actual switching from one AP to the new AP.
3971 It issues disassociate with reason code as Handoff and CSR as a part of
3972 handling disassoc rsp, issues reassociate to the new AP
3973
3974 \param pMac - The handle returned by macOpen.
3975
3976 \return VOID
3977
3978---------------------------------------------------------------------------*/
3979void csrNeighborRoamRequestHandoff(tpAniSirGlobal pMac)
3980{
3981
3982 tCsrRoamInfo roamInfo;
3983 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3984 tANI_U32 sessionId = pNeighborRoamInfo->csrSessionId;
3985 tCsrNeighborRoamBSSInfo handoffNode;
3986 extern void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeDisassocRsp );
3987 tANI_U32 roamId = 0;
3988
3989 if (pMac->roam.neighborRoamInfo.neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE)
3990 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003991 smsLog(pMac, LOGE, FL("Roam requested when Neighbor roam is in %d state"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003992 pMac->roam.neighborRoamInfo.neighborRoamState);
3993 return;
3994 }
3995
3996 vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo));
3997 csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId, &roamInfo, roamId, eCSR_ROAM_FT_START,
3998 eSIR_SME_SUCCESS);
3999
4000 vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo));
4001 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING)
4002
4003 csrNeighborRoamGetHandoffAPInfo(pMac, &handoffNode);
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08004004 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
4005 FL("HANDOFF CANDIDATE BSSID %02x:%02x:%02x:%02x:%02x:%02x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004006 handoffNode.pBssDescription->bssId[0],
4007 handoffNode.pBssDescription->bssId[1],
4008 handoffNode.pBssDescription->bssId[2],
4009 handoffNode.pBssDescription->bssId[3],
4010 handoffNode.pBssDescription->bssId[4],
4011 handoffNode.pBssDescription->bssId[5]);
4012
4013 /* Free the profile.. Just to make sure we dont leak memory here */
4014 csrReleaseProfile(pMac, &pNeighborRoamInfo->csrNeighborRoamProfile);
4015 /* Create the Handoff AP profile. Copy the currently connected profile and update only the BSSID and channel number
4016 This should happen before issuing disconnect */
4017 csrRoamCopyConnectedProfile(pMac, pNeighborRoamInfo->csrSessionId, &pNeighborRoamInfo->csrNeighborRoamProfile);
4018 vos_mem_copy(pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, handoffNode.pBssDescription->bssId, sizeof(tSirMacAddr));
4019 pNeighborRoamInfo->csrNeighborRoamProfile.ChannelInfo.ChannelList[0] = handoffNode.pBssDescription->channelId;
4020
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004021 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, " csrRoamHandoffRequested: disassociating with current AP");
Jeff Johnson295189b2012-06-20 16:38:30 -07004022
4023 if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_HANDOFF)))
4024 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004025 smsLog(pMac, LOGW, "csrRoamHandoffRequested: fail to issue disassociate");
Jeff Johnson295189b2012-06-20 16:38:30 -07004026 return;
4027 }
4028
4029 //notify HDD for handoff, providing the BSSID too
4030 roamInfo.reasonCode = eCsrRoamReasonBetterAP;
4031
4032 vos_mem_copy(roamInfo.bssid,
4033 handoffNode.pBssDescription->bssId,
4034 sizeof( tCsrBssid ));
4035
4036 csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE);
4037
4038
4039 return;
4040}
4041
4042/* ---------------------------------------------------------------------------
4043
4044 \fn csrNeighborRoamIsHandoffInProgress
4045
4046 \brief This function returns whether handoff is in progress or not based on
4047 the current neighbor roam state
4048
4049 \param pMac - The handle returned by macOpen.
4050 is11rReassoc - Return whether reassoc is of type 802.11r reassoc
4051
4052 \return eANI_BOOLEAN_TRUE if reassoc in progress, eANI_BOOLEAN_FALSE otherwise
4053
4054---------------------------------------------------------------------------*/
4055tANI_BOOLEAN csrNeighborRoamIsHandoffInProgress(tpAniSirGlobal pMac)
4056{
4057 if (eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING == pMac->roam.neighborRoamInfo.neighborRoamState)
4058 return eANI_BOOLEAN_TRUE;
4059
4060 return eANI_BOOLEAN_FALSE;
4061}
4062
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08004063#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(WLAN_FEATURE_NEIGHBOR_ROAMING)
Jeff Johnson295189b2012-06-20 16:38:30 -07004064/* ---------------------------------------------------------------------------
4065
4066 \fn csrNeighborRoamIs11rAssoc
4067
4068 \brief This function returns whether the current association is a 11r assoc or not
4069
4070 \param pMac - The handle returned by macOpen.
4071
4072 \return eANI_BOOLEAN_TRUE if current assoc is 11r, eANI_BOOLEAN_FALSE otherwise
4073
4074---------------------------------------------------------------------------*/
4075tANI_BOOLEAN csrNeighborRoamIs11rAssoc(tpAniSirGlobal pMac)
4076{
4077 return pMac->roam.neighborRoamInfo.is11rAssoc;
4078}
4079#endif /* WLAN_FEATURE_VOWIFI_11R */
4080
4081
4082/* ---------------------------------------------------------------------------
4083
4084 \fn csrNeighborRoamGetHandoffAPInfo
4085
4086 \brief This function returns the best possible AP for handoff. For 11R case, it
4087 returns the 1st entry from pre-auth done list. For non-11r case, it returns
4088 the 1st entry from roamable AP list
4089
4090 \param pMac - The handle returned by macOpen.
4091 pHandoffNode - AP node that is the handoff candidate returned
4092
4093 \return VOID
4094
4095---------------------------------------------------------------------------*/
4096void csrNeighborRoamGetHandoffAPInfo(tpAniSirGlobal pMac, tpCsrNeighborRoamBSSInfo pHandoffNode)
4097{
4098 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4099 tpCsrNeighborRoamBSSInfo pBssNode;
4100
4101 VOS_ASSERT(NULL != pHandoffNode);
4102
4103#ifdef WLAN_FEATURE_VOWIFI_11R
4104 if (pNeighborRoamInfo->is11rAssoc)
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
4112#ifdef FEATURE_WLAN_CCX
4113 if (pNeighborRoamInfo->isCCXAssoc)
4114 {
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 Johnson04dd8a82012-06-29 20:41:40 -07004121#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05304122 if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004123 {
4124 /* Always the BSS info in the head is the handoff candidate */
4125 pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL);
4126 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList));
4127 }
4128 else
4129#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004130 {
4131 pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL);
4132 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->roamableAPList));
4133 }
4134 vos_mem_copy(pHandoffNode, pBssNode, sizeof(tCsrNeighborRoamBSSInfo));
4135
4136 return;
4137}
4138
4139/* ---------------------------------------------------------------------------
4140 \brief This function returns TRUE if preauth is completed
4141
4142 \param pMac - The handle returned by macOpen.
4143
4144 \return boolean
4145
4146---------------------------------------------------------------------------*/
4147tANI_BOOLEAN csrNeighborRoamStatePreauthDone(tpAniSirGlobal pMac)
4148{
4149 return (pMac->roam.neighborRoamInfo.neighborRoamState ==
4150 eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE);
4151}
4152
4153/* ---------------------------------------------------------------------------
4154 \brief In the event that we are associated with AP1 and we have
4155 completed pre auth with AP2. Then we receive a deauth/disassoc from
4156 AP1.
4157 At this point neighbor roam is in pre auth done state, pre auth timer
4158 is running. We now handle this case by stopping timer and clearing
4159 the pre-auth state. We basically clear up and just go to disconnected
4160 state.
4161
4162 \param pMac - The handle returned by macOpen.
4163
4164 \return boolean
4165---------------------------------------------------------------------------*/
4166void csrNeighborRoamTranistionPreauthDoneToDisconnected(tpAniSirGlobal pMac)
4167{
4168 if (pMac->roam.neighborRoamInfo.neighborRoamState !=
4169 eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE) return;
4170
4171 // Stop timer
4172 palTimerStop(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer);
4173
4174 // Transition to init state
4175 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
4176}
4177
Srikant Kuppafef66a72013-01-30 17:32:44 -08004178/* ---------------------------------------------------------------------------
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08004179 \brief This function returns TRUE if background scan triggered by
4180 LFR is in progress.
Srikant Kuppafef66a72013-01-30 17:32:44 -08004181
4182 \param halHandle - The handle from HDD context.
4183
4184 \return boolean
4185
4186---------------------------------------------------------------------------*/
4187tANI_BOOLEAN csrNeighborRoamScanRspPending (tHalHandle hHal)
4188{
4189 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4190 return (pMac->roam.neighborRoamInfo.scanRspPending);
4191}
4192
Srinivas Girigowdaa553c462013-03-07 19:42:52 -08004193/* ---------------------------------------------------------------------------
4194 \brief This function returns TRUE if STA is in the middle of roaming states
4195
4196 \param halHandle - The handle from HDD context.
4197
4198 \return boolean
4199
4200---------------------------------------------------------------------------*/
4201tANI_BOOLEAN csrNeighborMiddleOfRoaming (tHalHandle hHal)
4202{
4203 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4204 tANI_BOOLEAN val = (eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4205 (eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4206 (eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4207 (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4208 (eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN == pMac->roam.neighborRoamInfo.neighborRoamState);
4209 return (val);
4210}
4211
Jeff Johnson295189b2012-06-20 16:38:30 -07004212#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */