blob: 33b3bb3bce8c6a958b508a1f4f6656a16925b8e3 [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
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700273 if ((pNeighborRoamInfo->is11rAssoc)
274#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
275 && !csrRoamIsRoamOffloadScanEnabled(pMac)
276#endif
277 )
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800278 {
279 if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
280 {
281 csrNeighborRoamIssuePreauthReq(pMac);
282 }
283 else
284 {
285 smsLog(pMac, LOGE, FL("11R Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState);
286 VOS_ASSERT(0);
287 }
288 }
289 else
290#endif
291
292#ifdef FEATURE_WLAN_CCX
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700293 if ((pNeighborRoamInfo->isCCXAssoc)
294#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
295 && !csrRoamIsRoamOffloadScanEnabled(pMac)
296#endif
297 )
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800298 {
299 if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
300 {
301 csrNeighborRoamIssuePreauthReq(pMac);
302 }
303 else
304 {
305 smsLog(pMac, LOGE, FL("CCX Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState);
306 VOS_ASSERT(0);
307 }
308 }
309 else
310#endif
311#ifdef FEATURE_WLAN_LFR
312 if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID))
313 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700314 if ((eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
315#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
316 || csrRoamIsRoamOffloadScanEnabled(pMac)
317#endif
318 )
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800319 {
320 csrNeighborRoamIssuePreauthReq(pMac);
321 }
322 else
323 {
324 smsLog(pMac, LOGE, FL("LFR Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState);
325 VOS_ASSERT(0);
326 }
327 }
328 else
329#endif
330 {
331 if (eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN == pNeighborRoamInfo->neighborRoamState)
332 {
333 csrNeighborRoamRequestHandoff(pMac);
334 }
335 else
336 {
337 smsLog(pMac, LOGE, FL("Non-11R Reassoc indication received in unexpected state %d"), pNeighborRoamInfo->neighborRoamState);
338 VOS_ASSERT(0);
339 }
340 }
341}
342
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700343VOS_STATUS csrNeighborRoamUpdateFastRoamingEnabled(tpAniSirGlobal pMac, const v_BOOL_t fastRoamEnabled)
344{
345 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
346 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
347
348 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
349 {
350 if (VOS_TRUE == fastRoamEnabled)
351 {
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700352#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
353 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
354 {
355 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_START, REASON_CONNECT);
356 } else {
357#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700358 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"),
359 pNeighborRoamInfo->currentNeighborLookupThreshold);
360 /* Register Neighbor Lookup threshold callback with TL for DOWN event only */
361 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
362 WLANTL_HO_THRESHOLD_DOWN,
363 csrNeighborRoamNeighborLookupDOWNCallback,
364 VOS_MODULE_ID_SME, pMac);
365 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
366 {
367 //err msg
368 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d"), vosStatus);
369 vosStatus = VOS_STATUS_E_FAILURE;
370 }
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700371#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
372 }
373#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700374 }
375 else if (VOS_FALSE == fastRoamEnabled)
376 {
377 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in CONNECTED state, so deregister all events"));
378 /* De-register existing lookup UP/DOWN, Rssi indications */
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700379#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
380 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
381 {
382 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_STOP, REASON_DISCONNECTED);
383 } else {
384#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700385 csrNeighborRoamDeregAllRssiIndication(pMac);
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700386#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
387 }
388#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700389 }
390 }
391 else if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
392 {
393 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in INIT state, Nothing to do"));
394 }
395 else
396 {
397 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Unexpected state %d, returning failure"), pNeighborRoamInfo->neighborRoamState);
398 vosStatus = VOS_STATUS_E_FAILURE;
399 }
400 return vosStatus;
401}
402
403#ifdef FEATURE_WLAN_CCX
404VOS_STATUS csrNeighborRoamUpdateCcxModeEnabled(tpAniSirGlobal pMac, const v_BOOL_t ccxMode)
405{
406 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
407 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
408
409 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
410 {
411 if (VOS_TRUE == ccxMode)
412 {
413 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"),
414 pNeighborRoamInfo->currentNeighborLookupThreshold);
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700415#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
416 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
417 {
418 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_START, REASON_CONNECT);
419 } else {
420#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700421 /* Register Neighbor Lookup threshold callback with TL for DOWN event only */
422 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
423 WLANTL_HO_THRESHOLD_DOWN,
424 csrNeighborRoamNeighborLookupDOWNCallback,
425 VOS_MODULE_ID_SME, pMac);
426 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
427 {
428 //err msg
429 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d"), vosStatus);
430 vosStatus = VOS_STATUS_E_FAILURE;
431 }
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700432#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
433 }
434#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700435 }
436 else if (VOS_FALSE == ccxMode)
437 {
438 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in CONNECTED state, so deregister all events"));
439 /* De-register existing lookup UP/DOWN, Rssi indications */
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700440#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
441 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
442 {
443 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_STOP, REASON_DISCONNECTED);
444 } else {
445#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700446 csrNeighborRoamDeregAllRssiIndication(pMac);
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700447#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
448 }
449#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700450 }
451 }
452 else if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
453 {
454 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in INIT state, Nothing to do"));
455 }
456 else
457 {
458 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Unexpected state %d, returning failure"), pNeighborRoamInfo->neighborRoamState);
459 vosStatus = VOS_STATUS_E_FAILURE;
460 }
461 return vosStatus;
462}
463
464#endif
465
466
Srinivas Girigowdade697412013-02-14 16:31:48 -0800467VOS_STATUS csrNeighborRoamSetLookupRssiThreshold(tpAniSirGlobal pMac, v_U8_t neighborLookupRssiThreshold)
468{
469 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
470 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
471
472 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
473 {
474 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in CONNECTED state, so deregister all and re-register for DOWN event again"));
475 /* De-register existing lookup UP/DOWN, Rssi indications */
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -0700476#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
477 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
478 {
479 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_STOP, REASON_DISCONNECTED);
480 }
481 else
482 {
483#endif
484 csrNeighborRoamDeregAllRssiIndication(pMac);
485#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
486 }
487#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -0800488 pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold = neighborLookupRssiThreshold;
489 pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold;
490
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -0700491#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
492 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
Srinivas Girigowdade697412013-02-14 16:31:48 -0800493 {
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -0700494 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_START, REASON_CONNECT);
Srinivas Girigowdade697412013-02-14 16:31:48 -0800495 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -0700496 else
497 {
498#endif
499 NEIGHBOR_ROAM_DEBUG(pMac, LOG2,
500 FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"),
501 pNeighborRoamInfo->currentNeighborLookupThreshold);
502 /* Register Neighbor Lookup threshold callback with TL for DOWN event only */
503 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext,
504 (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
505 WLANTL_HO_THRESHOLD_DOWN,
506 csrNeighborRoamNeighborLookupDOWNCallback,
507 VOS_MODULE_ID_SME, pMac);
508 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
509 {
510 //err msg
511 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d"), vosStatus);
512 vosStatus = VOS_STATUS_E_FAILURE;
513 }
514#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
515 }
516#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -0800517 }
518 else if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
519 {
520 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in INIT state, safe to set lookupRssi threshold"));
521 pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold = neighborLookupRssiThreshold;
522 pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold;
523 }
524 else
525 {
526 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Unexpected state %d, returning failure"), pNeighborRoamInfo->neighborRoamState);
527 vosStatus = VOS_STATUS_E_FAILURE;
528 }
529 return vosStatus;
530}
531
Jeff Johnson295189b2012-06-20 16:38:30 -0700532/* ---------------------------------------------------------------------------
533
534 \fn csrNeighborRoamReassocIndCallback
535
536 \brief Reassoc callback invoked by TL on crossing the registered re-assoc threshold.
537 Directly triggere HO in case of non-11r association
538 In case of 11R association, triggers a pre-auth eventually followed by actual HO
539
540 \param pAdapter - VOS Context
541 trafficStatus - UP/DOWN indication from TL
542 pUserCtxt - Parameter for callback registered during callback registration. Should be pMac
543
544 \return VOID
545
546---------------------------------------------------------------------------*/
547VOS_STATUS csrNeighborRoamReassocIndCallback(v_PVOID_t pAdapter,
548 v_U8_t trafficStatus,
Srinivasdaaec712012-12-12 15:59:44 -0800549 v_PVOID_t pUserCtxt,
550 v_S7_t avgRssi)
Jeff Johnson295189b2012-06-20 16:38:30 -0700551{
552 tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt );
553 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
554 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
555
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800556 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 -0800557 pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
558 avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -0700559
560 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
561 WLANTL_HO_THRESHOLD_DOWN,
562 csrNeighborRoamReassocIndCallback,
563 VOS_MODULE_ID_SME);
564
565 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
566 {
567 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800568 smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 }
570
Srinivasdaaec712012-12-12 15:59:44 -0800571 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Rcvd reassoc notification-deregister UP indication. Threshold RSSI = %d Reported RSSI = %d"),
572 NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1), avgRssi);
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -0800573 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
574 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
575 WLANTL_HO_THRESHOLD_UP,
576 csrNeighborRoamNeighborLookupUPCallback,
577 VOS_MODULE_ID_SME);
Jeff Johnson295189b2012-06-20 16:38:30 -0700578
579 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
580 {
581 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800582 smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamNeighborLookupUPCallback with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 }
584
585 /* We dont need to run this timer any more. */
586 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -0800587 palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -0700588
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800589 csrNeighborRoamTriggerHandoff(pMac, pNeighborRoamInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700590
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 return VOS_STATUS_SUCCESS;
592}
593
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700594/*CleanUP Routines*/
595static void csrNeighborRoamResetChannelInfo(tpCsrNeighborRoamChannelInfo rChInfo)
596{
597 if ((rChInfo->IAPPNeighborListReceived == FALSE) &&
598 (rChInfo->currentChannelListInfo.numOfChannels))
599 {
600 rChInfo->currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX;
601 rChInfo->currentChannelListInfo.numOfChannels = 0;
602
603 if (rChInfo->currentChannelListInfo.ChannelList)
604 vos_mem_free(rChInfo->currentChannelListInfo.ChannelList);
605
606 rChInfo->currentChannelListInfo.ChannelList = NULL;
607 rChInfo->chanListScanInProgress = eANI_BOOLEAN_FALSE;
608 }
609 else
610 {
611 rChInfo->currentChanIndex = 0;
612 rChInfo->chanListScanInProgress = eANI_BOOLEAN_TRUE;
613 }
614}
615
616static void csrNeighborRoamResetCfgListChanScanControlInfo(tpAniSirGlobal pMac)
617{
618 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
619
620 /* Stop neighbor scan timer */
621 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
622
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -0700623 /* Stop neighbor scan results refresh timer */
624 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
625
Srinivas Girigowdade697412013-02-14 16:31:48 -0800626 /* Stop empty scan results refresh timer */
627 palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
628
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700629 /* Abort any ongoing scan */
630 if (eANI_BOOLEAN_TRUE == pNeighborRoamInfo->scanRspPending)
631 {
632 csrScanAbortMacScan(pMac);
633 }
634 pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE;
635
636 /* Reset roam channel list information */
637 csrNeighborRoamResetChannelInfo(&pNeighborRoamInfo->roamChannelInfo);
638}
639
640static void csrNeighborRoamResetPreauthControlInfo(tpAniSirGlobal pMac)
641{
642 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
643
644#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
645 pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700646 /* Purge pre-auth fail list */
647 csrNeighborRoamPurgePreauthFailedList(pMac);
648#endif
649
650 pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_FALSE;
651 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
652#ifdef WLAN_FEATURE_VOWIFI_11R
653 /* Do not free up the preauth done list here */
654 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
655 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE;
656 pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0;
657 vos_mem_zero(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700658#endif
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -0700659#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
660 pNeighborRoamInfo->uOsRequestedHandoff = 0;
661 vos_mem_zero(&pNeighborRoamInfo->handoffReqInfo, sizeof(tCsrHandoffRequest));
662#endif
663
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700664}
665
666static void csrNeighborRoamDeregAllRssiIndication(tpAniSirGlobal pMac)
667{
668 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
669 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
670
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800671 NEIGHBOR_ROAM_DEBUG(pMac, LOG2,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700672 FL("Deregister neighbor lookup UP callback with TL. RSSI = %d"),
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -0800673 NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1));
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700674
675 /* Deregister reassoc callback. Ignore return status */
676 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -0800677 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700678 WLANTL_HO_THRESHOLD_UP,
679 csrNeighborRoamNeighborLookupUPCallback,
680 VOS_MODULE_ID_SME);
681
682 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
683 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800684 smsLog(pMac, LOGW,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700685 FL("Couldn't deregister csrNeighborRoamNeighborLookupUPCallback "
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800686 "with TL: Status = %d"), vosStatus);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700687 }
688
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800689 NEIGHBOR_ROAM_DEBUG(pMac, LOG2,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700690 FL("Deregistering reassoc DOWN callback with TL. RSSI = %d"),
691 pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
692
693 /* Deregister reassoc callback. Ignore return status */
694 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
695 (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
696 WLANTL_HO_THRESHOLD_DOWN,
697 csrNeighborRoamReassocIndCallback,
698 VOS_MODULE_ID_SME);
699
700 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
701 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800702 smsLog(pMac, LOGW,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700703 FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with "
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800704 "TL: Status = %d"), vosStatus);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700705 }
706
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800707 NEIGHBOR_ROAM_DEBUG(pMac, LOG2,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700708 FL("Deregistering neighborLookup DOWN callback with TL. RSSI = %d"),
709 pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
710
711 /* Deregister neighbor lookup callback. Ignore return status */
712 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
713 (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
714 WLANTL_HO_THRESHOLD_DOWN,
715 csrNeighborRoamNeighborLookupDOWNCallback,
716 VOS_MODULE_ID_SME);
717
718 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
719 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800720 smsLog(pMac, LOGW,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700721 FL(" Couldn't deregister csrNeighborRoamNeighborLookupDOWNCallback "
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800722 "with TL: Status = %d"), vosStatus);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700723 }
724
725 /* Reset thresholds only after deregistering DOWN event from TL */
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700726 pNeighborRoamInfo->currentNeighborLookupThreshold =
727 pNeighborRoamInfo->cfgParams.neighborLookupThreshold;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -0800728#ifdef FEATURE_WLAN_LFR
729 pNeighborRoamInfo->uEmptyScanCount = 0;
Srikant Kuppa866893f2012-12-27 17:28:14 -0800730 pNeighborRoamInfo->lookupDOWNRssi = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -0800731 pNeighborRoamInfo->uScanMode = DEFAULT_SCAN;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -0800732#endif
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700733}
734
Jeff Johnson295189b2012-06-20 16:38:30 -0700735/* ---------------------------------------------------------------------------
736
737 \fn csrNeighborRoamResetConnectedStateControlInfo
738
739 \brief This function will reset the neighbor roam control info data structures.
740 This function should be invoked whenever we move to CONNECTED state from
741 any state other than INIT state
742
743 \param pMac - The handle returned by macOpen.
744
745 \return VOID
746
747---------------------------------------------------------------------------*/
748void csrNeighborRoamResetConnectedStateControlInfo(tpAniSirGlobal pMac)
749{
750 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
751
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700752 csrNeighborRoamResetChannelInfo(&pNeighborRoamInfo->roamChannelInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700753 csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700754
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700755 /* We dont need to run this timer any more. */
756 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -0800757 palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -0700758
759#ifdef WLAN_FEATURE_VOWIFI_11R
760 /* Do not free up the preauth done list here */
761 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
762 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE;
763 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
764 pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0;
765 pNeighborRoamInfo->FTRoamInfo.preauthRspPending = 0;
766 vos_mem_zero(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
Jeff Johnson295189b2012-06-20 16:38:30 -0700767#endif
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -0700768#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
769 pNeighborRoamInfo->uOsRequestedHandoff = 0;
770 vos_mem_zero(&pNeighborRoamInfo->handoffReqInfo, sizeof(tCsrHandoffRequest));
771#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700772}
773
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -0700774void csrNeighborRoamResetReportScanStateControlInfo(tpAniSirGlobal pMac)
Jeff Johnson295189b2012-06-20 16:38:30 -0700775{
776 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 pNeighborRoamInfo->csrSessionId = CSR_SESSION_ID_INVALID;
778 vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0);
779 pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
780 pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
Jeff Johnson295189b2012-06-20 16:38:30 -0700781#ifdef FEATURE_WLAN_CCX
782 pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_FALSE;
783 pNeighborRoamInfo->isVOAdmitted = eANI_BOOLEAN_FALSE;
784 pNeighborRoamInfo->MinQBssLoadRequired = 0;
785#endif
Madan Mohan Koyyalamudi595208a2012-10-05 12:48:38 -0700786
787 /* Stop scan refresh timer */
788 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -0800789 /* Stop empty scan results refresh timer */
790 palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700791 /* Purge roamable AP list */
792 csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 return;
794}
795
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -0700796/* ---------------------------------------------------------------------------
797
798 \fn csrNeighborRoamResetInitStateControlInfo
799
800 \brief This function will reset the neighbor roam control info data structures.
801 This function should be invoked whenever we move to CONNECTED state from
802 INIT state
803
804 \param pMac - The handle returned by macOpen.
805
806 \return VOID
807
808---------------------------------------------------------------------------*/
809void csrNeighborRoamResetInitStateControlInfo(tpAniSirGlobal pMac)
810{
811 csrNeighborRoamResetConnectedStateControlInfo(pMac);
812
813 /* In addition to the above resets, we should clear off the curAPBssId/Session ID in the timers */
814 csrNeighborRoamResetReportScanStateControlInfo(pMac);
815}
816
817
818
Jeff Johnson295189b2012-06-20 16:38:30 -0700819#ifdef WLAN_FEATURE_VOWIFI_11R
820/* ---------------------------------------------------------------------------
821
822 \fn csrNeighborRoamBssIdScanFilter
823
824 \brief This API is used to prepare a filter to obtain scan results when
825 we complete the scan in the REPORT_SCAN state after receiving a
826 valid neighbor report from AP. This filter includes BSSIDs received from
827 the neighbor report from the AP in addition to the other filter parameters
828 created from connected profile
829
830 \param pMac - The handle returned by macOpen.
831 pScanFilter - Scan filter to be filled and returned
832
833 \return eHAL_STATUS_SUCCESS on succesful filter creation, corresponding error
834 code otherwise
835
836---------------------------------------------------------------------------*/
837static eHalStatus csrNeighborRoamBssIdScanFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter)
838{
839 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
840 tANI_U8 i = 0;
841
842 VOS_ASSERT(pScanFilter != NULL);
Gopichand Nakkalad5a904e2013-03-29 01:07:54 +0530843 if (pScanFilter == NULL)
844 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 vos_mem_zero(pScanFilter, sizeof(tCsrScanResultFilter));
846
847 pScanFilter->BSSIDs.numOfBSSIDs = pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport;
848 pScanFilter->BSSIDs.bssid = vos_mem_malloc(sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs);
849 if (NULL == pScanFilter->BSSIDs.bssid)
850 {
851 smsLog(pMac, LOGE, FL("Scan Filter BSSID mem alloc failed"));
852 return eHAL_STATUS_FAILED_ALLOC;
853 }
854
855 vos_mem_zero(pScanFilter->BSSIDs.bssid, sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs);
856
857 /* Populate the BSSID from Neighbor BSS info received from neighbor report */
858 for (i = 0; i < pScanFilter->BSSIDs.numOfBSSIDs; i++)
859 {
860 vos_mem_copy(&pScanFilter->BSSIDs.bssid[i],
861 pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[i].neighborBssId, sizeof(tSirMacAddr));
862 }
863
864 /* Fill other general scan filter params */
865 return csrNeighborRoamPrepareScanProfileFilter(pMac, pScanFilter);
866}
867
868/* ---------------------------------------------------------------------------
869
870 \fn csrNeighborRoamPurgePreauthFailList
871
872 \brief This function empties the preauth fail list
873
874 \param pMac - The handle returned by macOpen.
875
876 \return VOID
877
878---------------------------------------------------------------------------*/
879void csrNeighborRoamPurgePreauthFailList(tpAniSirGlobal pMac)
880{
881 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
882
883 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Purging the preauth fail list"));
884 while (pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress)
885 {
886 vos_mem_zero(pNeighborRoamInfo->FTRoamInfo.preAuthFailList.macAddress[pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress-1],
887 sizeof(tSirMacAddr));
888 pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress--;
889 }
890 return;
891}
892
893/* ---------------------------------------------------------------------------
894
895 \fn csrNeighborRoamAddBssIdToPreauthFailList
896
897 \brief This function adds the given BSSID to the Preauth fail list
898
899 \param pMac - The handle returned by macOpen.
900 bssId - BSSID to be added to the preauth fail list
901
902 \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise
903
904---------------------------------------------------------------------------*/
905eHalStatus csrNeighborRoamAddBssIdToPreauthFailList(tpAniSirGlobal pMac, tSirMacAddr bssId)
906{
907 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
908
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800909 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 -0700910 bssId[0], bssId[1], bssId[2], bssId[3], bssId[4], bssId[5]);
911
912
913 if ((pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress + 1) >
914 MAX_NUM_PREAUTH_FAIL_LIST_ADDRESS)
915 {
916 smsLog(pMac, LOGE, FL("Preauth fail list already full.. Cannot add new one"));
917 return eHAL_STATUS_FAILURE;
918 }
919 vos_mem_copy(pNeighborRoamInfo->FTRoamInfo.preAuthFailList.macAddress[pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress],
920 bssId, sizeof(tSirMacAddr));
921 pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress++;
922
923 return eHAL_STATUS_SUCCESS;
924}
925
926/* ---------------------------------------------------------------------------
927
928 \fn csrNeighborRoamIsPreauthCandidate
929
930 \brief This function checks whether the given MAC address is already
931 present in the preauth fail list and returns TRUE/FALSE accordingly
932
933 \param pMac - The handle returned by macOpen.
934
935 \return eANI_BOOLEAN_TRUE if preauth candidate, eANI_BOOLEAN_FALSE otherwise
936
937---------------------------------------------------------------------------*/
938tANI_BOOLEAN csrNeighborRoamIsPreauthCandidate(tpAniSirGlobal pMac, tSirMacAddr bssId)
939{
940 tANI_U8 i = 0;
941 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
942
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700943#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
944 if (csrRoamIsRoamOffloadScanEnabled(pMac))
945 {
946 return eANI_BOOLEAN_TRUE;
947 }
948#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700949 if (0 == pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress)
950 return eANI_BOOLEAN_TRUE;
951
952 for (i = 0; i < pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress; i++)
953 {
954 if (VOS_TRUE == vos_mem_compare(pNeighborRoamInfo->FTRoamInfo.preAuthFailList.macAddress[i],
955 bssId, sizeof(tSirMacAddr)))
956 {
957 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("BSSID %02x:%02x:%02x:%02x:%02x:%02x already present in preauth fail list"),
958 bssId[0], bssId[1], bssId[2], bssId[3], bssId[4], bssId[5]);
959 return eANI_BOOLEAN_FALSE;
960 }
961 }
962
963 return eANI_BOOLEAN_TRUE;
964}
965
966/* ---------------------------------------------------------------------------
967
968 \fn csrNeighborRoamIssuePreauthReq
969
970 \brief This function issues preauth request to PE with the 1st AP entry in the
971 roamable AP list
972
973 \param pMac - The handle returned by macOpen.
974
975 \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise
976
977---------------------------------------------------------------------------*/
978static eHalStatus csrNeighborRoamIssuePreauthReq(tpAniSirGlobal pMac)
979{
980 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
981 eHalStatus status = eHAL_STATUS_SUCCESS;
982 tpCsrNeighborRoamBSSInfo pNeighborBssNode;
983
984 /* This must not be true here */
985 VOS_ASSERT(pNeighborRoamInfo->FTRoamInfo.preauthRspPending == eANI_BOOLEAN_FALSE);
986
987 /* Issue Preauth request to PE here */
988 /* Need to issue the preauth request with the BSSID that is there in the head of the roamable AP list */
989 /* Parameters that should be passed are BSSID, Channel number and the neighborScanPeriod(probably) */
990 /* If roamableAPList gets empty, should transition to REPORT_SCAN state */
991 pNeighborBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL);
992
993 if (NULL == pNeighborBssNode)
994 {
995 smsLog(pMac, LOG1, FL("Roamable AP list is empty.. "));
996 return eHAL_STATUS_FAILURE;
997 }
998 else
999 {
Madan Mohan Koyyalamudi286b60e2012-10-11 12:59:07 -07001000 status = csrRoamEnqueuePreauth(pMac, pNeighborRoamInfo->csrSessionId, pNeighborBssNode->pBssDescription,
1001 eCsrPerformPreauth, eANI_BOOLEAN_TRUE);
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05301002
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001003 smsLog(pMac, LOG1, FL("Before Pre-Auth: BSSID %02x:%02x:%02x:%02x:%02x:%02x, Ch:%d"),
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05301004 pNeighborBssNode->pBssDescription->bssId[0],
1005 pNeighborBssNode->pBssDescription->bssId[1],
1006 pNeighborBssNode->pBssDescription->bssId[2],
1007 pNeighborBssNode->pBssDescription->bssId[3],
1008 pNeighborBssNode->pBssDescription->bssId[4],
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001009 pNeighborBssNode->pBssDescription->bssId[5],
1010 (int)pNeighborBssNode->pBssDescription->channelId);
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05301011
Jeff Johnson295189b2012-06-20 16:38:30 -07001012 if (eHAL_STATUS_SUCCESS != status)
1013 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001014 smsLog(pMac, LOGE, FL("Send Preauth request to PE failed with status %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001015 return status;
1016 }
1017 }
1018
1019 pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_TRUE;
1020
1021 /* Increment the preauth retry count */
1022 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries++;
1023
1024 /* Transition the state to preauthenticating */
1025 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING)
Jeff Johnson295189b2012-06-20 16:38:30 -07001026
1027 return status;
1028}
1029
1030/* ---------------------------------------------------------------------------
1031
1032 \fn csrNeighborRoamPreauthRspHandler
1033
1034 \brief This function handle the Preauth response from PE
1035 Every preauth is allowed max 3 tries if it fails. If a bssid failed
1036 for more than MAX_TRIES, we will remove it from the list and try
1037 with the next node in the roamable AP list and add the BSSID to pre-auth failed
1038 list. If no more entries present in
1039 roamable AP list, transition to REPORT_SCAN state
1040
1041 \param pMac - The handle returned by macOpen.
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001042 limStatus - eSIR_SUCCESS/eSIR_FAILURE/eSIR_LIM_MAX_STA_REACHED_ERROR/
1043 eSIT_LIM_AUTH_RSP_TIMEOUT status from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07001044
Madan Mohan Koyyalamudi7a579cc2012-10-21 11:25:39 -07001045 \return eHAL_STATUS_SUCCESS on success (i.e. pre-auth processed),
1046 eHAL_STATUS_FAILURE otherwise
Jeff Johnson295189b2012-06-20 16:38:30 -07001047
1048---------------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001049eHalStatus csrNeighborRoamPreauthRspHandler(tpAniSirGlobal pMac, tSirRetStatus limStatus)
Jeff Johnson295189b2012-06-20 16:38:30 -07001050{
1051 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1052 eHalStatus status = eHAL_STATUS_SUCCESS;
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001053 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Madan Mohan Koyyalamudi7a579cc2012-10-21 11:25:39 -07001054 eHalStatus preauthProcessed = eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001055 tpCsrNeighborRoamBSSInfo pPreauthRspNode = NULL;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001056
1057 if (eANI_BOOLEAN_FALSE == pNeighborRoamInfo->FTRoamInfo.preauthRspPending)
1058 {
1059
1060 /* This can happen when we disconnect immediately
1061 * after sending a pre-auth request. During processing
1062 * of the disconnect command, we would have reset
1063 * preauthRspPending and transitioned to INIT state.
1064 */
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001065 NEIGHBOR_ROAM_DEBUG(pMac, LOGW,
1066 FL("Unexpected pre-auth response in state %d"),
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001067 pNeighborRoamInfo->neighborRoamState);
Madan Mohan Koyyalamudi7a579cc2012-10-21 11:25:39 -07001068 preauthProcessed = eHAL_STATUS_FAILURE;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001069 goto DEQ_PREAUTH;
1070 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001071
1072 // We can receive it in these 2 states.
Jeff Johnson295189b2012-06-20 16:38:30 -07001073 if ((pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING) &&
1074 (pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN))
1075 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001076 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Preauth response received in state %d"),
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001077 pNeighborRoamInfo->neighborRoamState);
Madan Mohan Koyyalamudi7a579cc2012-10-21 11:25:39 -07001078 preauthProcessed = eHAL_STATUS_FAILURE;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001079 goto DEQ_PREAUTH;
Jeff Johnson295189b2012-06-20 16:38:30 -07001080 }
1081
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001082 pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001083
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001084 if (eSIR_SUCCESS == limStatus)
Jeff Johnson295189b2012-06-20 16:38:30 -07001085 {
1086 pPreauthRspNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL);
1087 }
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001088 if ((eSIR_SUCCESS == limStatus) && (NULL != pPreauthRspNode))
Jeff Johnson295189b2012-06-20 16:38:30 -07001089 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001090 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Preauth completed successfully after %d tries"), pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries);
Jeff Johnson295189b2012-06-20 16:38:30 -07001091
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001092 smsLog(pMac, LOG1, FL("After Pre-Auth: BSSID %02x:%02x:%02x:%02x:%02x:%02x, Ch:%d"),
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05301093 pPreauthRspNode->pBssDescription->bssId[0],
1094 pPreauthRspNode->pBssDescription->bssId[1],
1095 pPreauthRspNode->pBssDescription->bssId[2],
1096 pPreauthRspNode->pBssDescription->bssId[3],
1097 pPreauthRspNode->pBssDescription->bssId[4],
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001098 pPreauthRspNode->pBssDescription->bssId[5],
1099 (int)pPreauthRspNode->pBssDescription->channelId);
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05301100
Jeff Johnson295189b2012-06-20 16:38:30 -07001101 /* Preauth competer successfully. Insert the preauthenticated node to tail of preAuthDoneList */
1102 csrNeighborRoamRemoveRoamableAPListEntry(pMac, &pNeighborRoamInfo->roamableAPList, pPreauthRspNode);
1103 csrLLInsertTail(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, &pPreauthRspNode->List, LL_ACCESS_LOCK);
1104
1105 /* Pre-auth completed successfully. Transition to PREAUTH Done state */
1106 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE)
1107 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
1108
1109 /* The caller of this function would start a timer and by the time it expires, supplicant should
1110 have provided the updated FTIEs to SME. So, when it expires, handoff will be triggered then */
1111 }
1112 else
1113 {
1114 tpCsrNeighborRoamBSSInfo pNeighborBssNode = NULL;
1115 tListElem *pEntry;
1116
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001117 smsLog(pMac, LOGE, FL("Preauth failed retry number %d, status = 0x%x"),
1118 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries, limStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07001119
1120 /* 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 -08001121 if ((pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries >=
1122 CSR_NEIGHBOR_ROAM_MAX_NUM_PREAUTH_RETRIES) ||
1123 (eSIR_LIM_MAX_STA_REACHED_ERROR == limStatus))
Jeff Johnson295189b2012-06-20 16:38:30 -07001124 {
1125 /* We are going to remove the node as it fails for more than MAX tries. Reset this count to 0 */
1126 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
1127
1128 /* The one in the head of the list should be one with which we issued pre-auth and failed */
1129 pEntry = csrLLRemoveHead(&pNeighborRoamInfo->roamableAPList, LL_ACCESS_LOCK);
1130 if(pEntry)
1131 {
1132 pNeighborBssNode = GET_BASE_ADDR(pEntry, tCsrNeighborRoamBSSInfo, List);
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07001133 /* Add the BSSID to pre-auth fail list if it is not requested by HDD */
1134#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1135 if(!pNeighborRoamInfo->uOsRequestedHandoff)
1136#endif
1137 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001138 status = csrNeighborRoamAddBssIdToPreauthFailList(pMac, pNeighborBssNode->pBssDescription->bssId);
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07001139 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001140 /* Now we can free this node */
1141 csrNeighborRoamFreeNeighborRoamBSSNode(pMac, pNeighborBssNode);
1142 }
1143 }
1144
1145 /* Issue preauth request for the same/next entry */
1146 if (eHAL_STATUS_SUCCESS == csrNeighborRoamIssuePreauthReq(pMac))
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001147 goto DEQ_PREAUTH;
Jeff Johnson295189b2012-06-20 16:38:30 -07001148
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001149#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1150 if (csrRoamIsRoamOffloadScanEnabled(pMac))
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001151 {
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07001152 pNeighborRoamInfo->uOsRequestedHandoff = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001153 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_RESTART, REASON_PREAUTH_FAILED_FOR_ALL);
1154 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED);
1155 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07001156 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001157#endif
1158 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN);
1159
1160 /* Register Neighbor Lookup threshold callback with TL for UP event now */
1161 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("No more pre-auth candidates-"
1162 "register UP indication with TL. RSSI = %d,"), NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1));
1163
1164 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext,
1165 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
1166 WLANTL_HO_THRESHOLD_UP,
1167 csrNeighborRoamNeighborLookupUPCallback,
1168 VOS_MODULE_ID_SME, pMac);
1169 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1170 {
1171 //err msg
1172 smsLog(pMac, LOGE, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback UP event with TL: Status = %d"), status);
1173 }
1174
1175 /* Start the neighbor results refresh timer and transition to REPORT_SCAN state to perform scan again */
1176 status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer,
1177 pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT,
1178 eANI_BOOLEAN_FALSE);
1179 if (eHAL_STATUS_SUCCESS != status)
1180 {
1181 smsLog(pMac, LOGE, FL("Neighbor results refresh timer start failed with status %d"), status);
1182 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001183 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001184#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001185 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001186#endif
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001187
1188DEQ_PREAUTH:
1189 csrRoamDequeuePreauth(pMac);
Madan Mohan Koyyalamudi7a579cc2012-10-21 11:25:39 -07001190 return preauthProcessed;
Jeff Johnson295189b2012-06-20 16:38:30 -07001191}
1192#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */
1193
1194/* ---------------------------------------------------------------------------
1195
1196 \fn csrNeighborRoamPrepareScanProfileFilter
1197
1198 \brief This function creates a scan filter based on the currently connected profile.
1199 Based on this filter, scan results are obtained
1200
1201 \param pMac - The handle returned by macOpen.
1202 pScanFilter - Populated scan filter based on the connected profile
1203
1204 \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise
1205
1206---------------------------------------------------------------------------*/
1207eHalStatus csrNeighborRoamPrepareScanProfileFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter)
1208{
1209 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1210 tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId;
1211 tCsrRoamConnectedProfile *pCurProfile = &pMac->roam.roamSession[sessionId].connectedProfile;
1212 tANI_U8 i = 0;
1213
1214 VOS_ASSERT(pScanFilter != NULL);
Gopichand Nakkalad5a904e2013-03-29 01:07:54 +05301215 if (pScanFilter == NULL)
1216 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001217
1218 vos_mem_zero(pScanFilter, sizeof(tCsrScanResultFilter));
1219
1220 /* We dont want to set BSSID based Filter */
1221 pScanFilter->BSSIDs.numOfBSSIDs = 0;
1222
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07001223 //only for HDD requested handoff fill in the BSSID in the filter
1224#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1225 if (pNeighborRoamInfo->uOsRequestedHandoff)
1226 {
1227 pScanFilter->BSSIDs.numOfBSSIDs = 1;
1228 pScanFilter->BSSIDs.bssid = vos_mem_malloc(sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs);
1229 if (NULL == pScanFilter->BSSIDs.bssid)
1230 {
1231 smsLog(pMac, LOGE, FL("Scan Filter BSSID mem alloc failed"));
1232 return eHAL_STATUS_FAILED_ALLOC;
1233 }
1234
1235 vos_mem_zero(pScanFilter->BSSIDs.bssid, sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs);
1236
1237 /* Populate the BSSID from handoff info received from HDD */
1238 for (i = 0; i < pScanFilter->BSSIDs.numOfBSSIDs; i++)
1239 {
1240 vos_mem_copy(&pScanFilter->BSSIDs.bssid[i],
1241 pNeighborRoamInfo->handoffReqInfo.bssid, sizeof(tSirMacAddr));
1242 }
1243 }
1244#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001245 /* Populate all the information from the connected profile */
1246 pScanFilter->SSIDs.numOfSSIDs = 1;
1247 pScanFilter->SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo));
1248 if (NULL == pScanFilter->SSIDs.SSIDList)
1249 {
1250 smsLog(pMac, LOGE, FL("Scan Filter SSID mem alloc failed"));
1251 return eHAL_STATUS_FAILED_ALLOC;
1252 }
1253 pScanFilter->SSIDs.SSIDList->handoffPermitted = 1;
1254 pScanFilter->SSIDs.SSIDList->ssidHidden = 0;
1255 pScanFilter->SSIDs.SSIDList->SSID.length = pCurProfile->SSID.length;
1256 vos_mem_copy((void *)pScanFilter->SSIDs.SSIDList->SSID.ssId, (void *)pCurProfile->SSID.ssId, pCurProfile->SSID.length);
1257
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05301258 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Filtering from scan results for"
1259 "SSID = 0x%08lx%08lx%08lx%08lx%08lx%08lx%08lx%08lx\nSSID Length = %d"),
1260 pScanFilter->SSIDs.SSIDList->SSID.ssId[0],
1261 pScanFilter->SSIDs.SSIDList->SSID.ssId[4],
1262 pScanFilter->SSIDs.SSIDList->SSID.ssId[8],
1263 pScanFilter->SSIDs.SSIDList->SSID.ssId[12],
1264 pScanFilter->SSIDs.SSIDList->SSID.ssId[16],
1265 pScanFilter->SSIDs.SSIDList->SSID.ssId[20],
1266 pScanFilter->SSIDs.SSIDList->SSID.ssId[24],
1267 pScanFilter->SSIDs.SSIDList->SSID.ssId[28],
1268 pScanFilter->SSIDs.SSIDList->SSID.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001269 pScanFilter->authType.numEntries = 1;
1270 pScanFilter->authType.authType[0] = pCurProfile->AuthType;
1271
1272 pScanFilter->EncryptionType.numEntries = 1; //This must be 1
1273 pScanFilter->EncryptionType.encryptionType[0] = pCurProfile->EncryptionType;
1274
1275 pScanFilter->mcEncryptionType.numEntries = 1;
1276 pScanFilter->mcEncryptionType.encryptionType[0] = pCurProfile->mcEncryptionType;
1277
1278 pScanFilter->BSSType = pCurProfile->BSSType;
1279
1280 /* We are intrested only in the scan results on channels that we scanned */
1281 pScanFilter->ChannelInfo.numOfChannels = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels;
1282 pScanFilter->ChannelInfo.ChannelList = vos_mem_malloc(pScanFilter->ChannelInfo.numOfChannels * sizeof(tANI_U8));
1283 if (NULL == pScanFilter->ChannelInfo.ChannelList)
1284 {
1285 smsLog(pMac, LOGE, FL("Scan Filter Channel list mem alloc failed"));
1286 vos_mem_free(pScanFilter->SSIDs.SSIDList);
1287 pScanFilter->SSIDs.SSIDList = NULL;
1288 return eHAL_STATUS_FAILED_ALLOC;
1289 }
1290 for (i = 0; i < pScanFilter->ChannelInfo.numOfChannels; i++)
1291 {
1292 pScanFilter->ChannelInfo.ChannelList[i] = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i];
1293 }
1294
1295#ifdef WLAN_FEATURE_VOWIFI_11R
1296 if (pNeighborRoamInfo->is11rAssoc)
1297 {
1298 /* MDIE should be added as a part of profile. This should be added as a part of filter as well */
1299 pScanFilter->MDID.mdiePresent = pCurProfile->MDID.mdiePresent;
1300 pScanFilter->MDID.mobilityDomain = pCurProfile->MDID.mobilityDomain;
1301 }
1302#endif
1303
1304 return eHAL_STATUS_SUCCESS;
1305}
1306
Jeff Johnson43971f52012-07-17 12:26:56 -07001307tANI_U32 csrGetCurrentAPRssi(tpAniSirGlobal pMac, tScanResultHandle *pScanResultList)
1308{
1309 tCsrScanResultInfo *pScanResult;
1310 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda2efea0e2013-01-24 17:40:41 -08001311#ifdef FEATURE_WLAN_LFR
1312 tANI_U32 CurrAPRssi = pNeighborRoamInfo->lookupDOWNRssi;
1313#else
1314 /* We are setting this as default value to make sure we return this value,
1315 when we do not see this AP in the scan result for some reason.However,it is
1316 less likely that we are associated to an AP and do not see it in the scan list */
1317 tANI_U32 CurrAPRssi = -125;
1318#endif
Jeff Johnson43971f52012-07-17 12:26:56 -07001319
1320 while (NULL != (pScanResult = csrScanResultGetNext(pMac, *pScanResultList)))
1321 {
1322
1323 if (VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId,
1324 pNeighborRoamInfo->currAPbssid, sizeof(tSirMacAddr)))
1325 {
1326 /* We got a match with the currently associated AP.
1327 * Capture the RSSI value and complete the while loop.
1328 * The while loop is completed in order to make the current entry go back to NULL,
1329 * and in the next while loop, it properly starts searching from the head of the list.
1330 * TODO: Can also try setting the current entry directly to NULL as soon as we find the new AP*/
1331
1332 CurrAPRssi = (int)pScanResult->BssDescriptor.rssi * (-1) ;
1333
1334 } else {
1335 continue;
1336 }
1337 }
1338
1339 return CurrAPRssi;
1340
1341}
1342
Jeff Johnson295189b2012-06-20 16:38:30 -07001343/* ---------------------------------------------------------------------------
1344
1345 \fn csrNeighborRoamProcessScanResults
1346
1347 \brief This function extracts scan results, sorts on the basis of neighbor score(todo).
1348 Assumed that the results are already sorted by RSSI by csrScanGetResult
1349
1350 \param pMac - The handle returned by macOpen.
1351 pScanResultList - Scan result result obtained from csrScanGetResult()
1352
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001353 \return tANI_BOOLEAN - return TRUE if we have a candidate we can immediately
1354 roam to. Otherwise, return FALSE.
Jeff Johnson295189b2012-06-20 16:38:30 -07001355
1356---------------------------------------------------------------------------*/
1357
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001358static tANI_BOOLEAN csrNeighborRoamProcessScanResults(tpAniSirGlobal pMac,
1359 tScanResultHandle *pScanResultList)
Jeff Johnson295189b2012-06-20 16:38:30 -07001360{
1361 tCsrScanResultInfo *pScanResult;
1362 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1363 tpCsrNeighborRoamBSSInfo pBssInfo;
Jeff Johnson43971f52012-07-17 12:26:56 -07001364 tANI_U32 CurrAPRssi;
1365 tANI_U8 RoamRssiDiff = pMac->roam.configParam.RoamRssiDiff;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001366#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
1367 tANI_U8 immediateRoamRssiDiff = pMac->roam.configParam.nImmediateRoamRssiDiff;
1368#endif
1369 tANI_BOOLEAN roamNow = eANI_BOOLEAN_FALSE;
Jeff Johnson43971f52012-07-17 12:26:56 -07001370
1371 /***************************************************************
1372 * Find out the Current AP RSSI and keep it handy to check if
1373 * it is better than the RSSI of the AP which we are
1374 * going to roam.If so, we are going to continue with the
1375 * current AP.
1376 ***************************************************************/
1377 CurrAPRssi = csrGetCurrentAPRssi(pMac, pScanResultList);
Jeff Johnson295189b2012-06-20 16:38:30 -07001378
1379 /* Expecting the scan result already to be in the sorted order based on the RSSI */
1380 /* Based on the previous state we need to check whether the list should be sorted again taking neighbor score into consideration */
1381 /* If previous state is CFG_CHAN_LIST_SCAN, there should not be any neighbor score associated with any of the BSS.
1382 If the previous state is REPORT_QUERY, then there will be neighbor score for each of the APs */
1383 /* For now, let us take the top of the list provided as it is by the CSR Scan result API. This means it is assumed that neighbor score
1384 and rssi score are in the same order. This will be taken care later */
1385
1386 while (NULL != (pScanResult = csrScanResultGetNext(pMac, *pScanResultList)))
1387 {
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001388 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
1389 FL("Scan result: BSSID %02x:%02x:%02x:%02x:%02x:%02x (Rssi %d, Ch:%d)"),
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001390 pScanResult->BssDescriptor.bssId[0],
1391 pScanResult->BssDescriptor.bssId[1],
1392 pScanResult->BssDescriptor.bssId[2],
1393 pScanResult->BssDescriptor.bssId[3],
1394 pScanResult->BssDescriptor.bssId[4],
1395 pScanResult->BssDescriptor.bssId[5],
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001396 abs(pScanResult->BssDescriptor.rssi),
1397 pScanResult->BssDescriptor.channelId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001398
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001399 if (VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 pNeighborRoamInfo->currAPbssid, sizeof(tSirMacAddr)))
1401 {
Jeff Johnson43971f52012-07-17 12:26:56 -07001402 /* currently associated AP. Do not have this in the roamable AP list */
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001403 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001404 "SKIP-currently associated AP");
Jeff Johnson295189b2012-06-20 16:38:30 -07001405 continue;
1406 }
1407
Jeff Johnson43971f52012-07-17 12:26:56 -07001408 /* This condition is to ensure to roam to an AP with better RSSI. if the value of RoamRssiDiff is Zero, this feature
1409 * is disabled and we continue to roam without any check*/
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001410 if ((RoamRssiDiff > 0)
1411#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1412 && !csrRoamIsRoamOffloadScanEnabled(pMac)
1413#endif
1414 )
Jeff Johnson43971f52012-07-17 12:26:56 -07001415 {
Madan Mohan Koyyalamudif553b742012-12-03 16:37:39 -08001416 /*
1417 * If RSSI is lower than the lookup threshold, then continue.
1418 */
1419 if (abs(pScanResult->BssDescriptor.rssi) >
1420 pNeighborRoamInfo->currentNeighborLookupThreshold)
1421 {
1422 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001423 "%s: [INFOLOG] new ap rssi (%d) lower than lookup threshold (%d)",
Madan Mohan Koyyalamudif553b742012-12-03 16:37:39 -08001424 __func__, (int)pScanResult->BssDescriptor.rssi * (-1),
1425 (int)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
1426 continue;
1427 }
1428
Jeff Johnson43971f52012-07-17 12:26:56 -07001429 if (abs(CurrAPRssi) < abs(pScanResult->BssDescriptor.rssi))
1430 {
1431 /*Do not roam to an AP with worse RSSI than the current*/
1432 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001433 "%s: [INFOLOG]Current AP rssi=%d new ap rssi worse=%d", __func__,
Jeff Johnson43971f52012-07-17 12:26:56 -07001434 CurrAPRssi,
1435 (int)pScanResult->BssDescriptor.rssi * (-1) );
1436 continue;
1437 } else {
1438 /*Do not roam to an AP which is having better RSSI than the current AP, but still less than the
1439 * margin that is provided by user from the ini file (RoamRssiDiff)*/
1440 if (abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)) < RoamRssiDiff)
1441 {
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001442 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001443 "%s: [INFOLOG]Current AP rssi=%d new ap rssi=%d not good enough, roamRssiDiff=%d", __func__,
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001444 CurrAPRssi,
1445 (int)pScanResult->BssDescriptor.rssi * (-1),
1446 RoamRssiDiff);
Jeff Johnson43971f52012-07-17 12:26:56 -07001447 continue;
1448 }
1449 else {
1450 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001451 "%s: [INFOLOG]Current AP rssi=%d new ap rssi better=%d", __func__,
Jeff Johnson43971f52012-07-17 12:26:56 -07001452 CurrAPRssi,
1453 (int)pScanResult->BssDescriptor.rssi * (-1) );
1454 }
1455 }
1456 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001457
1458#ifdef WLAN_FEATURE_VOWIFI_11R
1459 if (pNeighborRoamInfo->is11rAssoc)
1460 {
1461 if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId))
1462 {
1463 smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring"));
1464 continue;
1465 }
1466 }
1467#endif /* WLAN_FEATURE_VOWIFI_11R */
1468
1469#ifdef FEATURE_WLAN_CCX
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001470#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1471 if (!csrRoamIsRoamOffloadScanEnabled(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07001472 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001473#endif
1474 if (pNeighborRoamInfo->isCCXAssoc)
1475 {
1476 if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId))
1477 {
1478 smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring"));
1479 continue;
1480 }
1481 }
1482 if ((pScanResult->BssDescriptor.QBSSLoad_present) &&
1483 (pScanResult->BssDescriptor.QBSSLoad_avail))
1484 {
1485 if (pNeighborRoamInfo->isVOAdmitted)
1486 {
1487 smsLog(pMac, LOG1, FL("New AP has %x BW available"), (unsigned int)pScanResult->BssDescriptor.QBSSLoad_avail);
1488 smsLog(pMac, LOG1, FL("We need %x BW available"),(unsigned int)pNeighborRoamInfo->MinQBssLoadRequired);
1489 if (pScanResult->BssDescriptor.QBSSLoad_avail < pNeighborRoamInfo->MinQBssLoadRequired)
1490 {
1491 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
1492 "[INFOLOG]BSSID : %02x:%02x:%02x:%02x:%02x:%02x has no bandwidth ignoring..not adding to roam list",
1493 pScanResult->BssDescriptor.bssId[0],
1494 pScanResult->BssDescriptor.bssId[1],
1495 pScanResult->BssDescriptor.bssId[2],
1496 pScanResult->BssDescriptor.bssId[3],
1497 pScanResult->BssDescriptor.bssId[4],
1498 pScanResult->BssDescriptor.bssId[5]);
1499 continue;
1500 }
1501 }
1502 }
1503 else
1504 {
1505 smsLog(pMac, LOGE, FL("No QBss %x %x"), (unsigned int)pScanResult->BssDescriptor.QBSSLoad_avail, (unsigned int)pScanResult->BssDescriptor.QBSSLoad_present);
1506 if (pNeighborRoamInfo->isVOAdmitted)
1507 {
1508 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
1509 "[INFOLOG]BSSID : %02x:%02x:%02x:%02x:%02x:%02x has no QBSSLoad IE, ignoring..not adding to roam list",
1510 pScanResult->BssDescriptor.bssId[0],
1511 pScanResult->BssDescriptor.bssId[1],
1512 pScanResult->BssDescriptor.bssId[2],
1513 pScanResult->BssDescriptor.bssId[3],
1514 pScanResult->BssDescriptor.bssId[4],
1515 pScanResult->BssDescriptor.bssId[5]);
1516 continue;
1517 }
1518 }
1519#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001520 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001521#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001522#endif /* FEATURE_WLAN_CCX */
1523
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001524#ifdef FEATURE_WLAN_LFR
1525 // If we are supporting legacy roaming, and
1526 // if the candidate is on the "pre-auth failed" list, ignore it.
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05301527 if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001528 {
1529 if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId))
1530 {
1531 smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring"));
1532 continue;
1533 }
1534 }
1535#endif /* FEATURE_WLAN_LFR */
1536
Jeff Johnson295189b2012-06-20 16:38:30 -07001537 /* If the received timestamp in BSS description is earlier than the scan request timestamp, skip
1538 * this result */
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001539 if ((pNeighborRoamInfo->scanRequestTimeStamp >= pScanResult->BssDescriptor.nReceivedTime)
1540#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1541 && !csrRoamIsRoamOffloadScanEnabled(pMac)
1542#endif
1543 )
Jeff Johnson295189b2012-06-20 16:38:30 -07001544 {
1545 smsLog(pMac, LOGE, FL("Ignoring BSS as it is older than the scan request timestamp"));
1546 continue;
1547 }
1548
1549 pBssInfo = vos_mem_malloc(sizeof(tCsrNeighborRoamBSSInfo));
1550 if (NULL == pBssInfo)
1551 {
1552 smsLog(pMac, LOGE, FL("Memory allocation for Neighbor Roam BSS Info failed.. Just ignoring"));
1553 continue;
1554 }
1555
1556 pBssInfo->pBssDescription = vos_mem_malloc(pScanResult->BssDescriptor.length + sizeof(pScanResult->BssDescriptor.length));
1557 if (pBssInfo->pBssDescription != NULL)
1558 {
1559 vos_mem_copy(pBssInfo->pBssDescription, &pScanResult->BssDescriptor,
1560 pScanResult->BssDescriptor.length + sizeof(pScanResult->BssDescriptor.length));
1561 }
1562 else
1563 {
1564 smsLog(pMac, LOGE, FL("Memory allocation for Neighbor Roam BSS Descriptor failed.. Just ignoring"));
1565 vos_mem_free(pBssInfo);
1566 continue;
1567
1568 }
1569 pBssInfo->apPreferenceVal = 10; //some value for now. Need to calculate the actual score based on RSSI and neighbor AP score
1570
1571 /* Just add to the end of the list as it is already sorted by RSSI */
1572 csrLLInsertTail(&pNeighborRoamInfo->roamableAPList, &pBssInfo->List, LL_ACCESS_LOCK);
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001573
1574#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001575 if ((abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)) >= immediateRoamRssiDiff)
1576#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1577 && !csrRoamIsRoamOffloadScanEnabled(pMac)
1578#endif
1579 )
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001580 {
1581 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
1582 "%s: [INFOLOG] potential candidate to roam immediately (diff=%d, expected=%d)",
1583 __func__, abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)),
1584 immediateRoamRssiDiff);
1585 roamNow = eANI_BOOLEAN_TRUE;
1586 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001587#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1588 /* If we are here means, FW already found candidates to roam, so we are
1589 good to go with pre-auth */
1590 if(csrRoamIsRoamOffloadScanEnabled(pMac))
1591 {
1592 roamNow = eANI_BOOLEAN_TRUE;
1593 }
1594#endif
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001595#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001596 }
1597
1598 /* Now we have all the scan results in our local list. Good time to free up the the list we got as a part of csrGetScanResult */
1599 csrScanResultPurge(pMac, *pScanResultList);
1600
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001601 return roamNow;
Jeff Johnson295189b2012-06-20 16:38:30 -07001602}
1603
1604/* ---------------------------------------------------------------------------
1605
1606 \fn csrNeighborRoamHandleEmptyScanResult
1607
1608 \brief This function will be invoked in CFG_CHAN_LIST_SCAN state when
1609 there are no valid APs in the scan result for roaming. This means
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001610 our AP is the best and no other AP is around. No point in scanning
Jeff Johnson295189b2012-06-20 16:38:30 -07001611 again and again. Performing the following here.
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001612 1. Stop the neighbor scan timer.
1613 2a. If this is the first time we encountered empty scan, then
1614 re-register with TL with modified lookup threshold.
1615 2b. Else if this is the second time we encountered empty scan,
1616 then start neighbor scan results refresh timer (20s).
1617 2c. Else, nothing more to do.
1618 NOTE: In LFR, channels selected for scanning is dervied from
1619 the occuped channel list. Scan cycle following one which
1620 yielded empty results is split into two halves: (i) scan on
1621 channels in the occupied list, and (ii) scan on channels not
1622 in the occupied list. This helps converging faster (while
1623 looking for candidates in the occupied list first), and also,
1624 adds channels to the occupied channel list upon finding candidates
1625 matching SSID profile of interest.
1626
1627 uEmptyScanCount Comments
1628 eFirstEmptyScan Previous scan was done on channels in the
1629 occupied list and yielded potential candidates.
1630 This scan cycle was likely triggered through
1631 receipt of lookup DOWN notification event.
1632 eSecondEmptyScan Previous scan was done on channels in the
1633 occupied list and yielded no candidates. This scan
1634 cycle was triggered through RSSI notification
1635 with modified lookup threshold.
1636 eThirdEmptyScan Previous scan was done on channels NOT in
1637 the occupied list and yielded no candidates. This
1638 scan cycle was triggered immediately after scanning
1639 channels in the occupied list and no candidates
1640 were found.
1641 eFourthEmptyScan Previous scan was done on channels in the
1642 occupied list and yielded no candidates. This scan
1643 cycle was triggered upon expiry of
1644 neighborScanResultsRefreshPeriod (=20s).
1645 eFifthEmptyScan Previous scan was done on channels NOT in
1646 the occupied list and yielded no candidates. This
1647 scan cycle was triggered immediately after scanning
1648 channels in the occupied list and no candidates
1649 were found.
1650
1651 [1], [2,3] and [4,5] together form one discrete set of scan cycle.
Jeff Johnson295189b2012-06-20 16:38:30 -07001652
1653 \param pMac - The handle returned by macOpen.
1654
1655 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
1656
1657---------------------------------------------------------------------------*/
1658static VOS_STATUS csrNeighborRoamHandleEmptyScanResult(tpAniSirGlobal pMac)
1659{
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001660 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001661 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1662 eHalStatus status = eHAL_STATUS_SUCCESS;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001663#ifdef FEATURE_WLAN_LFR
1664 tANI_BOOLEAN performPeriodicScan =
1665 (pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod) ? TRUE : FALSE;
1666#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001667
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001668 /* Stop neighbor scan timer */
Jeff Johnson295189b2012-06-20 16:38:30 -07001669 status = palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001670 if (eHAL_STATUS_SUCCESS != status)
Jeff Johnson295189b2012-06-20 16:38:30 -07001671 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001672 smsLog(pMac, LOGW, FL("stopping neighborScanTimer failed with status %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001673 }
1674
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001675 /*
1676 * Increase the neighbor lookup threshold by 3 dB
1677 * after every scan cycle. NOTE: uEmptyScanCount
1678 * would be either 1, 3 or 5 at the end of every
1679 * scan cycle.
1680 */
1681#ifdef FEATURE_WLAN_LFR
1682 if ((++pNeighborRoamInfo->uEmptyScanCount) > eFifthEmptyScan)
1683 {
1684 pNeighborRoamInfo->uEmptyScanCount = eFifthEmptyScan;
1685 }
Srikant Kuppa327c52e2013-05-09 15:09:24 -07001686 if (((0 != pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels) ||
1687 (abs(pNeighborRoamInfo->lookupDOWNRssi) >
1688 abs(pNeighborRoamInfo->cfgParams.neighborReassocThreshold))) &&
Srinivas Girigowdade697412013-02-14 16:31:48 -08001689 ((pNeighborRoamInfo->uEmptyScanCount == eSecondEmptyScan) ||
1690 (pNeighborRoamInfo->uEmptyScanCount == eFourthEmptyScan)))
1691 {
1692 /*
1693 * If the scan was triggered due to lookupDOWNRssi > reassoc threshold,
1694 * then it would be a contiguous scan on all valid non-DFS channels.
Srikant Kuppa327c52e2013-05-09 15:09:24 -07001695 * If channels are configured in INI, then only those channels need
1696 * to be scanned.
1697 * In either of these modes, there is no need to trigger an immediate
1698 * scan upon empty scan results for the second and fourth time (which
1699 * would be equivalent to scanning on channels in non-occupied list).
Srinivas Girigowdade697412013-02-14 16:31:48 -08001700 * Incrementing uEmptyScanCount will correspond to skipping this step.
1701 * NOTE: double increment of uEmptyScanCount corresponds to completion
1702 * of scans on all valid channels.
1703 */
1704 ++pNeighborRoamInfo->uEmptyScanCount;
1705 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Extra increment of empty scan count (=%d)"
1706 " in contiguous scan mode", pNeighborRoamInfo->uEmptyScanCount);
1707 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001708#endif
1709 if (((pNeighborRoamInfo->currentNeighborLookupThreshold+3) <
1710 pNeighborRoamInfo->cfgParams.neighborReassocThreshold)
1711#ifdef FEATURE_WLAN_LFR
1712 && ((pNeighborRoamInfo->uEmptyScanCount % 2) == 1)
1713#endif
1714 )
1715 {
1716 pNeighborRoamInfo->currentNeighborLookupThreshold += 3;
1717 }
1718
Jeff Johnson295189b2012-06-20 16:38:30 -07001719#ifdef WLAN_FEATURE_VOWIFI_11R
1720 /* Clear off the old neighbor report details */
1721 vos_mem_zero(&pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
1722#endif
1723
Srikant Kuppa866893f2012-12-27 17:28:14 -08001724 /* Transition to CONNECTED state */
1725 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED);
1726
1727 /* Reset all the necessary variables before transitioning to the CONNECTED state */
1728 csrNeighborRoamResetConnectedStateControlInfo(pMac);
1729
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001730#ifdef FEATURE_WLAN_LFR
1731 if (pNeighborRoamInfo->uEmptyScanCount == eFirstEmptyScan)
1732 {
1733#endif
1734 /* Empty scan results for the first time */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001735 /* Re-register neighbor lookup DOWN threshold callback with TL */
1736 NEIGHBOR_ROAM_DEBUG(pMac, LOGE,
1737 FL("Registering DOWN event neighbor lookup callback with TL for RSSI = %d"),
1738 pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
1739
1740 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext,
1741 (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
1742 WLANTL_HO_THRESHOLD_DOWN,
1743 csrNeighborRoamNeighborLookupDOWNCallback,
1744 VOS_MODULE_ID_SME, pMac);
1745
1746 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1747 {
1748 smsLog(pMac, LOGW,
1749 FL("Couldn't re-register csrNeighborRoamNeighborLookupDOWNCallback"
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001750 " with TL: Status = %d"), status);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001751 }
1752#ifdef FEATURE_WLAN_LFR
Srikant Kuppa866893f2012-12-27 17:28:14 -08001753 pNeighborRoamInfo->lookupDOWNRssi = 0;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001754 }
1755 else if ((pNeighborRoamInfo->uEmptyScanCount == eSecondEmptyScan) ||
1756 (pNeighborRoamInfo->uEmptyScanCount == eFourthEmptyScan))
1757 {
1758 /* Empty scan results for the second or fourth time */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001759
1760 /* Immediately scan on channels in non-occupied list */
1761 csrNeighborRoamTransitToCFGChanScan(pMac);
1762 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08001763 else if (pNeighborRoamInfo->uEmptyScanCount >= eThirdEmptyScan)
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001764 {
1765 /* Empty scan results for the third time */
Srinivas Girigowdade697412013-02-14 16:31:48 -08001766 if (performPeriodicScan)
1767 {
1768 smsLog(pMac, LOGE, FL("Performing periodic scan, uEmptyScanCount=%d"),
1769 pNeighborRoamInfo->uEmptyScanCount);
Srikant Kuppa866893f2012-12-27 17:28:14 -08001770
Srinivas Girigowdade697412013-02-14 16:31:48 -08001771 /*
1772 * Set uEmptyScanCount to MAX so that we always enter this
1773 * condition on subsequent empty scan results
1774 */
1775 pNeighborRoamInfo->uEmptyScanCount = eMaxEmptyScan;
1776
1777 /* From here on, ONLY scan on channels in the occupied list */
1778 pNeighborRoamInfo->uScanMode = SPLIT_SCAN_OCCUPIED_LIST;
1779
1780 /* Start empty scan refresh timer */
1781 if (eHAL_STATUS_SUCCESS !=
1782 palTimerStart(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer,
1783 pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod * PAL_TIMER_TO_MS_UNIT,
1784 eANI_BOOLEAN_FALSE))
1785 {
1786 smsLog(pMac, LOGE, FL("Empty scan refresh timer failed to start (%d)"),
1787 status);
1788 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
1789 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07001790 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001791 vosStatus = VOS_STATUS_E_FAILURE;
1792 }
1793 else
1794 {
1795 smsLog(pMac, LOGE, FL("Empty scan refresh timer started (%ld ms)"),
1796 (pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod));
1797 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001798 }
Srikant Kuppa327c52e2013-05-09 15:09:24 -07001799 else if (eThirdEmptyScan == pNeighborRoamInfo->uEmptyScanCount)
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001800 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08001801 /* Start neighbor scan results refresh timer */
1802 if (eHAL_STATUS_SUCCESS !=
1803 palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer,
1804 pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT,
1805 eANI_BOOLEAN_FALSE))
1806 {
1807 smsLog(pMac, LOGE, FL("Neighbor results refresh timer failed to start (%d)"),
1808 status);
1809 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
1810 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07001811 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001812 vosStatus = VOS_STATUS_E_FAILURE;
1813 }
1814 else
1815 {
1816 smsLog(pMac, LOG2, FL("Neighbor results refresh timer started (%ld ms)"),
1817 (pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT));
1818 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001819 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001820 }
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001821
Srinivas Girigowdade697412013-02-14 16:31:48 -08001822 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Neighbor roam empty scan count=%d scan mode=%d",
1823 pNeighborRoamInfo->uEmptyScanCount, pNeighborRoamInfo->uScanMode);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001824#endif
1825 return vosStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07001826}
1827
Jeff Johnson295189b2012-06-20 16:38:30 -07001828
Srikant Kuppa866893f2012-12-27 17:28:14 -08001829static eHalStatus csrNeighborRoamProcessScanComplete (tpAniSirGlobal pMac)
Jeff Johnson295189b2012-06-20 16:38:30 -07001830{
Jeff Johnson295189b2012-06-20 16:38:30 -07001831 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001832 tCsrScanResultFilter scanFilter;
1833 tScanResultHandle scanResult;
1834 tANI_U32 tempVal = 0;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001835 tANI_BOOLEAN roamNow = eANI_BOOLEAN_FALSE;
Srikant Kuppa866893f2012-12-27 17:28:14 -08001836 eHalStatus hstatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07001837
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001838#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001839 /* If the state is REPORT_SCAN, then this must be the scan after the REPORT_QUERY state. So, we
1840 should use the BSSID filter made out of neighbor reports */
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001841 if ((eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
1842#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1843 && (!csrRoamIsRoamOffloadScanEnabled(pMac))
1844#endif
1845 )
Jeff Johnson295189b2012-06-20 16:38:30 -07001846 {
Jeff Johnson43971f52012-07-17 12:26:56 -07001847 hstatus = csrNeighborRoamBssIdScanFilter(pMac, &scanFilter);
1848 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("11R or CCX Association: Prepare scan filter status with neighbor AP = %d"), hstatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07001849 tempVal = 1;
1850 }
1851 else
1852#endif
1853 {
Jeff Johnson43971f52012-07-17 12:26:56 -07001854 hstatus = csrNeighborRoamPrepareScanProfileFilter(pMac, &scanFilter);
1855 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("11R/CCX/Other Association: Prepare scan to find neighbor AP filter status = %d"), hstatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07001856 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001857 if (eHAL_STATUS_SUCCESS != hstatus)
Jeff Johnson295189b2012-06-20 16:38:30 -07001858 {
1859 smsLog(pMac, LOGE, FL("Scan Filter preparation failed for Assoc type %d.. Bailing out.."), tempVal);
1860 return eHAL_STATUS_FAILURE;
1861 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001862 hstatus = csrScanGetResult(pMac, &scanFilter, &scanResult);
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05301863 if (hstatus != eHAL_STATUS_SUCCESS)
1864 {
1865 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Get Scan Result status code %d"), hstatus);
1866 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001867 /* Process the scan results and update roamable AP list */
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001868 roamNow = csrNeighborRoamProcessScanResults(pMac, &scanResult);
Jeff Johnson295189b2012-06-20 16:38:30 -07001869
1870 /* Free the scan filter */
1871 csrFreeScanFilter(pMac, &scanFilter);
1872
1873 tempVal = csrLLCount(&pNeighborRoamInfo->roamableAPList);
1874
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001875#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1876 if(!csrRoamIsRoamOffloadScanEnabled(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07001877 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001878#endif
1879 switch(pNeighborRoamInfo->neighborRoamState)
1880 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001881 case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:
1882 if (tempVal)
1883 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001884#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001885 /*
1886 * Since there are non-zero candidates found
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001887 * after the scan, reset empty scan count.
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001888 */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001889 pNeighborRoamInfo->uEmptyScanCount = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001890 pNeighborRoamInfo->uScanMode = DEFAULT_SCAN;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001891#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001892#ifdef WLAN_FEATURE_VOWIFI_11R
1893 /* If this is a non-11r association, then we can register the reassoc callback here as we have some
1894 APs in the roamable AP list */
1895 if (pNeighborRoamInfo->is11rAssoc)
1896 {
1897 /* Valid APs are found after scan. Now we can initiate pre-authentication */
1898 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
1899 }
1900 else
1901#endif
1902#ifdef FEATURE_WLAN_CCX
1903 /* If this is a non-11r association, then we can register the reassoc callback here as we have some
1904 APs in the roamable AP list */
1905 if (pNeighborRoamInfo->isCCXAssoc)
1906 {
1907 /* Valid APs are found after scan. Now we can initiate pre-authentication */
1908 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
1909 }
1910 else
1911#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001912#ifdef FEATURE_WLAN_LFR
1913 /* If LFR is enabled, then we can register the reassoc callback here as we have some
1914 APs in the roamable AP list */
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05301915 if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001916 {
1917 /* Valid APs are found after scan. Now we can initiate pre-authentication */
1918 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
1919 }
1920 else
1921#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001922 {
1923
1924 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Completed scanning of CFG CHAN LIST in non-11r association. Registering reassoc callback"));
1925 /* Nothing much to do now. Will continue to remain in this state in case of non-11r association */
1926 /* Stop the timer. But how long the roamable AP list will be valid in here. At some point of time, we
1927 need to restart the CFG CHAN list scan procedure if reassoc callback is not invoked from TL
1928 within certain duration */
1929
1930// palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
1931 }
1932 }
1933 else
1934 {
Madan Mohan Koyyalamudib40e5582012-10-11 16:48:42 -07001935 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("No candidate found after scanning in state %d.. "), pNeighborRoamInfo->neighborRoamState);
1936 /* Handle it appropriately */
1937 csrNeighborRoamHandleEmptyScanResult(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001938 }
1939 break;
1940#ifdef WLAN_FEATURE_VOWIFI_11R
1941 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
1942 if (!tempVal)
1943 {
1944 smsLog(pMac, LOGE, FL("No candidate found after scanning in state %d.. "), pNeighborRoamInfo->neighborRoamState);
1945 /* Stop the timer here as the same timer will be started again in CFG_CHAN_SCAN_STATE */
1946 csrNeighborRoamTransitToCFGChanScan(pMac);
1947 }
1948 break;
1949#endif /* WLAN_FEATURE_VOWIFI_11R */
1950 default:
1951 // Can come only in INIT state. Where in we are associated, we sent scan and user
1952 // in the meantime decides to disassoc, we will be in init state and still received call
1953 // back issued. Should not come here in any other state, printing just in case
1954 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001955 "%s: [INFOLOG] State %d", __func__, (pNeighborRoamInfo->neighborRoamState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001956
1957 // Lets just exit out silently.
1958 return eHAL_STATUS_SUCCESS;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001959 }
1960#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001961 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001962#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001963
1964 if (tempVal)
1965 {
1966 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
1967
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001968 if (roamNow)
1969 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001970#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1971 if(!csrRoamIsRoamOffloadScanEnabled(pMac))
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001972 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001973#endif
1974 NEIGHBOR_ROAM_DEBUG(pMac, LOG2,
1975 FL("Immediate roam-deregister UP indication. RSSI = %d"),
1976 NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1));
1977
1978 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
1979 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
1980 WLANTL_HO_THRESHOLD_UP,
1981 csrNeighborRoamNeighborLookupUPCallback,
1982 VOS_MODULE_ID_SME);
1983
1984 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1985 {
1986 smsLog(pMac, LOGW,
1987 FL("Couldn't deregister lookup UP callback with TL: Status = %d"), vosStatus);
1988 }
1989#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001990 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001991#endif
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001992
1993 csrNeighborRoamTriggerHandoff(pMac, pNeighborRoamInfo);
1994 return eHAL_STATUS_SUCCESS;
1995 }
1996
Srikant Kuppa866893f2012-12-27 17:28:14 -08001997 hstatus = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer,
1998 pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT,
1999 eANI_BOOLEAN_FALSE);
2000
Jeff Johnson295189b2012-06-20 16:38:30 -07002001 /* This timer should be started before registering the Reassoc callback with TL. This is because, it is very likely
2002 * that the callback getting called immediately and the timer would never be stopped when pre-auth is in progress */
Srikant Kuppa866893f2012-12-27 17:28:14 -08002003 if (eHAL_STATUS_SUCCESS != hstatus)
Jeff Johnson295189b2012-06-20 16:38:30 -07002004 {
Srikant Kuppa866893f2012-12-27 17:28:14 -08002005 smsLog(pMac, LOGE, FL("Neighbor results refresh timer failed to start, status = %d"), hstatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002006 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
2007 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07002008 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Jeff Johnson43971f52012-07-17 12:26:56 -07002009 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002011
Jeff Johnson295189b2012-06-20 16:38:30 -07002012 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event Reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
2013 /* Register a reassoc Indication callback */
2014 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
2015 WLANTL_HO_THRESHOLD_DOWN,
2016 csrNeighborRoamReassocIndCallback,
2017 VOS_MODULE_ID_SME, pMac);
2018
2019 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
2020 {
2021 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002022 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamReassocIndCallback with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002023 }
2024
2025 }
Srikant Kuppa866893f2012-12-27 17:28:14 -08002026
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002027#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2028if (csrRoamIsRoamOffloadScanEnabled(pMac))
2029 {
2030 if (!tempVal || !roamNow)
2031 {
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002032 pNeighborRoamInfo->uOsRequestedHandoff = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002033 /* There is no candidate or We are not roaming Now.
2034 * Inform the FW to restart Roam Offload Scan */
2035 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_RESTART, REASON_NO_CAND_FOUND_OR_NOT_ROAMING_NOW);
2036 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED);
2037 }
2038 }
2039#endif
Srikant Kuppa866893f2012-12-27 17:28:14 -08002040 return eHAL_STATUS_SUCCESS;
2041
2042}
2043
2044
2045/* ---------------------------------------------------------------------------
2046
2047 \fn csrNeighborRoamScanRequestCallback
2048
2049 \brief This function is the callback function registered in csrScanRequest() to
2050 indicate the completion of scan. If scan is completed for all the channels in
2051 the channel list, this function gets the scan result and starts the refresh results
2052 timer to avoid having stale results. If scan is not completed on all the channels,
2053 it restarts the neighbor scan timer which on expiry issues scan on the next
2054 channel
2055
2056 \param halHandle - The handle returned by macOpen.
2057 pContext - not used
2058 scanId - not used
2059 status - not used
2060
2061 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
2062
2063---------------------------------------------------------------------------*/
2064static eHalStatus csrNeighborRoamScanRequestCallback(tHalHandle halHandle, void *pContext,
2065 tANI_U32 scanId, eCsrScanStatus status)
2066{
2067 tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle;
2068 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2069 tANI_U8 currentChanIndex;
2070 eHalStatus hstatus;
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002071#ifdef FEATURE_WLAN_LFR
2072 tANI_U32 sessionId = CSR_SESSION_ID_INVALID;
Srikant Kuppa866893f2012-12-27 17:28:14 -08002073
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002074 if (NULL != pContext)
2075 {
2076 sessionId = *((tANI_U32*)pContext);
2077 if (!csrRoamIsFastRoamEnabled(pMac,sessionId))
2078 {
2079 smsLog(pMac, LOGE, FL("Received when fast roam is disabled. Ignore it"));
2080 vos_mem_free(pContext);
2081 return eHAL_STATUS_SUCCESS;
2082 }
2083 }
2084#endif
Srikant Kuppa866893f2012-12-27 17:28:14 -08002085 pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE;
2086
2087 /* This can happen when we receive a UP event from TL in any of the scan states. Silently ignore it */
2088 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
2089 {
2090 smsLog(pMac, LOGE, FL("Received in CONNECTED state. Must be because a UP event from TL after issuing scan request. Ignore it"));
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002091 if (NULL != pContext)
2092 vos_mem_free(pContext);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002093 return eHAL_STATUS_SUCCESS;
2094 }
2095
2096 /* -1 is done because the chanIndex would have got incremented after issuing a successful scan request */
2097 currentChanIndex = (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex) ? (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex - 1) : 0;
2098
2099 /* Validate inputs */
2100 if (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList) {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002101 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("csrNeighborRoamScanRequestCallback received for Channel = %d, ChanIndex = %d"),
Srikant Kuppa866893f2012-12-27 17:28:14 -08002102 pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList[currentChanIndex], currentChanIndex);
2103 }
2104 else
2105 {
2106 smsLog(pMac, LOG1, FL("Received during clean-up. Silently ignore scan completion event."));
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002107 if (NULL != pContext)
2108 vos_mem_free(pContext);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002109 return eHAL_STATUS_SUCCESS;
2110 }
2111
2112 if (eANI_BOOLEAN_FALSE == pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress)
2113 {
2114 /* Scan is completed in the CFG_CHAN_SCAN state. We can transition to REPORT_SCAN state
2115 just to get the results and perform PREAUTH */
2116 /* Now we have completed scanning the channel list. We have get the result by applying appropriate filter
2117 sort the results based on neighborScore and RSSI and select the best candidate out of the list */
2118 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Channel list scan completed. Current chan index = %d"), currentChanIndex);
2119 VOS_ASSERT(pNeighborRoamInfo->roamChannelInfo.currentChanIndex == 0);
2120
2121 hstatus = csrNeighborRoamProcessScanComplete(pMac);
2122
2123 if (eHAL_STATUS_SUCCESS != hstatus)
2124 {
2125 smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus);
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002126 if (NULL != pContext)
2127 vos_mem_free(pContext);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002128 return eHAL_STATUS_FAILURE;
2129 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002130 }
2131 else
2132 {
2133
2134 /* Restart the timer for the next scan sequence as scanning is not over */
Jeff Johnson43971f52012-07-17 12:26:56 -07002135 hstatus = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer,
Jeff Johnson295189b2012-06-20 16:38:30 -07002136 pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT,
2137 eANI_BOOLEAN_FALSE);
2138
Jeff Johnson43971f52012-07-17 12:26:56 -07002139 if (eHAL_STATUS_SUCCESS != hstatus)
Jeff Johnson295189b2012-06-20 16:38:30 -07002140 {
2141 /* Timer start failed.. Should we ASSERT here??? */
2142 smsLog(pMac, LOGE, FL("Neighbor scan PAL Timer start failed, status = %d, Ignoring state transition"), status);
2143 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
2144 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07002145 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002146 if (NULL != pContext)
2147 vos_mem_free(pContext);
Jeff Johnson43971f52012-07-17 12:26:56 -07002148 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002149 }
2150 }
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002151
2152 if (NULL != pContext)
2153 vos_mem_free(pContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07002154 return eHAL_STATUS_SUCCESS;
2155}
2156
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002157#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2158/* ---------------------------------------------------------------------------
2159
2160 \fn csrNeighborRoamScanResultRequestCallback
2161
2162 \brief This function is the callback function registered in csrScanRequestLfrResult() to
2163 indicate the completion of scan. If scan is completed for all the channels in
2164 the channel list, this function gets the scan result and treats them as candidates
2165
2166 \param halHandle - The handle returned by macOpen.
2167 pContext - not used
2168 scanId - not used
2169 status - not used
2170
2171 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
2172
2173---------------------------------------------------------------------------*/
2174static eHalStatus csrNeighborRoamScanResultRequestCallback(tHalHandle halHandle, void *pContext,
2175 tANI_U32 scanId, eCsrScanStatus status)
2176{
2177 tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle;
2178 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2179 eHalStatus hstatus;
2180
2181 smsLog(pMac, LOG2, FL("called "));
2182 pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE;
2183
2184 /* we must be in connected state, if not ignore it */
2185 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED != pNeighborRoamInfo->neighborRoamState)
2186 {
2187 smsLog(pMac, LOGW, FL("Received in not CONNECTED state. Ignore it"));
2188 return eHAL_STATUS_SUCCESS;
2189 }
2190
2191 /* Now we have completed scanning the channel list. We have get the result by applying appropriate filter
2192 sort the results based on neighborScore and RSSI and select the best candidate out of the list */
2193
2194 hstatus = csrNeighborRoamProcessScanComplete(pMac);
2195
2196 if (eHAL_STATUS_SUCCESS != hstatus)
2197 {
2198 smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus);
2199 return eHAL_STATUS_FAILURE;
2200 }
2201 return eHAL_STATUS_SUCCESS;
2202}
2203#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2204
Srikant Kuppa866893f2012-12-27 17:28:14 -08002205#ifdef FEATURE_WLAN_LFR
2206static eHalStatus csrNeighborRoamContiguousScanRequestCallback(tHalHandle halHandle,
2207 void *pContext, tANI_U32 scanId, eCsrScanStatus status)
2208{
2209 tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle;
2210 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2211 eHalStatus hstatus = eHAL_STATUS_SUCCESS;
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002212 tANI_U32 sessionId = CSR_SESSION_ID_INVALID;
2213
2214 if (NULL != pContext)
2215 {
2216 sessionId = *((tANI_U32*)pContext);
2217 if (!csrRoamIsFastRoamEnabled(pMac,sessionId))
2218 {
2219 smsLog(pMac, LOGE, FL("Received when fast roam is disabled. Ignore it"));
2220 vos_mem_free(pContext);
2221 return eHAL_STATUS_SUCCESS;
2222 }
2223 }
Srikant Kuppa866893f2012-12-27 17:28:14 -08002224
2225 pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE;
2226
2227 /* This can happen when we receive a UP event from TL in any of the scan states. Silently ignore it */
2228 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
2229 {
2230 smsLog(pMac, LOGE, FL("Received in CONNECTED state. Must be because a UP event from TL after issuing scan request. Ignore it"));
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002231 if (NULL != pContext)
2232 vos_mem_free(pContext);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002233 return eHAL_STATUS_SUCCESS;
2234 }
2235
Srinivas Girigowdade697412013-02-14 16:31:48 -08002236 if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
2237 {
2238 smsLog(pMac, LOGE, FL("Received in INIT state. Must have disconnected. Ignore it"));
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002239 if (NULL != pContext)
2240 vos_mem_free(pContext);
Srinivas Girigowdade697412013-02-14 16:31:48 -08002241 return eHAL_STATUS_SUCCESS;
2242 }
2243
Srikant Kuppa866893f2012-12-27 17:28:14 -08002244 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "%s: process scan results", __func__);
2245 hstatus = csrNeighborRoamProcessScanComplete(pMac);
2246
2247 if (eHAL_STATUS_SUCCESS != hstatus)
2248 {
2249 smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus);
2250 }
2251
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002252 if (NULL != pContext)
2253 vos_mem_free(pContext);
2254
Srikant Kuppa866893f2012-12-27 17:28:14 -08002255 return hstatus;
2256}
2257#endif
2258
Jeff Johnson295189b2012-06-20 16:38:30 -07002259/* ---------------------------------------------------------------------------
2260
2261 \fn csrNeighborRoamIssueBgScanRequest
2262
2263 \brief This function issues CSR scan request after populating all the BG scan params
2264 passed
2265
2266 \param pMac - The handle returned by macOpen.
2267 pBgScanParams - Params that need to be populated into csr Scan request
2268
2269 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
2270
2271---------------------------------------------------------------------------*/
Srikant Kuppa866893f2012-12-27 17:28:14 -08002272eHalStatus csrNeighborRoamIssueBgScanRequest(tpAniSirGlobal pMac,
2273 tCsrBGScanRequest *pBgScanParams,
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002274 tANI_U32 sessionId,
Srikant Kuppa866893f2012-12-27 17:28:14 -08002275 csrScanCompleteCallback callbackfn)
Jeff Johnson295189b2012-06-20 16:38:30 -07002276{
2277 eHalStatus status = eHAL_STATUS_SUCCESS;
2278 tANI_U32 scanId;
2279 tCsrScanRequest scanReq;
2280 tANI_U8 channel;
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002281 void * userData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002282
Srikant Kuppa866893f2012-12-27 17:28:14 -08002283 if (1 == pBgScanParams->ChannelInfo.numOfChannels)
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002284 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Channel = %d, ChanIndex = %d"),
Srikant Kuppa866893f2012-12-27 17:28:14 -08002285 pBgScanParams->ChannelInfo.ChannelList[0],
2286 pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07002287
2288 //send down the scan req for 1 channel on the associated SSID
2289 palZeroMemory(pMac->hHdd, &scanReq, sizeof(tCsrScanRequest));
2290 /* Fill in the SSID Info */
2291 scanReq.SSIDs.numOfSSIDs = 1;
2292 scanReq.SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo) * scanReq.SSIDs.numOfSSIDs);
2293 if(NULL == scanReq.SSIDs.SSIDList)
2294 {
2295 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002296 smsLog(pMac, LOGE, FL("Couldn't allocate memory for the SSID..Freeing memory allocated for Channel List"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002297 return eHAL_STATUS_FAILURE;
2298 }
2299 vos_mem_zero(scanReq.SSIDs.SSIDList, sizeof(tCsrSSIDInfo) * scanReq.SSIDs.numOfSSIDs);
2300
2301 scanReq.SSIDs.SSIDList[0].handoffPermitted = eANI_BOOLEAN_TRUE;
2302 scanReq.SSIDs.SSIDList[0].ssidHidden = eANI_BOOLEAN_TRUE;
2303 vos_mem_copy((void *)&scanReq.SSIDs.SSIDList[0].SSID, (void *)&pBgScanParams->SSID, sizeof(pBgScanParams->SSID));
2304
2305 scanReq.ChannelInfo.numOfChannels = pBgScanParams->ChannelInfo.numOfChannels;
Srikant Kuppa866893f2012-12-27 17:28:14 -08002306 if (1 == pBgScanParams->ChannelInfo.numOfChannels)
2307 {
2308 channel = pBgScanParams->ChannelInfo.ChannelList[0];
2309 scanReq.ChannelInfo.ChannelList = &channel;
2310 }
2311 else
2312 {
2313 scanReq.ChannelInfo.ChannelList = pBgScanParams->ChannelInfo.ChannelList;
2314 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002315
2316 scanReq.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
2317 scanReq.scanType = eSIR_ACTIVE_SCAN;
2318 scanReq.requestType = eCSR_SCAN_HO_BG_SCAN;
2319 scanReq.maxChnTime = pBgScanParams->maxChnTime;
2320 scanReq.minChnTime = pBgScanParams->minChnTime;
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002321
2322 userData = vos_mem_malloc(sizeof(tANI_U32));
2323 if (NULL == userData)
2324 {
2325 smsLog(pMac, LOGE, FL("Failed to allocate memory for scan request"));
2326 vos_mem_free(scanReq.SSIDs.SSIDList);
2327 return eHAL_STATUS_FAILURE;
2328 }
2329 *((tANI_U32*)userData) = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002330 status = csrScanRequest(pMac, CSR_SESSION_ID_INVALID, &scanReq,
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002331 &scanId, callbackfn, (void *) userData);
Jeff Johnson295189b2012-06-20 16:38:30 -07002332 if (eHAL_STATUS_SUCCESS != status)
2333 {
2334 smsLog(pMac, LOGE, FL("CSR Scan Request failed with status %d"), status);
2335 vos_mem_free(scanReq.SSIDs.SSIDList);
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002336 vos_mem_free(userData);
Jeff Johnson295189b2012-06-20 16:38:30 -07002337 return status;
2338 }
2339 pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_TRUE;
2340
2341 vos_mem_free(scanReq.SSIDs.SSIDList);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002342 if (1 == pBgScanParams->ChannelInfo.numOfChannels)
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002343 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Channel List Address = %08x, Actual index = %d"),
Srikant Kuppa866893f2012-12-27 17:28:14 -08002344 &pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList[0],
2345 pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex);
2346
Jeff Johnson295189b2012-06-20 16:38:30 -07002347 return status;
2348}
2349
Srikant Kuppa866893f2012-12-27 17:28:14 -08002350static void csrNeighborRoamFillNonChannelBgScanParams (tpAniSirGlobal pMac,
2351 tpCsrBGScanRequest bgScanParams)
2352{
2353 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2354 tANI_U8 broadcastBssid[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
2355
2356 vos_mem_copy(bgScanParams->bssid, broadcastBssid, sizeof(tCsrBssid));
2357 bgScanParams->SSID.length = pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length;
2358 vos_mem_copy(bgScanParams->SSID.ssId,
2359 pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.ssId,
2360 pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length);
2361
2362 bgScanParams->minChnTime = pNeighborRoamInfo->cfgParams.minChannelScanTime;
2363 bgScanParams->maxChnTime = pNeighborRoamInfo->cfgParams.maxChannelScanTime;
2364}
2365
Jeff Johnson295189b2012-06-20 16:38:30 -07002366/* ---------------------------------------------------------------------------
2367
2368 \fn csrNeighborRoamPerformBgScan
2369
2370 \brief This function is invoked on every expiry of neighborScanTimer till all
2371 the channels in the channel list are scanned. It populates necessary
2372 parameters for BG scan and calls appropriate AP to invoke the CSR scan
2373 request
2374
2375 \param pMac - The handle returned by macOpen.
2376
2377 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
2378
2379---------------------------------------------------------------------------*/
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002380eHalStatus csrNeighborRoamPerformBgScan(tpAniSirGlobal pMac, tANI_U32 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07002381{
2382 eHalStatus status = eHAL_STATUS_SUCCESS;
2383 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2384 tCsrBGScanRequest bgScanParams;
Jeff Johnson295189b2012-06-20 16:38:30 -07002385 tANI_U8 channel = 0;
2386
2387 if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
2388 {
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05302389 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Channel List Address = %08x"), &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[0]);
Jeff Johnson295189b2012-06-20 16:38:30 -07002390 }
2391 else
2392 {
2393 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Channel List Empty"));
Jeff Johnson902c9832012-12-10 14:28:09 -08002394 // Go back and restart. Mostly timer start failure has occurred.
Jeff Johnson295189b2012-06-20 16:38:30 -07002395 // When timer start is declared a failure, then we delete the list.
2396 // Should not happen now as we stop and then only start the scan timer.
2397 // still handle the unlikely case.
2398 csrNeighborRoamHandleEmptyScanResult(pMac);
2399 return status;
2400 }
James Zmuda9ea1edd2013-04-18 18:20:54 -07002401
2402 /* Validate the currentChanIndex value before using it to index the ChannelList array */
2403 if ( pNeighborRoamInfo->roamChannelInfo.currentChanIndex
2404 > pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels)
2405 {
2406 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Invalid channel index: %d"), pNeighborRoamInfo->roamChannelInfo.currentChanIndex);
2407 // Go back and restart.
2408 csrNeighborRoamHandleEmptyScanResult(pMac);
2409 return status;
2410 }
2411
Jeff Johnson295189b2012-06-20 16:38:30 -07002412 /* Need to perform scan here before getting the list */
Srikant Kuppa866893f2012-12-27 17:28:14 -08002413
2414 palZeroMemory(pMac->hHdd, &bgScanParams, sizeof(tCsrBGScanRequest));
Jeff Johnson295189b2012-06-20 16:38:30 -07002415
2416 channel = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[pNeighborRoamInfo->roamChannelInfo.currentChanIndex];
2417 bgScanParams.ChannelInfo.numOfChannels = 1;
2418 bgScanParams.ChannelInfo.ChannelList = &channel;
2419
Srikant Kuppa866893f2012-12-27 17:28:14 -08002420 csrNeighborRoamFillNonChannelBgScanParams(pMac, &bgScanParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002421
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002422 status = csrNeighborRoamIssueBgScanRequest(pMac, &bgScanParams,
2423 sessionId, csrNeighborRoamScanRequestCallback);
Jeff Johnson295189b2012-06-20 16:38:30 -07002424 if (eHAL_STATUS_SUCCESS != status)
2425 {
2426 smsLog(pMac, LOGE, FL("Issue of BG Scan request failed: Status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07002427 }
2428
2429 pNeighborRoamInfo->roamChannelInfo.currentChanIndex++;
2430 if (pNeighborRoamInfo->roamChannelInfo.currentChanIndex >=
2431 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels)
2432 {
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05302433 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Completed scanning channels in Channel List: CurrChanIndex = %d, Num Channels = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002434 pNeighborRoamInfo->roamChannelInfo.currentChanIndex,
2435 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels);
2436 /* We have completed scanning all the channels */
2437 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
2438 /* We are no longer scanning the channel list. Next timer firing should be used to get the scan results
2439 and select the best AP in the list */
2440 if (eANI_BOOLEAN_TRUE == pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress)
2441 {
2442 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
2443 }
2444 }
2445
Gopichand Nakkalac7b1d3e2012-12-31 14:07:19 -08002446 if (eHAL_STATUS_SUCCESS != status)
2447 {
2448 /*
2449 * If the status is not success, we need to call the callback
2450 * routine so that the state machine does not get stuck.
2451 */
2452 csrNeighborRoamScanRequestCallback(pMac, NULL, 0, eCSR_SCAN_FAILURE);
2453 }
2454
Jeff Johnson295189b2012-06-20 16:38:30 -07002455 return status;
2456}
2457
Srikant Kuppa866893f2012-12-27 17:28:14 -08002458#ifdef FEATURE_WLAN_LFR
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002459eHalStatus csrNeighborRoamPerformContiguousBgScan(tpAniSirGlobal pMac, tANI_U32 sessionId)
Srikant Kuppa866893f2012-12-27 17:28:14 -08002460{
2461 eHalStatus status = eHAL_STATUS_SUCCESS;
2462 tCsrBGScanRequest bgScanParams;
2463 int numOfChannels = 0, i = 0;
2464 tANI_U8 *channelList = NULL;
Srinivas Girigowdade697412013-02-14 16:31:48 -08002465 tANI_U8 *pInChannelList = NULL;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002466 tANI_U8 tmpChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
Srikant Kuppa866893f2012-12-27 17:28:14 -08002467
2468 palZeroMemory(pMac->hHdd, &bgScanParams, sizeof(tCsrBGScanRequest));
2469
2470 /* Contiguously scan all channels from valid list */
2471 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "%s: get valid channel list", __func__);
Srinivas Girigowdade697412013-02-14 16:31:48 -08002472
2473 if (NULL != pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.ChannelList)
Srikant Kuppa866893f2012-12-27 17:28:14 -08002474 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08002475 /* this list is filled only if the country code is set to KR */
2476 numOfChannels = pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels;
2477 pInChannelList = pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.countryValidChannelList.ChannelList;
Srikant Kuppa866893f2012-12-27 17:28:14 -08002478 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08002479 else
2480 {
2481 numOfChannels = sizeof(pMac->roam.validChannelList);
2482
2483 if(!HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac,
2484 (tANI_U8 *)pMac->roam.validChannelList,
2485 (tANI_U32 *) &numOfChannels)))
2486 {
2487 smsLog(pMac, LOGE, FL("Could not get valid channel list"));
2488 return eHAL_STATUS_FAILURE;
2489 }
2490 pInChannelList = pMac->roam.validChannelList;
2491 }
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002492
2493 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
2494 {
2495 csrNeighborRoamChannelsFilterByCurrentBand(
2496 pMac,
2497 pInChannelList,
2498 numOfChannels,
2499 tmpChannelList,
2500 &numOfChannels);
2501 pInChannelList = tmpChannelList;
2502 }
2503
Srikant Kuppa866893f2012-12-27 17:28:14 -08002504 channelList = vos_mem_malloc( numOfChannels );
2505 if( NULL == channelList )
2506 {
2507 smsLog(pMac, LOGE, FL("could not allocate memory for channelList"));
2508 return eHAL_STATUS_FAILURE;
2509 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08002510 vos_mem_copy(channelList, (tANI_U8 *)pInChannelList,
Srikant Kuppa866893f2012-12-27 17:28:14 -08002511 numOfChannels * sizeof(tANI_U8));
2512
2513 bgScanParams.ChannelInfo.numOfChannels = numOfChannels;
2514 bgScanParams.ChannelInfo.ChannelList = channelList;
2515 for (i = 0; i < numOfChannels; i++)
2516 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002517 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "%s: valid channel list = %d",
Srikant Kuppa866893f2012-12-27 17:28:14 -08002518 __func__, bgScanParams.ChannelInfo.ChannelList[i]);
2519 }
2520 csrNeighborRoamFillNonChannelBgScanParams(pMac, &bgScanParams);
2521
2522 status = csrNeighborRoamIssueBgScanRequest(pMac, &bgScanParams,
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002523 sessionId, csrNeighborRoamContiguousScanRequestCallback);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002524
2525 vos_mem_free( channelList );
2526
2527 if (eHAL_STATUS_SUCCESS != status)
2528 {
2529 smsLog(pMac, LOGE, FL("Issue of BG Scan request failed: Status = %d"), status);
2530 }
2531
2532 return status;
2533}
2534#endif
2535
Jeff Johnson295189b2012-06-20 16:38:30 -07002536/* ---------------------------------------------------------------------------
2537
2538 \fn csrNeighborRoamNeighborScanTimerCallback
2539
2540 \brief This function is the neighbor scan timer callback function. It invokes
2541 the BG scan request based on the current and previous states
2542
2543 \param pv - CSR timer context info which includes pMac and session ID
2544
2545 \return VOID
2546
2547---------------------------------------------------------------------------*/
2548void csrNeighborRoamNeighborScanTimerCallback(void *pv)
2549{
2550 tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv;
2551 tpAniSirGlobal pMac = pInfo->pMac;
2552 tANI_U32 sessionId = pInfo->sessionId;
2553 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2554
2555 // check if bg scan is on going, no need to send down the new params if true
2556 if(eANI_BOOLEAN_TRUE == pNeighborRoamInfo->scanRspPending)
2557 {
2558 //msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002559 smsLog(pMac, LOGW, FL("Already BgScanRsp is Pending"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002560 return;
2561 }
2562
2563 VOS_ASSERT(sessionId == pNeighborRoamInfo->csrSessionId);
2564
2565 switch (pNeighborRoamInfo->neighborRoamState)
2566 {
2567#ifdef WLAN_FEATURE_VOWIFI_11R
2568 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2569 switch(pNeighborRoamInfo->prevNeighborRoamState)
2570 {
2571 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY:
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002572 csrNeighborRoamPerformBgScan(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002573 break;
2574 default:
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002575 smsLog(pMac, LOGE, FL("Neighbor scan callback received in state %d, prev state = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002576 pNeighborRoamInfo->neighborRoamState, pNeighborRoamInfo->prevNeighborRoamState);
2577 break;
2578 }
2579 break;
2580#endif /* WLAN_FEATURE_VOWIFI_11R */
2581 case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002582 csrNeighborRoamPerformBgScan(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002583 break;
2584 default:
2585 break;
2586 }
2587 return;
2588}
2589
Srinivas Girigowdade697412013-02-14 16:31:48 -08002590void csrNeighborRoamEmptyScanRefreshTimerCallback(void *context)
2591{
2592 tCsrTimerInfo *pInfo = (tCsrTimerInfo *)context;
2593 tpAniSirGlobal pMac = pInfo->pMac;
2594 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
2595 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2596
2597 /* Reset all the variables just as no scan had happened before */
2598 csrNeighborRoamResetConnectedStateControlInfo(pMac);
2599
2600#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
2601 if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled))
2602 {
2603 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state"));
2604 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
2605 if (VOS_STATUS_SUCCESS != vosStatus)
2606 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002607 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Srinivas Girigowdade697412013-02-14 16:31:48 -08002608 return;
2609 }
2610 /* Increment the neighbor report retry count after sending the neighbor request successfully */
2611 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
2612 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
2613 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY)
2614 }
2615 else
2616#endif
2617 {
2618 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Non 11R or CCX Association:empty scan refresh timer expired"));
2619 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
2620 if (VOS_STATUS_SUCCESS != vosStatus)
2621 {
2622 return;
2623 }
2624 }
2625 return;
2626}
2627
Jeff Johnson295189b2012-06-20 16:38:30 -07002628/* ---------------------------------------------------------------------------
2629
2630 \fn csrNeighborRoamResultsRefreshTimerCallback
2631
2632 \brief This function is the timer callback function for results refresh timer.
2633 When this is invoked, it is as good as down event received from TL. So,
2634 clear off the roamable AP list and start the scan procedure based on 11R
2635 or non-11R association
2636
2637 \param context - CSR timer context info which includes pMac and session ID
2638
2639 \return VOID
2640
2641---------------------------------------------------------------------------*/
2642void csrNeighborRoamResultsRefreshTimerCallback(void *context)
2643{
2644 tCsrTimerInfo *pInfo = (tCsrTimerInfo *)context;
2645 tpAniSirGlobal pMac = pInfo->pMac;
2646 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
2647 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2648
2649 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
2650
2651 /* Deregister reassoc callback. Ignore return status */
2652 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
2653 WLANTL_HO_THRESHOLD_DOWN,
2654 csrNeighborRoamReassocIndCallback,
2655 VOS_MODULE_ID_SME);
2656
2657 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
2658 {
2659 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002660 smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002661 }
2662
2663 /* Reset all the variables just as no scan had happened before */
2664 csrNeighborRoamResetConnectedStateControlInfo(pMac);
2665
2666#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
2667 if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled))
2668 {
2669 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state"));
2670 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
2671 if (VOS_STATUS_SUCCESS != vosStatus)
2672 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002673 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002674 return;
2675 }
2676 /* Increment the neighbor report retry count after sending the neighbor request successfully */
2677 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
2678 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
2679 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY)
2680 }
2681 else
2682#endif
2683 {
Srikant Kuppa866893f2012-12-27 17:28:14 -08002684 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Non 11R or CCX Association:results refresh timer expired"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002685 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
2686 if (VOS_STATUS_SUCCESS != vosStatus)
2687 {
2688 return;
2689 }
2690 }
2691 return;
2692}
2693
2694#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
2695/* ---------------------------------------------------------------------------
2696
2697 \fn csrNeighborRoamIssueNeighborRptRequest
2698
2699 \brief This function is invoked when TL issues a down event and the current assoc
2700 is a 11R association. It invokes SME RRM API to issue the neighbor request to
2701 the currently associated AP with the current SSID
2702
2703 \param pMac - The handle returned by macOpen.
2704
2705 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2706
2707---------------------------------------------------------------------------*/
2708VOS_STATUS csrNeighborRoamIssueNeighborRptRequest(tpAniSirGlobal pMac)
2709{
2710 tRrmNeighborRspCallbackInfo callbackInfo;
2711 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2712 tRrmNeighborReq neighborReq;
2713
2714
2715 neighborReq.no_ssid = 0;
2716
2717 /* Fill in the SSID */
2718 neighborReq.ssid.length = pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length;
2719 vos_mem_copy(neighborReq.ssid.ssId, pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.ssId,
2720 pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length);
2721
2722 callbackInfo.neighborRspCallback = csrNeighborRoamRRMNeighborReportResult;
2723 callbackInfo.neighborRspCallbackContext = pMac;
2724 callbackInfo.timeout = pNeighborRoamInfo->FTRoamInfo.neighborReportTimeout;
2725
2726 return sme_NeighborReportRequest(pMac,(tANI_U8) pNeighborRoamInfo->csrSessionId, &neighborReq, &callbackInfo);
2727}
2728
2729/* ---------------------------------------------------------------------------
2730
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002731 \fn csrNeighborRoamChannelsFilterByCurrentBand
2732
2733 \brief This function is used to filter out the channels
2734 based on the currently associated AP channel
2735
2736 \param pMac - The handle returned by macOpen.
2737 \param pInputChannelList - The input channel list
2738 \param inputNumOfChannels - The number of channels in input channel list
2739 \param pOutputChannelList - The output channel list
2740 \param outputNumOfChannels - The number of channels in output channel list
2741 \param pMergedOutputNumOfChannels - The final number of channels in the output channel list.
2742
2743 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2744
2745---------------------------------------------------------------------------*/
2746
2747VOS_STATUS csrNeighborRoamChannelsFilterByCurrentBand(
2748 tpAniSirGlobal pMac,
2749 tANI_U8* pInputChannelList,
2750 int inputNumOfChannels,
2751 tANI_U8* pOutputChannelList,
2752 int* pMergedOutputNumOfChannels
2753 )
2754{
2755 int i = 0;
2756 int numChannels = 0;
2757 tANI_U8 currAPoperationChannel = pMac->roam.neighborRoamInfo.currAPoperationChannel;
2758 // Check for NULL pointer
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302759 if (!pInputChannelList) return VOS_STATUS_E_INVAL;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002760
2761 // Check for NULL pointer
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302762 if (!pOutputChannelList) return VOS_STATUS_E_INVAL;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002763
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302764 if (inputNumOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN)
2765 {
2766 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2767 "%s: Wrong Number of Input Channels %d",
2768 __func__, inputNumOfChannels);
2769 return VOS_STATUS_E_INVAL;
2770 }
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002771 for (i = 0; i < inputNumOfChannels; i++)
2772 {
2773 if (GetRFBand(currAPoperationChannel) == GetRFBand(pInputChannelList[i]))
2774 {
2775 pOutputChannelList[numChannels] = pInputChannelList[i];
2776 numChannels++;
2777 }
2778 }
2779
2780 // Return final number of channels
2781 *pMergedOutputNumOfChannels = numChannels;
2782
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302783 return VOS_STATUS_SUCCESS;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002784}
2785
2786/* ---------------------------------------------------------------------------
2787
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002788 \fn csrNeighborRoamMergeChannelLists
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002789
2790 \brief This function is used to merge two channel list.
2791 NB: If called with outputNumOfChannels == 0, this routines
2792 simply copies the input channel list to the output channel list.
2793
2794 \param pMac - The handle returned by macOpen.
2795 \param pInputChannelList - The addtional channels to merge in to the "merged" channels list.
2796 \param inputNumOfChannels - The number of additional channels.
2797 \param pOutputChannelList - The place to put the "merged" channel list.
2798 \param outputNumOfChannels - The original number of channels in the "merged" channels list.
2799 \param pMergedOutputNumOfChannels - The final number of channels in the "merged" channel list.
2800
2801 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2802
2803---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002804VOS_STATUS csrNeighborRoamMergeChannelLists(
2805 tpAniSirGlobal pMac,
2806 tANI_U8 *pInputChannelList,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002807 int inputNumOfChannels,
2808 tANI_U8 *pOutputChannelList,
2809 int outputNumOfChannels,
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002810 int *pMergedOutputNumOfChannels
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002811 )
2812{
2813 int i = 0;
2814 int j = 0;
2815 int numChannels = outputNumOfChannels;
2816
2817 // Check for NULL pointer
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302818 if (!pInputChannelList) return VOS_STATUS_E_INVAL;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002819
2820 // Check for NULL pointer
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302821 if (!pOutputChannelList) return VOS_STATUS_E_INVAL;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002822
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302823 if (inputNumOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN)
2824 {
2825 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2826 "%s: Wrong Number of Input Channels %d",
2827 __func__, inputNumOfChannels);
2828 return VOS_STATUS_E_INVAL;
2829 }
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002830 // Add the "new" channels in the input list to the end of the output list.
2831 for (i = 0; i < inputNumOfChannels; i++)
2832 {
2833 for (j = 0; j < outputNumOfChannels; j++)
2834 {
2835 if (pInputChannelList[i] == pOutputChannelList[j])
2836 break;
2837 }
2838 if (j == outputNumOfChannels)
2839 {
2840 if (pInputChannelList[i])
2841 {
Madan Mohan Koyyalamudif5c368b2012-12-06 13:10:13 -08002842 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002843 "%s: [INFOLOG] Adding extra %d to Neighbor channel list", __func__,
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002844 pInputChannelList[i]);
2845 pOutputChannelList[numChannels] = pInputChannelList[i];
2846 numChannels++;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002847 }
2848 }
2849 }
2850
2851 // Return final number of channels
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002852 *pMergedOutputNumOfChannels = numChannels;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002853
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302854 return VOS_STATUS_SUCCESS;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002855}
2856
2857/* ---------------------------------------------------------------------------
2858
Jeff Johnson295189b2012-06-20 16:38:30 -07002859 \fn csrNeighborRoamCreateChanListFromNeighborReport
2860
2861 \brief This function is invoked when neighbor report is received for the
2862 neighbor request. Based on the channels present in the neighbor report,
2863 it generates channel list which will be used in REPORT_SCAN state to
2864 scan for these neighbor APs
2865
2866 \param pMac - The handle returned by macOpen.
2867
2868 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2869
2870---------------------------------------------------------------------------*/
2871VOS_STATUS csrNeighborRoamCreateChanListFromNeighborReport(tpAniSirGlobal pMac)
2872{
2873 tpRrmNeighborReportDesc pNeighborBssDesc;
2874 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002875 tANI_U8 numChannels = 0, i = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002876 tANI_U8 channelList[MAX_BSS_IN_NEIGHBOR_RPT];
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002877#if 0
2878 eHalStatus status = eHAL_STATUS_SUCCESS;
2879#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002880
2881 /* This should always start from 0 whenever we create a channel list out of neighbor AP list */
2882 pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0;
2883
2884 pNeighborBssDesc = smeRrmGetFirstBssEntryFromNeighborCache(pMac);
2885
2886 while (pNeighborBssDesc)
2887 {
2888 if (pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport >= MAX_BSS_IN_NEIGHBOR_RPT) break;
2889
2890 /* Update the neighbor BSS Info in the 11r FT Roam Info */
2891 pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].channelNum =
2892 pNeighborBssDesc->pNeighborBssDescription->channel;
2893 pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].neighborScore =
2894 (tANI_U8)pNeighborBssDesc->roamScore;
2895 vos_mem_copy(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].neighborBssId,
2896 pNeighborBssDesc->pNeighborBssDescription->bssId, sizeof(tSirMacAddr));
2897 pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport++;
2898
2899 /* Saving the channel list non-redundantly */
2900 if (numChannels > 0)
2901 {
2902 for (i = 0; i < numChannels; i++)
2903 {
2904 if (pNeighborBssDesc->pNeighborBssDescription->channel == channelList[i])
2905 break;
2906 }
2907
2908 }
2909 if (i == numChannels)
2910 {
2911 if (pNeighborBssDesc->pNeighborBssDescription->channel)
2912 {
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002913 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
2914 {
2915 // Make sure to add only if its the same band
2916 if (GetRFBand(pNeighborRoamInfo->currAPoperationChannel) ==
2917 GetRFBand(pNeighborBssDesc->pNeighborBssDescription->channel))
2918 {
2919 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2920 "%s: [INFOLOG] Adding %d to Neighbor channel list (Same band)\n", __func__,
2921 pNeighborBssDesc->pNeighborBssDescription->channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07002922 channelList[numChannels] = pNeighborBssDesc->pNeighborBssDescription->channel;
2923 numChannels++;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002924 }
2925 }
2926 else
2927 {
2928 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2929 "%s: [INFOLOG] Adding %d to Neighbor channel list\n", __func__,
2930 pNeighborBssDesc->pNeighborBssDescription->channel);
2931 channelList[numChannels] = pNeighborBssDesc->pNeighborBssDescription->channel;
2932 numChannels++;
2933 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002934 }
2935 }
2936
2937 pNeighborBssDesc = smeRrmGetNextBssEntryFromNeighborCache(pMac, pNeighborBssDesc);
2938 }
2939
2940 if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
2941 {
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002942#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07002943 // Before we free the existing channel list for a safety net make sure
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002944 // we have a union of the IAPP and the already existing list.
2945 status = csrNeighborRoamMergeChannelLists(
2946 pMac,
2947 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList,
2948 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels,
2949 channelList,
2950 numChannels,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002951 &numChannels );
2952#endif
2953
Jeff Johnson295189b2012-06-20 16:38:30 -07002954 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
2955 }
2956
2957 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07002958 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002959 /* Store the obtained channel list to the Neighbor Control data structure */
2960 if (numChannels)
2961 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = vos_mem_malloc((numChannels) * sizeof(tANI_U8));
2962 if (NULL == pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
2963 {
2964 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed.. TL event ignored"));
2965 return VOS_STATUS_E_RESOURCES;
2966 }
2967
2968 vos_mem_copy(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList,
2969 channelList, (numChannels) * sizeof(tANI_U8));
2970 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = numChannels;
2971 if (numChannels)
2972 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002973 smsLog(pMac, LOG1, FL("IAPP Neighbor list callback received as expected in state %d."),
Jeff Johnson295189b2012-06-20 16:38:30 -07002974 pNeighborRoamInfo->neighborRoamState);
2975 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_TRUE;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002976#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2977 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
2978 {
2979 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
2980 }
2981#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002982 }
2983 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
2984 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE;
2985
2986 return VOS_STATUS_SUCCESS;
2987}
2988
2989/* ---------------------------------------------------------------------------
2990
2991 \fn csrNeighborRoamRRMNeighborReportResult
2992
2993 \brief This function is the neighbor report callback that will be invoked by
2994 SME RRM on receiving a neighbor report or of neighbor report is not
2995 received after timeout. On receiving a valid report, it generates a
2996 channel list from the neighbor report and starts the
2997 neighbor scan timer
2998
2999 \param context - The handle returned by macOpen.
3000 vosStatus - Status of the callback(SUCCESS/FAILURE)
3001
3002 \return VOID
3003
3004---------------------------------------------------------------------------*/
3005void csrNeighborRoamRRMNeighborReportResult(void *context, VOS_STATUS vosStatus)
3006{
3007 tpAniSirGlobal pMac = PMAC_STRUCT(context);
3008 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3009 eHalStatus status = eHAL_STATUS_SUCCESS;
3010
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003011 smsLog(pMac, LOG1, FL("Neighbor report result callback with status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003012 switch (pNeighborRoamInfo->neighborRoamState)
3013 {
3014 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY:
3015 /* Reset the report pending variable */
3016 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE;
3017 if (VOS_STATUS_SUCCESS == vosStatus)
3018 {
3019 /* Need to create channel list based on the neighbor AP list and transition to REPORT_SCAN state */
3020 vosStatus = csrNeighborRoamCreateChanListFromNeighborReport(pMac);
3021 if (VOS_STATUS_SUCCESS == vosStatus)
3022 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003023 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Channel List created from Neighbor report, Transitioning to NEIGHBOR_SCAN state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003024 }
3025
3026 /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */
3027 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
3028
3029 /* Now ready for neighbor scan based on the channel list created */
3030 /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is
3031 what palTimerStart expects */
3032 status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer,
3033 pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT,
3034 eANI_BOOLEAN_FALSE);
3035 if (eHAL_STATUS_SUCCESS != status)
3036 {
3037 /* Timer start failed.. Should we ASSERT here??? */
3038 smsLog(pMac, LOGE, FL("PAL Timer start for neighbor scan timer failed, status = %d, Ignoring state transition"), status);
3039 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
3040 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07003041 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003042 return;
3043 }
3044 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
3045 /* Neighbor scan timer started. Transition to REPORT_SCAN state */
3046 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
3047 }
3048 else
3049 {
3050 /* Neighbor report timeout happened in SME RRM. We can try sending more neighbor requests until we
3051 reach the maxNeighborRetries or receiving a successful neighbor response */
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003052 smsLog(pMac, LOGE, FL("Neighbor report result failed after %d retries, MAX RETRIES = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003053 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum, pNeighborRoamInfo->cfgParams.maxNeighborRetries);
3054 if (pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum >=
3055 pNeighborRoamInfo->cfgParams.maxNeighborRetries)
3056 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003057 smsLog(pMac, LOGE, FL("Bailing out to CFG Channel list scan.. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003058 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
3059 if (VOS_STATUS_SUCCESS != vosStatus)
3060 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003061 smsLog(pMac, LOGE, FL("Transit to CFG Channel list scan state failed with status %d "), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003062 return;
3063 }
3064 /* We transitioned to different state now. Reset the Neighbor report retry count */
3065 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
3066 }
3067 else
3068 {
3069 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
3070 if (VOS_STATUS_SUCCESS != vosStatus)
3071 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003072 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003073 return;
3074 }
3075 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
3076 /* Increment the neighbor report retry count after sending the neighbor request successfully */
3077 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
3078 }
3079 }
3080 break;
3081 default:
3082 smsLog(pMac, LOGE, FL("Neighbor result callback not expected in state %d, Ignoring.."), pNeighborRoamInfo->neighborRoamState);
3083 break;
3084 }
3085 return;
3086}
3087#endif /* WLAN_FEATURE_VOWIFI_11R */
3088
3089
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003090#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003091tANI_BOOLEAN csrNeighborRoamIsSsidAndSecurityMatch(
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003092 tpAniSirGlobal pMac,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003093 tCsrRoamConnectedProfile *pCurProfile,
3094 tSirBssDescription *pBssDesc,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003095 tDot11fBeaconIEs *pIes)
3096{
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003097 tCsrAuthList authType;
3098 tCsrEncryptionList uCEncryptionType;
3099 tCsrEncryptionList mCEncryptionType;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003100 tANI_BOOLEAN fMatch = FALSE;
3101
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003102 authType.numEntries = 1;
3103 authType.authType[0] = pCurProfile->AuthType;
3104 uCEncryptionType.numEntries = 1;
3105 uCEncryptionType.encryptionType[0] = pCurProfile->EncryptionType;
3106 mCEncryptionType.numEntries = 1;
3107 mCEncryptionType.encryptionType[0] = pCurProfile->mcEncryptionType;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003108
3109 if( pIes )
3110 {
3111 if(pIes->SSID.present)
3112 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003113 fMatch = csrIsSsidMatch( pMac,
3114 (void *)pCurProfile->SSID.ssId, pCurProfile->SSID.length,
3115 pIes->SSID.ssid, pIes->SSID.num_ssid,
3116 eANI_BOOLEAN_TRUE );
3117 if(TRUE == fMatch)
3118 {
3119 fMatch = csrIsSecurityMatch( pMac, &authType, &uCEncryptionType,
3120 &mCEncryptionType, pBssDesc, pIes, NULL, NULL, NULL );
3121 return (fMatch);
3122 }
3123 else
3124 {
3125 return (fMatch);
3126 }
3127
3128 }
3129 else
3130 {
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003131 return FALSE; // Treat a missing SSID as a non-match.
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003132 }
3133 }
3134 else
3135 {
3136 return FALSE; // Again, treat missing pIes as a non-match.
3137 }
3138}
3139
3140tANI_BOOLEAN csrNeighborRoamIsNewConnectedProfile(
3141 tpAniSirGlobal pMac)
3142{
3143 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3144 tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId;
3145 tCsrRoamConnectedProfile *pCurrProfile = NULL;
3146 tCsrRoamConnectedProfile *pPrevProfile = NULL;
3147 tDot11fBeaconIEs *pIes = NULL;
3148 tSirBssDescription *pBssDesc = NULL;
3149 tANI_BOOLEAN fNew = TRUE;
3150
3151 if(!(pMac->roam.roamSession && CSR_IS_SESSION_VALID(pMac, sessionId)))
3152 {
3153 return (fNew);
3154 }
3155
3156 pCurrProfile = &pMac->roam.roamSession[sessionId].connectedProfile;
3157 if( !pCurrProfile )
3158 {
3159 return (fNew);
3160}
3161
3162 pPrevProfile = &pNeighborRoamInfo->prevConnProfile;
3163 if( !pPrevProfile )
3164 {
3165 return (fNew);
3166 }
3167
3168 pBssDesc = pPrevProfile->pBssDesc;
3169 if (pBssDesc)
3170 {
3171 if (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac,
3172 pBssDesc, &pIes)) &&
3173 csrNeighborRoamIsSsidAndSecurityMatch(pMac, pCurrProfile, pBssDesc, pIes))
3174 {
3175 fNew = FALSE;
3176 }
3177 if (pIes) {
3178 palFreeMemory(pMac->hHdd, pIes);
3179 }
3180 }
3181
3182 if (fNew)
3183 {
3184 smsLog(pMac, LOG1, FL("Prev roam profile did not match current"));
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003185 }
3186 else
3187 {
3188 smsLog(pMac, LOG1, FL("Prev roam profile matches current"));
3189 }
3190
3191 return (fNew);
3192}
3193
3194tANI_BOOLEAN csrNeighborRoamConnectedProfileMatch(
3195 tpAniSirGlobal pMac,
3196 tCsrScanResult *pResult,
3197 tDot11fBeaconIEs *pIes)
3198{
3199 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3200 tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId;
3201 tCsrRoamConnectedProfile *pCurProfile = NULL;
3202 tSirBssDescription *pBssDesc = &pResult->Result.BssDescriptor;
3203
3204 if( !(pMac->roam.roamSession
3205 && CSR_IS_SESSION_VALID(pMac, sessionId)))
3206 {
3207 return FALSE;
3208 }
3209
3210 pCurProfile = &pMac->roam.roamSession[sessionId].connectedProfile;
3211
3212 if( !pCurProfile)
3213 {
3214 return FALSE;
3215 }
3216
3217 return csrNeighborRoamIsSsidAndSecurityMatch(pMac, pCurProfile, pBssDesc, pIes);
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003218}
3219
3220/* ---------------------------------------------------------------------------
3221
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003222 \fn csrNeighborRoamPrepareNonOccupiedChannelList
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003223
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003224 \brief This function is used to prepare a channel list that is derived from
3225 the list of valid channels and does not include those in the occupied
3226 list.
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003227
3228 \param pMac - The handle returned by macOpen.
3229 \param pInputChannelList - The default channels list.
3230 \param numOfChannels - The number of channels in the default channels list.
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003231 \param pOutputChannelList - The place to put the non-occupied channel list.
3232 \param pOutputNumOfChannels - The number of channels in the non-occupied channel list.
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003233
3234 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3235
3236---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003237VOS_STATUS csrNeighborRoamPrepareNonOccupiedChannelList(
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003238 tpAniSirGlobal pMac,
3239 tANI_U8 *pInputChannelList,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003240 int numOfChannels,
3241 tANI_U8 *pOutputChannelList,
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003242 int *pOutputNumOfChannels
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003243 )
3244{
3245 int i = 0;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003246 int outputNumOfChannels = 0; // Clear the output number of channels
3247 tANI_U8 numOccupiedChannels = pMac->scan.occupiedChannels.numChannels;
3248 tANI_U8 *pOccupiedChannelList = pMac->scan.occupiedChannels.channelList;
3249
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003250 for (i = 0; i < numOfChannels; i++)
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003251 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003252 if (!csrIsChannelPresentInList(pOccupiedChannelList, numOccupiedChannels,
3253 pInputChannelList[i]))
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003254 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003255 pOutputChannelList[outputNumOfChannels++] = pInputChannelList[i];
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003256 }
3257 }
3258
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003259 smsLog(pMac, LOG2, FL("Number of channels in the valid channel list=%d; "
3260 "Number of channels in the non-occupied list list=%d"),
3261 numOfChannels, outputNumOfChannels);
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003262
3263 // Return the number of channels
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003264 *pOutputNumOfChannels = outputNumOfChannels;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003265
3266 return eHAL_STATUS_SUCCESS;
3267}
3268#endif /* FEATURE_WLAN_LFR */
3269
Jeff Johnson295189b2012-06-20 16:38:30 -07003270/* ---------------------------------------------------------------------------
3271
3272 \fn csrNeighborRoamTransitToCFGChanScan
3273
3274 \brief This function is called whenever there is a transition to CFG chan scan
3275 state from any state. It frees up the current channel list and allocates
3276 a new memory for the channels received from CFG item. It then starts the
3277 neighbor scan timer to perform the scan on each channel one by one
3278
3279 \param pMac - The handle returned by macOpen.
3280
3281 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3282
3283---------------------------------------------------------------------------*/
3284VOS_STATUS csrNeighborRoamTransitToCFGChanScan(tpAniSirGlobal pMac)
3285{
3286 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3287 eHalStatus status = eHAL_STATUS_SUCCESS;
3288 int i = 0;
3289 int numOfChannels = 0;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003290 tANI_U8 channelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003291 tpCsrChannelInfo currChannelListInfo;
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07003292#ifdef FEATURE_WLAN_LFR
3293 tANI_U32 sessionId = pNeighborRoamInfo->csrSessionId;
3294#endif
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003295 currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07003296
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003297 if (
Jeff Johnson295189b2012-06-20 16:38:30 -07003298#ifdef FEATURE_WLAN_CCX
3299 ((pNeighborRoamInfo->isCCXAssoc) &&
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003300 (pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == eANI_BOOLEAN_FALSE)) ||
Jeff Johnson295189b2012-06-20 16:38:30 -07003301 (pNeighborRoamInfo->isCCXAssoc == eANI_BOOLEAN_FALSE) ||
3302#endif // CCX
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003303 currChannelListInfo->numOfChannels == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003304 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003305 smsLog(pMac, LOGW, FL("Building channel list to scan"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003306
3307
3308 /* Free up the channel list and allocate a new memory. This is because we dont know how much
3309 was allocated last time. If we directly copy more number of bytes than allocated earlier, this might
3310 result in memory corruption */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003311 if (NULL != currChannelListInfo->ChannelList)
Jeff Johnson295189b2012-06-20 16:38:30 -07003312 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003313 vos_mem_free(currChannelListInfo->ChannelList);
3314 currChannelListInfo->ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07003315 currChannelListInfo->numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003316 }
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003317
3318 // Now obtain the contents for "channelList" (the "default valid channel list") from EITHER
3319 // the gNeighborScanChannelList in "cfg.ini", OR the actual "valid channel list" information formed by CSR.
3320 if (0 != pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels)
Jeff Johnson295189b2012-06-20 16:38:30 -07003321 {
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003322 // Copy the "default valid channel list" (channelList) from the gNeighborScanChannelList in "cfg.ini".
3323 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, "Using the channel list from cfg.ini");
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003324 status = csrNeighborRoamMergeChannelLists(
3325 pMac,
3326 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList,
3327 pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels,
3328 channelList,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003329 0, //NB: If 0, simply copy the input channel list to the output list.
3330 &numOfChannels );
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003331
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003332 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
3333 {
3334 csrNeighborRoamChannelsFilterByCurrentBand(
3335 pMac,
3336 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList,
3337 pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels,
3338 channelList,
3339 &numOfChannels);
3340 }
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05303341 if(numOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN)
3342 {
3343 smsLog(pMac, LOGE, FL("Received wrong number of Channel list"));
3344 return VOS_STATUS_E_INVAL;
3345 }
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003346 currChannelListInfo->ChannelList =
3347 vos_mem_malloc(numOfChannels*sizeof(tANI_U8));
3348 if (NULL == currChannelListInfo->ChannelList)
3349 {
3350 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed"));
3351 return VOS_STATUS_E_RESOURCES;
3352 }
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003353 vos_mem_copy(currChannelListInfo->ChannelList,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003354 channelList, numOfChannels * sizeof(tANI_U8));
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003355 }
Srikant Kuppa866893f2012-12-27 17:28:14 -08003356#ifdef FEATURE_WLAN_LFR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003357 else if ((pNeighborRoamInfo->uScanMode == DEFAULT_SCAN) &&
3358 (abs(pNeighborRoamInfo->lookupDOWNRssi) >
3359 abs(pNeighborRoamInfo->cfgParams.neighborReassocThreshold)))
Srikant Kuppa866893f2012-12-27 17:28:14 -08003360 {
3361 /*
3362 * Trigger a contiguous scan on all channels when the
3363 * RSSI in the lookup DOWN notification is below reassoc
3364 * threshold. This will help us find the best available
3365 * candidate and also update the channel cache.
3366 */
3367 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "Triggering contiguous scan "
3368 "(lookupDOWNRssi=%d,reassocThreshold=%d)",
3369 pNeighborRoamInfo->lookupDOWNRssi,
3370 pNeighborRoamInfo->cfgParams.neighborReassocThreshold*(-1));
3371
3372 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
3373
3374 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3375
3376 /* We are about to start a fresh scan cycle,
3377 * purge non-P2P results from the past */
3378 csrScanFlushSelectiveResult(pMac, VOS_FALSE);
Krunal Soni81b24262013-05-15 17:46:41 -07003379
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07003380 csrNeighborRoamPerformContiguousBgScan(pMac, sessionId);
Srikant Kuppa866893f2012-12-27 17:28:14 -08003381
3382 /* Transition to CFG_CHAN_LIST_SCAN */
3383 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN);
Krunal Soni81b24262013-05-15 17:46:41 -07003384
Srikant Kuppa866893f2012-12-27 17:28:14 -08003385 return VOS_STATUS_SUCCESS;
3386 }
3387#endif
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003388 else
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003389 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003390 numOfChannels = pMac->scan.occupiedChannels.numChannels;
3391 if (numOfChannels
3392#ifdef FEATURE_WLAN_LFR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003393 && ((pNeighborRoamInfo->uScanMode == SPLIT_SCAN_OCCUPIED_LIST) ||
3394 (pNeighborRoamInfo->uEmptyScanCount == 0) ||
3395 ((pNeighborRoamInfo->uEmptyScanCount % 2) == 1))
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003396#endif
3397 )
Jeff Johnson295189b2012-06-20 16:38:30 -07003398 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003399 /*
3400 * Always scan channels in the occupied channel list
3401 * before scanning on the non-occupied list.
3402 */
Srinivas Girigowdade697412013-02-14 16:31:48 -08003403 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Switching to occupied channel list"
3404#ifdef FEATURE_WLAN_LFR
3405 "-uScanMode=%d, uEmptyScanCount=%d",
3406 pNeighborRoamInfo->uScanMode,
3407 pNeighborRoamInfo->uEmptyScanCount
3408#endif
3409 );
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003410 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
3411 {
3412 csrNeighborRoamChannelsFilterByCurrentBand(
3413 pMac,
3414 pMac->scan.occupiedChannels.channelList,
3415 numOfChannels,
3416 channelList,
3417 &numOfChannels);
3418 }
3419 else
3420 {
Krunal Sonia75019a2013-05-01 01:08:22 -07003421 if (numOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN)
3422 {
3423 numOfChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
3424 }
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003425 vos_mem_copy(channelList,
3426 pMac->scan.occupiedChannels.channelList,
3427 numOfChannels * sizeof(tANI_U8));
3428 }
3429
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003430 VOS_ASSERT(currChannelListInfo->ChannelList == NULL);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003431 currChannelListInfo->ChannelList = vos_mem_malloc(numOfChannels * sizeof(tANI_U8));
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003432
3433 if (NULL == currChannelListInfo->ChannelList)
3434 {
3435 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed"));
3436 return VOS_STATUS_E_RESOURCES;
3437 }
Krunal Soni81b24262013-05-15 17:46:41 -07003438 if (numOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN)
3439 {
3440 numOfChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
3441 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003442 vos_mem_copy(currChannelListInfo->ChannelList,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003443 channelList,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003444 numOfChannels * sizeof(tANI_U8));
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003445 }
3446 else
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003447 {
3448 /* Scan all channels from non-occupied list */
3449 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Get valid channel list");
3450 numOfChannels = sizeof(pMac->roam.validChannelList);
3451
3452 if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac,
3453 (tANI_U8 *)pMac->roam.validChannelList,
3454 (tANI_U32 *) &numOfChannels)))
3455 {
3456#ifdef FEATURE_WLAN_LFR
3457 /*
3458 * Prepare non-occupied channel list (channelList)
3459 * from the actual "valid channel list" information
3460 * formed by CSR.
3461 */
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05303462 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, "Switching to non-occupied channel list");
Srinivas Girigowdade697412013-02-14 16:31:48 -08003463 status = csrNeighborRoamPrepareNonOccupiedChannelList(pMac,
3464 (tANI_U8 *)pMac->roam.validChannelList,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003465 numOfChannels,
3466 channelList,
3467 &numOfChannels);
3468#else
3469 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Merging channel list");
3470 status = csrNeighborRoamMergeChannelLists(
3471 pMac,
3472 (tANI_U8 *)pMac->roam.validChannelList,
3473 numOfChannels, // The number of channels in the validChannelList
3474 channelList,
3475 0, //NB: If 0, simply copy the input channel list to the output list.
3476 &numOfChannels ); // The final number of channels in the output list. Will be numOfChannels
3477#endif
3478 }
3479 else
3480 {
3481 smsLog(pMac, LOGE, FL("Could not get valid channel list"));
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003482 return VOS_STATUS_E_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003483 }
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003484
3485 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
3486 {
3487 csrNeighborRoamChannelsFilterByCurrentBand(
3488 pMac,
3489 (tANI_U8 *)pMac->roam.validChannelList,
3490 numOfChannels,
3491 channelList,
3492 &numOfChannels);
3493 }
3494
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003495 currChannelListInfo->ChannelList =
3496 vos_mem_malloc(numOfChannels*sizeof(tANI_U8));
3497
3498 if (NULL == currChannelListInfo->ChannelList)
3499 {
3500 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed"));
3501 return VOS_STATUS_E_RESOURCES;
3502 }
3503#ifdef FEATURE_WLAN_LFR
3504 vos_mem_copy(currChannelListInfo->ChannelList,
3505 channelList, numOfChannels * sizeof(tANI_U8));
3506#else
Krunal Sonia75019a2013-05-01 01:08:22 -07003507 if (numOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN)
3508 {
3509 numOfChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
3510 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003511 vos_mem_copy(currChannelListInfo->ChannelList,
3512 (tANI_U8 *)pMac->roam.validChannelList,
3513 numOfChannels * sizeof(tANI_U8));
3514#endif
3515 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003516 }
3517
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003518 /* Adjust for the actual number that are used */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003519 currChannelListInfo->numOfChannels = numOfChannels;
Srikant Kuppa866893f2012-12-27 17:28:14 -08003520 NEIGHBOR_ROAM_DEBUG(pMac, LOGW,
3521 "Number of channels from CFG (or) (non-)occupied list=%d",
3522 currChannelListInfo->numOfChannels);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003523 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07003524 {
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05303525 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "Channel List from CFG (or) (non-)occupied list"
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003526 "= %d", currChannelListInfo->ChannelList[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003527 }
3528 }
3529
3530 /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */
3531 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
3532
3533 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3534 /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is
3535 what palTimerStart expects */
3536 status = palTimerStart(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer,
3537 pNeighborRoamInfo->cfgParams.neighborScanPeriod * PAL_TIMER_TO_MS_UNIT,
3538 eANI_BOOLEAN_FALSE);
3539
3540 if (eHAL_STATUS_SUCCESS != status)
3541 {
3542 /* Timer start failed.. */
3543 smsLog(pMac, LOGE, FL("Neighbor scan PAL Timer start failed, status = %d, Ignoring state transition"), status);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003544 vos_mem_free(currChannelListInfo->ChannelList);
3545 currChannelListInfo->ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07003546 currChannelListInfo->numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003547 return VOS_STATUS_E_FAILURE;
3548 }
3549
3550 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
3551 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE;
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05303552 /* We are about to start a fresh scan cycle,
3553 * purge non-P2P results from the past */
3554 csrScanFlushSelectiveResult(pMac, VOS_FALSE);
James Zmuda5ba36d02013-03-14 17:39:07 -07003555
3556 /* We are about to start a fresh scan cycle,
3557 * purge failed pre-auth results from the past */
3558 csrNeighborRoamPurgePreauthFailedList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003559
3560 /* Transition to CFG_CHAN_LIST_SCAN_STATE */
3561 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN)
3562
3563 return VOS_STATUS_SUCCESS;
3564}
3565
3566/* ---------------------------------------------------------------------------
3567
3568 \fn csrNeighborRoamNeighborLookupUpEvent
3569
3570 \brief This function is called as soon as TL indicates that the current AP's
3571 RSSI is better than the neighbor lookup threshold. Here, we transition to
3572 CONNECTED state and reset all the scan parameters
3573
3574 \param pMac - The handle returned by macOpen.
3575
3576 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3577
3578---------------------------------------------------------------------------*/
3579VOS_STATUS csrNeighborRoamNeighborLookupUpEvent(tpAniSirGlobal pMac)
3580{
3581 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3582 VOS_STATUS vosStatus;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07003583 csrNeighborRoamDeregAllRssiIndication(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003584
Jeff Johnson295189b2012-06-20 16:38:30 -07003585 /* Recheck whether the below check is needed. */
3586 if (pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)
3587 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07003588#ifdef FEATURE_WLAN_LFR
3589 if (!csrRoamIsFastRoamEnabled(pMac,pMac->roam.neighborRoamInfo.csrSessionId))
3590 {
3591 smsLog(pMac, LOGE, FL("Received when fast roam is disabled. Ignore it"));
3592 return eHAL_STATUS_SUCCESS;
3593 }
3594#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07003595 /* Reset all the neighbor roam info control variables. Free all the allocated memory. It is like we are just associated now */
3596 csrNeighborRoamResetConnectedStateControlInfo(pMac);
3597
Jeff Johnson295189b2012-06-20 16:38:30 -07003598
3599 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event neighbor lookup callback with TL. RSSI = %d,"), pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
3600 /* Register Neighbor Lookup threshold callback with TL for DOWN event now */
3601 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
3602 WLANTL_HO_THRESHOLD_DOWN,
3603 csrNeighborRoamNeighborLookupDOWNCallback,
3604 VOS_MODULE_ID_SME, pMac);
Srikant Kuppa866893f2012-12-27 17:28:14 -08003605#ifdef FEATURE_WLAN_LFR
3606 pNeighborRoamInfo->lookupDOWNRssi = 0;
3607#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003608 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
3609 {
3610 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003611 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback DOWN event with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003612 }
3613
3614
3615 return vosStatus;
3616}
3617
3618/* ---------------------------------------------------------------------------
3619
3620 \fn csrNeighborRoamNeighborLookupDownEvent
3621
3622 \brief This function is called as soon as TL indicates that the current AP's
3623 RSSI falls below the current eighbor lookup threshold. Here, we transition to
3624 REPORT_QUERY for 11r association and CFG_CHAN_LIST_SCAN state if the assoc is
3625 a non-11R association.
3626
3627 \param pMac - The handle returned by macOpen.
3628
3629 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3630
3631---------------------------------------------------------------------------*/
3632VOS_STATUS csrNeighborRoamNeighborLookupDownEvent(tpAniSirGlobal pMac)
3633{
3634 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3635 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
3636 eHalStatus status = eHAL_STATUS_SUCCESS;
3637
3638 switch (pNeighborRoamInfo->neighborRoamState)
3639 {
3640 case eCSR_NEIGHBOR_ROAM_STATE_CONNECTED:
3641
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003642 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event neighbor lookup callback with TL. RSSI = %d,"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003643 pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
3644 /* De-register Neighbor Lookup threshold callback with TL */
3645 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
3646 WLANTL_HO_THRESHOLD_DOWN,
3647 csrNeighborRoamNeighborLookupDOWNCallback,
3648 VOS_MODULE_ID_SME);
3649
3650 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
3651 {
3652 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003653 smsLog(pMac, LOGW, FL(" Couldn't Deregister csrNeighborRoamNeighborLookupCallback DOWN event from TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003654 }
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07003655#ifdef FEATURE_WLAN_LFR
3656 if (!csrRoamIsFastRoamEnabled(pMac,pMac->roam.neighborRoamInfo.csrSessionId))
3657 {
3658 smsLog(pMac, LOGE, FL("Received when fast roam is disabled. Ignore it"));
3659 return eHAL_STATUS_SUCCESS;
3660 }
3661#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003662
3663#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
3664 if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled))
3665 {
3666
3667 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state"));
3668 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
3669 if (VOS_STATUS_SUCCESS != vosStatus)
3670 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003671 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003672 return vosStatus;
3673 }
3674 /* Increment the neighbor report retry count after sending the neighbor request successfully */
3675 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
3676 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
3677 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY)
3678 }
3679 else
3680#endif
3681 {
3682 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Non 11R or CCX Association:Neighbor Lookup Down event received in CONNECTED state"));
3683
3684 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
3685 if (VOS_STATUS_SUCCESS != vosStatus)
3686 {
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08003687 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("csrNeighborRoamTransitToCFGChanScan failed"
3688 " with status=%d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003689 return vosStatus;
3690 }
3691 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003692 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 -07003693 /* Register Neighbor Lookup threshold callback with TL for UP event now */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003694 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext,
3695 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
Jeff Johnson295189b2012-06-20 16:38:30 -07003696 WLANTL_HO_THRESHOLD_UP,
3697 csrNeighborRoamNeighborLookupUPCallback,
3698 VOS_MODULE_ID_SME, pMac);
3699 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
3700 {
3701 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003702 smsLog(pMac, LOGE, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback UP event with TL: Status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07003703 }
3704 break;
3705 default:
3706 smsLog(pMac, LOGE, FL("DOWN event received in invalid state %d..Ignoring..."), pNeighborRoamInfo->neighborRoamState);
3707 break;
3708
3709 }
3710 return vosStatus;
3711}
3712
3713/* ---------------------------------------------------------------------------
3714
3715 \fn csrNeighborRoamNeighborLookupUPCallback
3716
3717 \brief This function is registered with TL to indicate whenever the RSSI
3718 gets better than the neighborLookup RSSI Threshold
3719
3720 \param pAdapter - VOS Context
3721 trafficStatus - UP/DOWN indication from TL
3722 pUserCtxt - Parameter for callback registered during callback registration. Should be pMac
3723
3724 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3725
3726---------------------------------------------------------------------------*/
3727VOS_STATUS csrNeighborRoamNeighborLookupUPCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
Srinivasdaaec712012-12-12 15:59:44 -08003728 v_PVOID_t pUserCtxt,
3729 v_S7_t avgRssi)
Jeff Johnson295189b2012-06-20 16:38:30 -07003730{
3731 tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt );
3732 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3733 VOS_STATUS vosStatus = eHAL_STATUS_SUCCESS;
3734
Srinivasdaaec712012-12-12 15:59:44 -08003735 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Neighbor Lookup UP indication callback called with notification %d Reported RSSI = %d"),
3736 rssiNotification,
3737 avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -07003738
3739 if(!csrIsConnStateConnectedInfra(pMac, pNeighborRoamInfo->csrSessionId))
3740 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003741 smsLog(pMac, LOGW, "Ignoring the indication as we are not connected");
Jeff Johnson295189b2012-06-20 16:38:30 -07003742 return VOS_STATUS_SUCCESS;
3743 }
3744
3745 VOS_ASSERT(WLANTL_HO_THRESHOLD_UP == rssiNotification);
3746 vosStatus = csrNeighborRoamNeighborLookupUpEvent(pMac);
3747 return vosStatus;
3748}
3749
3750/* ---------------------------------------------------------------------------
3751
3752 \fn csrNeighborRoamNeighborLookupDOWNCallback
3753
3754 \brief This function is registered with TL to indicate whenever the RSSI
3755 falls below the current neighborLookup RSSI Threshold
3756
3757 \param pAdapter - VOS Context
3758 trafficStatus - UP/DOWN indication from TL
3759 pUserCtxt - Parameter for callback registered during callback registration. Should be pMac
3760
3761 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3762
3763---------------------------------------------------------------------------*/
3764VOS_STATUS csrNeighborRoamNeighborLookupDOWNCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
Srinivasdaaec712012-12-12 15:59:44 -08003765 v_PVOID_t pUserCtxt,
3766 v_S7_t avgRssi)
Jeff Johnson295189b2012-06-20 16:38:30 -07003767{
3768 tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt );
3769 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3770 VOS_STATUS vosStatus = eHAL_STATUS_SUCCESS;
3771
Srinivasdaaec712012-12-12 15:59:44 -08003772 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Neighbor Lookup DOWN indication callback called with notification %d Reported RSSI = %d"),
3773 rssiNotification,
3774 avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -07003775
Srikant Kuppa866893f2012-12-27 17:28:14 -08003776#ifdef FEATURE_WLAN_LFR
3777 pNeighborRoamInfo->lookupDOWNRssi = avgRssi;
3778#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003779 if(!csrIsConnStateConnectedInfra(pMac, pNeighborRoamInfo->csrSessionId))
3780 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003781 smsLog(pMac, LOGW, "Ignoring the indication as we are not connected");
Jeff Johnson295189b2012-06-20 16:38:30 -07003782 return VOS_STATUS_SUCCESS;
3783 }
3784
3785 VOS_ASSERT(WLANTL_HO_THRESHOLD_DOWN == rssiNotification);
3786 vosStatus = csrNeighborRoamNeighborLookupDownEvent(pMac);
3787
3788 return vosStatus;
3789}
3790
3791#ifdef RSSI_HACK
3792extern int dumpCmdRSSI;
3793#endif
3794
3795/* ---------------------------------------------------------------------------
3796
3797 \fn csrNeighborRoamIndicateDisconnect
3798
3799 \brief This function is called by CSR as soon as the station disconnects from
3800 the AP. This function does the necessary cleanup of neighbor roam data
3801 structures. Neighbor roam state transitions to INIT state whenever this
3802 function is called except if the current state is REASSOCIATING
3803
3804 \param pMac - The handle returned by macOpen.
3805 sessionId - CSR session id that got disconnected
3806
3807 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
3808
3809---------------------------------------------------------------------------*/
3810eHalStatus csrNeighborRoamIndicateDisconnect(tpAniSirGlobal pMac, tANI_U8 sessionId)
3811{
3812 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003813#ifdef FEATURE_WLAN_LFR
3814 tCsrRoamConnectedProfile *pPrevProfile = &pNeighborRoamInfo->prevConnProfile;
3815#endif
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07003816 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003817
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07003818 smsLog(pMac, LOGE, FL("Disconnect indication on session %d in state %d"),
3819 sessionId, pNeighborRoamInfo->neighborRoamState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003820
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003821#ifdef FEATURE_WLAN_LFR
3822 /*Free the current previous profile and move the current profile to prev profile.*/
3823 csrRoamFreeConnectProfile(pMac, pPrevProfile);
3824 csrRoamGetConnectProfile(pMac, sessionId, pPrevProfile);
3825#endif
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07003826 if (NULL != pSession)
3827 {
3828 if (NULL != pSession->pCurRoamProfile)
3829 {
3830 if (VOS_STA_MODE != pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona)
3831 {
3832 smsLog(pMac, LOGE, FL("Ignoring Disconnect indication received from a non STA persona."
3833 "sessionId: %d, csrPersonna %d"), sessionId,
3834 (int)pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona);
3835 return eHAL_STATUS_SUCCESS;
3836 }
3837 }
3838 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003839
Jeff Johnson295189b2012-06-20 16:38:30 -07003840#ifdef FEATURE_WLAN_CCX
3841 {
Jeff Johnson295189b2012-06-20 16:38:30 -07003842 if (pSession->connectedProfile.isCCXAssoc)
3843 {
3844 vos_mem_copy(&pSession->prevApSSID, &pSession->connectedProfile.SSID, sizeof(tSirMacSSid));
3845 vos_mem_copy(pSession->prevApBssid, pSession->connectedProfile.bssid, sizeof(tSirMacAddr));
3846 pSession->prevOpChannel = pSession->connectedProfile.operationChannel;
3847 pSession->isPrevApInfoValid = TRUE;
3848 pSession->roamTS1 = vos_timer_get_system_time();
3849
3850 }
3851 }
3852#endif
3853
3854#ifdef RSSI_HACK
3855 dumpCmdRSSI = -40;
3856#endif
3857 switch (pNeighborRoamInfo->neighborRoamState)
3858 {
3859 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
3860 // Stop scan and neighbor refresh timers.
3861 // These are indeed not required when we are in reassociating
3862 // state.
3863 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
3864 palTimerStop(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -08003865 palTimerStop(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Madan Mohan Koyyalamudi5ad3dff2012-10-21 11:32:02 -07003866 if (!CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId )) {
3867 /*
3868 * Disconnect indication during Disassoc Handoff sub-state
3869 * is received when we are trying to disconnect with the old
3870 * AP during roam. BUT, if receive a disconnect indication
3871 * outside of Disassoc Handoff sub-state, then it means that
3872 * this is a genuine disconnect and we need to clean up.
3873 * Otherwise, we will be stuck in reassoc state which will
3874 * in-turn block scans (see csrIsScanAllowed).
3875 */
3876 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT);
3877 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003878 break;
3879
3880 case eCSR_NEIGHBOR_ROAM_STATE_INIT:
Jeff Johnson295189b2012-06-20 16:38:30 -07003881 csrNeighborRoamResetInitStateControlInfo(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003882#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
3883 if(!pMac->roam.configParam.isRoamOffloadScanEnabled)
3884 {
3885#endif
3886 csrNeighborRoamDeregAllRssiIndication(pMac);
3887#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
3888 }
3889#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003890 break;
3891
Srikant Kuppa866893f2012-12-27 17:28:14 -08003892 case eCSR_NEIGHBOR_ROAM_STATE_CONNECTED:
3893 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
3894 csrNeighborRoamResetConnectedStateControlInfo(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003895#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
3896 if(!pMac->roam.configParam.isRoamOffloadScanEnabled)
3897 {
3898#endif
3899 csrNeighborRoamDeregAllRssiIndication(pMac);
3900#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
3901 }
3902#endif
Srikant Kuppa866893f2012-12-27 17:28:14 -08003903 break;
3904
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07003905 case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:
3906 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT);
3907 csrNeighborRoamResetCfgListChanScanControlInfo(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003908#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
3909 if (!pMac->roam.configParam.isRoamOffloadScanEnabled)
3910 {
3911#endif
3912 csrNeighborRoamDeregAllRssiIndication(pMac);
3913#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
3914 }
3915#endif
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07003916 break;
3917
3918 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
3919 /* Stop pre-auth to reassoc interval timer */
3920 palTimerStop(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer);
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07003921 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
3922 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
3923 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07003924 csrNeighborRoamResetPreauthControlInfo(pMac);
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07003925 csrNeighborRoamResetReportScanStateControlInfo(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003926#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
3927 if (!pMac->roam.configParam.isRoamOffloadScanEnabled)
3928 {
3929#endif
3930 csrNeighborRoamDeregAllRssiIndication(pMac);
3931#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
3932 }
3933#endif
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07003934 break;
3935
Jeff Johnson295189b2012-06-20 16:38:30 -07003936 default:
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07003937 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Received disconnect event in state %d"), pNeighborRoamInfo->neighborRoamState);
3938 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Transitioning to INIT state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003939 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07003940 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07003941 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003942#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
3943 /*Inform the Firmware to STOP Scanning as the host has a disconnect.*/
3944 if (csrRoamIsStaMode(pMac, sessionId))
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07003945 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003946 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_STOP, REASON_DISCONNECTED);
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07003947 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003948#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003949 return eHAL_STATUS_SUCCESS;
3950}
3951
3952/* ---------------------------------------------------------------------------
3953
3954 \fn csrNeighborRoamIndicateConnect
3955
3956 \brief This function is called by CSR as soon as the station connects to an AP.
3957 This initializes all the necessary data structures related to the
3958 associated AP and transitions the state to CONNECTED state
3959
3960 \param pMac - The handle returned by macOpen.
3961 sessionId - CSR session id that got connected
3962 vosStatus - connect status SUCCESS/FAILURE
3963
3964 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
3965
3966---------------------------------------------------------------------------*/
3967eHalStatus csrNeighborRoamIndicateConnect(tpAniSirGlobal pMac, tANI_U8 sessionId, VOS_STATUS vosStatus)
3968{
3969 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3970 eHalStatus status = eHAL_STATUS_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07003971 VOS_STATUS vstatus;
3972
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003973#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07003974 int init_ft_flag = FALSE;
3975#endif
3976
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07003977 smsLog(pMac, LOG2, FL("Connect indication received with session id %d in state %d"), sessionId, pNeighborRoamInfo->neighborRoamState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003978
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07003979 // Bail out if this is NOT a STA persona or if a concurrent session is running
3980 if ((pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona != VOS_STA_MODE)||
3981 csrIsConcurrentSessionRunning(pMac))
3982 {
3983 smsLog(pMac, LOGE, FL("Ignoring Connect indication received from a non STA persona."
3984 "sessionId: %d, csrPersonna %d, is multisession %d"),
3985 sessionId,
3986 (int)pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona,
3987 csrIsConcurrentSessionRunning(pMac));
3988 return eHAL_STATUS_SUCCESS;
3989 }
3990
Jeff Johnson295189b2012-06-20 16:38:30 -07003991 switch (pNeighborRoamInfo->neighborRoamState)
3992 {
3993 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
3994 if (VOS_STATUS_SUCCESS != vosStatus)
3995 {
3996 /* Just transition the state to INIT state. Rest of the clean up happens when we get next connect indication */
3997 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
3998 break;
3999 }
4000 /* Fall through if the status is SUCCESS */
4001 case eCSR_NEIGHBOR_ROAM_STATE_INIT:
4002 /* Reset all the data structures here */
4003 csrNeighborRoamResetInitStateControlInfo(pMac);
4004
Jeff Johnson295189b2012-06-20 16:38:30 -07004005 pNeighborRoamInfo->csrSessionId = sessionId;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08004006
4007#ifdef FEATURE_WLAN_LFR
4008 /*
4009 * Initialize the occupied list ONLY if we are
4010 * transitioning from INIT state to CONNECTED state.
4011 */
4012 if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
4013 csrInitOccupiedChannelsList(pMac);
4014#endif
4015 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED);
4016
Jeff Johnson295189b2012-06-20 16:38:30 -07004017 vos_mem_copy(pNeighborRoamInfo->currAPbssid,
4018 pMac->roam.roamSession[sessionId].connectedProfile.bssid, sizeof(tCsrBssid));
4019 pNeighborRoamInfo->currAPoperationChannel = pMac->roam.roamSession[sessionId].connectedProfile.operationChannel;
4020 pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
4021 pNeighborRoamInfo->neighborScanTimerInfo.sessionId = sessionId;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08004022 pNeighborRoamInfo->currentNeighborLookupThreshold =
4023 pNeighborRoamInfo->cfgParams.neighborLookupThreshold;
4024#ifdef FEATURE_WLAN_LFR
4025 pNeighborRoamInfo->uEmptyScanCount = 0;
Srikant Kuppa866893f2012-12-27 17:28:14 -08004026 pNeighborRoamInfo->lookupDOWNRssi = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08004027 pNeighborRoamInfo->uScanMode = DEFAULT_SCAN;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08004028#endif
4029
Jeff Johnson295189b2012-06-20 16:38:30 -07004030
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004031#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07004032 /* Now we can clear the preauthDone that was saved as we are connected afresh */
4033 csrNeighborRoamFreeRoamableBSSList(pMac, &pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
4034#endif
4035
4036#ifdef WLAN_FEATURE_VOWIFI_11R
4037 // Based on the auth scheme tell if we are 11r
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08004038 if ( csrIsAuthType11r( pMac->roam.roamSession[sessionId].connectedProfile.AuthType,
4039 pMac->roam.roamSession[sessionId].connectedProfile.MDID.mdiePresent))
Jeff Johnson295189b2012-06-20 16:38:30 -07004040 {
4041 if (pMac->roam.configParam.isFastTransitionEnabled)
4042 init_ft_flag = TRUE;
4043 pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_TRUE;
4044 }
4045 else
4046 pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07004047 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("11rAssoc is = %d"), pNeighborRoamInfo->is11rAssoc);
Jeff Johnson295189b2012-06-20 16:38:30 -07004048#endif
4049
4050#ifdef FEATURE_WLAN_CCX
4051 // Based on the auth scheme tell if we are 11r
4052 if (pMac->roam.roamSession[sessionId].connectedProfile.isCCXAssoc)
4053 {
4054 if (pMac->roam.configParam.isFastTransitionEnabled)
4055 init_ft_flag = TRUE;
4056 pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_TRUE;
4057 }
4058 else
4059 pNeighborRoamInfo->isCCXAssoc = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07004060 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("isCCXAssoc is = %d ft = %d"),
4061 pNeighborRoamInfo->isCCXAssoc, init_ft_flag);
Jeff Johnson295189b2012-06-20 16:38:30 -07004062
4063#endif
4064
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004065#ifdef FEATURE_WLAN_LFR
4066 // If "Legacy Fast Roaming" is enabled
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05304067 if (csrRoamIsFastRoamEnabled(pMac, sessionId))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004068 {
4069 init_ft_flag = TRUE;
4070 }
4071#endif
4072
4073#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07004074 if ( init_ft_flag == TRUE )
4075 {
4076 /* Initialize all the data structures needed for the 11r FT Preauth */
Jeff Johnson295189b2012-06-20 16:38:30 -07004077 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
4078 csrNeighborRoamPurgePreauthFailedList(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004079#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
4080 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
4081 {
4082 /*If this is not a INFRA type BSS, then do not send the command
4083 * down to firmware.Do not send the START command for other session
4084 * connections.*/
4085 if(csrRoamIsStaMode(pMac, sessionId))
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004086 {
4087 pNeighborRoamInfo->uOsRequestedHandoff = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004088 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_START, REASON_CONNECT);
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004089 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004090 } else {
4091#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004092
4093 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"), pNeighborRoamInfo->currentNeighborLookupThreshold);
4094 /* Register Neighbor Lookup threshold callback with TL for DOWN event only */
Jeff Johnson43971f52012-07-17 12:26:56 -07004095 vstatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
Jeff Johnson295189b2012-06-20 16:38:30 -07004096 WLANTL_HO_THRESHOLD_DOWN,
4097 csrNeighborRoamNeighborLookupDOWNCallback,
4098 VOS_MODULE_ID_SME, pMac);
Srikant Kuppa866893f2012-12-27 17:28:14 -08004099#ifdef FEATURE_WLAN_LFR
4100 pNeighborRoamInfo->lookupDOWNRssi = 0;
4101#endif
Jeff Johnson43971f52012-07-17 12:26:56 -07004102 if(!VOS_IS_STATUS_SUCCESS(vstatus))
Jeff Johnson295189b2012-06-20 16:38:30 -07004103 {
4104 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004105 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d"), vstatus);
Jeff Johnson43971f52012-07-17 12:26:56 -07004106 status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004108#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
4109 }
4110#endif /* WLAN_FEATURE_ROAM_SCAN_OFFLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004111 }
4112#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004113 break;
4114 default:
4115 smsLog(pMac, LOGE, FL("Connect event received in invalid state %d..Ignoring..."), pNeighborRoamInfo->neighborRoamState);
4116 break;
4117 }
4118 return status;
4119}
4120
4121
4122#ifdef WLAN_FEATURE_VOWIFI_11R
4123/* ---------------------------------------------------------------------------
4124
Jeff Johnson295189b2012-06-20 16:38:30 -07004125 \fn csrNeighborRoamPurgePreauthFailedList
4126
4127 \brief This function purges all the MAC addresses in the pre-auth fail list
4128
4129 \param pMac - The handle returned by macOpen.
4130
4131 \return VOID
4132
4133---------------------------------------------------------------------------*/
4134void csrNeighborRoamPurgePreauthFailedList(tpAniSirGlobal pMac)
4135{
4136 tANI_U8 i;
4137
4138 for (i = 0; i < pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.numMACAddress; i++)
4139 {
4140 vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.macAddress[i], sizeof(tSirMacAddr));
4141 }
4142 pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.numMACAddress = 0;
4143
4144 return;
4145}
4146
4147/* ---------------------------------------------------------------------------
4148
4149 \fn csrNeighborRoamInit11rAssocInfo
4150
4151 \brief This function initializes 11r related neighbor roam data structures
4152
4153 \param pMac - The handle returned by macOpen.
4154
4155 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
4156
4157---------------------------------------------------------------------------*/
4158eHalStatus csrNeighborRoamInit11rAssocInfo(tpAniSirGlobal pMac)
4159{
4160 eHalStatus status;
4161 tpCsr11rAssocNeighborInfo pFTRoamInfo = &pMac->roam.neighborRoamInfo.FTRoamInfo;
4162
4163 pMac->roam.neighborRoamInfo.is11rAssoc = eANI_BOOLEAN_FALSE;
4164 pMac->roam.neighborRoamInfo.cfgParams.maxNeighborRetries = pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries;
4165 pFTRoamInfo->neighborReportTimeout = CSR_NEIGHBOR_ROAM_REPORT_QUERY_TIMEOUT;
4166 pFTRoamInfo->PEPreauthRespTimeout = CSR_NEIGHBOR_ROAM_PREAUTH_RSP_WAIT_MULTIPLIER * pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
4167 pFTRoamInfo->neighborRptPending = eANI_BOOLEAN_FALSE;
4168 pFTRoamInfo->preauthRspPending = eANI_BOOLEAN_FALSE;
4169
Jeff Johnson295189b2012-06-20 16:38:30 -07004170 pMac->roam.neighborRoamInfo.FTRoamInfo.currentNeighborRptRetryNum = 0;
4171 pMac->roam.neighborRoamInfo.FTRoamInfo.numBssFromNeighborReport = 0;
4172 vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.neighboReportBssInfo,
4173 sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
4174
4175
4176 status = csrLLOpen(pMac->hHdd, &pFTRoamInfo->preAuthDoneList);
4177 if (eHAL_STATUS_SUCCESS != status)
4178 {
4179 smsLog(pMac, LOGE, FL("LL Open of preauth done AP List failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004180 return eHAL_STATUS_RESOURCES;
4181 }
4182 return status;
4183}
4184#endif /* WLAN_FEATURE_VOWIFI_11R */
4185
4186/* ---------------------------------------------------------------------------
4187
4188 \fn csrNeighborRoamInit
4189
4190 \brief This function initializes neighbor roam data structures
4191
4192 \param pMac - The handle returned by macOpen.
4193
4194 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
4195
4196---------------------------------------------------------------------------*/
4197eHalStatus csrNeighborRoamInit(tpAniSirGlobal pMac)
4198{
4199 eHalStatus status;
4200 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4201
4202 pNeighborRoamInfo->neighborRoamState = eCSR_NEIGHBOR_ROAM_STATE_CLOSED;
4203 pNeighborRoamInfo->prevNeighborRoamState = eCSR_NEIGHBOR_ROAM_STATE_CLOSED;
4204 pNeighborRoamInfo->csrSessionId = CSR_SESSION_ID_INVALID;
4205 pNeighborRoamInfo->cfgParams.maxChannelScanTime = pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime;
4206 pNeighborRoamInfo->cfgParams.minChannelScanTime = pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime;
4207 pNeighborRoamInfo->cfgParams.maxNeighborRetries = 0;
4208 pNeighborRoamInfo->cfgParams.neighborLookupThreshold = pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
4209 pNeighborRoamInfo->cfgParams.neighborReassocThreshold = pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold;
4210 pNeighborRoamInfo->cfgParams.neighborScanPeriod = pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod;
4211 pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod = pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
Srinivas Girigowdade697412013-02-14 16:31:48 -08004212 pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod = pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
4213
4214#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
4215 pNeighborRoamInfo->cfgParams.countryChannelInfo.revision = SME_KR_25;
4216 pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.ChannelList = NULL;
4217 pNeighborRoamInfo->cfgParams.countryChannelInfo.countryValidChannelList.numOfChannels = 0;
4218
4219 if (0 == strncmp(pMac->scan.countryCodeCurrent, "KR", 2))
4220 {
4221 csrInitCountryValidChannelList(pMac, SME_KR_25);
4222 }
4223#endif
4224
4225 pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels =
Jeff Johnson295189b2012-06-20 16:38:30 -07004226 pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels;
4227
Srinivas Girigowdade697412013-02-14 16:31:48 -08004228 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList =
Jeff Johnson295189b2012-06-20 16:38:30 -07004229 vos_mem_malloc(pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels);
4230
4231 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
4232 {
4233 smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed"));
4234 return eHAL_STATUS_RESOURCES;
4235 }
4236
4237 /* Update the roam global structure from CFG */
Srinivas Girigowdade697412013-02-14 16:31:48 -08004238 palCopyMemory(pMac->hHdd, pNeighborRoamInfo->cfgParams.channelInfo.ChannelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07004239 pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList,
4240 pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels);
4241
4242 vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0);
4243 pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08004244#ifdef FEATURE_WLAN_LFR
Srikant Kuppa866893f2012-12-27 17:28:14 -08004245 pNeighborRoamInfo->lookupDOWNRssi = 0;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08004246 pNeighborRoamInfo->uEmptyScanCount = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08004247 pNeighborRoamInfo->uScanMode = DEFAULT_SCAN;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08004248 palZeroMemory(pMac->hHdd, &pNeighborRoamInfo->prevConnProfile,
4249 sizeof(tCsrRoamConnectedProfile));
4250#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004251 pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE;
4252
4253 pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
4254 pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
4255 status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->neighborScanTimer,
4256 csrNeighborRoamNeighborScanTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
4257
4258 if (eHAL_STATUS_SUCCESS != status)
4259 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08004260 smsLog(pMac, LOGE, FL("Neighbor scan timer allocation failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004261 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
4262 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
4263 return eHAL_STATUS_RESOURCES;
4264 }
4265
4266 status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->neighborResultsRefreshTimer,
4267 csrNeighborRoamResultsRefreshTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
4268
4269 if (eHAL_STATUS_SUCCESS != status)
4270 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08004271 smsLog(pMac, LOGE, FL("Neighbor results refresh timer allocation failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004272 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
4273 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
4274 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
4275 return eHAL_STATUS_RESOURCES;
4276 }
4277
Srinivas Girigowdade697412013-02-14 16:31:48 -08004278 status = palTimerAlloc(pMac->hHdd, &pNeighborRoamInfo->emptyScanRefreshTimer,
4279 csrNeighborRoamEmptyScanRefreshTimerCallback,
4280 (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
4281
4282 if (eHAL_STATUS_SUCCESS != status)
4283 {
4284 smsLog(pMac, LOGE, FL("Empty scan refresh timer allocation failed"));
4285 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
4286 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
4287 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
4288 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
4289 return eHAL_STATUS_RESOURCES;
4290 }
4291
Jeff Johnson295189b2012-06-20 16:38:30 -07004292 status = csrLLOpen(pMac->hHdd, &pNeighborRoamInfo->roamableAPList);
4293 if (eHAL_STATUS_SUCCESS != status)
4294 {
4295 smsLog(pMac, LOGE, FL("LL Open of roamable AP List failed"));
4296 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
4297 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
4298 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
4299 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -08004300 palTimerFree(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07004301 return eHAL_STATUS_RESOURCES;
4302 }
4303
4304 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX;
4305 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
4306 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
4307 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
4308 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
4309
4310#ifdef WLAN_FEATURE_VOWIFI_11R
4311 status = csrNeighborRoamInit11rAssocInfo(pMac);
4312 if (eHAL_STATUS_SUCCESS != status)
4313 {
4314 smsLog(pMac, LOGE, FL("LL Open of roamable AP List failed"));
4315 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
4316 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
4317 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
4318 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -08004319 palTimerFree(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07004320 csrLLClose(&pNeighborRoamInfo->roamableAPList);
4321 return eHAL_STATUS_RESOURCES;
4322 }
4323#endif
4324 /* Initialize this with the current tick count */
4325 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
4326
4327 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
4328
4329 return eHAL_STATUS_SUCCESS;
4330}
4331
4332/* ---------------------------------------------------------------------------
4333
4334 \fn csrNeighborRoamClose
4335
4336 \brief This function closes/frees all the neighbor roam data structures
4337
4338 \param pMac - The handle returned by macOpen.
4339
4340 \return VOID
4341
4342---------------------------------------------------------------------------*/
4343void csrNeighborRoamClose(tpAniSirGlobal pMac)
4344{
4345 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4346
4347 if (eCSR_NEIGHBOR_ROAM_STATE_CLOSED == pNeighborRoamInfo->neighborRoamState)
4348 {
Madan Mohan Koyyalamudi8b7f1e62012-10-05 14:56:51 -07004349 smsLog(pMac, LOGW, FL("Neighbor Roam Algorithm Already Closed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004350 return;
4351 }
4352
4353 if (pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
4354 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
4355
4356 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
4357
4358 pNeighborRoamInfo->neighborScanTimerInfo.pMac = NULL;
4359 pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
4360 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborScanTimer);
4361 palTimerFree(pMac->hHdd, pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -08004362 palTimerFree(pMac->hHdd, pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07004363
4364 /* Should free up the nodes in the list before closing the double Linked list */
4365 csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList);
4366 csrLLClose(&pNeighborRoamInfo->roamableAPList);
4367
4368 if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
4369 {
4370 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
4371 }
4372
4373 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
4374 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX;
4375 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
4376 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
4377 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
4378 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
4379
4380 /* Free the profile.. */
4381 csrReleaseProfile(pMac, &pNeighborRoamInfo->csrNeighborRoamProfile);
Sandeep Pc4818ef2012-12-13 14:19:25 -08004382#ifdef FEATURE_WLAN_LFR
Sandeep Pc2b00f62012-12-12 16:44:44 -08004383 csrRoamFreeConnectProfile(pMac, &pNeighborRoamInfo->prevConnProfile);
Sandeep Pc4818ef2012-12-13 14:19:25 -08004384#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004385#ifdef WLAN_FEATURE_VOWIFI_11R
4386 pMac->roam.neighborRoamInfo.FTRoamInfo.currentNeighborRptRetryNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004387 pMac->roam.neighborRoamInfo.FTRoamInfo.numBssFromNeighborReport = 0;
4388 vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.neighboReportBssInfo,
4389 sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
4390 csrNeighborRoamFreeRoamableBSSList(pMac, &pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
4391 csrLLClose(&pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
4392#endif /* WLAN_FEATURE_VOWIFI_11R */
4393
4394 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CLOSED)
4395
4396 return;
4397}
4398
4399/* ---------------------------------------------------------------------------
4400
4401 \fn csrNeighborRoamRequestHandoff
4402
4403 \brief This function triggers actual switching from one AP to the new AP.
4404 It issues disassociate with reason code as Handoff and CSR as a part of
4405 handling disassoc rsp, issues reassociate to the new AP
4406
4407 \param pMac - The handle returned by macOpen.
4408
4409 \return VOID
4410
4411---------------------------------------------------------------------------*/
4412void csrNeighborRoamRequestHandoff(tpAniSirGlobal pMac)
4413{
4414
4415 tCsrRoamInfo roamInfo;
4416 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4417 tANI_U32 sessionId = pNeighborRoamInfo->csrSessionId;
4418 tCsrNeighborRoamBSSInfo handoffNode;
4419 extern void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeDisassocRsp );
4420 tANI_U32 roamId = 0;
4421
4422 if (pMac->roam.neighborRoamInfo.neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE)
4423 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004424 smsLog(pMac, LOGE, FL("Roam requested when Neighbor roam is in %d state"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004425 pMac->roam.neighborRoamInfo.neighborRoamState);
4426 return;
4427 }
4428
4429 vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo));
4430 csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId, &roamInfo, roamId, eCSR_ROAM_FT_START,
4431 eSIR_SME_SUCCESS);
4432
4433 vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo));
4434 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING)
4435
4436 csrNeighborRoamGetHandoffAPInfo(pMac, &handoffNode);
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08004437 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
4438 FL("HANDOFF CANDIDATE BSSID %02x:%02x:%02x:%02x:%02x:%02x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004439 handoffNode.pBssDescription->bssId[0],
4440 handoffNode.pBssDescription->bssId[1],
4441 handoffNode.pBssDescription->bssId[2],
4442 handoffNode.pBssDescription->bssId[3],
4443 handoffNode.pBssDescription->bssId[4],
4444 handoffNode.pBssDescription->bssId[5]);
4445
4446 /* Free the profile.. Just to make sure we dont leak memory here */
4447 csrReleaseProfile(pMac, &pNeighborRoamInfo->csrNeighborRoamProfile);
4448 /* Create the Handoff AP profile. Copy the currently connected profile and update only the BSSID and channel number
4449 This should happen before issuing disconnect */
4450 csrRoamCopyConnectedProfile(pMac, pNeighborRoamInfo->csrSessionId, &pNeighborRoamInfo->csrNeighborRoamProfile);
4451 vos_mem_copy(pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, handoffNode.pBssDescription->bssId, sizeof(tSirMacAddr));
4452 pNeighborRoamInfo->csrNeighborRoamProfile.ChannelInfo.ChannelList[0] = handoffNode.pBssDescription->channelId;
4453
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004454 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, " csrRoamHandoffRequested: disassociating with current AP");
Jeff Johnson295189b2012-06-20 16:38:30 -07004455
4456 if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_HANDOFF)))
4457 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004458 smsLog(pMac, LOGW, "csrRoamHandoffRequested: fail to issue disassociate");
Jeff Johnson295189b2012-06-20 16:38:30 -07004459 return;
4460 }
4461
4462 //notify HDD for handoff, providing the BSSID too
4463 roamInfo.reasonCode = eCsrRoamReasonBetterAP;
4464
4465 vos_mem_copy(roamInfo.bssid,
4466 handoffNode.pBssDescription->bssId,
4467 sizeof( tCsrBssid ));
4468
4469 csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE);
4470
4471
4472 return;
4473}
4474
4475/* ---------------------------------------------------------------------------
4476
4477 \fn csrNeighborRoamIsHandoffInProgress
4478
4479 \brief This function returns whether handoff is in progress or not based on
4480 the current neighbor roam state
4481
4482 \param pMac - The handle returned by macOpen.
4483 is11rReassoc - Return whether reassoc is of type 802.11r reassoc
4484
4485 \return eANI_BOOLEAN_TRUE if reassoc in progress, eANI_BOOLEAN_FALSE otherwise
4486
4487---------------------------------------------------------------------------*/
4488tANI_BOOLEAN csrNeighborRoamIsHandoffInProgress(tpAniSirGlobal pMac)
4489{
4490 if (eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING == pMac->roam.neighborRoamInfo.neighborRoamState)
4491 return eANI_BOOLEAN_TRUE;
4492
4493 return eANI_BOOLEAN_FALSE;
4494}
4495
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08004496#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(WLAN_FEATURE_NEIGHBOR_ROAMING)
Jeff Johnson295189b2012-06-20 16:38:30 -07004497/* ---------------------------------------------------------------------------
4498
4499 \fn csrNeighborRoamIs11rAssoc
4500
4501 \brief This function returns whether the current association is a 11r assoc or not
4502
4503 \param pMac - The handle returned by macOpen.
4504
4505 \return eANI_BOOLEAN_TRUE if current assoc is 11r, eANI_BOOLEAN_FALSE otherwise
4506
4507---------------------------------------------------------------------------*/
4508tANI_BOOLEAN csrNeighborRoamIs11rAssoc(tpAniSirGlobal pMac)
4509{
4510 return pMac->roam.neighborRoamInfo.is11rAssoc;
4511}
4512#endif /* WLAN_FEATURE_VOWIFI_11R */
4513
4514
4515/* ---------------------------------------------------------------------------
4516
4517 \fn csrNeighborRoamGetHandoffAPInfo
4518
4519 \brief This function returns the best possible AP for handoff. For 11R case, it
4520 returns the 1st entry from pre-auth done list. For non-11r case, it returns
4521 the 1st entry from roamable AP list
4522
4523 \param pMac - The handle returned by macOpen.
4524 pHandoffNode - AP node that is the handoff candidate returned
4525
4526 \return VOID
4527
4528---------------------------------------------------------------------------*/
4529void csrNeighborRoamGetHandoffAPInfo(tpAniSirGlobal pMac, tpCsrNeighborRoamBSSInfo pHandoffNode)
4530{
4531 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4532 tpCsrNeighborRoamBSSInfo pBssNode;
4533
4534 VOS_ASSERT(NULL != pHandoffNode);
4535
4536#ifdef WLAN_FEATURE_VOWIFI_11R
4537 if (pNeighborRoamInfo->is11rAssoc)
4538 {
4539 /* Always the BSS info in the head is the handoff candidate */
4540 pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL);
4541 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList));
4542 }
4543 else
4544#endif
4545#ifdef FEATURE_WLAN_CCX
4546 if (pNeighborRoamInfo->isCCXAssoc)
4547 {
4548 /* Always the BSS info in the head is the handoff candidate */
4549 pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL);
4550 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList));
4551 }
4552 else
4553#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004554#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05304555 if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004556 {
4557 /* Always the BSS info in the head is the handoff candidate */
4558 pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL);
4559 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList));
4560 }
4561 else
4562#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004563 {
4564 pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL);
4565 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->roamableAPList));
4566 }
4567 vos_mem_copy(pHandoffNode, pBssNode, sizeof(tCsrNeighborRoamBSSInfo));
4568
4569 return;
4570}
4571
4572/* ---------------------------------------------------------------------------
4573 \brief This function returns TRUE if preauth is completed
4574
4575 \param pMac - The handle returned by macOpen.
4576
4577 \return boolean
4578
4579---------------------------------------------------------------------------*/
4580tANI_BOOLEAN csrNeighborRoamStatePreauthDone(tpAniSirGlobal pMac)
4581{
4582 return (pMac->roam.neighborRoamInfo.neighborRoamState ==
4583 eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE);
4584}
4585
4586/* ---------------------------------------------------------------------------
4587 \brief In the event that we are associated with AP1 and we have
4588 completed pre auth with AP2. Then we receive a deauth/disassoc from
4589 AP1.
4590 At this point neighbor roam is in pre auth done state, pre auth timer
4591 is running. We now handle this case by stopping timer and clearing
4592 the pre-auth state. We basically clear up and just go to disconnected
4593 state.
4594
4595 \param pMac - The handle returned by macOpen.
4596
4597 \return boolean
4598---------------------------------------------------------------------------*/
4599void csrNeighborRoamTranistionPreauthDoneToDisconnected(tpAniSirGlobal pMac)
4600{
4601 if (pMac->roam.neighborRoamInfo.neighborRoamState !=
4602 eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE) return;
4603
4604 // Stop timer
4605 palTimerStop(pMac->hHdd, pMac->ft.ftSmeContext.preAuthReassocIntvlTimer);
4606
4607 // Transition to init state
4608 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
4609}
4610
Srikant Kuppafef66a72013-01-30 17:32:44 -08004611/* ---------------------------------------------------------------------------
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08004612 \brief This function returns TRUE if background scan triggered by
4613 LFR is in progress.
Srikant Kuppafef66a72013-01-30 17:32:44 -08004614
4615 \param halHandle - The handle from HDD context.
4616
4617 \return boolean
4618
4619---------------------------------------------------------------------------*/
4620tANI_BOOLEAN csrNeighborRoamScanRspPending (tHalHandle hHal)
4621{
4622 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4623 return (pMac->roam.neighborRoamInfo.scanRspPending);
4624}
4625
Srinivas Girigowdaa553c462013-03-07 19:42:52 -08004626/* ---------------------------------------------------------------------------
4627 \brief This function returns TRUE if STA is in the middle of roaming states
4628
4629 \param halHandle - The handle from HDD context.
4630
4631 \return boolean
4632
4633---------------------------------------------------------------------------*/
4634tANI_BOOLEAN csrNeighborMiddleOfRoaming (tHalHandle hHal)
4635{
4636 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4637 tANI_BOOLEAN val = (eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4638 (eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4639 (eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4640 (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4641 (eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN == pMac->roam.neighborRoamInfo.neighborRoamState);
4642 return (val);
4643}
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004644#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
4645/* ---------------------------------------------------------------------------
Srinivas Girigowdaa553c462013-03-07 19:42:52 -08004646
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004647 \fn csrNeighborRoamCandidateFoundIndHdlr
4648
4649 \brief This function is called by CSR as soon as TL posts the candidate
4650 found indication to SME via MC thread
4651
4652 \param pMac - The handle returned by macOpen.
4653 pMsg - Msg sent by PE
4654
4655 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
4656
4657---------------------------------------------------------------------------*/
4658eHalStatus csrNeighborRoamCandidateFoundIndHdlr(tpAniSirGlobal pMac, void* pMsg)
4659{
4660 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4661 eHalStatus status = eHAL_STATUS_SUCCESS;
4662 /* we must be in connected state, if not ignore it */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004663 if ((eCSR_NEIGHBOR_ROAM_STATE_CONNECTED != pNeighborRoamInfo->neighborRoamState)
4664 || (pNeighborRoamInfo->uOsRequestedHandoff))
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004665 {
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004666 smsLog(pMac, LOGE, FL("Received in not CONNECTED state OR uOsRequestedHandoff is set. Ignore it"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004667 status = eHAL_STATUS_FAILURE;
4668 }
4669 else
4670 {
4671 /* We are about to start a fresh scan cycle,
4672 * purge non-P2P results from the past */
4673 csrScanFlushSelectiveResult(pMac, VOS_FALSE);
4674 /* Once it gets the candidates found indication from PE, will issue a scan
4675 - req to PE with “freshScan” in scanreq structure set as follows:
4676 0x42 - Return & purge LFR scan results
4677 */
4678 status = csrScanRequestLfrResult(pMac, pNeighborRoamInfo->csrSessionId,
4679 csrNeighborRoamScanResultRequestCallback, pMac);
4680 }
4681
4682 return status;
4683}
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004684
4685/* ---------------------------------------------------------------------------
4686
4687 \fn csrNeighborRoamProcessHandoffReq
4688
4689 \brief This function is called start with the handoff process. First do a
4690 SSID scan for the BSSID provided
4691
4692 \param pMac - The handle returned by macOpen.
4693
4694 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
4695
4696---------------------------------------------------------------------------*/
4697eHalStatus csrNeighborRoamProcessHandoffReq(tpAniSirGlobal pMac)
4698{
4699 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4700 eHalStatus status = eHAL_STATUS_SUCCESS;
4701 tANI_U32 roamId;
4702 tCsrRoamProfile *pProfile = NULL;
4703 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pNeighborRoamInfo->csrSessionId );
4704 tANI_U8 i = 0;
4705
4706 do
4707 {
4708 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4709 status = palAllocateMemory(pMac->hHdd, (void **)&pProfile, sizeof(tCsrRoamProfile));
4710 if(!HAL_STATUS_SUCCESS(status))
4711 {
4712 smsLog(pMac, LOGE, FL("Memory alloc failed"));
4713 break;
4714 }
4715 palZeroMemory(pMac->hHdd, pProfile, sizeof(tCsrRoamProfile));
4716 status = csrRoamCopyProfile(pMac, pProfile, pSession->pCurRoamProfile);
4717 if(!HAL_STATUS_SUCCESS(status))
4718 {
4719 smsLog(pMac, LOGE, FL("Profile copy failed"));
4720 break;
4721 }
4722
4723 //Add the BSSID & Channel
4724 pProfile->BSSIDs.numOfBSSIDs = 1;
4725 pProfile->BSSIDs.bssid = vos_mem_malloc(sizeof(tSirMacAddr) * pProfile->BSSIDs.numOfBSSIDs);
4726 if (NULL == pProfile->BSSIDs.bssid)
4727 {
4728 smsLog(pMac, LOGE, FL("mem alloc failed for BSSID"));
4729 status = eHAL_STATUS_FAILURE;
4730 break;
4731 }
4732
4733 vos_mem_zero(pProfile->BSSIDs.bssid, sizeof(tSirMacAddr) * pProfile->BSSIDs.numOfBSSIDs);
4734
4735 /* Populate the BSSID from handoff info received from HDD */
4736 for (i = 0; i < pProfile->BSSIDs.numOfBSSIDs; i++)
4737 {
4738 vos_mem_copy(&pProfile->BSSIDs.bssid[i],
4739 pNeighborRoamInfo->handoffReqInfo.bssid, sizeof(tSirMacAddr));
4740 }
4741
4742 pProfile->ChannelInfo.numOfChannels = 1;
4743 pProfile->ChannelInfo.ChannelList =
4744 vos_mem_malloc(sizeof(*pProfile->ChannelInfo.ChannelList) *
4745 pProfile->ChannelInfo.numOfChannels);
4746 if (NULL == pProfile->ChannelInfo.ChannelList)
4747 {
4748 smsLog(pMac, LOGE, FL("mem alloc failed for ChannelList"));
4749 status = eHAL_STATUS_FAILURE;
4750 break;
4751 }
4752 pProfile->ChannelInfo.ChannelList[0] = pNeighborRoamInfo->handoffReqInfo.channel;
4753
4754 //clean up csr cache first
4755 //csrScanFlushSelectiveResult(pMac, VOS_FALSE);
4756 //do a SSID scan
4757 status = csrScanForSSID(pMac, pNeighborRoamInfo->csrSessionId, pProfile, roamId, FALSE);
4758 if(!HAL_STATUS_SUCCESS(status))
4759 {
4760 smsLog(pMac, LOGE, FL("SSID scan failed"));
4761 }
4762 }while(0);
4763
4764 if(NULL != pProfile)
4765 {
4766 csrReleaseProfile(pMac, pProfile);
4767 palFreeMemory(pMac->hHdd, pProfile);
4768 }
4769
4770 return status;
4771}
4772
4773/* ---------------------------------------------------------------------------
4774
4775 \fn csrNeighborRoamSssidScanDone
4776
4777 \brief This function is called once SSID scan is done. If SSID scan failed
4778 to find our candidate add an entry to csr scan cache ourself before starting
4779 the handoff process
4780
4781 \param pMac - The handle returned by macOpen.
4782
4783 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
4784
4785---------------------------------------------------------------------------*/
4786eHalStatus csrNeighborRoamSssidScanDone(tpAniSirGlobal pMac, eHalStatus status)
4787{
4788 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4789 eHalStatus hstatus;
4790
4791 smsLog(pMac, LOGE, FL("called "));
4792
4793 /* we must be in connected state, if not ignore it */
4794 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED != pNeighborRoamInfo->neighborRoamState)
4795 {
4796 smsLog(pMac, LOGE, FL("Received in not CONNECTED state. Ignore it"));
4797 return eHAL_STATUS_FAILURE;
4798 }
4799
4800 //if SSID scan failed to find our candidate add an entry to csr scan cache ourself
4801 if(!HAL_STATUS_SUCCESS(status))
4802 {
4803 smsLog(pMac, LOGE, FL("Add an entry to csr scan cache"));
4804 hstatus = csrScanCreateEntryInScanCache(pMac, pNeighborRoamInfo->csrSessionId,
4805 pNeighborRoamInfo->handoffReqInfo.bssid,
4806 pNeighborRoamInfo->handoffReqInfo.channel);
4807 if (eHAL_STATUS_SUCCESS != hstatus)
4808 {
4809 smsLog(pMac, LOGE, FL("csrScanCreateEntryInScanCache failed with status %d"), hstatus);
4810 return eHAL_STATUS_FAILURE;
4811 }
4812 }
4813
4814 /* Now we have completed scanning for the candidate provided by HDD. Let move on to HO*/
4815 hstatus = csrNeighborRoamProcessScanComplete(pMac);
4816
4817 if (eHAL_STATUS_SUCCESS != hstatus)
4818 {
4819 smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus);
4820 return eHAL_STATUS_FAILURE;
4821 }
4822 return eHAL_STATUS_SUCCESS;
4823}
4824
4825/* ---------------------------------------------------------------------------
4826
4827 \fn csrNeighborRoamHandoffReqHdlr
4828
4829 \brief This function is called by CSR as soon as it gets a handoff request
4830 to SME via MC thread
4831
4832 \param pMac - The handle returned by macOpen.
4833 pMsg - Msg sent by HDD
4834
4835 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
4836
4837---------------------------------------------------------------------------*/
4838eHalStatus csrNeighborRoamHandoffReqHdlr(tpAniSirGlobal pMac, void* pMsg)
4839{
4840 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4841 tAniHandoffReq *pHandoffReqInfo;
4842 eHalStatus status = eHAL_STATUS_SUCCESS;
4843 /* we must be in connected state, if not ignore it */
4844 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED != pNeighborRoamInfo->neighborRoamState)
4845 {
4846 smsLog(pMac, LOGE, FL("Received in not CONNECTED state. Ignore it"));
4847 status = eHAL_STATUS_FAILURE;
4848 }
4849 else
4850 {
4851 //save the handoff info came from HDD as part of the reassoc req
4852 pHandoffReqInfo = (tAniHandoffReq *)pMsg;
4853 if (NULL != pHandoffReqInfo)
4854 {
4855 //sanity check
4856 if (VOS_FALSE == vos_mem_compare(pHandoffReqInfo->bssid,
4857 pNeighborRoamInfo->currAPbssid,
4858 sizeof(tSirMacAddr)))
4859 {
4860
4861 pNeighborRoamInfo->handoffReqInfo.channel = pHandoffReqInfo->channel;
4862 vos_mem_copy(pNeighborRoamInfo->handoffReqInfo.bssid,
4863 pHandoffReqInfo->bssid,
4864 6);
4865 pNeighborRoamInfo->uOsRequestedHandoff = 1;
4866 status = csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_STOP,
4867 REASON_OS_REQUESTED_ROAMING_NOW);
4868 if (eHAL_STATUS_SUCCESS != status)
4869 {
4870 smsLog(pMac, LOGE, FL("csrRoamOffloadScan failed"));
4871 pNeighborRoamInfo->uOsRequestedHandoff = 0;
4872 }
4873 }
4874 else
4875 {
4876 smsLog(pMac, LOGE, FL("Received req has same BSSID as current AP!!"));
4877 status = eHAL_STATUS_FAILURE;
4878 }
4879 }
4880 else
4881 {
4882 smsLog(pMac, LOGE, FL("Received msg is NULL"));
4883 status = eHAL_STATUS_FAILURE;
4884 }
4885 }
4886
4887 return status;
4888}
4889
4890/* ---------------------------------------------------------------------------
4891
4892 \fn csrNeighborRoamProceedWithHandoffReq
4893
4894 \brief This function is called by CSR as soon as it gets rsp back for
4895 ROAM_SCAN_OFFLOAD_STOP with reason REASON_OS_REQUESTED_ROAMING_NOW
4896
4897 \param pMac - The handle returned by macOpen.
4898
4899 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
4900
4901---------------------------------------------------------------------------*/
4902eHalStatus csrNeighborRoamProceedWithHandoffReq(tpAniSirGlobal pMac)
4903{
4904 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4905 eHalStatus status = eHAL_STATUS_SUCCESS;
4906 /* we must be in connected state, if not ignore it */
4907 if ((eCSR_NEIGHBOR_ROAM_STATE_CONNECTED != pNeighborRoamInfo->neighborRoamState)
4908 || (!pNeighborRoamInfo->uOsRequestedHandoff))
4909 {
4910 smsLog(pMac, LOGE, FL("Received in not CONNECTED state or uOsRequestedHandoff is not set. Ignore it"));
4911 status = eHAL_STATUS_FAILURE;
4912 }
4913 else
4914 {
4915 //Let's go ahead with handoff
4916 status = csrNeighborRoamProcessHandoffReq(pMac);
4917 }
4918 if(!HAL_STATUS_SUCCESS(status))
4919 {
4920 pNeighborRoamInfo->uOsRequestedHandoff = 0;
4921 }
4922 return status;
4923}
4924
4925/* ---------------------------------------------------------------------------
4926
4927 \fn csrNeighborRoamRestartLfrScan
4928
4929 \brief This function is called if HDD requested handoff failed for some
4930 reason. Restart the LFR logic at that point.
4931
4932 \param pMac - The handle returned by macOpen.
4933
4934 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
4935
4936---------------------------------------------------------------------------*/
4937eHalStatus csrNeighborRoamRestartLfrScan(tpAniSirGlobal pMac)
4938{
4939 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4940 pNeighborRoamInfo->uOsRequestedHandoff = 0;
4941 /* There is no candidate or We are not roaming Now.
4942 * Inform the FW to restart Roam Offload Scan */
4943 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_RESTART, REASON_NO_CAND_FOUND_OR_NOT_ROAMING_NOW);
4944
4945 return eHAL_STATUS_SUCCESS;
4946}
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004947#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07004948#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */