blob: 612f35d7676b3d0a930916ef3b76ea2ab234dabe [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam0fb93dd2014-02-19 00:32:59 -08002 * Copyright (c) 2012-2014 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.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam0fb93dd2014-02-19 00:32:59 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Jeff Johnson295189b2012-06-20 16:38:30 -070028/** ------------------------------------------------------------------------- *
29 ------------------------------------------------------------------------- *
30
31
32 \file csrNeighborRoam.c
33
34 Implementation for the simple roaming algorithm for 802.11r Fast transitions and Legacy roaming for Android platform.
35
36 Copyright (C) 2010 Qualcomm, Incorporated
37
38
39 ========================================================================== */
40
41/*===========================================================================
42
43 EDIT HISTORY FOR FILE
44
45
46 This section contains comments describing changes made to the module.
47 Notice that changes are listed in reverse chronological order.
48
49
50
51 when who what, where, why
52---------- --- --------------------------------------------------------
5308/01/10 Murali Created
54
55===========================================================================*/
56#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
57#include "wlan_qct_wda.h"
58#include "palApi.h"
59#include "csrInsideApi.h"
60#include "smsDebug.h"
61#include "logDump.h"
62#include "smeQosInternal.h"
63#include "wlan_qct_tl.h"
64#include "smeInside.h"
65#include "vos_diag_core_event.h"
66#include "vos_diag_core_log.h"
67#include "csrApi.h"
68#include "wlan_qct_tl.h"
69#include "sme_Api.h"
70#include "csrNeighborRoam.h"
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053071#include "macTrace.h"
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080072#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
73#include "csrEse.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070074#endif
75
76#define WLAN_FEATURE_NEIGHBOR_ROAMING_DEBUG 1
77#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING_DEBUG
78#define NEIGHBOR_ROAM_DEBUG smsLog
79#else
80#define NEIGHBOR_ROAM_DEBUG(x...)
81#endif
82
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -070083static void csrNeighborRoamResetChannelInfo(tpCsrNeighborRoamChannelInfo rChInfo);
84static void csrNeighborRoamResetCfgListChanScanControlInfo(tpAniSirGlobal pMac);
85static void csrNeighborRoamResetPreauthControlInfo(tpAniSirGlobal pMac);
86static void csrNeighborRoamDeregAllRssiIndication(tpAniSirGlobal pMac);
87
Jeff Johnson295189b2012-06-20 16:38:30 -070088VOS_STATUS csrNeighborRoamNeighborLookupUPCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
Srinivasdaaec712012-12-12 15:59:44 -080089 v_PVOID_t pUserCtxt,
90 v_S7_t avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -070091VOS_STATUS csrNeighborRoamNeighborLookupDOWNCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
Srinivasdaaec712012-12-12 15:59:44 -080092 v_PVOID_t pUserCtxt,
93 v_S7_t avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -070094void csrNeighborRoamRRMNeighborReportResult(void *context, VOS_STATUS vosStatus);
95eHalStatus csrRoamCopyConnectedProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pDstProfile );
96
97#ifdef WLAN_FEATURE_VOWIFI_11R
98static eHalStatus csrNeighborRoamIssuePreauthReq(tpAniSirGlobal pMac);
99VOS_STATUS csrNeighborRoamIssueNeighborRptRequest(tpAniSirGlobal pMac);
100#endif
101
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800102v_U8_t *csrNeighborRoamStateToString(v_U8_t state)
103{
104 switch(state)
105 {
Daram Sudha1f7e0e92013-12-17 07:52:31 +0530106 CASE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_CLOSED );
107 CASE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_INIT );
108 CASE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_CONNECTED );
109 CASE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN );
110 CASE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING );
111 CASE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY );
112 CASE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN );
113 CASE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING );
114 CASE_RETURN_STRING( eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE );
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800115 default:
116 return "eCSR_NEIGHBOR_ROAM_STATE_UNKNOWN";
117 }
118
119}
120
Jeff Johnson295189b2012-06-20 16:38:30 -0700121/* State Transition macro */
122#define CSR_NEIGHBOR_ROAM_STATE_TRANSITION(newState)\
123{\
124 pMac->roam.neighborRoamInfo.prevNeighborRoamState = pMac->roam.neighborRoamInfo.neighborRoamState;\
125 pMac->roam.neighborRoamInfo.neighborRoamState = newState;\
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800126 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG, \
127 FL("Neighbor Roam Transition from state %s ==> %s"), \
128 csrNeighborRoamStateToString (pMac->roam.neighborRoamInfo.prevNeighborRoamState), \
129 csrNeighborRoamStateToString (newState));\
Jeff Johnson295189b2012-06-20 16:38:30 -0700130}
131
132/* ---------------------------------------------------------------------------
133
134 \fn csrNeighborRoamFreeNeighborRoamBSSNode
135
136 \brief This function frees all the internal pointers CSR NeighborRoam BSS Info
137 and also frees the node itself
138
139 \param pMac - The handle returned by macOpen.
140 neighborRoamBSSNode - Neighbor Roam BSS Node to be freed
141
142 \return VOID
143
144---------------------------------------------------------------------------*/
145void csrNeighborRoamFreeNeighborRoamBSSNode(tpAniSirGlobal pMac, tpCsrNeighborRoamBSSInfo neighborRoamBSSNode)
146{
147 if (neighborRoamBSSNode)
148 {
149 if (neighborRoamBSSNode->pBssDescription)
150 {
151 vos_mem_free(neighborRoamBSSNode->pBssDescription);
152 neighborRoamBSSNode->pBssDescription = NULL;
153 }
154 vos_mem_free(neighborRoamBSSNode);
155 neighborRoamBSSNode = NULL;
156 }
157
158 return;
159}
160
161/* ---------------------------------------------------------------------------
162
163 \fn csrNeighborRoamRemoveRoamableAPListEntry
164
165 \brief This function removes a given entry from the given list
166
167 \param pMac - The handle returned by macOpen.
168 pList - The list from which the entry should be removed
169 pNeighborEntry - Neighbor Roam BSS Node to be removed
170
171 \return TRUE if successfully removed, else FALSE
172
173---------------------------------------------------------------------------*/
174tANI_BOOLEAN csrNeighborRoamRemoveRoamableAPListEntry(tpAniSirGlobal pMac,
175 tDblLinkList *pList, tpCsrNeighborRoamBSSInfo pNeighborEntry)
176{
177 if(pList)
178 {
179 return csrLLRemoveEntry(pList, &pNeighborEntry->List, LL_ACCESS_LOCK);
180 }
181
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800182 smsLog(pMac, LOGE, FL("Removing neighbor BSS node from list failed. Current count = %d"), csrLLCount(pList));
Jeff Johnson295189b2012-06-20 16:38:30 -0700183
184 return eANI_BOOLEAN_FALSE;
185}
186
187/* ---------------------------------------------------------------------------
188
189 \fn csrNeighborRoamGetRoamableAPListNextEntry
190
191 \brief Gets the entry next to passed entry. If NULL is passed, return the entry in the head of the list
192
193 \param pMac - The handle returned by macOpen.
194 pList - The list from which the entry should be returned
195 pNeighborEntry - Neighbor Roam BSS Node whose next entry should be returned
196
197 \return Neighbor Roam BSS Node to be returned
198
199---------------------------------------------------------------------------*/
200tpCsrNeighborRoamBSSInfo csrNeighborRoamGetRoamableAPListNextEntry(tpAniSirGlobal pMac,
201 tDblLinkList *pList, tpCsrNeighborRoamBSSInfo pNeighborEntry)
202{
203 tListElem *pEntry = NULL;
204 tpCsrNeighborRoamBSSInfo pResult = NULL;
205
206 if(pList)
207 {
208 if(NULL == pNeighborEntry)
209 {
210 pEntry = csrLLPeekHead(pList, LL_ACCESS_LOCK);
211 }
212 else
213 {
214 pEntry = csrLLNext(pList, &pNeighborEntry->List, LL_ACCESS_LOCK);
215 }
216 if(pEntry)
217 {
218 pResult = GET_BASE_ADDR(pEntry, tCsrNeighborRoamBSSInfo, List);
219 }
220 }
221
222 return pResult;
223}
224
225/* ---------------------------------------------------------------------------
226
227 \fn csrNeighborRoamFreeRoamableBSSList
228
229 \brief Empties and frees all the nodes in the roamable AP list
230
231 \param pMac - The handle returned by macOpen.
232 pList - Neighbor Roam BSS List to be emptied
233
234 \return VOID
235
236---------------------------------------------------------------------------*/
237void csrNeighborRoamFreeRoamableBSSList(tpAniSirGlobal pMac, tDblLinkList *pList)
238{
239 tpCsrNeighborRoamBSSInfo pResult = NULL;
240
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800241 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Emptying the BSS list. Current count = %d"), csrLLCount(pList));
Jeff Johnson295189b2012-06-20 16:38:30 -0700242
243 /* Pick up the head, remove and free the node till the list becomes empty */
244 while ((pResult = csrNeighborRoamGetRoamableAPListNextEntry(pMac, pList, NULL)) != NULL)
245 {
246 csrNeighborRoamRemoveRoamableAPListEntry(pMac, pList, pResult);
247 csrNeighborRoamFreeNeighborRoamBSSNode(pMac, pResult);
248 }
249 return;
250}
251
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800252static void csrNeighborRoamTriggerHandoff(tpAniSirGlobal pMac,
253 tpCsrNeighborRoamControlInfo pNeighborRoamInfo)
254{
255#ifdef WLAN_FEATURE_VOWIFI_11R
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700256 if ((pNeighborRoamInfo->is11rAssoc)
257#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
258 && !csrRoamIsRoamOffloadScanEnabled(pMac)
259#endif
260 )
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800261 {
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +0530262 if ((eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState) ||
263 (eSME_ROAM_TRIGGER_FAST_ROAM == pNeighborRoamInfo->cfgRoamEn))
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800264 {
265 csrNeighborRoamIssuePreauthReq(pMac);
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +0530266 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_NONE;
267 vos_mem_set(&pNeighborRoamInfo->cfgRoambssId[0],
268 sizeof(pNeighborRoamInfo->cfgRoambssId),
269 0xFF);
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800270 }
271 else
272 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +0530273 smsLog(pMac, LOGE, FL("11R Reassoc indication received in"
274 "unexpected state %s"),
275 macTraceGetNeighbourRoamState(
276 pNeighborRoamInfo->neighborRoamState));
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800277 VOS_ASSERT(0);
278 }
279 }
280 else
281#endif
282
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800283#ifdef FEATURE_WLAN_ESE
284 if ((pNeighborRoamInfo->isESEAssoc)
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700285#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
286 && !csrRoamIsRoamOffloadScanEnabled(pMac)
287#endif
288 )
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800289 {
290 if (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
291 {
292 csrNeighborRoamIssuePreauthReq(pMac);
293 }
294 else
295 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800296 smsLog(pMac, LOGE, FL("ESE Reassoc indication received in unexpected state %s"),
297 macTraceGetNeighbourRoamState(pNeighborRoamInfo->neighborRoamState));
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800298 VOS_ASSERT(0);
299 }
300 }
301 else
302#endif
303#ifdef FEATURE_WLAN_LFR
304 if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID))
305 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700306 if ((eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
307#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +0530308 || csrRoamIsRoamOffloadScanEnabled(pMac) ||
309 (eSME_ROAM_TRIGGER_FAST_ROAM == pNeighborRoamInfo->cfgRoamEn)
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700310#endif
311 )
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800312 {
313 csrNeighborRoamIssuePreauthReq(pMac);
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +0530314 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_NONE;
315 vos_mem_set(&pNeighborRoamInfo->cfgRoambssId[0],
316 sizeof(pNeighborRoamInfo->cfgRoambssId),
317 0xFF);
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800318 }
319 else
320 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +0530321 smsLog(pMac, LOGE, FL("LFR Reassoc indication received in"
322 "unexpected state %s"),
323 macTraceGetNeighbourRoamState(
324 pNeighborRoamInfo->neighborRoamState));
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800325 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 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +0530337 smsLog(pMac, LOGE, FL("Non-11R Reassoc indication received in"
338 "unexpected state %s or Roaming is disabled"),
339 macTraceGetNeighbourRoamState(
340 pNeighborRoamInfo->neighborRoamState));
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -0800341 }
342 }
343}
344
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700345VOS_STATUS csrNeighborRoamUpdateFastRoamingEnabled(tpAniSirGlobal pMac, const v_BOOL_t fastRoamEnabled)
346{
347 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
348 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
349
350 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
351 {
352 if (VOS_TRUE == fastRoamEnabled)
353 {
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700354#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
355 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
356 {
357 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_START, REASON_CONNECT);
358 } else {
359#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700360 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"),
361 pNeighborRoamInfo->currentNeighborLookupThreshold);
362 /* Register Neighbor Lookup threshold callback with TL for DOWN event only */
363 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
364 WLANTL_HO_THRESHOLD_DOWN,
365 csrNeighborRoamNeighborLookupDOWNCallback,
366 VOS_MODULE_ID_SME, pMac);
367 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
368 {
369 //err msg
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +0530370 smsLog(pMac, LOGE, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d"), vosStatus);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700371 vosStatus = VOS_STATUS_E_FAILURE;
372 }
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700373#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
374 }
375#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700376 }
377 else if (VOS_FALSE == fastRoamEnabled)
378 {
379 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in CONNECTED state, so deregister all events"));
380 /* De-register existing lookup UP/DOWN, Rssi indications */
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700381#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
382 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
383 {
384 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_STOP, REASON_DISCONNECTED);
385 } else {
386#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700387 csrNeighborRoamDeregAllRssiIndication(pMac);
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700388#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
389 }
390#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700391 }
392 }
393 else if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
394 {
395 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in INIT state, Nothing to do"));
396 }
397 else
398 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +0530399 NEIGHBOR_ROAM_DEBUG(pMac, LOGE,
400 FL("Unexpected state %s, returning failure"),
401 macTraceGetNeighbourRoamState(
402 pNeighborRoamInfo->neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700403 vosStatus = VOS_STATUS_E_FAILURE;
404 }
405 return vosStatus;
406}
407
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800408#ifdef FEATURE_WLAN_ESE
409VOS_STATUS csrNeighborRoamUpdateEseModeEnabled(tpAniSirGlobal pMac, const v_BOOL_t eseMode)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700410{
411 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
412 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
413
414 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
415 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800416 if (VOS_TRUE == eseMode)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700417 {
418 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"),
419 pNeighborRoamInfo->currentNeighborLookupThreshold);
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700420#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
421 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
422 {
423 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_START, REASON_CONNECT);
424 } else {
425#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700426 /* Register Neighbor Lookup threshold callback with TL for DOWN event only */
427 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
428 WLANTL_HO_THRESHOLD_DOWN,
429 csrNeighborRoamNeighborLookupDOWNCallback,
430 VOS_MODULE_ID_SME, pMac);
431 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
432 {
433 //err msg
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +0530434 smsLog(pMac, LOGE, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d"), vosStatus);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700435 vosStatus = VOS_STATUS_E_FAILURE;
436 }
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700437#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
438 }
439#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700440 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800441 else if (VOS_FALSE == eseMode)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700442 {
443 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in CONNECTED state, so deregister all events"));
444 /* De-register existing lookup UP/DOWN, Rssi indications */
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700445#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
446 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
447 {
448 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_STOP, REASON_DISCONNECTED);
449 } else {
450#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700451 csrNeighborRoamDeregAllRssiIndication(pMac);
Varun Reddy Yeturu6d99ac82013-05-08 14:15:35 -0700452#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
453 }
454#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -0700455 }
456 }
457 else if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
458 {
459 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in INIT state, Nothing to do"));
460 }
461 else
462 {
463 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Unexpected state %d, returning failure"), pNeighborRoamInfo->neighborRoamState);
464 vosStatus = VOS_STATUS_E_FAILURE;
465 }
466 return vosStatus;
467}
468
469#endif
470
471
Srinivas Girigowdade697412013-02-14 16:31:48 -0800472VOS_STATUS csrNeighborRoamSetLookupRssiThreshold(tpAniSirGlobal pMac, v_U8_t neighborLookupRssiThreshold)
473{
474 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
475 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
476
477 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
478 {
479 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in CONNECTED state, so deregister all and re-register for DOWN event again"));
Srinivas Girigowda577ed652013-08-14 11:38:29 -0700480
481 pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold = neighborLookupRssiThreshold;
482 pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold;
483
Srinivas Girigowdade697412013-02-14 16:31:48 -0800484 /* De-register existing lookup UP/DOWN, Rssi indications */
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -0700485#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
486 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
487 {
Srinivas Girigowda577ed652013-08-14 11:38:29 -0700488 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_LOOKUP_THRESH_CHANGED);
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -0700489 }
490 else
491 {
492#endif
493 csrNeighborRoamDeregAllRssiIndication(pMac);
Srinivas Girigowdade697412013-02-14 16:31:48 -0800494
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -0700495 NEIGHBOR_ROAM_DEBUG(pMac, LOG2,
496 FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"),
497 pNeighborRoamInfo->currentNeighborLookupThreshold);
498 /* Register Neighbor Lookup threshold callback with TL for DOWN event only */
499 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext,
500 (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
501 WLANTL_HO_THRESHOLD_DOWN,
502 csrNeighborRoamNeighborLookupDOWNCallback,
503 VOS_MODULE_ID_SME, pMac);
504 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
505 {
506 //err msg
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +0530507 smsLog(pMac, LOGE, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d"), vosStatus);
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -0700508 vosStatus = VOS_STATUS_E_FAILURE;
509 }
510#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
511 }
512#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -0800513 }
514 else if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
515 {
516 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Currently in INIT state, safe to set lookupRssi threshold"));
517 pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold = neighborLookupRssiThreshold;
518 pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold;
519 }
520 else
521 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +0530522 NEIGHBOR_ROAM_DEBUG(pMac, LOGE,
523 FL("Unexpected state %s, returning failure"),
524 macTraceGetNeighbourRoamState(pNeighborRoamInfo->neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -0800525 vosStatus = VOS_STATUS_E_FAILURE;
526 }
527 return vosStatus;
528}
529
Jeff Johnson295189b2012-06-20 16:38:30 -0700530/* ---------------------------------------------------------------------------
531
532 \fn csrNeighborRoamReassocIndCallback
533
534 \brief Reassoc callback invoked by TL on crossing the registered re-assoc threshold.
535 Directly triggere HO in case of non-11r association
536 In case of 11R association, triggers a pre-auth eventually followed by actual HO
537
538 \param pAdapter - VOS Context
539 trafficStatus - UP/DOWN indication from TL
540 pUserCtxt - Parameter for callback registered during callback registration. Should be pMac
541
542 \return VOID
543
544---------------------------------------------------------------------------*/
545VOS_STATUS csrNeighborRoamReassocIndCallback(v_PVOID_t pAdapter,
546 v_U8_t trafficStatus,
Srinivasdaaec712012-12-12 15:59:44 -0800547 v_PVOID_t pUserCtxt,
548 v_S7_t avgRssi)
Jeff Johnson295189b2012-06-20 16:38:30 -0700549{
550 tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt );
551 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
552 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +0530553
554 if (eSME_ROAM_TRIGGER_FAST_ROAM != pNeighborRoamInfo->cfgRoamEn)
555 {
556 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
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +0530560 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 WLANTL_HO_THRESHOLD_DOWN,
562 csrNeighborRoamReassocIndCallback,
563 VOS_MODULE_ID_SME);
564
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +0530565 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
566 {
567 //err msg
568 smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d"), vosStatus);
569 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700570
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +0530571 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);
573 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
574 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
575 WLANTL_HO_THRESHOLD_UP,
576 csrNeighborRoamNeighborLookupUPCallback,
577 VOS_MODULE_ID_SME);
578
579 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
580 {
581 //err msg
582 smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamNeighborLookupUPCallback with TL: Status = %d"), vosStatus);
583 }
584 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 /* We dont need to run this timer any more. */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +0530586 vos_timer_stop(&pNeighborRoamInfo->neighborResultsRefreshTimer);
587 vos_timer_stop(&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 */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +0530621 vos_timer_stop(&pNeighborRoamInfo->neighborScanTimer);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700622
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -0700623 /* Stop neighbor scan results refresh timer */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +0530624 vos_timer_stop(&pNeighborRoamInfo->neighborResultsRefreshTimer);
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -0700625
Srinivas Girigowdade697412013-02-14 16:31:48 -0800626 /* Stop empty scan results refresh timer */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +0530627 vos_timer_stop(&pNeighborRoamInfo->emptyScanRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -0800628
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700629 /* Abort any ongoing scan */
630 if (eANI_BOOLEAN_TRUE == pNeighborRoamInfo->scanRspPending)
631 {
Srinivas, Dasari138af4f2014-02-07 11:13:45 +0530632 csrScanAbortMacScan(pMac, pNeighborRoamInfo->csrSessionId,
633 eCSR_SCAN_ABORT_DEFAULT);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700634 }
635 pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE;
636
637 /* Reset roam channel list information */
638 csrNeighborRoamResetChannelInfo(&pNeighborRoamInfo->roamChannelInfo);
639}
640
641static void csrNeighborRoamResetPreauthControlInfo(tpAniSirGlobal pMac)
642{
643 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
644
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800645#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700646 pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700647 /* Purge pre-auth fail list */
648 csrNeighborRoamPurgePreauthFailedList(pMac);
649#endif
650
651 pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_FALSE;
652 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
653#ifdef WLAN_FEATURE_VOWIFI_11R
654 /* Do not free up the preauth done list here */
655 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
656 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE;
657 pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0;
658 vos_mem_zero(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700659#endif
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -0700660#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
661 pNeighborRoamInfo->uOsRequestedHandoff = 0;
662 vos_mem_zero(&pNeighborRoamInfo->handoffReqInfo, sizeof(tCsrHandoffRequest));
663#endif
664
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700665}
666
667static void csrNeighborRoamDeregAllRssiIndication(tpAniSirGlobal pMac)
668{
669 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
670 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
671
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800672 NEIGHBOR_ROAM_DEBUG(pMac, LOG2,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700673 FL("Deregister neighbor lookup UP callback with TL. RSSI = %d"),
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -0800674 NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1));
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700675
676 /* Deregister reassoc callback. Ignore return status */
677 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -0800678 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700679 WLANTL_HO_THRESHOLD_UP,
680 csrNeighborRoamNeighborLookupUPCallback,
681 VOS_MODULE_ID_SME);
682
683 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
684 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800685 smsLog(pMac, LOGW,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700686 FL("Couldn't deregister csrNeighborRoamNeighborLookupUPCallback "
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800687 "with TL: Status = %d"), vosStatus);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700688 }
689
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800690 NEIGHBOR_ROAM_DEBUG(pMac, LOG2,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700691 FL("Deregistering reassoc DOWN callback with TL. RSSI = %d"),
692 pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
693
694 /* Deregister reassoc callback. Ignore return status */
695 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
696 (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
697 WLANTL_HO_THRESHOLD_DOWN,
698 csrNeighborRoamReassocIndCallback,
699 VOS_MODULE_ID_SME);
700
701 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
702 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800703 smsLog(pMac, LOGW,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700704 FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with "
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800705 "TL: Status = %d"), vosStatus);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700706 }
707
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800708 NEIGHBOR_ROAM_DEBUG(pMac, LOG2,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700709 FL("Deregistering neighborLookup DOWN callback with TL. RSSI = %d"),
710 pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
711
712 /* Deregister neighbor lookup callback. Ignore return status */
713 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
714 (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
715 WLANTL_HO_THRESHOLD_DOWN,
716 csrNeighborRoamNeighborLookupDOWNCallback,
717 VOS_MODULE_ID_SME);
718
719 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
720 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800721 smsLog(pMac, LOGW,
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700722 FL(" Couldn't deregister csrNeighborRoamNeighborLookupDOWNCallback "
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -0800723 "with TL: Status = %d"), vosStatus);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700724 }
725
726 /* Reset thresholds only after deregistering DOWN event from TL */
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700727 pNeighborRoamInfo->currentNeighborLookupThreshold =
728 pNeighborRoamInfo->cfgParams.neighborLookupThreshold;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -0800729#ifdef FEATURE_WLAN_LFR
730 pNeighborRoamInfo->uEmptyScanCount = 0;
Srikant Kuppa866893f2012-12-27 17:28:14 -0800731 pNeighborRoamInfo->lookupDOWNRssi = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -0800732 pNeighborRoamInfo->uScanMode = DEFAULT_SCAN;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -0800733#endif
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700734}
735
Jeff Johnson295189b2012-06-20 16:38:30 -0700736/* ---------------------------------------------------------------------------
737
738 \fn csrNeighborRoamResetConnectedStateControlInfo
739
740 \brief This function will reset the neighbor roam control info data structures.
741 This function should be invoked whenever we move to CONNECTED state from
742 any state other than INIT state
743
744 \param pMac - The handle returned by macOpen.
745
746 \return VOID
747
748---------------------------------------------------------------------------*/
749void csrNeighborRoamResetConnectedStateControlInfo(tpAniSirGlobal pMac)
750{
751 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
752
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700753 csrNeighborRoamResetChannelInfo(&pNeighborRoamInfo->roamChannelInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700755
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700756 /* We dont need to run this timer any more. */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +0530757 vos_timer_stop(&pNeighborRoamInfo->neighborResultsRefreshTimer);
758 vos_timer_stop(&pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -0700759
760#ifdef WLAN_FEATURE_VOWIFI_11R
761 /* Do not free up the preauth done list here */
762 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
763 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE;
764 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
765 pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0;
766 pNeighborRoamInfo->FTRoamInfo.preauthRspPending = 0;
767 vos_mem_zero(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
Jeff Johnson295189b2012-06-20 16:38:30 -0700768#endif
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -0700769#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
770 pNeighborRoamInfo->uOsRequestedHandoff = 0;
771 vos_mem_zero(&pNeighborRoamInfo->handoffReqInfo, sizeof(tCsrHandoffRequest));
772#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700773}
774
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -0700775void csrNeighborRoamResetReportScanStateControlInfo(tpAniSirGlobal pMac)
Jeff Johnson295189b2012-06-20 16:38:30 -0700776{
777 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700778 pNeighborRoamInfo->csrSessionId = CSR_SESSION_ID_INVALID;
779 vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0);
780 pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
781 pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800782#ifdef FEATURE_WLAN_ESE
783 pNeighborRoamInfo->isESEAssoc = eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700784 pNeighborRoamInfo->isVOAdmitted = eANI_BOOLEAN_FALSE;
785 pNeighborRoamInfo->MinQBssLoadRequired = 0;
786#endif
Madan Mohan Koyyalamudi595208a2012-10-05 12:48:38 -0700787
788 /* Stop scan refresh timer */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +0530789 vos_timer_stop(&pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -0800790 /* Stop empty scan results refresh timer */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +0530791 vos_timer_stop(&pNeighborRoamInfo->emptyScanRefreshTimer);
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -0700792 /* Purge roamable AP list */
793 csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700794 return;
795}
796
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -0700797/* ---------------------------------------------------------------------------
798
799 \fn csrNeighborRoamResetInitStateControlInfo
800
801 \brief This function will reset the neighbor roam control info data structures.
802 This function should be invoked whenever we move to CONNECTED state from
803 INIT state
804
805 \param pMac - The handle returned by macOpen.
806
807 \return VOID
808
809---------------------------------------------------------------------------*/
810void csrNeighborRoamResetInitStateControlInfo(tpAniSirGlobal pMac)
811{
812 csrNeighborRoamResetConnectedStateControlInfo(pMac);
813
814 /* In addition to the above resets, we should clear off the curAPBssId/Session ID in the timers */
815 csrNeighborRoamResetReportScanStateControlInfo(pMac);
816}
817
818
819
Jeff Johnson295189b2012-06-20 16:38:30 -0700820#ifdef WLAN_FEATURE_VOWIFI_11R
821/* ---------------------------------------------------------------------------
822
823 \fn csrNeighborRoamBssIdScanFilter
824
825 \brief This API is used to prepare a filter to obtain scan results when
826 we complete the scan in the REPORT_SCAN state after receiving a
827 valid neighbor report from AP. This filter includes BSSIDs received from
828 the neighbor report from the AP in addition to the other filter parameters
829 created from connected profile
830
831 \param pMac - The handle returned by macOpen.
832 pScanFilter - Scan filter to be filled and returned
833
834 \return eHAL_STATUS_SUCCESS on succesful filter creation, corresponding error
835 code otherwise
836
837---------------------------------------------------------------------------*/
838static eHalStatus csrNeighborRoamBssIdScanFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter)
839{
840 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
841 tANI_U8 i = 0;
842
843 VOS_ASSERT(pScanFilter != NULL);
Gopichand Nakkalad5a904e2013-03-29 01:07:54 +0530844 if (pScanFilter == NULL)
845 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700846 vos_mem_zero(pScanFilter, sizeof(tCsrScanResultFilter));
847
848 pScanFilter->BSSIDs.numOfBSSIDs = pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport;
849 pScanFilter->BSSIDs.bssid = vos_mem_malloc(sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs);
850 if (NULL == pScanFilter->BSSIDs.bssid)
851 {
852 smsLog(pMac, LOGE, FL("Scan Filter BSSID mem alloc failed"));
853 return eHAL_STATUS_FAILED_ALLOC;
854 }
855
856 vos_mem_zero(pScanFilter->BSSIDs.bssid, sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs);
857
858 /* Populate the BSSID from Neighbor BSS info received from neighbor report */
859 for (i = 0; i < pScanFilter->BSSIDs.numOfBSSIDs; i++)
860 {
861 vos_mem_copy(&pScanFilter->BSSIDs.bssid[i],
862 pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[i].neighborBssId, sizeof(tSirMacAddr));
863 }
864
865 /* Fill other general scan filter params */
866 return csrNeighborRoamPrepareScanProfileFilter(pMac, pScanFilter);
867}
868
869/* ---------------------------------------------------------------------------
870
871 \fn csrNeighborRoamPurgePreauthFailList
872
873 \brief This function empties the preauth fail list
874
875 \param pMac - The handle returned by macOpen.
876
877 \return VOID
878
879---------------------------------------------------------------------------*/
880void csrNeighborRoamPurgePreauthFailList(tpAniSirGlobal pMac)
881{
882 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
883
884 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Purging the preauth fail list"));
885 while (pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress)
886 {
887 vos_mem_zero(pNeighborRoamInfo->FTRoamInfo.preAuthFailList.macAddress[pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress-1],
888 sizeof(tSirMacAddr));
889 pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress--;
890 }
891 return;
892}
893
894/* ---------------------------------------------------------------------------
895
896 \fn csrNeighborRoamAddBssIdToPreauthFailList
897
898 \brief This function adds the given BSSID to the Preauth fail list
899
900 \param pMac - The handle returned by macOpen.
901 bssId - BSSID to be added to the preauth fail list
902
903 \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise
904
905---------------------------------------------------------------------------*/
906eHalStatus csrNeighborRoamAddBssIdToPreauthFailList(tpAniSirGlobal pMac, tSirMacAddr bssId)
907{
908 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
909
Arif Hussain24bafea2013-11-15 15:10:03 -0800910 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL(" Added BSSID "MAC_ADDRESS_STR" to Preauth failed list"),
911 MAC_ADDR_ARRAY(bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -0700912
913
914 if ((pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress + 1) >
915 MAX_NUM_PREAUTH_FAIL_LIST_ADDRESS)
916 {
917 smsLog(pMac, LOGE, FL("Preauth fail list already full.. Cannot add new one"));
918 return eHAL_STATUS_FAILURE;
919 }
Kiet Lam64c1b492013-07-12 13:56:44 +0530920 vos_mem_copy(pNeighborRoamInfo->FTRoamInfo.preAuthFailList.macAddress[
921 pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress],
922 bssId,
923 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700924 pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress++;
925
926 return eHAL_STATUS_SUCCESS;
927}
928
929/* ---------------------------------------------------------------------------
930
931 \fn csrNeighborRoamIsPreauthCandidate
932
933 \brief This function checks whether the given MAC address is already
934 present in the preauth fail list and returns TRUE/FALSE accordingly
935
936 \param pMac - The handle returned by macOpen.
937
938 \return eANI_BOOLEAN_TRUE if preauth candidate, eANI_BOOLEAN_FALSE otherwise
939
940---------------------------------------------------------------------------*/
941tANI_BOOLEAN csrNeighborRoamIsPreauthCandidate(tpAniSirGlobal pMac, tSirMacAddr bssId)
942{
943 tANI_U8 i = 0;
944 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
945
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700946#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
947 if (csrRoamIsRoamOffloadScanEnabled(pMac))
948 {
949 return eANI_BOOLEAN_TRUE;
950 }
951#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700952 if (0 == pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress)
953 return eANI_BOOLEAN_TRUE;
954
955 for (i = 0; i < pNeighborRoamInfo->FTRoamInfo.preAuthFailList.numMACAddress; i++)
956 {
957 if (VOS_TRUE == vos_mem_compare(pNeighborRoamInfo->FTRoamInfo.preAuthFailList.macAddress[i],
958 bssId, sizeof(tSirMacAddr)))
959 {
Arif Hussain24bafea2013-11-15 15:10:03 -0800960 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("BSSID "MAC_ADDRESS_STR" already present in preauth fail list"),
961 MAC_ADDR_ARRAY(bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -0700962 return eANI_BOOLEAN_FALSE;
963 }
964 }
965
966 return eANI_BOOLEAN_TRUE;
967}
968
969/* ---------------------------------------------------------------------------
970
971 \fn csrNeighborRoamIssuePreauthReq
972
973 \brief This function issues preauth request to PE with the 1st AP entry in the
974 roamable AP list
975
976 \param pMac - The handle returned by macOpen.
977
978 \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise
979
980---------------------------------------------------------------------------*/
981static eHalStatus csrNeighborRoamIssuePreauthReq(tpAniSirGlobal pMac)
982{
983 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
984 eHalStatus status = eHAL_STATUS_SUCCESS;
985 tpCsrNeighborRoamBSSInfo pNeighborBssNode;
Yue Maef608272013-04-08 23:09:17 -0700986
987#ifdef FEATURE_WLAN_LFR_METRICS
988 tCsrRoamInfo *roamInfo;
989#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700990
991 /* This must not be true here */
992 VOS_ASSERT(pNeighborRoamInfo->FTRoamInfo.preauthRspPending == eANI_BOOLEAN_FALSE);
993
994 /* Issue Preauth request to PE here */
995 /* Need to issue the preauth request with the BSSID that is there in the head of the roamable AP list */
996 /* Parameters that should be passed are BSSID, Channel number and the neighborScanPeriod(probably) */
997 /* If roamableAPList gets empty, should transition to REPORT_SCAN state */
998 pNeighborBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL);
999
1000 if (NULL == pNeighborBssNode)
1001 {
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05301002 smsLog(pMac, LOGW, FL("Roamable AP list is empty.. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001003 return eHAL_STATUS_FAILURE;
1004 }
1005 else
1006 {
Yue Maef608272013-04-08 23:09:17 -07001007#ifdef FEATURE_WLAN_LFR_METRICS
1008 /* LFR metrics - pre-auth initiation metric.
1009 Send the event to supplicant that pre-auth was initiated */
1010 roamInfo = vos_mem_malloc(sizeof(tCsrRoamInfo));
1011 if (NULL == roamInfo)
1012 {
1013 smsLog(pMac, LOG1, FL("Memory allocation failed!"));
1014 }
1015 else
1016 {
1017 vos_mem_copy((void *)roamInfo->bssid,
1018 (void *)pNeighborBssNode->pBssDescription->bssId,
1019 sizeof(tCsrBssid));
1020 csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId,
1021 roamInfo, 0, eCSR_ROAM_PREAUTH_INIT_NOTIFY, 0);
1022 vos_mem_free(pRoamInfo);
1023 }
1024#endif
1025
Madan Mohan Koyyalamudi286b60e2012-10-11 12:59:07 -07001026 status = csrRoamEnqueuePreauth(pMac, pNeighborRoamInfo->csrSessionId, pNeighborBssNode->pBssDescription,
1027 eCsrPerformPreauth, eANI_BOOLEAN_TRUE);
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05301028
Arif Hussain24bafea2013-11-15 15:10:03 -08001029 smsLog(pMac, LOG1, FL("Before Pre-Auth: BSSID "MAC_ADDRESS_STR", Ch:%d"),
1030 MAC_ADDR_ARRAY(pNeighborBssNode->pBssDescription->bssId),
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001031 (int)pNeighborBssNode->pBssDescription->channelId);
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05301032
Jeff Johnson295189b2012-06-20 16:38:30 -07001033 if (eHAL_STATUS_SUCCESS != status)
1034 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001035 smsLog(pMac, LOGE, FL("Send Preauth request to PE failed with status %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07001036 return status;
1037 }
1038 }
1039
1040 pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_TRUE;
1041
1042 /* Increment the preauth retry count */
1043 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries++;
1044
1045 /* Transition the state to preauthenticating */
1046 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING)
Jeff Johnson295189b2012-06-20 16:38:30 -07001047
1048 return status;
1049}
1050
1051/* ---------------------------------------------------------------------------
1052
1053 \fn csrNeighborRoamPreauthRspHandler
1054
1055 \brief This function handle the Preauth response from PE
1056 Every preauth is allowed max 3 tries if it fails. If a bssid failed
1057 for more than MAX_TRIES, we will remove it from the list and try
1058 with the next node in the roamable AP list and add the BSSID to pre-auth failed
1059 list. If no more entries present in
1060 roamable AP list, transition to REPORT_SCAN state
1061
1062 \param pMac - The handle returned by macOpen.
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001063 limStatus - eSIR_SUCCESS/eSIR_FAILURE/eSIR_LIM_MAX_STA_REACHED_ERROR/
1064 eSIT_LIM_AUTH_RSP_TIMEOUT status from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07001065
Madan Mohan Koyyalamudi7a579cc2012-10-21 11:25:39 -07001066 \return eHAL_STATUS_SUCCESS on success (i.e. pre-auth processed),
1067 eHAL_STATUS_FAILURE otherwise
Jeff Johnson295189b2012-06-20 16:38:30 -07001068
1069---------------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001070eHalStatus csrNeighborRoamPreauthRspHandler(tpAniSirGlobal pMac, tSirRetStatus limStatus)
Jeff Johnson295189b2012-06-20 16:38:30 -07001071{
1072 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1073 eHalStatus status = eHAL_STATUS_SUCCESS;
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001074 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Madan Mohan Koyyalamudi7a579cc2012-10-21 11:25:39 -07001075 eHalStatus preauthProcessed = eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001076 tpCsrNeighborRoamBSSInfo pPreauthRspNode = NULL;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001077
Yue Maef608272013-04-08 23:09:17 -07001078#ifdef FEATURE_WLAN_LFR_METRICS
1079 tCsrRoamInfo *roamInfo;
1080#endif
1081
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001082 if (eANI_BOOLEAN_FALSE == pNeighborRoamInfo->FTRoamInfo.preauthRspPending)
1083 {
1084
1085 /* This can happen when we disconnect immediately
1086 * after sending a pre-auth request. During processing
1087 * of the disconnect command, we would have reset
1088 * preauthRspPending and transitioned to INIT state.
1089 */
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001090 NEIGHBOR_ROAM_DEBUG(pMac, LOGW,
1091 FL("Unexpected pre-auth response in state %d"),
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001092 pNeighborRoamInfo->neighborRoamState);
Madan Mohan Koyyalamudi7a579cc2012-10-21 11:25:39 -07001093 preauthProcessed = eHAL_STATUS_FAILURE;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001094 goto DEQ_PREAUTH;
1095 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001096
1097 // We can receive it in these 2 states.
Jeff Johnson295189b2012-06-20 16:38:30 -07001098 if ((pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING) &&
1099 (pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN))
1100 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05301101 NEIGHBOR_ROAM_DEBUG(pMac, LOGW,
1102 FL("Preauth response received in state %s"),
1103 macTraceGetNeighbourRoamState(
1104 pNeighborRoamInfo->neighborRoamState));
Madan Mohan Koyyalamudi7a579cc2012-10-21 11:25:39 -07001105 preauthProcessed = eHAL_STATUS_FAILURE;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001106 goto DEQ_PREAUTH;
Jeff Johnson295189b2012-06-20 16:38:30 -07001107 }
1108
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001109 pNeighborRoamInfo->FTRoamInfo.preauthRspPending = eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001110
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001111 if (eSIR_SUCCESS == limStatus)
Jeff Johnson295189b2012-06-20 16:38:30 -07001112 {
1113 pPreauthRspNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL);
1114 }
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001115 if ((eSIR_SUCCESS == limStatus) && (NULL != pPreauthRspNode))
Jeff Johnson295189b2012-06-20 16:38:30 -07001116 {
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001117 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Preauth completed successfully after %d tries"), pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries);
Jeff Johnson295189b2012-06-20 16:38:30 -07001118
Arif Hussain24bafea2013-11-15 15:10:03 -08001119 smsLog(pMac, LOG1, FL("After Pre-Auth: BSSID "MAC_ADDRESS_STR", Ch:%d"),
1120 MAC_ADDR_ARRAY(pPreauthRspNode->pBssDescription->bssId),
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001121 (int)pPreauthRspNode->pBssDescription->channelId);
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05301122
Yue Maef608272013-04-08 23:09:17 -07001123#ifdef FEATURE_WLAN_LFR_METRICS
1124 /* LFR metrics - pre-auth completion metric.
1125 Send the event to supplicant that pre-auth successfully completed */
1126 roamInfo = vos_mem_malloc(sizeof(tCsrRoamInfo));
1127 if (NULL == roamInfo)
1128 {
1129 smsLog(pMac, LOG1, FL("Memory allocation failed!"));
1130 }
1131 else
1132 {
1133 vos_mem_copy((void *)roamInfo->bssid,
1134 (void *)pPreauthRspNode->pBssDescription->bssId,
1135 sizeof(tCsrBssid));
1136 csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId,
1137 roamInfo, 0, eCSR_ROAM_PREAUTH_STATUS_SUCCESS, 0);
1138 vos_mem_free(pRoamInfo);
1139 }
1140#endif
1141
Jeff Johnson295189b2012-06-20 16:38:30 -07001142 /* Preauth competer successfully. Insert the preauthenticated node to tail of preAuthDoneList */
1143 csrNeighborRoamRemoveRoamableAPListEntry(pMac, &pNeighborRoamInfo->roamableAPList, pPreauthRspNode);
1144 csrLLInsertTail(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, &pPreauthRspNode->List, LL_ACCESS_LOCK);
1145
1146 /* Pre-auth completed successfully. Transition to PREAUTH Done state */
1147 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE)
1148 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
1149
1150 /* The caller of this function would start a timer and by the time it expires, supplicant should
1151 have provided the updated FTIEs to SME. So, when it expires, handoff will be triggered then */
1152 }
1153 else
1154 {
1155 tpCsrNeighborRoamBSSInfo pNeighborBssNode = NULL;
1156 tListElem *pEntry;
1157
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001158 smsLog(pMac, LOGE, FL("Preauth failed retry number %d, status = 0x%x"),
1159 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries, limStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07001160
1161 /* 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 -08001162 if ((pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries >=
1163 CSR_NEIGHBOR_ROAM_MAX_NUM_PREAUTH_RETRIES) ||
1164 (eSIR_LIM_MAX_STA_REACHED_ERROR == limStatus))
Jeff Johnson295189b2012-06-20 16:38:30 -07001165 {
1166 /* We are going to remove the node as it fails for more than MAX tries. Reset this count to 0 */
1167 pNeighborRoamInfo->FTRoamInfo.numPreAuthRetries = 0;
1168
1169 /* The one in the head of the list should be one with which we issued pre-auth and failed */
1170 pEntry = csrLLRemoveHead(&pNeighborRoamInfo->roamableAPList, LL_ACCESS_LOCK);
1171 if(pEntry)
1172 {
1173 pNeighborBssNode = GET_BASE_ADDR(pEntry, tCsrNeighborRoamBSSInfo, List);
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07001174 /* Add the BSSID to pre-auth fail list if it is not requested by HDD */
1175#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1176 if(!pNeighborRoamInfo->uOsRequestedHandoff)
1177#endif
1178 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001179 status = csrNeighborRoamAddBssIdToPreauthFailList(pMac, pNeighborBssNode->pBssDescription->bssId);
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07001180 }
Yue Maef608272013-04-08 23:09:17 -07001181
1182#ifdef FEATURE_WLAN_LFR_METRICS
1183 /* LFR metrics - pre-auth completion metric. Send the event
1184 to supplicant that pre-auth successfully completed */
1185 roamInfo = vos_mem_malloc(sizeof(tCsrRoamInfo));
1186 if (NULL == roamInfo)
1187 {
1188 smsLog(pMac, LOG1, FL("Memory allocation failed!"));
1189 }
1190 else
1191 {
1192 vos_mem_copy((void *)roamInfo->bssid,
1193 (void *)pNeighborBssNode->pBssDescription->bssId,
1194 sizeof(tCsrBssid));
1195 csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId,
1196 roamInfo, 0, eCSR_ROAM_PREAUTH_STATUS_FAILURE, 0);
1197 vos_mem_free(pRoamInfo);
1198 }
1199#endif
1200
Jeff Johnson295189b2012-06-20 16:38:30 -07001201 /* Now we can free this node */
1202 csrNeighborRoamFreeNeighborRoamBSSNode(pMac, pNeighborBssNode);
1203 }
1204 }
1205
1206 /* Issue preauth request for the same/next entry */
1207 if (eHAL_STATUS_SUCCESS == csrNeighborRoamIssuePreauthReq(pMac))
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001208 goto DEQ_PREAUTH;
Jeff Johnson295189b2012-06-20 16:38:30 -07001209
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001210#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1211 if (csrRoamIsRoamOffloadScanEnabled(pMac))
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001212 {
Varun Reddy Yeturue3af4282013-06-07 00:56:52 -07001213 if(pNeighborRoamInfo->uOsRequestedHandoff)
1214 {
1215 pNeighborRoamInfo->uOsRequestedHandoff = 0;
1216 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_START, REASON_PREAUTH_FAILED_FOR_ALL);
1217 }
1218 else
1219 {
1220 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_RESTART, REASON_PREAUTH_FAILED_FOR_ALL);
1221 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001222 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED);
1223 } else
Jeff Johnson295189b2012-06-20 16:38:30 -07001224 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001225#endif
1226 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN);
1227
1228 /* Register Neighbor Lookup threshold callback with TL for UP event now */
1229 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("No more pre-auth candidates-"
1230 "register UP indication with TL. RSSI = %d,"), NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1));
1231
1232 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext,
1233 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
1234 WLANTL_HO_THRESHOLD_UP,
1235 csrNeighborRoamNeighborLookupUPCallback,
1236 VOS_MODULE_ID_SME, pMac);
1237 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1238 {
1239 //err msg
1240 smsLog(pMac, LOGE, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback UP event with TL: Status = %d"), status);
1241 }
1242
1243 /* Start the neighbor results refresh timer and transition to REPORT_SCAN state to perform scan again */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05301244 status = vos_timer_start(&pNeighborRoamInfo->neighborResultsRefreshTimer,
1245 pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod);
1246 if ( status != eHAL_STATUS_SUCCESS )
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001247 {
1248 smsLog(pMac, LOGE, FL("Neighbor results refresh timer start failed with status %d"), status);
1249 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001250 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001251#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001252 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001253#endif
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07001254
1255DEQ_PREAUTH:
1256 csrRoamDequeuePreauth(pMac);
Madan Mohan Koyyalamudi7a579cc2012-10-21 11:25:39 -07001257 return preauthProcessed;
Jeff Johnson295189b2012-06-20 16:38:30 -07001258}
1259#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */
1260
1261/* ---------------------------------------------------------------------------
1262
1263 \fn csrNeighborRoamPrepareScanProfileFilter
1264
1265 \brief This function creates a scan filter based on the currently connected profile.
1266 Based on this filter, scan results are obtained
1267
1268 \param pMac - The handle returned by macOpen.
1269 pScanFilter - Populated scan filter based on the connected profile
1270
1271 \return eHAL_STATUS_SUCCESS on success, eHAL_STATUS_FAILURE otherwise
1272
1273---------------------------------------------------------------------------*/
1274eHalStatus csrNeighborRoamPrepareScanProfileFilter(tpAniSirGlobal pMac, tCsrScanResultFilter *pScanFilter)
1275{
1276 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1277 tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId;
1278 tCsrRoamConnectedProfile *pCurProfile = &pMac->roam.roamSession[sessionId].connectedProfile;
1279 tANI_U8 i = 0;
1280
1281 VOS_ASSERT(pScanFilter != NULL);
Gopichand Nakkalad5a904e2013-03-29 01:07:54 +05301282 if (pScanFilter == NULL)
1283 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001284
1285 vos_mem_zero(pScanFilter, sizeof(tCsrScanResultFilter));
1286
1287 /* We dont want to set BSSID based Filter */
1288 pScanFilter->BSSIDs.numOfBSSIDs = 0;
1289
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07001290 //only for HDD requested handoff fill in the BSSID in the filter
1291#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1292 if (pNeighborRoamInfo->uOsRequestedHandoff)
1293 {
1294 pScanFilter->BSSIDs.numOfBSSIDs = 1;
1295 pScanFilter->BSSIDs.bssid = vos_mem_malloc(sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs);
1296 if (NULL == pScanFilter->BSSIDs.bssid)
1297 {
1298 smsLog(pMac, LOGE, FL("Scan Filter BSSID mem alloc failed"));
1299 return eHAL_STATUS_FAILED_ALLOC;
1300 }
1301
1302 vos_mem_zero(pScanFilter->BSSIDs.bssid, sizeof(tSirMacAddr) * pScanFilter->BSSIDs.numOfBSSIDs);
1303
1304 /* Populate the BSSID from handoff info received from HDD */
1305 for (i = 0; i < pScanFilter->BSSIDs.numOfBSSIDs; i++)
1306 {
1307 vos_mem_copy(&pScanFilter->BSSIDs.bssid[i],
1308 pNeighborRoamInfo->handoffReqInfo.bssid, sizeof(tSirMacAddr));
1309 }
1310 }
1311#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001312 /* Populate all the information from the connected profile */
1313 pScanFilter->SSIDs.numOfSSIDs = 1;
1314 pScanFilter->SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo));
1315 if (NULL == pScanFilter->SSIDs.SSIDList)
1316 {
1317 smsLog(pMac, LOGE, FL("Scan Filter SSID mem alloc failed"));
1318 return eHAL_STATUS_FAILED_ALLOC;
1319 }
1320 pScanFilter->SSIDs.SSIDList->handoffPermitted = 1;
1321 pScanFilter->SSIDs.SSIDList->ssidHidden = 0;
1322 pScanFilter->SSIDs.SSIDList->SSID.length = pCurProfile->SSID.length;
1323 vos_mem_copy((void *)pScanFilter->SSIDs.SSIDList->SSID.ssId, (void *)pCurProfile->SSID.ssId, pCurProfile->SSID.length);
1324
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001325 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Filtering for SSID %.*s from scan results,"
Sanjay Devnani05814522013-06-24 11:46:56 -07001326 "length of SSID = %u"),
1327 pScanFilter->SSIDs.SSIDList->SSID.length,
1328 pScanFilter->SSIDs.SSIDList->SSID.ssId,
1329 pScanFilter->SSIDs.SSIDList->SSID.length);
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 pScanFilter->authType.numEntries = 1;
1331 pScanFilter->authType.authType[0] = pCurProfile->AuthType;
1332
1333 pScanFilter->EncryptionType.numEntries = 1; //This must be 1
1334 pScanFilter->EncryptionType.encryptionType[0] = pCurProfile->EncryptionType;
1335
1336 pScanFilter->mcEncryptionType.numEntries = 1;
1337 pScanFilter->mcEncryptionType.encryptionType[0] = pCurProfile->mcEncryptionType;
1338
1339 pScanFilter->BSSType = pCurProfile->BSSType;
1340
1341 /* We are intrested only in the scan results on channels that we scanned */
1342 pScanFilter->ChannelInfo.numOfChannels = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels;
1343 pScanFilter->ChannelInfo.ChannelList = vos_mem_malloc(pScanFilter->ChannelInfo.numOfChannels * sizeof(tANI_U8));
1344 if (NULL == pScanFilter->ChannelInfo.ChannelList)
1345 {
1346 smsLog(pMac, LOGE, FL("Scan Filter Channel list mem alloc failed"));
1347 vos_mem_free(pScanFilter->SSIDs.SSIDList);
1348 pScanFilter->SSIDs.SSIDList = NULL;
1349 return eHAL_STATUS_FAILED_ALLOC;
1350 }
1351 for (i = 0; i < pScanFilter->ChannelInfo.numOfChannels; i++)
1352 {
1353 pScanFilter->ChannelInfo.ChannelList[i] = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[i];
1354 }
1355
1356#ifdef WLAN_FEATURE_VOWIFI_11R
1357 if (pNeighborRoamInfo->is11rAssoc)
1358 {
1359 /* MDIE should be added as a part of profile. This should be added as a part of filter as well */
1360 pScanFilter->MDID.mdiePresent = pCurProfile->MDID.mdiePresent;
1361 pScanFilter->MDID.mobilityDomain = pCurProfile->MDID.mobilityDomain;
1362 }
1363#endif
1364
1365 return eHAL_STATUS_SUCCESS;
1366}
1367
Jeff Johnson43971f52012-07-17 12:26:56 -07001368tANI_U32 csrGetCurrentAPRssi(tpAniSirGlobal pMac, tScanResultHandle *pScanResultList)
1369{
1370 tCsrScanResultInfo *pScanResult;
1371 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda2efea0e2013-01-24 17:40:41 -08001372#ifdef FEATURE_WLAN_LFR
1373 tANI_U32 CurrAPRssi = pNeighborRoamInfo->lookupDOWNRssi;
1374#else
1375 /* We are setting this as default value to make sure we return this value,
1376 when we do not see this AP in the scan result for some reason.However,it is
1377 less likely that we are associated to an AP and do not see it in the scan list */
1378 tANI_U32 CurrAPRssi = -125;
1379#endif
Jeff Johnson43971f52012-07-17 12:26:56 -07001380
1381 while (NULL != (pScanResult = csrScanResultGetNext(pMac, *pScanResultList)))
1382 {
1383
1384 if (VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId,
1385 pNeighborRoamInfo->currAPbssid, sizeof(tSirMacAddr)))
1386 {
1387 /* We got a match with the currently associated AP.
1388 * Capture the RSSI value and complete the while loop.
1389 * The while loop is completed in order to make the current entry go back to NULL,
1390 * and in the next while loop, it properly starts searching from the head of the list.
1391 * TODO: Can also try setting the current entry directly to NULL as soon as we find the new AP*/
1392
1393 CurrAPRssi = (int)pScanResult->BssDescriptor.rssi * (-1) ;
1394
1395 } else {
1396 continue;
1397 }
1398 }
1399
1400 return CurrAPRssi;
1401
1402}
1403
Jeff Johnson295189b2012-06-20 16:38:30 -07001404/* ---------------------------------------------------------------------------
1405
1406 \fn csrNeighborRoamProcessScanResults
1407
1408 \brief This function extracts scan results, sorts on the basis of neighbor score(todo).
1409 Assumed that the results are already sorted by RSSI by csrScanGetResult
1410
1411 \param pMac - The handle returned by macOpen.
1412 pScanResultList - Scan result result obtained from csrScanGetResult()
1413
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001414 \return tANI_BOOLEAN - return TRUE if we have a candidate we can immediately
1415 roam to. Otherwise, return FALSE.
Jeff Johnson295189b2012-06-20 16:38:30 -07001416
1417---------------------------------------------------------------------------*/
1418
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001419static tANI_BOOLEAN csrNeighborRoamProcessScanResults(tpAniSirGlobal pMac,
1420 tScanResultHandle *pScanResultList)
Jeff Johnson295189b2012-06-20 16:38:30 -07001421{
1422 tCsrScanResultInfo *pScanResult;
1423 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1424 tpCsrNeighborRoamBSSInfo pBssInfo;
Jeff Johnson43971f52012-07-17 12:26:56 -07001425 tANI_U32 CurrAPRssi;
1426 tANI_U8 RoamRssiDiff = pMac->roam.configParam.RoamRssiDiff;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001427#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001428 tANI_U8 immediateRoamRssiDiff = pMac->roam.configParam.nImmediateRoamRssiDiff;
1429#endif
1430 tANI_BOOLEAN roamNow = eANI_BOOLEAN_FALSE;
Jeff Johnson43971f52012-07-17 12:26:56 -07001431
1432 /***************************************************************
1433 * Find out the Current AP RSSI and keep it handy to check if
1434 * it is better than the RSSI of the AP which we are
1435 * going to roam.If so, we are going to continue with the
1436 * current AP.
1437 ***************************************************************/
1438 CurrAPRssi = csrGetCurrentAPRssi(pMac, pScanResultList);
Jeff Johnson295189b2012-06-20 16:38:30 -07001439
1440 /* Expecting the scan result already to be in the sorted order based on the RSSI */
1441 /* Based on the previous state we need to check whether the list should be sorted again taking neighbor score into consideration */
1442 /* If previous state is CFG_CHAN_LIST_SCAN, there should not be any neighbor score associated with any of the BSS.
1443 If the previous state is REPORT_QUERY, then there will be neighbor score for each of the APs */
1444 /* 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
1445 and rssi score are in the same order. This will be taken care later */
1446
1447 while (NULL != (pScanResult = csrScanResultGetNext(pMac, *pScanResultList)))
1448 {
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001449 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Arif Hussain24bafea2013-11-15 15:10:03 -08001450 FL("Scan result: BSSID "MAC_ADDRESS_STR" (Rssi %ld, Ch:%d)"),
1451 MAC_ADDR_ARRAY(pScanResult->BssDescriptor.bssId),
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001452 abs(pScanResult->BssDescriptor.rssi),
1453 pScanResult->BssDescriptor.channelId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001454
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05301455 if ((VOS_TRUE == vos_mem_compare(pScanResult->BssDescriptor.bssId,
1456 pNeighborRoamInfo->currAPbssid, sizeof(tSirMacAddr))) ||
1457 ((eSME_ROAM_TRIGGER_SCAN == pNeighborRoamInfo->cfgRoamEn) &&
1458 (VOS_TRUE != vos_mem_compare(pScanResult->BssDescriptor.bssId,
1459 pNeighborRoamInfo->cfgRoambssId, sizeof(tSirMacAddr)))))
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 {
Jeff Johnson43971f52012-07-17 12:26:56 -07001461 /* currently associated AP. Do not have this in the roamable AP list */
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001462 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001463 "SKIP-currently associated AP");
Jeff Johnson295189b2012-06-20 16:38:30 -07001464 continue;
1465 }
1466
Tushnim Bhattacharyya5128d752013-06-26 23:23:18 -07001467#ifdef FEATURE_WLAN_LFR
1468#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1469 /* In case of reassoc requested by upper layer, look for exact match of bssid & channel;
1470 csr cache might have duplicates*/
1471 if ((pNeighborRoamInfo->uOsRequestedHandoff) &&
1472 ((VOS_FALSE == vos_mem_compare(pScanResult->BssDescriptor.bssId,
1473 pNeighborRoamInfo->handoffReqInfo.bssid,
1474 sizeof(tSirMacAddr)))||
1475 (pScanResult->BssDescriptor.channelId != pNeighborRoamInfo->handoffReqInfo.channel)))
1476
1477 {
1478 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
1479 "SKIP-not a candidate AP for OS requested roam");
1480 continue;
1481 }
1482#endif
1483#endif
1484
Jeff Johnson43971f52012-07-17 12:26:56 -07001485 /* This condition is to ensure to roam to an AP with better RSSI. if the value of RoamRssiDiff is Zero, this feature
1486 * is disabled and we continue to roam without any check*/
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001487 if ((RoamRssiDiff > 0)
1488#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1489 && !csrRoamIsRoamOffloadScanEnabled(pMac)
1490#endif
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05301491 && ((eSME_ROAM_TRIGGER_SCAN != pNeighborRoamInfo->cfgRoamEn) ||
1492 (eSME_ROAM_TRIGGER_FAST_ROAM != pNeighborRoamInfo->cfgRoamEn)))
Jeff Johnson43971f52012-07-17 12:26:56 -07001493 {
Madan Mohan Koyyalamudif553b742012-12-03 16:37:39 -08001494 /*
1495 * If RSSI is lower than the lookup threshold, then continue.
1496 */
1497 if (abs(pScanResult->BssDescriptor.rssi) >
1498 pNeighborRoamInfo->currentNeighborLookupThreshold)
1499 {
1500 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001501 "%s: [INFOLOG] new ap rssi (%d) lower than lookup threshold (%d)",
Madan Mohan Koyyalamudif553b742012-12-03 16:37:39 -08001502 __func__, (int)pScanResult->BssDescriptor.rssi * (-1),
1503 (int)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
1504 continue;
1505 }
1506
Jeff Johnson43971f52012-07-17 12:26:56 -07001507 if (abs(CurrAPRssi) < abs(pScanResult->BssDescriptor.rssi))
1508 {
1509 /*Do not roam to an AP with worse RSSI than the current*/
1510 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001511 "%s: [INFOLOG]Current AP rssi=%d new ap rssi worse=%d", __func__,
Jeff Johnson43971f52012-07-17 12:26:56 -07001512 CurrAPRssi,
1513 (int)pScanResult->BssDescriptor.rssi * (-1) );
1514 continue;
1515 } else {
1516 /*Do not roam to an AP which is having better RSSI than the current AP, but still less than the
1517 * margin that is provided by user from the ini file (RoamRssiDiff)*/
1518 if (abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)) < RoamRssiDiff)
1519 {
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001520 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001521 "%s: [INFOLOG]Current AP rssi=%d new ap rssi=%d not good enough, roamRssiDiff=%d", __func__,
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08001522 CurrAPRssi,
1523 (int)pScanResult->BssDescriptor.rssi * (-1),
1524 RoamRssiDiff);
Jeff Johnson43971f52012-07-17 12:26:56 -07001525 continue;
1526 }
1527 else {
1528 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001529 "%s: [INFOLOG]Current AP rssi=%d new ap rssi better=%d", __func__,
Jeff Johnson43971f52012-07-17 12:26:56 -07001530 CurrAPRssi,
1531 (int)pScanResult->BssDescriptor.rssi * (-1) );
1532 }
1533 }
1534 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001535
1536#ifdef WLAN_FEATURE_VOWIFI_11R
1537 if (pNeighborRoamInfo->is11rAssoc)
1538 {
1539 if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId))
1540 {
1541 smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring"));
1542 continue;
1543 }
1544 }
1545#endif /* WLAN_FEATURE_VOWIFI_11R */
1546
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001547#ifdef FEATURE_WLAN_ESE
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001548#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1549 if (!csrRoamIsRoamOffloadScanEnabled(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07001550 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001551#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001552 if (pNeighborRoamInfo->isESEAssoc)
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001553 {
1554 if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId))
1555 {
1556 smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring"));
1557 continue;
1558 }
1559 }
1560 if ((pScanResult->BssDescriptor.QBSSLoad_present) &&
1561 (pScanResult->BssDescriptor.QBSSLoad_avail))
1562 {
1563 if (pNeighborRoamInfo->isVOAdmitted)
1564 {
1565 smsLog(pMac, LOG1, FL("New AP has %x BW available"), (unsigned int)pScanResult->BssDescriptor.QBSSLoad_avail);
1566 smsLog(pMac, LOG1, FL("We need %x BW available"),(unsigned int)pNeighborRoamInfo->MinQBssLoadRequired);
1567 if (pScanResult->BssDescriptor.QBSSLoad_avail < pNeighborRoamInfo->MinQBssLoadRequired)
1568 {
1569 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Arif Hussain24bafea2013-11-15 15:10:03 -08001570 "[INFOLOG]BSSID : "MAC_ADDRESS_STR" has no bandwidth ignoring..not adding to roam list",
1571 MAC_ADDR_ARRAY(pScanResult->BssDescriptor.bssId));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001572 continue;
1573 }
1574 }
1575 }
1576 else
1577 {
1578 smsLog(pMac, LOGE, FL("No QBss %x %x"), (unsigned int)pScanResult->BssDescriptor.QBSSLoad_avail, (unsigned int)pScanResult->BssDescriptor.QBSSLoad_present);
1579 if (pNeighborRoamInfo->isVOAdmitted)
1580 {
1581 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Arif Hussain24bafea2013-11-15 15:10:03 -08001582 "[INFOLOG]BSSID : "MAC_ADDRESS_STR" has no QBSSLoad IE, ignoring..not adding to roam list",
1583 MAC_ADDR_ARRAY(pScanResult->BssDescriptor.bssId));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001584 continue;
1585 }
1586 }
1587#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001588 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001589#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001590#endif /* FEATURE_WLAN_ESE */
Jeff Johnson295189b2012-06-20 16:38:30 -07001591
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001592#ifdef FEATURE_WLAN_LFR
1593 // If we are supporting legacy roaming, and
1594 // if the candidate is on the "pre-auth failed" list, ignore it.
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05301595 if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001596 {
1597 if (!csrNeighborRoamIsPreauthCandidate(pMac, pScanResult->BssDescriptor.bssId))
1598 {
1599 smsLog(pMac, LOGE, FL("BSSID present in pre-auth fail list.. Ignoring"));
1600 continue;
1601 }
1602 }
1603#endif /* FEATURE_WLAN_LFR */
1604
Jeff Johnson295189b2012-06-20 16:38:30 -07001605 /* If the received timestamp in BSS description is earlier than the scan request timestamp, skip
1606 * this result */
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001607 if ((pNeighborRoamInfo->scanRequestTimeStamp >= pScanResult->BssDescriptor.nReceivedTime)
1608#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1609 && !csrRoamIsRoamOffloadScanEnabled(pMac)
1610#endif
1611 )
Jeff Johnson295189b2012-06-20 16:38:30 -07001612 {
1613 smsLog(pMac, LOGE, FL("Ignoring BSS as it is older than the scan request timestamp"));
1614 continue;
1615 }
1616
1617 pBssInfo = vos_mem_malloc(sizeof(tCsrNeighborRoamBSSInfo));
1618 if (NULL == pBssInfo)
1619 {
1620 smsLog(pMac, LOGE, FL("Memory allocation for Neighbor Roam BSS Info failed.. Just ignoring"));
1621 continue;
1622 }
1623
1624 pBssInfo->pBssDescription = vos_mem_malloc(pScanResult->BssDescriptor.length + sizeof(pScanResult->BssDescriptor.length));
1625 if (pBssInfo->pBssDescription != NULL)
1626 {
1627 vos_mem_copy(pBssInfo->pBssDescription, &pScanResult->BssDescriptor,
1628 pScanResult->BssDescriptor.length + sizeof(pScanResult->BssDescriptor.length));
1629 }
1630 else
1631 {
1632 smsLog(pMac, LOGE, FL("Memory allocation for Neighbor Roam BSS Descriptor failed.. Just ignoring"));
1633 vos_mem_free(pBssInfo);
1634 continue;
1635
1636 }
1637 pBssInfo->apPreferenceVal = 10; //some value for now. Need to calculate the actual score based on RSSI and neighbor AP score
1638
1639 /* Just add to the end of the list as it is already sorted by RSSI */
1640 csrLLInsertTail(&pNeighborRoamInfo->roamableAPList, &pBssInfo->List, LL_ACCESS_LOCK);
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001641
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001642#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05301643 if ((eSME_ROAM_TRIGGER_SCAN == pNeighborRoamInfo->cfgRoamEn) ||
1644 (eSME_ROAM_TRIGGER_FAST_ROAM == pNeighborRoamInfo->cfgRoamEn))
1645 {
1646 roamNow = eANI_BOOLEAN_FALSE;
1647 }
1648 else if ((abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)) >= immediateRoamRssiDiff)
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001649#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1650 && !csrRoamIsRoamOffloadScanEnabled(pMac)
1651#endif
1652 )
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001653 {
1654 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Jeff Johnsonce8ad512013-10-30 12:34:42 -07001655 "%s: [INFOLOG] potential candidate to roam immediately (diff=%ld, expected=%d)",
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001656 __func__, abs(abs(CurrAPRssi) - abs(pScanResult->BssDescriptor.rssi)),
1657 immediateRoamRssiDiff);
1658 roamNow = eANI_BOOLEAN_TRUE;
1659 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001660#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1661 /* If we are here means, FW already found candidates to roam, so we are
1662 good to go with pre-auth */
1663 if(csrRoamIsRoamOffloadScanEnabled(pMac))
1664 {
1665 roamNow = eANI_BOOLEAN_TRUE;
1666 }
1667#endif
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001668#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001669 }
1670
1671 /* 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 */
1672 csrScanResultPurge(pMac, *pScanResultList);
1673
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001674 return roamNow;
Jeff Johnson295189b2012-06-20 16:38:30 -07001675}
1676
1677/* ---------------------------------------------------------------------------
1678
1679 \fn csrNeighborRoamHandleEmptyScanResult
1680
1681 \brief This function will be invoked in CFG_CHAN_LIST_SCAN state when
1682 there are no valid APs in the scan result for roaming. This means
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001683 our AP is the best and no other AP is around. No point in scanning
Jeff Johnson295189b2012-06-20 16:38:30 -07001684 again and again. Performing the following here.
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001685 1. Stop the neighbor scan timer.
1686 2a. If this is the first time we encountered empty scan, then
1687 re-register with TL with modified lookup threshold.
1688 2b. Else if this is the second time we encountered empty scan,
1689 then start neighbor scan results refresh timer (20s).
1690 2c. Else, nothing more to do.
1691 NOTE: In LFR, channels selected for scanning is dervied from
1692 the occuped channel list. Scan cycle following one which
1693 yielded empty results is split into two halves: (i) scan on
1694 channels in the occupied list, and (ii) scan on channels not
1695 in the occupied list. This helps converging faster (while
1696 looking for candidates in the occupied list first), and also,
1697 adds channels to the occupied channel list upon finding candidates
1698 matching SSID profile of interest.
1699
1700 uEmptyScanCount Comments
1701 eFirstEmptyScan Previous scan was done on channels in the
1702 occupied list and yielded potential candidates.
1703 This scan cycle was likely triggered through
1704 receipt of lookup DOWN notification event.
1705 eSecondEmptyScan Previous scan was done on channels in the
1706 occupied list and yielded no candidates. This scan
1707 cycle was triggered through RSSI notification
1708 with modified lookup threshold.
1709 eThirdEmptyScan Previous scan was done on channels NOT in
1710 the occupied list and yielded no candidates. This
1711 scan cycle was triggered immediately after scanning
1712 channels in the occupied list and no candidates
1713 were found.
1714 eFourthEmptyScan Previous scan was done on channels in the
1715 occupied list and yielded no candidates. This scan
1716 cycle was triggered upon expiry of
1717 neighborScanResultsRefreshPeriod (=20s).
1718 eFifthEmptyScan Previous scan was done on channels NOT in
1719 the occupied list and yielded no candidates. This
1720 scan cycle was triggered immediately after scanning
1721 channels in the occupied list and no candidates
1722 were found.
1723
1724 [1], [2,3] and [4,5] together form one discrete set of scan cycle.
Jeff Johnson295189b2012-06-20 16:38:30 -07001725
1726 \param pMac - The handle returned by macOpen.
1727
1728 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
1729
1730---------------------------------------------------------------------------*/
1731static VOS_STATUS csrNeighborRoamHandleEmptyScanResult(tpAniSirGlobal pMac)
1732{
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001733 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001734 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
1735 eHalStatus status = eHAL_STATUS_SUCCESS;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001736#ifdef FEATURE_WLAN_LFR
1737 tANI_BOOLEAN performPeriodicScan =
1738 (pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod) ? TRUE : FALSE;
1739#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001740
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001741 /* Stop neighbor scan timer */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05301742 vos_timer_stop(&pNeighborRoamInfo->neighborScanTimer);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001743 /*
1744 * Increase the neighbor lookup threshold by 3 dB
1745 * after every scan cycle. NOTE: uEmptyScanCount
1746 * would be either 1, 3 or 5 at the end of every
1747 * scan cycle.
1748 */
1749#ifdef FEATURE_WLAN_LFR
1750 if ((++pNeighborRoamInfo->uEmptyScanCount) > eFifthEmptyScan)
1751 {
1752 pNeighborRoamInfo->uEmptyScanCount = eFifthEmptyScan;
1753 }
Srikant Kuppa327c52e2013-05-09 15:09:24 -07001754 if (((0 != pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels) ||
1755 (abs(pNeighborRoamInfo->lookupDOWNRssi) >
1756 abs(pNeighborRoamInfo->cfgParams.neighborReassocThreshold))) &&
Srinivas Girigowdade697412013-02-14 16:31:48 -08001757 ((pNeighborRoamInfo->uEmptyScanCount == eSecondEmptyScan) ||
1758 (pNeighborRoamInfo->uEmptyScanCount == eFourthEmptyScan)))
1759 {
1760 /*
1761 * If the scan was triggered due to lookupDOWNRssi > reassoc threshold,
1762 * then it would be a contiguous scan on all valid non-DFS channels.
Srikant Kuppa327c52e2013-05-09 15:09:24 -07001763 * If channels are configured in INI, then only those channels need
1764 * to be scanned.
1765 * In either of these modes, there is no need to trigger an immediate
1766 * scan upon empty scan results for the second and fourth time (which
1767 * would be equivalent to scanning on channels in non-occupied list).
Srinivas Girigowdade697412013-02-14 16:31:48 -08001768 * Incrementing uEmptyScanCount will correspond to skipping this step.
1769 * NOTE: double increment of uEmptyScanCount corresponds to completion
1770 * of scans on all valid channels.
1771 */
1772 ++pNeighborRoamInfo->uEmptyScanCount;
1773 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Extra increment of empty scan count (=%d)"
1774 " in contiguous scan mode", pNeighborRoamInfo->uEmptyScanCount);
1775 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001776#endif
1777 if (((pNeighborRoamInfo->currentNeighborLookupThreshold+3) <
1778 pNeighborRoamInfo->cfgParams.neighborReassocThreshold)
1779#ifdef FEATURE_WLAN_LFR
1780 && ((pNeighborRoamInfo->uEmptyScanCount % 2) == 1)
1781#endif
1782 )
1783 {
1784 pNeighborRoamInfo->currentNeighborLookupThreshold += 3;
1785 }
1786
Jeff Johnson295189b2012-06-20 16:38:30 -07001787#ifdef WLAN_FEATURE_VOWIFI_11R
1788 /* Clear off the old neighbor report details */
1789 vos_mem_zero(&pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo, sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
1790#endif
1791
Srikant Kuppa866893f2012-12-27 17:28:14 -08001792 /* Transition to CONNECTED state */
1793 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED);
1794
1795 /* Reset all the necessary variables before transitioning to the CONNECTED state */
1796 csrNeighborRoamResetConnectedStateControlInfo(pMac);
1797
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001798#ifdef FEATURE_WLAN_LFR
1799 if (pNeighborRoamInfo->uEmptyScanCount == eFirstEmptyScan)
1800 {
1801#endif
1802 /* Empty scan results for the first time */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001803 /* Re-register neighbor lookup DOWN threshold callback with TL */
1804 NEIGHBOR_ROAM_DEBUG(pMac, LOGE,
1805 FL("Registering DOWN event neighbor lookup callback with TL for RSSI = %d"),
1806 pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
1807
1808 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext,
1809 (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
1810 WLANTL_HO_THRESHOLD_DOWN,
1811 csrNeighborRoamNeighborLookupDOWNCallback,
1812 VOS_MODULE_ID_SME, pMac);
1813
1814 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
1815 {
1816 smsLog(pMac, LOGW,
1817 FL("Couldn't re-register csrNeighborRoamNeighborLookupDOWNCallback"
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08001818 " with TL: Status = %d"), status);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001819 }
1820#ifdef FEATURE_WLAN_LFR
Srikant Kuppa866893f2012-12-27 17:28:14 -08001821 pNeighborRoamInfo->lookupDOWNRssi = 0;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001822 }
1823 else if ((pNeighborRoamInfo->uEmptyScanCount == eSecondEmptyScan) ||
1824 (pNeighborRoamInfo->uEmptyScanCount == eFourthEmptyScan))
1825 {
1826 /* Empty scan results for the second or fourth time */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001827
1828 /* Immediately scan on channels in non-occupied list */
1829 csrNeighborRoamTransitToCFGChanScan(pMac);
1830 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08001831 else if (pNeighborRoamInfo->uEmptyScanCount >= eThirdEmptyScan)
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001832 {
1833 /* Empty scan results for the third time */
Srinivas Girigowdade697412013-02-14 16:31:48 -08001834 if (performPeriodicScan)
1835 {
1836 smsLog(pMac, LOGE, FL("Performing periodic scan, uEmptyScanCount=%d"),
1837 pNeighborRoamInfo->uEmptyScanCount);
Srikant Kuppa866893f2012-12-27 17:28:14 -08001838
Srinivas Girigowdade697412013-02-14 16:31:48 -08001839 /*
1840 * Set uEmptyScanCount to MAX so that we always enter this
1841 * condition on subsequent empty scan results
1842 */
1843 pNeighborRoamInfo->uEmptyScanCount = eMaxEmptyScan;
1844
1845 /* From here on, ONLY scan on channels in the occupied list */
1846 pNeighborRoamInfo->uScanMode = SPLIT_SCAN_OCCUPIED_LIST;
1847
1848 /* Start empty scan refresh timer */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05301849 if (VOS_STATUS_SUCCESS !=
1850 vos_timer_start(&pNeighborRoamInfo->emptyScanRefreshTimer,
1851 pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod))
Srinivas Girigowdade697412013-02-14 16:31:48 -08001852 {
1853 smsLog(pMac, LOGE, FL("Empty scan refresh timer failed to start (%d)"),
1854 status);
1855 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
1856 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07001857 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001858 vosStatus = VOS_STATUS_E_FAILURE;
1859 }
1860 else
1861 {
Jeff Johnsonce8ad512013-10-30 12:34:42 -07001862 smsLog(pMac, LOGE, FL("Empty scan refresh timer started (%d ms)"),
Srinivas Girigowdade697412013-02-14 16:31:48 -08001863 (pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod));
1864 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001865 }
Srikant Kuppa327c52e2013-05-09 15:09:24 -07001866 else if (eThirdEmptyScan == pNeighborRoamInfo->uEmptyScanCount)
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001867 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08001868 /* Start neighbor scan results refresh timer */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05301869 if (VOS_STATUS_SUCCESS !=
1870 vos_timer_start(&pNeighborRoamInfo->neighborResultsRefreshTimer,
1871 pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod))
Srinivas Girigowdade697412013-02-14 16:31:48 -08001872 {
1873 smsLog(pMac, LOGE, FL("Neighbor results refresh timer failed to start (%d)"),
1874 status);
1875 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
1876 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07001877 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001878 vosStatus = VOS_STATUS_E_FAILURE;
1879 }
1880 else
1881 {
Jeff Johnsonce8ad512013-10-30 12:34:42 -07001882 smsLog(pMac, LOG2, FL("Neighbor results refresh timer started (%d ms)"),
Srinivas Girigowdade697412013-02-14 16:31:48 -08001883 (pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod * PAL_TIMER_TO_MS_UNIT));
1884 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001885 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001886 }
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001887
Srinivas Girigowdade697412013-02-14 16:31:48 -08001888 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Neighbor roam empty scan count=%d scan mode=%d",
1889 pNeighborRoamInfo->uEmptyScanCount, pNeighborRoamInfo->uScanMode);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001890#endif
1891 return vosStatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07001892}
1893
Jeff Johnson295189b2012-06-20 16:38:30 -07001894
Srikant Kuppa866893f2012-12-27 17:28:14 -08001895static eHalStatus csrNeighborRoamProcessScanComplete (tpAniSirGlobal pMac)
Jeff Johnson295189b2012-06-20 16:38:30 -07001896{
Jeff Johnson295189b2012-06-20 16:38:30 -07001897 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001898 tCsrScanResultFilter scanFilter;
1899 tScanResultHandle scanResult;
1900 tANI_U32 tempVal = 0;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001901 tANI_BOOLEAN roamNow = eANI_BOOLEAN_FALSE;
Srikant Kuppa866893f2012-12-27 17:28:14 -08001902 eHalStatus hstatus;
Jeff Johnson295189b2012-06-20 16:38:30 -07001903
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001904#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001905 /* If the state is REPORT_SCAN, then this must be the scan after the REPORT_QUERY state. So, we
1906 should use the BSSID filter made out of neighbor reports */
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001907 if ((eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pNeighborRoamInfo->neighborRoamState)
1908#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1909 && (!csrRoamIsRoamOffloadScanEnabled(pMac))
1910#endif
1911 )
Jeff Johnson295189b2012-06-20 16:38:30 -07001912 {
Jeff Johnson43971f52012-07-17 12:26:56 -07001913 hstatus = csrNeighborRoamBssIdScanFilter(pMac, &scanFilter);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001914 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("11R or ESE Association: Prepare scan filter status with neighbor AP = %d"), hstatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07001915 tempVal = 1;
1916 }
1917 else
1918#endif
1919 {
Jeff Johnson43971f52012-07-17 12:26:56 -07001920 hstatus = csrNeighborRoamPrepareScanProfileFilter(pMac, &scanFilter);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001921 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("11R/ESE/Other Association: Prepare scan to find neighbor AP filter status = %d"), hstatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07001922 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001923 if (eHAL_STATUS_SUCCESS != hstatus)
Jeff Johnson295189b2012-06-20 16:38:30 -07001924 {
1925 smsLog(pMac, LOGE, FL("Scan Filter preparation failed for Assoc type %d.. Bailing out.."), tempVal);
1926 return eHAL_STATUS_FAILURE;
1927 }
Jeff Johnson43971f52012-07-17 12:26:56 -07001928 hstatus = csrScanGetResult(pMac, &scanFilter, &scanResult);
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05301929 if (hstatus != eHAL_STATUS_SUCCESS)
1930 {
1931 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Get Scan Result status code %d"), hstatus);
1932 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001933 /* Process the scan results and update roamable AP list */
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08001934 roamNow = csrNeighborRoamProcessScanResults(pMac, &scanResult);
Jeff Johnson295189b2012-06-20 16:38:30 -07001935
1936 /* Free the scan filter */
1937 csrFreeScanFilter(pMac, &scanFilter);
1938
1939 tempVal = csrLLCount(&pNeighborRoamInfo->roamableAPList);
1940
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001941#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1942 if(!csrRoamIsRoamOffloadScanEnabled(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07001943 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001944#endif
1945 switch(pNeighborRoamInfo->neighborRoamState)
1946 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001947 case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:
1948 if (tempVal)
1949 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001950#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001951 /*
1952 * Since there are non-zero candidates found
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001953 * after the scan, reset empty scan count.
Madan Mohan Koyyalamudi04039a12012-10-21 12:24:56 -07001954 */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001955 pNeighborRoamInfo->uEmptyScanCount = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08001956 pNeighborRoamInfo->uScanMode = DEFAULT_SCAN;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08001957#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001958#ifdef WLAN_FEATURE_VOWIFI_11R
1959 /* If this is a non-11r association, then we can register the reassoc callback here as we have some
1960 APs in the roamable AP list */
1961 if (pNeighborRoamInfo->is11rAssoc)
1962 {
1963 /* Valid APs are found after scan. Now we can initiate pre-authentication */
1964 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
1965 }
1966 else
1967#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001968#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07001969 /* If this is a non-11r association, then we can register the reassoc callback here as we have some
1970 APs in the roamable AP list */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001971 if (pNeighborRoamInfo->isESEAssoc)
Jeff Johnson295189b2012-06-20 16:38:30 -07001972 {
1973 /* Valid APs are found after scan. Now we can initiate pre-authentication */
1974 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
1975 }
1976 else
1977#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001978#ifdef FEATURE_WLAN_LFR
1979 /* If LFR is enabled, then we can register the reassoc callback here as we have some
1980 APs in the roamable AP list */
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05301981 if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001982 {
1983 /* Valid APs are found after scan. Now we can initiate pre-authentication */
1984 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
1985 }
1986 else
1987#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001988 {
1989
1990 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Completed scanning of CFG CHAN LIST in non-11r association. Registering reassoc callback"));
1991 /* Nothing much to do now. Will continue to remain in this state in case of non-11r association */
1992 /* Stop the timer. But how long the roamable AP list will be valid in here. At some point of time, we
1993 need to restart the CFG CHAN list scan procedure if reassoc callback is not invoked from TL
1994 within certain duration */
1995
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05301996// vos_timer_stop(&pNeighborRoamInfo->neighborScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001997 }
1998 }
1999 else
2000 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302001 NEIGHBOR_ROAM_DEBUG(pMac, LOGE,
2002 FL("No candidate found after scanning in state %s .. "),
2003 macTraceGetNeighbourRoamState(
2004 pNeighborRoamInfo->neighborRoamState));
Madan Mohan Koyyalamudib40e5582012-10-11 16:48:42 -07002005 /* Handle it appropriately */
2006 csrNeighborRoamHandleEmptyScanResult(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002007 }
2008 break;
2009#ifdef WLAN_FEATURE_VOWIFI_11R
2010 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2011 if (!tempVal)
2012 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302013 smsLog(pMac, LOGE, FL("No candidate found after scanning"
2014 "in state %s .. "),
2015 macTraceGetNeighbourRoamState(
2016 pNeighborRoamInfo->neighborRoamState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002017 /* Stop the timer here as the same timer will be started again in CFG_CHAN_SCAN_STATE */
2018 csrNeighborRoamTransitToCFGChanScan(pMac);
2019 }
2020 break;
2021#endif /* WLAN_FEATURE_VOWIFI_11R */
2022 default:
2023 // Can come only in INIT state. Where in we are associated, we sent scan and user
2024 // in the meantime decides to disassoc, we will be in init state and still received call
2025 // back issued. Should not come here in any other state, printing just in case
2026 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302027 FL("State %s"),
2028 macTraceGetNeighbourRoamState(
2029 pNeighborRoamInfo->neighborRoamState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002030
2031 // Lets just exit out silently.
2032 return eHAL_STATUS_SUCCESS;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002033 }
2034#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07002035 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002036#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002037
2038 if (tempVal)
2039 {
2040 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
2041
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08002042 if (roamNow)
2043 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002044#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2045 if(!csrRoamIsRoamOffloadScanEnabled(pMac))
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08002046 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002047#endif
2048 NEIGHBOR_ROAM_DEBUG(pMac, LOG2,
2049 FL("Immediate roam-deregister UP indication. RSSI = %d"),
2050 NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1));
2051
2052 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext,
2053 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
2054 WLANTL_HO_THRESHOLD_UP,
2055 csrNeighborRoamNeighborLookupUPCallback,
2056 VOS_MODULE_ID_SME);
2057
2058 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
2059 {
2060 smsLog(pMac, LOGW,
2061 FL("Couldn't deregister lookup UP callback with TL: Status = %d"), vosStatus);
2062 }
2063#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08002064 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002065#endif
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08002066
2067 csrNeighborRoamTriggerHandoff(pMac, pNeighborRoamInfo);
2068 return eHAL_STATUS_SUCCESS;
2069 }
2070
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05302071 hstatus = vos_timer_start(&pNeighborRoamInfo->neighborResultsRefreshTimer,
2072 pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002073
Jeff Johnson295189b2012-06-20 16:38:30 -07002074 /* This timer should be started before registering the Reassoc callback with TL. This is because, it is very likely
2075 * that the callback getting called immediately and the timer would never be stopped when pre-auth is in progress */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05302076 if( hstatus != eHAL_STATUS_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07002077 {
Srikant Kuppa866893f2012-12-27 17:28:14 -08002078 smsLog(pMac, LOGE, FL("Neighbor results refresh timer failed to start, status = %d"), hstatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
2080 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07002081 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Jeff Johnson43971f52012-07-17 12:26:56 -07002082 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002083 }
Jeff Johnson43971f52012-07-17 12:26:56 -07002084
Jeff Johnson295189b2012-06-20 16:38:30 -07002085 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event Reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
2086 /* Register a reassoc Indication callback */
2087 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
2088 WLANTL_HO_THRESHOLD_DOWN,
2089 csrNeighborRoamReassocIndCallback,
2090 VOS_MODULE_ID_SME, pMac);
2091
2092 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
2093 {
2094 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002095 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamReassocIndCallback with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002096 }
2097
2098 }
Srikant Kuppa866893f2012-12-27 17:28:14 -08002099
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002100#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2101if (csrRoamIsRoamOffloadScanEnabled(pMac))
2102 {
2103 if (!tempVal || !roamNow)
2104 {
Varun Reddy Yeturue3af4282013-06-07 00:56:52 -07002105 if (pNeighborRoamInfo->uOsRequestedHandoff)
2106 {
2107 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_START, REASON_NO_CAND_FOUND_OR_NOT_ROAMING_NOW);
2108 pNeighborRoamInfo->uOsRequestedHandoff = 0;
2109 }
2110 else
2111 {
2112 /* There is no candidate or We are not roaming Now.
2113 * Inform the FW to restart Roam Offload Scan */
2114 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_RESTART, REASON_NO_CAND_FOUND_OR_NOT_ROAMING_NOW);
2115 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002116 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED);
2117 }
2118 }
2119#endif
Srikant Kuppa866893f2012-12-27 17:28:14 -08002120 return eHAL_STATUS_SUCCESS;
2121
2122}
2123
2124
2125/* ---------------------------------------------------------------------------
2126
2127 \fn csrNeighborRoamScanRequestCallback
2128
2129 \brief This function is the callback function registered in csrScanRequest() to
2130 indicate the completion of scan. If scan is completed for all the channels in
2131 the channel list, this function gets the scan result and starts the refresh results
2132 timer to avoid having stale results. If scan is not completed on all the channels,
2133 it restarts the neighbor scan timer which on expiry issues scan on the next
2134 channel
2135
2136 \param halHandle - The handle returned by macOpen.
2137 pContext - not used
2138 scanId - not used
2139 status - not used
2140
2141 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
2142
2143---------------------------------------------------------------------------*/
2144static eHalStatus csrNeighborRoamScanRequestCallback(tHalHandle halHandle, void *pContext,
2145 tANI_U32 scanId, eCsrScanStatus status)
2146{
2147 tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle;
2148 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2149 tANI_U8 currentChanIndex;
2150 eHalStatus hstatus;
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002151#ifdef FEATURE_WLAN_LFR
2152 tANI_U32 sessionId = CSR_SESSION_ID_INVALID;
Srikant Kuppa866893f2012-12-27 17:28:14 -08002153
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002154 if (NULL != pContext)
2155 {
2156 sessionId = *((tANI_U32*)pContext);
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07002157
2158 if (!csrRoamIsStaMode(pMac, sessionId))
2159 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302160 smsLog(pMac, LOGE, FL("Ignoring scan request callback on non-infra"
2161 "session %d in state %s"),
2162 sessionId, macTraceGetNeighbourRoamState(
2163 pNeighborRoamInfo->neighborRoamState));
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07002164 vos_mem_free(pContext);
2165 return eHAL_STATUS_SUCCESS;
2166 }
2167
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002168 if (!csrRoamIsFastRoamEnabled(pMac,sessionId))
2169 {
2170 smsLog(pMac, LOGE, FL("Received when fast roam is disabled. Ignore it"));
2171 vos_mem_free(pContext);
2172 return eHAL_STATUS_SUCCESS;
2173 }
2174 }
2175#endif
Srikant Kuppa866893f2012-12-27 17:28:14 -08002176 pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE;
2177
2178 /* This can happen when we receive a UP event from TL in any of the scan states. Silently ignore it */
2179 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
2180 {
2181 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 -07002182 if (NULL != pContext)
2183 vos_mem_free(pContext);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002184 return eHAL_STATUS_SUCCESS;
2185 }
2186
2187 /* -1 is done because the chanIndex would have got incremented after issuing a successful scan request */
2188 currentChanIndex = (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex) ? (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex - 1) : 0;
2189
2190 /* Validate inputs */
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07002191 if (pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList) {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002192 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("csrNeighborRoamScanRequestCallback received for Channel = %d, ChanIndex = %d"),
Srikant Kuppa866893f2012-12-27 17:28:14 -08002193 pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList[currentChanIndex], currentChanIndex);
2194 }
2195 else
2196 {
2197 smsLog(pMac, LOG1, FL("Received during clean-up. Silently ignore scan completion event."));
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002198 if (NULL != pContext)
2199 vos_mem_free(pContext);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002200 return eHAL_STATUS_SUCCESS;
2201 }
2202
2203 if (eANI_BOOLEAN_FALSE == pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress)
2204 {
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07002205 /* Scan is completed in the CFG_CHAN_SCAN state. We can transition to REPORT_SCAN state
Srikant Kuppa866893f2012-12-27 17:28:14 -08002206 just to get the results and perform PREAUTH */
2207 /* Now we have completed scanning the channel list. We have get the result by applying appropriate filter
2208 sort the results based on neighborScore and RSSI and select the best candidate out of the list */
2209 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Channel list scan completed. Current chan index = %d"), currentChanIndex);
2210 VOS_ASSERT(pNeighborRoamInfo->roamChannelInfo.currentChanIndex == 0);
2211
2212 hstatus = csrNeighborRoamProcessScanComplete(pMac);
2213
2214 if (eHAL_STATUS_SUCCESS != hstatus)
2215 {
2216 smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus);
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002217 if (NULL != pContext)
2218 vos_mem_free(pContext);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002219 return eHAL_STATUS_FAILURE;
2220 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002221 }
2222 else
2223 {
2224
2225 /* Restart the timer for the next scan sequence as scanning is not over */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05302226 hstatus = vos_timer_start(&pNeighborRoamInfo->neighborScanTimer,
2227 pNeighborRoamInfo->cfgParams.neighborScanPeriod);
Jeff Johnson43971f52012-07-17 12:26:56 -07002228 if (eHAL_STATUS_SUCCESS != hstatus)
Jeff Johnson295189b2012-06-20 16:38:30 -07002229 {
2230 /* Timer start failed.. Should we ASSERT here??? */
2231 smsLog(pMac, LOGE, FL("Neighbor scan PAL Timer start failed, status = %d, Ignoring state transition"), status);
2232 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
2233 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07002234 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002235 if (NULL != pContext)
2236 vos_mem_free(pContext);
Jeff Johnson43971f52012-07-17 12:26:56 -07002237 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07002238 }
2239 }
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002240
2241 if (NULL != pContext)
2242 vos_mem_free(pContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07002243 return eHAL_STATUS_SUCCESS;
2244}
2245
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07002246#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2247/* ---------------------------------------------------------------------------
2248
2249 \fn csrNeighborRoamScanResultRequestCallback
2250
2251 \brief This function is the callback function registered in csrScanRequestLfrResult() to
2252 indicate the completion of scan. If scan is completed for all the channels in
2253 the channel list, this function gets the scan result and treats them as candidates
2254
2255 \param halHandle - The handle returned by macOpen.
2256 pContext - not used
2257 scanId - not used
2258 status - not used
2259
2260 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
2261
2262---------------------------------------------------------------------------*/
2263static eHalStatus csrNeighborRoamScanResultRequestCallback(tHalHandle halHandle, void *pContext,
2264 tANI_U32 scanId, eCsrScanStatus status)
2265{
2266 tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle;
2267 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2268 eHalStatus hstatus;
2269
2270 smsLog(pMac, LOG2, FL("called "));
2271 pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE;
2272
2273 /* we must be in connected state, if not ignore it */
2274 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED != pNeighborRoamInfo->neighborRoamState)
2275 {
2276 smsLog(pMac, LOGW, FL("Received in not CONNECTED state. Ignore it"));
2277 return eHAL_STATUS_SUCCESS;
2278 }
2279
2280 /* Now we have completed scanning the channel list. We have get the result by applying appropriate filter
2281 sort the results based on neighborScore and RSSI and select the best candidate out of the list */
2282
2283 hstatus = csrNeighborRoamProcessScanComplete(pMac);
2284
2285 if (eHAL_STATUS_SUCCESS != hstatus)
2286 {
2287 smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus);
2288 return eHAL_STATUS_FAILURE;
2289 }
2290 return eHAL_STATUS_SUCCESS;
2291}
2292#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2293
Srikant Kuppa866893f2012-12-27 17:28:14 -08002294#ifdef FEATURE_WLAN_LFR
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07002295static eHalStatus csrNeighborRoamContiguousScanRequestCallback(tHalHandle halHandle,
Srikant Kuppa866893f2012-12-27 17:28:14 -08002296 void *pContext, tANI_U32 scanId, eCsrScanStatus status)
2297{
2298 tpAniSirGlobal pMac = (tpAniSirGlobal) halHandle;
2299 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2300 eHalStatus hstatus = eHAL_STATUS_SUCCESS;
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002301 tANI_U32 sessionId = CSR_SESSION_ID_INVALID;
2302
2303 if (NULL != pContext)
2304 {
2305 sessionId = *((tANI_U32*)pContext);
2306 if (!csrRoamIsFastRoamEnabled(pMac,sessionId))
2307 {
2308 smsLog(pMac, LOGE, FL("Received when fast roam is disabled. Ignore it"));
2309 vos_mem_free(pContext);
2310 return eHAL_STATUS_SUCCESS;
2311 }
2312 }
Srikant Kuppa866893f2012-12-27 17:28:14 -08002313
2314 pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_FALSE;
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07002315
Srikant Kuppa866893f2012-12-27 17:28:14 -08002316 /* This can happen when we receive a UP event from TL in any of the scan states. Silently ignore it */
2317 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED == pNeighborRoamInfo->neighborRoamState)
2318 {
2319 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 -07002320 if (NULL != pContext)
2321 vos_mem_free(pContext);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002322 return eHAL_STATUS_SUCCESS;
2323 }
2324
Srinivas Girigowdade697412013-02-14 16:31:48 -08002325 if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
2326 {
2327 smsLog(pMac, LOGE, FL("Received in INIT state. Must have disconnected. Ignore it"));
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002328 if (NULL != pContext)
2329 vos_mem_free(pContext);
Srinivas Girigowdade697412013-02-14 16:31:48 -08002330 return eHAL_STATUS_SUCCESS;
2331 }
2332
Srikant Kuppa866893f2012-12-27 17:28:14 -08002333 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "%s: process scan results", __func__);
2334 hstatus = csrNeighborRoamProcessScanComplete(pMac);
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07002335
Srikant Kuppa866893f2012-12-27 17:28:14 -08002336 if (eHAL_STATUS_SUCCESS != hstatus)
2337 {
2338 smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus);
2339 }
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07002340
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002341 if (NULL != pContext)
2342 vos_mem_free(pContext);
2343
Srikant Kuppa866893f2012-12-27 17:28:14 -08002344 return hstatus;
2345}
2346#endif
2347
Jeff Johnson295189b2012-06-20 16:38:30 -07002348/* ---------------------------------------------------------------------------
2349
2350 \fn csrNeighborRoamIssueBgScanRequest
2351
2352 \brief This function issues CSR scan request after populating all the BG scan params
2353 passed
2354
2355 \param pMac - The handle returned by macOpen.
2356 pBgScanParams - Params that need to be populated into csr Scan request
2357
2358 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
2359
2360---------------------------------------------------------------------------*/
Srikant Kuppa866893f2012-12-27 17:28:14 -08002361eHalStatus csrNeighborRoamIssueBgScanRequest(tpAniSirGlobal pMac,
2362 tCsrBGScanRequest *pBgScanParams,
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002363 tANI_U32 sessionId,
Srikant Kuppa866893f2012-12-27 17:28:14 -08002364 csrScanCompleteCallback callbackfn)
Jeff Johnson295189b2012-06-20 16:38:30 -07002365{
2366 eHalStatus status = eHAL_STATUS_SUCCESS;
2367 tANI_U32 scanId;
2368 tCsrScanRequest scanReq;
2369 tANI_U8 channel;
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002370 void * userData = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002371
Srikant Kuppa866893f2012-12-27 17:28:14 -08002372 if (1 == pBgScanParams->ChannelInfo.numOfChannels)
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002373 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Channel = %d, ChanIndex = %d"),
Srikant Kuppa866893f2012-12-27 17:28:14 -08002374 pBgScanParams->ChannelInfo.ChannelList[0],
2375 pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex);
Jeff Johnson295189b2012-06-20 16:38:30 -07002376
2377 //send down the scan req for 1 channel on the associated SSID
Kiet Lam64c1b492013-07-12 13:56:44 +05302378 vos_mem_set(&scanReq, sizeof(tCsrScanRequest), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002379 /* Fill in the SSID Info */
2380 scanReq.SSIDs.numOfSSIDs = 1;
2381 scanReq.SSIDs.SSIDList = vos_mem_malloc(sizeof(tCsrSSIDInfo) * scanReq.SSIDs.numOfSSIDs);
Kiet Lam64c1b492013-07-12 13:56:44 +05302382 if (NULL == scanReq.SSIDs.SSIDList)
Jeff Johnson295189b2012-06-20 16:38:30 -07002383 {
2384 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002385 smsLog(pMac, LOGE, FL("Couldn't allocate memory for the SSID..Freeing memory allocated for Channel List"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002386 return eHAL_STATUS_FAILURE;
2387 }
2388 vos_mem_zero(scanReq.SSIDs.SSIDList, sizeof(tCsrSSIDInfo) * scanReq.SSIDs.numOfSSIDs);
2389
2390 scanReq.SSIDs.SSIDList[0].handoffPermitted = eANI_BOOLEAN_TRUE;
2391 scanReq.SSIDs.SSIDList[0].ssidHidden = eANI_BOOLEAN_TRUE;
2392 vos_mem_copy((void *)&scanReq.SSIDs.SSIDList[0].SSID, (void *)&pBgScanParams->SSID, sizeof(pBgScanParams->SSID));
2393
2394 scanReq.ChannelInfo.numOfChannels = pBgScanParams->ChannelInfo.numOfChannels;
Srikant Kuppa866893f2012-12-27 17:28:14 -08002395 if (1 == pBgScanParams->ChannelInfo.numOfChannels)
2396 {
2397 channel = pBgScanParams->ChannelInfo.ChannelList[0];
2398 scanReq.ChannelInfo.ChannelList = &channel;
2399 }
2400 else
2401 {
2402 scanReq.ChannelInfo.ChannelList = pBgScanParams->ChannelInfo.ChannelList;
2403 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002404
2405 scanReq.BSSType = eCSR_BSS_TYPE_INFRASTRUCTURE;
2406 scanReq.scanType = eSIR_ACTIVE_SCAN;
2407 scanReq.requestType = eCSR_SCAN_HO_BG_SCAN;
2408 scanReq.maxChnTime = pBgScanParams->maxChnTime;
2409 scanReq.minChnTime = pBgScanParams->minChnTime;
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002410
2411 userData = vos_mem_malloc(sizeof(tANI_U32));
2412 if (NULL == userData)
2413 {
2414 smsLog(pMac, LOGE, FL("Failed to allocate memory for scan request"));
2415 vos_mem_free(scanReq.SSIDs.SSIDList);
2416 return eHAL_STATUS_FAILURE;
2417 }
2418 *((tANI_U32*)userData) = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002419 status = csrScanRequest(pMac, CSR_SESSION_ID_INVALID, &scanReq,
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002420 &scanId, callbackfn, (void *) userData);
Jeff Johnson295189b2012-06-20 16:38:30 -07002421 if (eHAL_STATUS_SUCCESS != status)
2422 {
2423 smsLog(pMac, LOGE, FL("CSR Scan Request failed with status %d"), status);
2424 vos_mem_free(scanReq.SSIDs.SSIDList);
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002425 vos_mem_free(userData);
Jeff Johnson295189b2012-06-20 16:38:30 -07002426 return status;
2427 }
2428 pMac->roam.neighborRoamInfo.scanRspPending = eANI_BOOLEAN_TRUE;
2429
2430 vos_mem_free(scanReq.SSIDs.SSIDList);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002431 if (1 == pBgScanParams->ChannelInfo.numOfChannels)
Jeff Johnsonce8ad512013-10-30 12:34:42 -07002432 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Channel List Address = %p, Actual index = %d"),
Srikant Kuppa866893f2012-12-27 17:28:14 -08002433 &pMac->roam.neighborRoamInfo.roamChannelInfo.currentChannelListInfo.ChannelList[0],
2434 pMac->roam.neighborRoamInfo.roamChannelInfo.currentChanIndex);
2435
Jeff Johnson295189b2012-06-20 16:38:30 -07002436 return status;
2437}
2438
Srikant Kuppa866893f2012-12-27 17:28:14 -08002439static void csrNeighborRoamFillNonChannelBgScanParams (tpAniSirGlobal pMac,
2440 tpCsrBGScanRequest bgScanParams)
2441{
2442 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2443 tANI_U8 broadcastBssid[] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
2444
2445 vos_mem_copy(bgScanParams->bssid, broadcastBssid, sizeof(tCsrBssid));
2446 bgScanParams->SSID.length = pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length;
2447 vos_mem_copy(bgScanParams->SSID.ssId,
2448 pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.ssId,
2449 pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length);
2450
2451 bgScanParams->minChnTime = pNeighborRoamInfo->cfgParams.minChannelScanTime;
2452 bgScanParams->maxChnTime = pNeighborRoamInfo->cfgParams.maxChannelScanTime;
2453}
2454
Jeff Johnson295189b2012-06-20 16:38:30 -07002455/* ---------------------------------------------------------------------------
2456
2457 \fn csrNeighborRoamPerformBgScan
2458
2459 \brief This function is invoked on every expiry of neighborScanTimer till all
2460 the channels in the channel list are scanned. It populates necessary
2461 parameters for BG scan and calls appropriate AP to invoke the CSR scan
2462 request
2463
2464 \param pMac - The handle returned by macOpen.
2465
2466 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
2467
2468---------------------------------------------------------------------------*/
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002469eHalStatus csrNeighborRoamPerformBgScan(tpAniSirGlobal pMac, tANI_U32 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07002470{
2471 eHalStatus status = eHAL_STATUS_SUCCESS;
2472 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2473 tCsrBGScanRequest bgScanParams;
Jeff Johnson295189b2012-06-20 16:38:30 -07002474 tANI_U8 channel = 0;
2475
2476 if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
2477 {
Jeff Johnsonce8ad512013-10-30 12:34:42 -07002478 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Channel List Address = %p"), &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[0]);
Jeff Johnson295189b2012-06-20 16:38:30 -07002479 }
2480 else
2481 {
2482 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Channel List Empty"));
Jeff Johnson902c9832012-12-10 14:28:09 -08002483 // Go back and restart. Mostly timer start failure has occurred.
Jeff Johnson295189b2012-06-20 16:38:30 -07002484 // When timer start is declared a failure, then we delete the list.
2485 // Should not happen now as we stop and then only start the scan timer.
2486 // still handle the unlikely case.
2487 csrNeighborRoamHandleEmptyScanResult(pMac);
2488 return status;
2489 }
James Zmuda9ea1edd2013-04-18 18:20:54 -07002490
2491 /* Validate the currentChanIndex value before using it to index the ChannelList array */
2492 if ( pNeighborRoamInfo->roamChannelInfo.currentChanIndex
2493 > pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels)
2494 {
2495 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Invalid channel index: %d"), pNeighborRoamInfo->roamChannelInfo.currentChanIndex);
2496 // Go back and restart.
2497 csrNeighborRoamHandleEmptyScanResult(pMac);
2498 return status;
2499 }
2500
Jeff Johnson295189b2012-06-20 16:38:30 -07002501 /* Need to perform scan here before getting the list */
Srikant Kuppa866893f2012-12-27 17:28:14 -08002502
Kiet Lam64c1b492013-07-12 13:56:44 +05302503 vos_mem_set(&bgScanParams, sizeof(tCsrBGScanRequest), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002504
2505 channel = pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[pNeighborRoamInfo->roamChannelInfo.currentChanIndex];
2506 bgScanParams.ChannelInfo.numOfChannels = 1;
2507 bgScanParams.ChannelInfo.ChannelList = &channel;
2508
Srikant Kuppa866893f2012-12-27 17:28:14 -08002509 csrNeighborRoamFillNonChannelBgScanParams(pMac, &bgScanParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07002510
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002511 status = csrNeighborRoamIssueBgScanRequest(pMac, &bgScanParams,
2512 sessionId, csrNeighborRoamScanRequestCallback);
Jeff Johnson295189b2012-06-20 16:38:30 -07002513 if (eHAL_STATUS_SUCCESS != status)
2514 {
2515 smsLog(pMac, LOGE, FL("Issue of BG Scan request failed: Status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07002516 }
2517
2518 pNeighborRoamInfo->roamChannelInfo.currentChanIndex++;
2519 if (pNeighborRoamInfo->roamChannelInfo.currentChanIndex >=
2520 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels)
2521 {
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05302522 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Completed scanning channels in Channel List: CurrChanIndex = %d, Num Channels = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002523 pNeighborRoamInfo->roamChannelInfo.currentChanIndex,
2524 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels);
2525 /* We have completed scanning all the channels */
2526 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
2527 /* We are no longer scanning the channel list. Next timer firing should be used to get the scan results
2528 and select the best AP in the list */
2529 if (eANI_BOOLEAN_TRUE == pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress)
2530 {
2531 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
2532 }
2533 }
2534
Gopichand Nakkalac7b1d3e2012-12-31 14:07:19 -08002535 if (eHAL_STATUS_SUCCESS != status)
2536 {
2537 /*
2538 * If the status is not success, we need to call the callback
2539 * routine so that the state machine does not get stuck.
2540 */
2541 csrNeighborRoamScanRequestCallback(pMac, NULL, 0, eCSR_SCAN_FAILURE);
2542 }
2543
Jeff Johnson295189b2012-06-20 16:38:30 -07002544 return status;
2545}
2546
Srikant Kuppa866893f2012-12-27 17:28:14 -08002547#ifdef FEATURE_WLAN_LFR
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002548eHalStatus csrNeighborRoamPerformContiguousBgScan(tpAniSirGlobal pMac, tANI_U32 sessionId)
Srikant Kuppa866893f2012-12-27 17:28:14 -08002549{
2550 eHalStatus status = eHAL_STATUS_SUCCESS;
2551 tCsrBGScanRequest bgScanParams;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002552 tANI_U8 numOfChannels = 0, i = 0;
Srikant Kuppa866893f2012-12-27 17:28:14 -08002553 tANI_U8 *channelList = NULL;
Srinivas Girigowdade697412013-02-14 16:31:48 -08002554 tANI_U8 *pInChannelList = NULL;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002555 tANI_U8 tmpChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
Srikant Kuppa866893f2012-12-27 17:28:14 -08002556
Kiet Lam64c1b492013-07-12 13:56:44 +05302557 vos_mem_set(&bgScanParams, sizeof(tCsrBGScanRequest), 0);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002558
2559 /* Contiguously scan all channels from valid list */
2560 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "%s: get valid channel list", __func__);
Srinivas Girigowdade697412013-02-14 16:31:48 -08002561
Srinivas Girigowda56076852013-08-20 14:00:50 -07002562 numOfChannels = sizeof(pMac->roam.validChannelList);
Srinivas Girigowdade697412013-02-14 16:31:48 -08002563
Srinivas Girigowda56076852013-08-20 14:00:50 -07002564 if(!HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac,
2565 (tANI_U8 *)pMac->roam.validChannelList,
2566 (tANI_U32 *) &numOfChannels)))
2567 {
2568 smsLog(pMac, LOGE, FL("Could not get valid channel list"));
2569 return eHAL_STATUS_FAILURE;
Srinivas Girigowdade697412013-02-14 16:31:48 -08002570 }
Srinivas Girigowda56076852013-08-20 14:00:50 -07002571 pInChannelList = pMac->roam.validChannelList;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002572
2573 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
2574 {
2575 csrNeighborRoamChannelsFilterByCurrentBand(
2576 pMac,
2577 pInChannelList,
2578 numOfChannels,
2579 tmpChannelList,
2580 &numOfChannels);
2581 pInChannelList = tmpChannelList;
2582 }
2583
Kiet Lam64c1b492013-07-12 13:56:44 +05302584 channelList = vos_mem_malloc(numOfChannels);
2585 if ( NULL == channelList )
Srikant Kuppa866893f2012-12-27 17:28:14 -08002586 {
2587 smsLog(pMac, LOGE, FL("could not allocate memory for channelList"));
2588 return eHAL_STATUS_FAILURE;
2589 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08002590 vos_mem_copy(channelList, (tANI_U8 *)pInChannelList,
Srikant Kuppa866893f2012-12-27 17:28:14 -08002591 numOfChannels * sizeof(tANI_U8));
2592
2593 bgScanParams.ChannelInfo.numOfChannels = numOfChannels;
2594 bgScanParams.ChannelInfo.ChannelList = channelList;
2595 for (i = 0; i < numOfChannels; i++)
2596 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002597 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "%s: valid channel list = %d",
Srikant Kuppa866893f2012-12-27 17:28:14 -08002598 __func__, bgScanParams.ChannelInfo.ChannelList[i]);
2599 }
2600 csrNeighborRoamFillNonChannelBgScanParams(pMac, &bgScanParams);
2601
2602 status = csrNeighborRoamIssueBgScanRequest(pMac, &bgScanParams,
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002603 sessionId, csrNeighborRoamContiguousScanRequestCallback);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002604
Kiet Lam64c1b492013-07-12 13:56:44 +05302605 vos_mem_free(channelList);
Srikant Kuppa866893f2012-12-27 17:28:14 -08002606
2607 if (eHAL_STATUS_SUCCESS != status)
2608 {
2609 smsLog(pMac, LOGE, FL("Issue of BG Scan request failed: Status = %d"), status);
2610 }
2611
2612 return status;
2613}
2614#endif
2615
Jeff Johnson295189b2012-06-20 16:38:30 -07002616/* ---------------------------------------------------------------------------
2617
2618 \fn csrNeighborRoamNeighborScanTimerCallback
2619
2620 \brief This function is the neighbor scan timer callback function. It invokes
2621 the BG scan request based on the current and previous states
2622
2623 \param pv - CSR timer context info which includes pMac and session ID
2624
2625 \return VOID
2626
2627---------------------------------------------------------------------------*/
2628void csrNeighborRoamNeighborScanTimerCallback(void *pv)
2629{
2630 tCsrTimerInfo *pInfo = (tCsrTimerInfo *)pv;
2631 tpAniSirGlobal pMac = pInfo->pMac;
2632 tANI_U32 sessionId = pInfo->sessionId;
2633 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2634
2635 // check if bg scan is on going, no need to send down the new params if true
2636 if(eANI_BOOLEAN_TRUE == pNeighborRoamInfo->scanRspPending)
2637 {
2638 //msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002639 smsLog(pMac, LOGW, FL("Already BgScanRsp is Pending"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002640 return;
2641 }
2642
2643 VOS_ASSERT(sessionId == pNeighborRoamInfo->csrSessionId);
2644
2645 switch (pNeighborRoamInfo->neighborRoamState)
2646 {
2647#ifdef WLAN_FEATURE_VOWIFI_11R
2648 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2649 switch(pNeighborRoamInfo->prevNeighborRoamState)
2650 {
2651 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY:
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002652 csrNeighborRoamPerformBgScan(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002653 break;
2654 default:
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302655 smsLog(pMac, LOGE, FL("Neighbor scan callback received in"
2656 "state %s, prev state = %s"),
2657 macTraceGetNeighbourRoamState(
2658 pNeighborRoamInfo->neighborRoamState),
2659 macTraceGetNeighbourRoamState(
2660 pNeighborRoamInfo->prevNeighborRoamState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002661 break;
2662 }
2663 break;
2664#endif /* WLAN_FEATURE_VOWIFI_11R */
2665 case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07002666 csrNeighborRoamPerformBgScan(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002667 break;
2668 default:
2669 break;
2670 }
2671 return;
2672}
2673
Srinivas Girigowdade697412013-02-14 16:31:48 -08002674void csrNeighborRoamEmptyScanRefreshTimerCallback(void *context)
2675{
2676 tCsrTimerInfo *pInfo = (tCsrTimerInfo *)context;
2677 tpAniSirGlobal pMac = pInfo->pMac;
2678 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
2679 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2680
2681 /* Reset all the variables just as no scan had happened before */
2682 csrNeighborRoamResetConnectedStateControlInfo(pMac);
2683
2684#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
2685 if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled))
2686 {
2687 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state"));
2688 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
2689 if (VOS_STATUS_SUCCESS != vosStatus)
2690 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002691 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Srinivas Girigowdade697412013-02-14 16:31:48 -08002692 return;
2693 }
2694 /* Increment the neighbor report retry count after sending the neighbor request successfully */
2695 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
2696 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
2697 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY)
2698 }
2699 else
2700#endif
2701 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002702 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Non 11R or ESE Association:empty scan refresh timer expired"));
Srinivas Girigowdade697412013-02-14 16:31:48 -08002703 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
2704 if (VOS_STATUS_SUCCESS != vosStatus)
2705 {
2706 return;
2707 }
2708 }
2709 return;
2710}
2711
Jeff Johnson295189b2012-06-20 16:38:30 -07002712/* ---------------------------------------------------------------------------
2713
2714 \fn csrNeighborRoamResultsRefreshTimerCallback
2715
2716 \brief This function is the timer callback function for results refresh timer.
2717 When this is invoked, it is as good as down event received from TL. So,
2718 clear off the roamable AP list and start the scan procedure based on 11R
2719 or non-11R association
2720
2721 \param context - CSR timer context info which includes pMac and session ID
2722
2723 \return VOID
2724
2725---------------------------------------------------------------------------*/
2726void csrNeighborRoamResultsRefreshTimerCallback(void *context)
2727{
2728 tCsrTimerInfo *pInfo = (tCsrTimerInfo *)context;
2729 tpAniSirGlobal pMac = pInfo->pMac;
2730 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
2731 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2732
2733 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event reassoc callback with TL. RSSI = %d"), pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1));
2734
2735 /* Deregister reassoc callback. Ignore return status */
2736 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->cfgParams.neighborReassocThreshold * (-1),
2737 WLANTL_HO_THRESHOLD_DOWN,
2738 csrNeighborRoamReassocIndCallback,
2739 VOS_MODULE_ID_SME);
2740
2741 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
2742 {
2743 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002744 smsLog(pMac, LOGW, FL(" Couldn't deregister csrNeighborRoamReassocIndCallback with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002745 }
2746
2747 /* Reset all the variables just as no scan had happened before */
2748 csrNeighborRoamResetConnectedStateControlInfo(pMac);
2749
2750#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
2751 if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled))
2752 {
2753 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state"));
2754 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
2755 if (VOS_STATUS_SUCCESS != vosStatus)
2756 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002757 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07002758 return;
2759 }
2760 /* Increment the neighbor report retry count after sending the neighbor request successfully */
2761 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
2762 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
2763 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY)
2764 }
2765 else
2766#endif
2767 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002768 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Non 11R or ESE Association:results refresh timer expired"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002769 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
2770 if (VOS_STATUS_SUCCESS != vosStatus)
2771 {
2772 return;
2773 }
2774 }
2775 return;
2776}
2777
2778#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
2779/* ---------------------------------------------------------------------------
2780
2781 \fn csrNeighborRoamIssueNeighborRptRequest
2782
2783 \brief This function is invoked when TL issues a down event and the current assoc
2784 is a 11R association. It invokes SME RRM API to issue the neighbor request to
2785 the currently associated AP with the current SSID
2786
2787 \param pMac - The handle returned by macOpen.
2788
2789 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2790
2791---------------------------------------------------------------------------*/
2792VOS_STATUS csrNeighborRoamIssueNeighborRptRequest(tpAniSirGlobal pMac)
2793{
2794 tRrmNeighborRspCallbackInfo callbackInfo;
2795 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
2796 tRrmNeighborReq neighborReq;
2797
2798
2799 neighborReq.no_ssid = 0;
2800
2801 /* Fill in the SSID */
2802 neighborReq.ssid.length = pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length;
2803 vos_mem_copy(neighborReq.ssid.ssId, pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.ssId,
2804 pMac->roam.roamSession[pNeighborRoamInfo->csrSessionId].connectedProfile.SSID.length);
2805
2806 callbackInfo.neighborRspCallback = csrNeighborRoamRRMNeighborReportResult;
2807 callbackInfo.neighborRspCallbackContext = pMac;
2808 callbackInfo.timeout = pNeighborRoamInfo->FTRoamInfo.neighborReportTimeout;
2809
2810 return sme_NeighborReportRequest(pMac,(tANI_U8) pNeighborRoamInfo->csrSessionId, &neighborReq, &callbackInfo);
2811}
2812
2813/* ---------------------------------------------------------------------------
2814
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002815 \fn csrNeighborRoamChannelsFilterByCurrentBand
2816
2817 \brief This function is used to filter out the channels
2818 based on the currently associated AP channel
2819
2820 \param pMac - The handle returned by macOpen.
2821 \param pInputChannelList - The input channel list
2822 \param inputNumOfChannels - The number of channels in input channel list
2823 \param pOutputChannelList - The output channel list
2824 \param outputNumOfChannels - The number of channels in output channel list
2825 \param pMergedOutputNumOfChannels - The final number of channels in the output channel list.
2826
2827 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2828
2829---------------------------------------------------------------------------*/
2830
2831VOS_STATUS csrNeighborRoamChannelsFilterByCurrentBand(
2832 tpAniSirGlobal pMac,
2833 tANI_U8* pInputChannelList,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002834 tANI_U8 inputNumOfChannels,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002835 tANI_U8* pOutputChannelList,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002836 tANI_U8* pMergedOutputNumOfChannels
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002837 )
2838{
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002839 tANI_U8 i = 0;
2840 tANI_U8 numChannels = 0;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002841 tANI_U8 currAPoperationChannel = pMac->roam.neighborRoamInfo.currAPoperationChannel;
2842 // Check for NULL pointer
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302843 if (!pInputChannelList) return VOS_STATUS_E_INVAL;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002844
2845 // Check for NULL pointer
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302846 if (!pOutputChannelList) return VOS_STATUS_E_INVAL;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002847
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302848 if (inputNumOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN)
2849 {
2850 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2851 "%s: Wrong Number of Input Channels %d",
2852 __func__, inputNumOfChannels);
2853 return VOS_STATUS_E_INVAL;
2854 }
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002855 for (i = 0; i < inputNumOfChannels; i++)
2856 {
2857 if (GetRFBand(currAPoperationChannel) == GetRFBand(pInputChannelList[i]))
2858 {
2859 pOutputChannelList[numChannels] = pInputChannelList[i];
2860 numChannels++;
2861 }
2862 }
2863
2864 // Return final number of channels
2865 *pMergedOutputNumOfChannels = numChannels;
2866
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302867 return VOS_STATUS_SUCCESS;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002868}
2869
2870/* ---------------------------------------------------------------------------
2871
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002872 \fn csrNeighborRoamMergeChannelLists
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002873
2874 \brief This function is used to merge two channel list.
2875 NB: If called with outputNumOfChannels == 0, this routines
2876 simply copies the input channel list to the output channel list.
2877
2878 \param pMac - The handle returned by macOpen.
2879 \param pInputChannelList - The addtional channels to merge in to the "merged" channels list.
2880 \param inputNumOfChannels - The number of additional channels.
2881 \param pOutputChannelList - The place to put the "merged" channel list.
2882 \param outputNumOfChannels - The original number of channels in the "merged" channels list.
2883 \param pMergedOutputNumOfChannels - The final number of channels in the "merged" channel list.
2884
2885 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2886
2887---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002888VOS_STATUS csrNeighborRoamMergeChannelLists(
2889 tpAniSirGlobal pMac,
2890 tANI_U8 *pInputChannelList,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002891 tANI_U8 inputNumOfChannels,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002892 tANI_U8 *pOutputChannelList,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002893 tANI_U8 outputNumOfChannels,
2894 tANI_U8 *pMergedOutputNumOfChannels
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002895 )
2896{
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002897 tANI_U8 i = 0;
2898 tANI_U8 j = 0;
2899 tANI_U8 numChannels = outputNumOfChannels;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002900
2901 // Check for NULL pointer
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302902 if (!pInputChannelList) return VOS_STATUS_E_INVAL;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002903
2904 // Check for NULL pointer
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302905 if (!pOutputChannelList) return VOS_STATUS_E_INVAL;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002906
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302907 if (inputNumOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN)
2908 {
2909 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2910 "%s: Wrong Number of Input Channels %d",
2911 __func__, inputNumOfChannels);
2912 return VOS_STATUS_E_INVAL;
2913 }
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002914 // Add the "new" channels in the input list to the end of the output list.
2915 for (i = 0; i < inputNumOfChannels; i++)
2916 {
2917 for (j = 0; j < outputNumOfChannels; j++)
2918 {
2919 if (pInputChannelList[i] == pOutputChannelList[j])
2920 break;
2921 }
2922 if (j == outputNumOfChannels)
2923 {
2924 if (pInputChannelList[i])
2925 {
Madan Mohan Koyyalamudif5c368b2012-12-06 13:10:13 -08002926 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08002927 "%s: [INFOLOG] Adding extra %d to Neighbor channel list", __func__,
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002928 pInputChannelList[i]);
2929 pOutputChannelList[numChannels] = pInputChannelList[i];
2930 numChannels++;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002931 }
2932 }
2933 }
2934
2935 // Return final number of channels
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07002936 *pMergedOutputNumOfChannels = numChannels;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002937
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05302938 return VOS_STATUS_SUCCESS;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002939}
2940
2941/* ---------------------------------------------------------------------------
2942
Jeff Johnson295189b2012-06-20 16:38:30 -07002943 \fn csrNeighborRoamCreateChanListFromNeighborReport
2944
2945 \brief This function is invoked when neighbor report is received for the
2946 neighbor request. Based on the channels present in the neighbor report,
2947 it generates channel list which will be used in REPORT_SCAN state to
2948 scan for these neighbor APs
2949
2950 \param pMac - The handle returned by macOpen.
2951
2952 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
2953
2954---------------------------------------------------------------------------*/
2955VOS_STATUS csrNeighborRoamCreateChanListFromNeighborReport(tpAniSirGlobal pMac)
2956{
2957 tpRrmNeighborReportDesc pNeighborBssDesc;
2958 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002959 tANI_U8 numChannels = 0, i = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07002960 tANI_U8 channelList[MAX_BSS_IN_NEIGHBOR_RPT];
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002961 tANI_U8 mergedOutputNumOfChannels = 0;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07002962#if 0
2963 eHalStatus status = eHAL_STATUS_SUCCESS;
2964#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002965
2966 /* This should always start from 0 whenever we create a channel list out of neighbor AP list */
2967 pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport = 0;
2968
2969 pNeighborBssDesc = smeRrmGetFirstBssEntryFromNeighborCache(pMac);
2970
2971 while (pNeighborBssDesc)
2972 {
2973 if (pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport >= MAX_BSS_IN_NEIGHBOR_RPT) break;
2974
2975 /* Update the neighbor BSS Info in the 11r FT Roam Info */
2976 pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].channelNum =
2977 pNeighborBssDesc->pNeighborBssDescription->channel;
2978 pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].neighborScore =
2979 (tANI_U8)pNeighborBssDesc->roamScore;
2980 vos_mem_copy(pNeighborRoamInfo->FTRoamInfo.neighboReportBssInfo[pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport].neighborBssId,
2981 pNeighborBssDesc->pNeighborBssDescription->bssId, sizeof(tSirMacAddr));
2982 pNeighborRoamInfo->FTRoamInfo.numBssFromNeighborReport++;
2983
2984 /* Saving the channel list non-redundantly */
2985 if (numChannels > 0)
2986 {
2987 for (i = 0; i < numChannels; i++)
2988 {
2989 if (pNeighborBssDesc->pNeighborBssDescription->channel == channelList[i])
2990 break;
2991 }
2992
2993 }
2994 if (i == numChannels)
2995 {
2996 if (pNeighborBssDesc->pNeighborBssDescription->channel)
2997 {
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07002998 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
2999 {
3000 // Make sure to add only if its the same band
3001 if (GetRFBand(pNeighborRoamInfo->currAPoperationChannel) ==
3002 GetRFBand(pNeighborBssDesc->pNeighborBssDescription->channel))
3003 {
3004 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3005 "%s: [INFOLOG] Adding %d to Neighbor channel list (Same band)\n", __func__,
3006 pNeighborBssDesc->pNeighborBssDescription->channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07003007 channelList[numChannels] = pNeighborBssDesc->pNeighborBssDescription->channel;
3008 numChannels++;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003009 }
3010 }
3011 else
3012 {
3013 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3014 "%s: [INFOLOG] Adding %d to Neighbor channel list\n", __func__,
3015 pNeighborBssDesc->pNeighborBssDescription->channel);
3016 channelList[numChannels] = pNeighborBssDesc->pNeighborBssDescription->channel;
3017 numChannels++;
3018 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003019 }
3020 }
3021
3022 pNeighborBssDesc = smeRrmGetNextBssEntryFromNeighborCache(pMac, pNeighborBssDesc);
3023 }
3024
3025 if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
3026 {
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003027#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -07003028 // Before we free the existing channel list for a safety net make sure
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003029 // we have a union of the IAPP and the already existing list.
3030 status = csrNeighborRoamMergeChannelLists(
3031 pMac,
3032 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList,
3033 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels,
3034 channelList,
3035 numChannels,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003036 &numChannels );
3037#endif
3038
Jeff Johnson295189b2012-06-20 16:38:30 -07003039 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
3040 }
3041
3042 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07003043 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003044 /* Store the obtained channel list to the Neighbor Control data structure */
3045 if (numChannels)
3046 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = vos_mem_malloc((numChannels) * sizeof(tANI_U8));
3047 if (NULL == pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
3048 {
3049 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed.. TL event ignored"));
3050 return VOS_STATUS_E_RESOURCES;
3051 }
3052
3053 vos_mem_copy(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList,
3054 channelList, (numChannels) * sizeof(tANI_U8));
3055 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = numChannels;
Varun Reddy Yeturub4dedf22013-09-13 15:58:26 -07003056 /*
3057 * Create a Union of occupied channel list learnt by the DUT along with the Neighbor
3058 * report Channels. This increases the chances of the DUT to get a candidate AP while
3059 * roaming even if the Neighbor Report is not able to provide sufficient information.
3060 * */
3061 if (pMac->scan.occupiedChannels.numChannels)
3062 {
3063 csrNeighborRoamMergeChannelLists(pMac,
3064 &pMac->scan.occupiedChannels.channelList[0],
3065 pMac->scan.occupiedChannels.numChannels,
3066 &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList[0],
3067 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels,
3068 &mergedOutputNumOfChannels);
3069 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels =
3070 mergedOutputNumOfChannels;
3071
3072 }
3073 /*Indicate the firmware about the update only if any new channels are added.
3074 * Otherwise, the firmware would already be knowing the non-IAPPneighborlist
3075 * channels. There is no need to update.*/
Jeff Johnson295189b2012-06-20 16:38:30 -07003076 if (numChannels)
3077 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05303078 smsLog(pMac, LOG1, FL("IAPP Neighbor list callback received as expected"
3079 "in state %s."),
3080 macTraceGetNeighbourRoamState(
3081 pNeighborRoamInfo->neighborRoamState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003082 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_TRUE;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003083#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07003084 if (csrRoamIsRoamOffloadScanEnabled(pMac))
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003085 {
3086 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
3087 }
3088#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003089 }
3090 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
3091 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE;
3092
3093 return VOS_STATUS_SUCCESS;
3094}
3095
3096/* ---------------------------------------------------------------------------
3097
3098 \fn csrNeighborRoamRRMNeighborReportResult
3099
3100 \brief This function is the neighbor report callback that will be invoked by
3101 SME RRM on receiving a neighbor report or of neighbor report is not
3102 received after timeout. On receiving a valid report, it generates a
3103 channel list from the neighbor report and starts the
3104 neighbor scan timer
3105
3106 \param context - The handle returned by macOpen.
3107 vosStatus - Status of the callback(SUCCESS/FAILURE)
3108
3109 \return VOID
3110
3111---------------------------------------------------------------------------*/
3112void csrNeighborRoamRRMNeighborReportResult(void *context, VOS_STATUS vosStatus)
3113{
3114 tpAniSirGlobal pMac = PMAC_STRUCT(context);
3115 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3116 eHalStatus status = eHAL_STATUS_SUCCESS;
3117
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003118 smsLog(pMac, LOG1, FL("Neighbor report result callback with status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003119 switch (pNeighborRoamInfo->neighborRoamState)
3120 {
3121 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY:
3122 /* Reset the report pending variable */
3123 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_FALSE;
3124 if (VOS_STATUS_SUCCESS == vosStatus)
3125 {
3126 /* Need to create channel list based on the neighbor AP list and transition to REPORT_SCAN state */
3127 vosStatus = csrNeighborRoamCreateChanListFromNeighborReport(pMac);
3128 if (VOS_STATUS_SUCCESS == vosStatus)
3129 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003130 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("Channel List created from Neighbor report, Transitioning to NEIGHBOR_SCAN state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003131 }
3132
3133 /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */
3134 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
3135
3136 /* Now ready for neighbor scan based on the channel list created */
3137 /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is
3138 what palTimerStart expects */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05303139 status = vos_timer_start(&pNeighborRoamInfo->neighborScanTimer,
3140 pNeighborRoamInfo->cfgParams.neighborScanPeriod);
Jeff Johnson295189b2012-06-20 16:38:30 -07003141 if (eHAL_STATUS_SUCCESS != status)
3142 {
3143 /* Timer start failed.. Should we ASSERT here??? */
3144 smsLog(pMac, LOGE, FL("PAL Timer start for neighbor scan timer failed, status = %d, Ignoring state transition"), status);
3145 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
3146 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07003147 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003148 return;
3149 }
3150 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
3151 /* Neighbor scan timer started. Transition to REPORT_SCAN state */
3152 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN)
3153 }
3154 else
3155 {
3156 /* Neighbor report timeout happened in SME RRM. We can try sending more neighbor requests until we
3157 reach the maxNeighborRetries or receiving a successful neighbor response */
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003158 smsLog(pMac, LOGE, FL("Neighbor report result failed after %d retries, MAX RETRIES = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003159 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum, pNeighborRoamInfo->cfgParams.maxNeighborRetries);
3160 if (pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum >=
3161 pNeighborRoamInfo->cfgParams.maxNeighborRetries)
3162 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003163 smsLog(pMac, LOGE, FL("Bailing out to CFG Channel list scan.. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003164 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
3165 if (VOS_STATUS_SUCCESS != vosStatus)
3166 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003167 smsLog(pMac, LOGE, FL("Transit to CFG Channel list scan state failed with status %d "), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003168 return;
3169 }
3170 /* We transitioned to different state now. Reset the Neighbor report retry count */
3171 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
3172 }
3173 else
3174 {
3175 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
3176 if (VOS_STATUS_SUCCESS != vosStatus)
3177 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003178 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003179 return;
3180 }
3181 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
3182 /* Increment the neighbor report retry count after sending the neighbor request successfully */
3183 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
3184 }
3185 }
3186 break;
3187 default:
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05303188 smsLog(pMac, LOGE, FL("Neighbor result callback not expected in"
3189 "state %s, Ignoring.."),
3190 macTraceGetNeighbourRoamState(
3191 pNeighborRoamInfo->neighborRoamState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003192 break;
3193 }
3194 return;
3195}
3196#endif /* WLAN_FEATURE_VOWIFI_11R */
3197
3198
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003199#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003200tANI_BOOLEAN csrNeighborRoamIsSsidAndSecurityMatch(
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003201 tpAniSirGlobal pMac,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003202 tCsrRoamConnectedProfile *pCurProfile,
3203 tSirBssDescription *pBssDesc,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003204 tDot11fBeaconIEs *pIes)
3205{
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003206 tCsrAuthList authType;
3207 tCsrEncryptionList uCEncryptionType;
3208 tCsrEncryptionList mCEncryptionType;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003209 tANI_BOOLEAN fMatch = FALSE;
3210
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003211 authType.numEntries = 1;
3212 authType.authType[0] = pCurProfile->AuthType;
3213 uCEncryptionType.numEntries = 1;
3214 uCEncryptionType.encryptionType[0] = pCurProfile->EncryptionType;
3215 mCEncryptionType.numEntries = 1;
3216 mCEncryptionType.encryptionType[0] = pCurProfile->mcEncryptionType;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003217
3218 if( pIes )
3219 {
3220 if(pIes->SSID.present)
3221 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003222 fMatch = csrIsSsidMatch( pMac,
3223 (void *)pCurProfile->SSID.ssId, pCurProfile->SSID.length,
3224 pIes->SSID.ssid, pIes->SSID.num_ssid,
3225 eANI_BOOLEAN_TRUE );
3226 if(TRUE == fMatch)
3227 {
3228 fMatch = csrIsSecurityMatch( pMac, &authType, &uCEncryptionType,
3229 &mCEncryptionType, pBssDesc, pIes, NULL, NULL, NULL );
3230 return (fMatch);
3231 }
3232 else
3233 {
3234 return (fMatch);
3235 }
3236
3237 }
3238 else
3239 {
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003240 return FALSE; // Treat a missing SSID as a non-match.
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003241 }
3242 }
3243 else
3244 {
3245 return FALSE; // Again, treat missing pIes as a non-match.
3246 }
3247}
3248
3249tANI_BOOLEAN csrNeighborRoamIsNewConnectedProfile(
3250 tpAniSirGlobal pMac)
3251{
3252 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3253 tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId;
3254 tCsrRoamConnectedProfile *pCurrProfile = NULL;
3255 tCsrRoamConnectedProfile *pPrevProfile = NULL;
3256 tDot11fBeaconIEs *pIes = NULL;
3257 tSirBssDescription *pBssDesc = NULL;
3258 tANI_BOOLEAN fNew = TRUE;
3259
3260 if(!(pMac->roam.roamSession && CSR_IS_SESSION_VALID(pMac, sessionId)))
3261 {
3262 return (fNew);
3263 }
3264
3265 pCurrProfile = &pMac->roam.roamSession[sessionId].connectedProfile;
3266 if( !pCurrProfile )
3267 {
3268 return (fNew);
3269}
3270
3271 pPrevProfile = &pNeighborRoamInfo->prevConnProfile;
3272 if( !pPrevProfile )
3273 {
3274 return (fNew);
3275 }
3276
3277 pBssDesc = pPrevProfile->pBssDesc;
3278 if (pBssDesc)
3279 {
3280 if (HAL_STATUS_SUCCESS(csrGetParsedBssDescriptionIEs(pMac,
3281 pBssDesc, &pIes)) &&
3282 csrNeighborRoamIsSsidAndSecurityMatch(pMac, pCurrProfile, pBssDesc, pIes))
3283 {
3284 fNew = FALSE;
3285 }
Kiet Lam64c1b492013-07-12 13:56:44 +05303286 if (pIes)
3287 {
3288 vos_mem_free(pIes);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003289 }
3290 }
3291
3292 if (fNew)
3293 {
3294 smsLog(pMac, LOG1, FL("Prev roam profile did not match current"));
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003295 }
3296 else
3297 {
3298 smsLog(pMac, LOG1, FL("Prev roam profile matches current"));
3299 }
3300
3301 return (fNew);
3302}
3303
3304tANI_BOOLEAN csrNeighborRoamConnectedProfileMatch(
3305 tpAniSirGlobal pMac,
3306 tCsrScanResult *pResult,
3307 tDot11fBeaconIEs *pIes)
3308{
3309 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3310 tANI_U8 sessionId = (tANI_U8)pNeighborRoamInfo->csrSessionId;
3311 tCsrRoamConnectedProfile *pCurProfile = NULL;
3312 tSirBssDescription *pBssDesc = &pResult->Result.BssDescriptor;
3313
3314 if( !(pMac->roam.roamSession
3315 && CSR_IS_SESSION_VALID(pMac, sessionId)))
3316 {
3317 return FALSE;
3318 }
3319
3320 pCurProfile = &pMac->roam.roamSession[sessionId].connectedProfile;
3321
3322 if( !pCurProfile)
3323 {
3324 return FALSE;
3325 }
3326
3327 return csrNeighborRoamIsSsidAndSecurityMatch(pMac, pCurProfile, pBssDesc, pIes);
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003328}
3329
3330/* ---------------------------------------------------------------------------
3331
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003332 \fn csrNeighborRoamPrepareNonOccupiedChannelList
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003333
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003334 \brief This function is used to prepare a channel list that is derived from
3335 the list of valid channels and does not include those in the occupied
3336 list.
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003337
3338 \param pMac - The handle returned by macOpen.
3339 \param pInputChannelList - The default channels list.
3340 \param numOfChannels - The number of channels in the default channels list.
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003341 \param pOutputChannelList - The place to put the non-occupied channel list.
3342 \param pOutputNumOfChannels - The number of channels in the non-occupied channel list.
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003343
3344 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3345
3346---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003347VOS_STATUS csrNeighborRoamPrepareNonOccupiedChannelList(
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003348 tpAniSirGlobal pMac,
3349 tANI_U8 *pInputChannelList,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07003350 tANI_U8 numOfChannels,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003351 tANI_U8 *pOutputChannelList,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07003352 tANI_U8 *pOutputNumOfChannels
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003353 )
3354{
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07003355 tANI_U8 i = 0;
3356 tANI_U8 outputNumOfChannels = 0; // Clear the output number of channels
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003357 tANI_U8 numOccupiedChannels = pMac->scan.occupiedChannels.numChannels;
3358 tANI_U8 *pOccupiedChannelList = pMac->scan.occupiedChannels.channelList;
3359
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003360 for (i = 0; i < numOfChannels; i++)
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003361 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003362 if (!csrIsChannelPresentInList(pOccupiedChannelList, numOccupiedChannels,
3363 pInputChannelList[i]))
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003364 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003365 pOutputChannelList[outputNumOfChannels++] = pInputChannelList[i];
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003366 }
3367 }
3368
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003369 smsLog(pMac, LOG2, FL("Number of channels in the valid channel list=%d; "
3370 "Number of channels in the non-occupied list list=%d"),
3371 numOfChannels, outputNumOfChannels);
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003372
3373 // Return the number of channels
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003374 *pOutputNumOfChannels = outputNumOfChannels;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003375
3376 return eHAL_STATUS_SUCCESS;
3377}
3378#endif /* FEATURE_WLAN_LFR */
3379
Jeff Johnson295189b2012-06-20 16:38:30 -07003380/* ---------------------------------------------------------------------------
3381
3382 \fn csrNeighborRoamTransitToCFGChanScan
3383
3384 \brief This function is called whenever there is a transition to CFG chan scan
3385 state from any state. It frees up the current channel list and allocates
3386 a new memory for the channels received from CFG item. It then starts the
3387 neighbor scan timer to perform the scan on each channel one by one
3388
3389 \param pMac - The handle returned by macOpen.
3390
3391 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3392
3393---------------------------------------------------------------------------*/
3394VOS_STATUS csrNeighborRoamTransitToCFGChanScan(tpAniSirGlobal pMac)
3395{
3396 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3397 eHalStatus status = eHAL_STATUS_SUCCESS;
3398 int i = 0;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07003399 tANI_U8 numOfChannels = 0;
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003400 tANI_U8 channelList[WNI_CFG_VALID_CHANNEL_LIST_LEN];
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003401 tpCsrChannelInfo currChannelListInfo;
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07003402#ifdef FEATURE_WLAN_LFR
3403 tANI_U32 sessionId = pNeighborRoamInfo->csrSessionId;
3404#endif
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003405 currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07003406
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003407 if (
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003408#ifdef FEATURE_WLAN_ESE
3409 ((pNeighborRoamInfo->isESEAssoc) &&
Jeff Johnson04dd8a82012-06-29 20:41:40 -07003410 (pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived == eANI_BOOLEAN_FALSE)) ||
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003411 (pNeighborRoamInfo->isESEAssoc == eANI_BOOLEAN_FALSE) ||
3412#endif // ESE
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003413 currChannelListInfo->numOfChannels == 0)
Jeff Johnson295189b2012-06-20 16:38:30 -07003414 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003415 smsLog(pMac, LOGW, FL("Building channel list to scan"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003416
3417
3418 /* Free up the channel list and allocate a new memory. This is because we dont know how much
3419 was allocated last time. If we directly copy more number of bytes than allocated earlier, this might
3420 result in memory corruption */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003421 if (NULL != currChannelListInfo->ChannelList)
Jeff Johnson295189b2012-06-20 16:38:30 -07003422 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003423 vos_mem_free(currChannelListInfo->ChannelList);
3424 currChannelListInfo->ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07003425 currChannelListInfo->numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003426 }
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003427
3428 // Now obtain the contents for "channelList" (the "default valid channel list") from EITHER
3429 // the gNeighborScanChannelList in "cfg.ini", OR the actual "valid channel list" information formed by CSR.
3430 if (0 != pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels)
Jeff Johnson295189b2012-06-20 16:38:30 -07003431 {
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003432 // Copy the "default valid channel list" (channelList) from the gNeighborScanChannelList in "cfg.ini".
3433 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, "Using the channel list from cfg.ini");
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003434 status = csrNeighborRoamMergeChannelLists(
3435 pMac,
3436 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList,
3437 pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels,
3438 channelList,
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003439 0, //NB: If 0, simply copy the input channel list to the output list.
3440 &numOfChannels );
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003441
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003442 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
3443 {
3444 csrNeighborRoamChannelsFilterByCurrentBand(
3445 pMac,
3446 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList,
3447 pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels,
3448 channelList,
3449 &numOfChannels);
3450 }
Gopichand Nakkala9cd573c2013-04-19 21:52:58 +05303451 if(numOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN)
3452 {
3453 smsLog(pMac, LOGE, FL("Received wrong number of Channel list"));
3454 return VOS_STATUS_E_INVAL;
3455 }
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003456 currChannelListInfo->ChannelList =
3457 vos_mem_malloc(numOfChannels*sizeof(tANI_U8));
3458 if (NULL == currChannelListInfo->ChannelList)
3459 {
3460 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed"));
3461 return VOS_STATUS_E_RESOURCES;
3462 }
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003463 vos_mem_copy(currChannelListInfo->ChannelList,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003464 channelList, numOfChannels * sizeof(tANI_U8));
Madan Mohan Koyyalamudi596e4fb2012-10-05 11:39:52 -07003465 }
Srikant Kuppa866893f2012-12-27 17:28:14 -08003466#ifdef FEATURE_WLAN_LFR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003467 else if ((pNeighborRoamInfo->uScanMode == DEFAULT_SCAN) &&
3468 (abs(pNeighborRoamInfo->lookupDOWNRssi) >
3469 abs(pNeighborRoamInfo->cfgParams.neighborReassocThreshold)))
Srikant Kuppa866893f2012-12-27 17:28:14 -08003470 {
3471 /*
3472 * Trigger a contiguous scan on all channels when the
3473 * RSSI in the lookup DOWN notification is below reassoc
3474 * threshold. This will help us find the best available
3475 * candidate and also update the channel cache.
3476 */
3477 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "Triggering contiguous scan "
3478 "(lookupDOWNRssi=%d,reassocThreshold=%d)",
3479 pNeighborRoamInfo->lookupDOWNRssi,
3480 pNeighborRoamInfo->cfgParams.neighborReassocThreshold*(-1));
3481
3482 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
3483
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05303484 vos_timer_stop(&pNeighborRoamInfo->neighborScanTimer);
Srikant Kuppa866893f2012-12-27 17:28:14 -08003485
3486 /* We are about to start a fresh scan cycle,
3487 * purge non-P2P results from the past */
3488 csrScanFlushSelectiveResult(pMac, VOS_FALSE);
Krunal Soni81b24262013-05-15 17:46:41 -07003489
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07003490 csrNeighborRoamPerformContiguousBgScan(pMac, sessionId);
Srikant Kuppa866893f2012-12-27 17:28:14 -08003491
3492 /* Transition to CFG_CHAN_LIST_SCAN */
3493 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN);
Krunal Soni81b24262013-05-15 17:46:41 -07003494
Srikant Kuppa866893f2012-12-27 17:28:14 -08003495 return VOS_STATUS_SUCCESS;
3496 }
3497#endif
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003498 else
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003499 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003500 numOfChannels = pMac->scan.occupiedChannels.numChannels;
Kiet Lam600d3ca2013-08-31 16:33:32 +05303501 if (numOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN)
3502 {
3503 numOfChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
3504 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003505 if (numOfChannels
3506#ifdef FEATURE_WLAN_LFR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003507 && ((pNeighborRoamInfo->uScanMode == SPLIT_SCAN_OCCUPIED_LIST) ||
3508 (pNeighborRoamInfo->uEmptyScanCount == 0) ||
3509 ((pNeighborRoamInfo->uEmptyScanCount % 2) == 1))
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003510#endif
3511 )
Jeff Johnson295189b2012-06-20 16:38:30 -07003512 {
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003513 /*
3514 * Always scan channels in the occupied channel list
3515 * before scanning on the non-occupied list.
3516 */
Srinivas Girigowdade697412013-02-14 16:31:48 -08003517 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Switching to occupied channel list"
3518#ifdef FEATURE_WLAN_LFR
3519 "-uScanMode=%d, uEmptyScanCount=%d",
3520 pNeighborRoamInfo->uScanMode,
3521 pNeighborRoamInfo->uEmptyScanCount
3522#endif
3523 );
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003524 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
3525 {
3526 csrNeighborRoamChannelsFilterByCurrentBand(
3527 pMac,
3528 pMac->scan.occupiedChannels.channelList,
3529 numOfChannels,
3530 channelList,
3531 &numOfChannels);
3532 }
3533 else
3534 {
3535 vos_mem_copy(channelList,
3536 pMac->scan.occupiedChannels.channelList,
3537 numOfChannels * sizeof(tANI_U8));
3538 }
3539
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003540 VOS_ASSERT(currChannelListInfo->ChannelList == NULL);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003541 currChannelListInfo->ChannelList = vos_mem_malloc(numOfChannels * sizeof(tANI_U8));
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003542
3543 if (NULL == currChannelListInfo->ChannelList)
3544 {
3545 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed"));
3546 return VOS_STATUS_E_RESOURCES;
3547 }
3548 vos_mem_copy(currChannelListInfo->ChannelList,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003549 channelList,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003550 numOfChannels * sizeof(tANI_U8));
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003551 }
3552 else
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003553 {
3554 /* Scan all channels from non-occupied list */
3555 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Get valid channel list");
3556 numOfChannels = sizeof(pMac->roam.validChannelList);
3557
3558 if(HAL_STATUS_SUCCESS(csrGetCfgValidChannels(pMac,
3559 (tANI_U8 *)pMac->roam.validChannelList,
3560 (tANI_U32 *) &numOfChannels)))
3561 {
3562#ifdef FEATURE_WLAN_LFR
3563 /*
3564 * Prepare non-occupied channel list (channelList)
3565 * from the actual "valid channel list" information
3566 * formed by CSR.
3567 */
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05303568 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, "Switching to non-occupied channel list");
Srinivas Girigowdade697412013-02-14 16:31:48 -08003569 status = csrNeighborRoamPrepareNonOccupiedChannelList(pMac,
3570 (tANI_U8 *)pMac->roam.validChannelList,
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003571 numOfChannels,
3572 channelList,
3573 &numOfChannels);
3574#else
3575 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, "Merging channel list");
3576 status = csrNeighborRoamMergeChannelLists(
3577 pMac,
3578 (tANI_U8 *)pMac->roam.validChannelList,
3579 numOfChannels, // The number of channels in the validChannelList
3580 channelList,
3581 0, //NB: If 0, simply copy the input channel list to the output list.
3582 &numOfChannels ); // The final number of channels in the output list. Will be numOfChannels
3583#endif
3584 }
3585 else
3586 {
3587 smsLog(pMac, LOGE, FL("Could not get valid channel list"));
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003588 return VOS_STATUS_E_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07003589 }
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07003590
3591 if (CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
3592 {
3593 csrNeighborRoamChannelsFilterByCurrentBand(
3594 pMac,
3595 (tANI_U8 *)pMac->roam.validChannelList,
3596 numOfChannels,
3597 channelList,
3598 &numOfChannels);
3599 }
3600
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003601 currChannelListInfo->ChannelList =
3602 vos_mem_malloc(numOfChannels*sizeof(tANI_U8));
3603
3604 if (NULL == currChannelListInfo->ChannelList)
3605 {
3606 smsLog(pMac, LOGE, FL("Memory allocation for Channel list failed"));
3607 return VOS_STATUS_E_RESOURCES;
3608 }
3609#ifdef FEATURE_WLAN_LFR
3610 vos_mem_copy(currChannelListInfo->ChannelList,
3611 channelList, numOfChannels * sizeof(tANI_U8));
3612#else
Krunal Sonia75019a2013-05-01 01:08:22 -07003613 if (numOfChannels > WNI_CFG_VALID_CHANNEL_LIST_LEN)
3614 {
3615 numOfChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
3616 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003617 vos_mem_copy(currChannelListInfo->ChannelList,
3618 (tANI_U8 *)pMac->roam.validChannelList,
3619 numOfChannels * sizeof(tANI_U8));
3620#endif
3621 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003622 }
3623
Madan Mohan Koyyalamudi470d2cf2012-09-28 14:43:44 -07003624 /* Adjust for the actual number that are used */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003625 currChannelListInfo->numOfChannels = numOfChannels;
Srikant Kuppa866893f2012-12-27 17:28:14 -08003626 NEIGHBOR_ROAM_DEBUG(pMac, LOGW,
3627 "Number of channels from CFG (or) (non-)occupied list=%d",
3628 currChannelListInfo->numOfChannels);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003629 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
Jeff Johnson295189b2012-06-20 16:38:30 -07003630 {
Madan Mohan Koyyalamudi22f27082012-11-27 19:11:12 +05303631 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, "Channel List from CFG (or) (non-)occupied list"
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003632 "= %d", currChannelListInfo->ChannelList[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003633 }
3634 }
3635
3636 /* We are gonna scan now. Remember the time stamp to filter out results only after this timestamp */
3637 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
3638
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05303639 vos_timer_stop(&pNeighborRoamInfo->neighborScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07003640 /* Start Neighbor scan timer now. Multiplication by PAL_TIMER_TO_MS_UNIT is to convert ms to us which is
3641 what palTimerStart expects */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05303642 status = vos_timer_start(&pNeighborRoamInfo->neighborScanTimer,
3643 pNeighborRoamInfo->cfgParams.neighborScanPeriod);
Jeff Johnson295189b2012-06-20 16:38:30 -07003644
3645 if (eHAL_STATUS_SUCCESS != status)
3646 {
3647 /* Timer start failed.. */
3648 smsLog(pMac, LOGE, FL("Neighbor scan PAL Timer start failed, status = %d, Ignoring state transition"), status);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003649 vos_mem_free(currChannelListInfo->ChannelList);
3650 currChannelListInfo->ChannelList = NULL;
Kiran Kumar Lokeref0bd4382013-03-19 22:06:52 -07003651 currChannelListInfo->numOfChannels = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003652 return VOS_STATUS_E_FAILURE;
3653 }
3654
3655 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = 0;
3656 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_TRUE;
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05303657 /* We are about to start a fresh scan cycle,
3658 * purge non-P2P results from the past */
3659 csrScanFlushSelectiveResult(pMac, VOS_FALSE);
James Zmuda5ba36d02013-03-14 17:39:07 -07003660
3661 /* We are about to start a fresh scan cycle,
3662 * purge failed pre-auth results from the past */
3663 csrNeighborRoamPurgePreauthFailedList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003664
3665 /* Transition to CFG_CHAN_LIST_SCAN_STATE */
3666 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN)
3667
3668 return VOS_STATUS_SUCCESS;
3669}
3670
3671/* ---------------------------------------------------------------------------
3672
3673 \fn csrNeighborRoamNeighborLookupUpEvent
3674
3675 \brief This function is called as soon as TL indicates that the current AP's
3676 RSSI is better than the neighbor lookup threshold. Here, we transition to
3677 CONNECTED state and reset all the scan parameters
3678
3679 \param pMac - The handle returned by macOpen.
3680
3681 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3682
3683---------------------------------------------------------------------------*/
3684VOS_STATUS csrNeighborRoamNeighborLookupUpEvent(tpAniSirGlobal pMac)
3685{
3686 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3687 VOS_STATUS vosStatus;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07003688 csrNeighborRoamDeregAllRssiIndication(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003689
Jeff Johnson295189b2012-06-20 16:38:30 -07003690 /* Recheck whether the below check is needed. */
3691 if (pNeighborRoamInfo->neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)
3692 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED)
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07003693#ifdef FEATURE_WLAN_LFR
3694 if (!csrRoamIsFastRoamEnabled(pMac,pMac->roam.neighborRoamInfo.csrSessionId))
3695 {
3696 smsLog(pMac, LOGE, FL("Received when fast roam is disabled. Ignore it"));
3697 return eHAL_STATUS_SUCCESS;
3698 }
3699#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07003700 /* Reset all the neighbor roam info control variables. Free all the allocated memory. It is like we are just associated now */
3701 csrNeighborRoamResetConnectedStateControlInfo(pMac);
3702
Jeff Johnson295189b2012-06-20 16:38:30 -07003703
3704 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering DOWN event neighbor lookup callback with TL. RSSI = %d,"), pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
3705 /* Register Neighbor Lookup threshold callback with TL for DOWN event now */
3706 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
3707 WLANTL_HO_THRESHOLD_DOWN,
3708 csrNeighborRoamNeighborLookupDOWNCallback,
3709 VOS_MODULE_ID_SME, pMac);
Srikant Kuppa866893f2012-12-27 17:28:14 -08003710#ifdef FEATURE_WLAN_LFR
3711 pNeighborRoamInfo->lookupDOWNRssi = 0;
3712#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003713 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
3714 {
3715 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003716 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback DOWN event with TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003717 }
3718
3719
3720 return vosStatus;
3721}
3722
3723/* ---------------------------------------------------------------------------
3724
3725 \fn csrNeighborRoamNeighborLookupDownEvent
3726
3727 \brief This function is called as soon as TL indicates that the current AP's
3728 RSSI falls below the current eighbor lookup threshold. Here, we transition to
3729 REPORT_QUERY for 11r association and CFG_CHAN_LIST_SCAN state if the assoc is
3730 a non-11R association.
3731
3732 \param pMac - The handle returned by macOpen.
3733
3734 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3735
3736---------------------------------------------------------------------------*/
3737VOS_STATUS csrNeighborRoamNeighborLookupDownEvent(tpAniSirGlobal pMac)
3738{
3739 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3740 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
3741 eHalStatus status = eHAL_STATUS_SUCCESS;
3742
3743 switch (pNeighborRoamInfo->neighborRoamState)
3744 {
3745 case eCSR_NEIGHBOR_ROAM_STATE_CONNECTED:
3746
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003747 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Deregistering DOWN event neighbor lookup callback with TL. RSSI = %d,"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003748 pNeighborRoamInfo->currentNeighborLookupThreshold * (-1));
3749 /* De-register Neighbor Lookup threshold callback with TL */
3750 vosStatus = WLANTL_DeregRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
3751 WLANTL_HO_THRESHOLD_DOWN,
3752 csrNeighborRoamNeighborLookupDOWNCallback,
3753 VOS_MODULE_ID_SME);
3754
3755 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
3756 {
3757 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003758 smsLog(pMac, LOGW, FL(" Couldn't Deregister csrNeighborRoamNeighborLookupCallback DOWN event from TL: Status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003759 }
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07003760#ifdef FEATURE_WLAN_LFR
3761 if (!csrRoamIsFastRoamEnabled(pMac,pMac->roam.neighborRoamInfo.csrSessionId))
3762 {
3763 smsLog(pMac, LOGE, FL("Received when fast roam is disabled. Ignore it"));
3764 return eHAL_STATUS_SUCCESS;
3765 }
3766#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003767
3768#if defined WLAN_FEATURE_VOWIFI_11R && defined WLAN_FEATURE_VOWIFI
3769 if ((pNeighborRoamInfo->is11rAssoc) && (pMac->rrm.rrmSmeContext.rrmConfig.rrmEnabled))
3770 {
3771
3772 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("11R Association:Neighbor Lookup Down event received in CONNECTED state"));
3773 vosStatus = csrNeighborRoamIssueNeighborRptRequest(pMac);
3774 if (VOS_STATUS_SUCCESS != vosStatus)
3775 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003776 smsLog(pMac, LOGE, FL("Neighbor report request failed. status = %d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003777 return vosStatus;
3778 }
3779 /* Increment the neighbor report retry count after sending the neighbor request successfully */
3780 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum++;
3781 pNeighborRoamInfo->FTRoamInfo.neighborRptPending = eANI_BOOLEAN_TRUE;
3782 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REPORT_QUERY)
3783 }
3784 else
3785#endif
3786 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003787 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Non 11R or ESE Association:Neighbor Lookup Down event received in CONNECTED state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003788
3789 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
3790 if (VOS_STATUS_SUCCESS != vosStatus)
3791 {
Madan Mohan Koyyalamudi4450acc2012-11-15 17:24:31 -08003792 NEIGHBOR_ROAM_DEBUG(pMac, LOGE, FL("csrNeighborRoamTransitToCFGChanScan failed"
3793 " with status=%d"), vosStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -07003794 return vosStatus;
3795 }
3796 }
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003797 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 -07003798 /* Register Neighbor Lookup threshold callback with TL for UP event now */
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08003799 vosStatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext,
3800 (v_S7_t)NEIGHBOR_ROAM_LOOKUP_UP_THRESHOLD * (-1),
Jeff Johnson295189b2012-06-20 16:38:30 -07003801 WLANTL_HO_THRESHOLD_UP,
3802 csrNeighborRoamNeighborLookupUPCallback,
3803 VOS_MODULE_ID_SME, pMac);
3804 if(!VOS_IS_STATUS_SUCCESS(vosStatus))
3805 {
3806 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003807 smsLog(pMac, LOGE, FL(" Couldn't register csrNeighborRoamNeighborLookupCallback UP event with TL: Status = %d"), status);
Jeff Johnson295189b2012-06-20 16:38:30 -07003808 }
3809 break;
3810 default:
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05303811 smsLog(pMac, LOGE, FL("DOWN event received in invalid"
3812 "state %s ..Ignoring..."),
3813 macTraceGetNeighbourRoamState(
3814 pNeighborRoamInfo->neighborRoamState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003815 break;
3816
3817 }
3818 return vosStatus;
3819}
3820
3821/* ---------------------------------------------------------------------------
3822
3823 \fn csrNeighborRoamNeighborLookupUPCallback
3824
3825 \brief This function is registered with TL to indicate whenever the RSSI
3826 gets better than the neighborLookup RSSI Threshold
3827
3828 \param pAdapter - VOS Context
3829 trafficStatus - UP/DOWN indication from TL
3830 pUserCtxt - Parameter for callback registered during callback registration. Should be pMac
3831
3832 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3833
3834---------------------------------------------------------------------------*/
3835VOS_STATUS csrNeighborRoamNeighborLookupUPCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
Srinivasdaaec712012-12-12 15:59:44 -08003836 v_PVOID_t pUserCtxt,
3837 v_S7_t avgRssi)
Jeff Johnson295189b2012-06-20 16:38:30 -07003838{
3839 tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt );
3840 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3841 VOS_STATUS vosStatus = eHAL_STATUS_SUCCESS;
3842
Srinivasdaaec712012-12-12 15:59:44 -08003843 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Neighbor Lookup UP indication callback called with notification %d Reported RSSI = %d"),
3844 rssiNotification,
3845 avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -07003846
3847 if(!csrIsConnStateConnectedInfra(pMac, pNeighborRoamInfo->csrSessionId))
3848 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003849 smsLog(pMac, LOGW, "Ignoring the indication as we are not connected");
Jeff Johnson295189b2012-06-20 16:38:30 -07003850 return VOS_STATUS_SUCCESS;
3851 }
3852
3853 VOS_ASSERT(WLANTL_HO_THRESHOLD_UP == rssiNotification);
3854 vosStatus = csrNeighborRoamNeighborLookupUpEvent(pMac);
3855 return vosStatus;
3856}
3857
3858/* ---------------------------------------------------------------------------
3859
3860 \fn csrNeighborRoamNeighborLookupDOWNCallback
3861
3862 \brief This function is registered with TL to indicate whenever the RSSI
3863 falls below the current neighborLookup RSSI Threshold
3864
3865 \param pAdapter - VOS Context
3866 trafficStatus - UP/DOWN indication from TL
3867 pUserCtxt - Parameter for callback registered during callback registration. Should be pMac
3868
3869 \return VOS_STATUS_SUCCESS on success, corresponding error code otherwise
3870
3871---------------------------------------------------------------------------*/
3872VOS_STATUS csrNeighborRoamNeighborLookupDOWNCallback (v_PVOID_t pAdapter, v_U8_t rssiNotification,
Srinivasdaaec712012-12-12 15:59:44 -08003873 v_PVOID_t pUserCtxt,
3874 v_S7_t avgRssi)
Jeff Johnson295189b2012-06-20 16:38:30 -07003875{
3876 tpAniSirGlobal pMac = PMAC_STRUCT( pUserCtxt );
3877 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
3878 VOS_STATUS vosStatus = eHAL_STATUS_SUCCESS;
3879
Srinivasdaaec712012-12-12 15:59:44 -08003880 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Neighbor Lookup DOWN indication callback called with notification %d Reported RSSI = %d"),
3881 rssiNotification,
3882 avgRssi);
Jeff Johnson295189b2012-06-20 16:38:30 -07003883
Srikant Kuppa866893f2012-12-27 17:28:14 -08003884#ifdef FEATURE_WLAN_LFR
3885 pNeighborRoamInfo->lookupDOWNRssi = avgRssi;
3886#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07003887 if(!csrIsConnStateConnectedInfra(pMac, pNeighborRoamInfo->csrSessionId))
3888 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08003889 smsLog(pMac, LOGW, "Ignoring the indication as we are not connected");
Jeff Johnson295189b2012-06-20 16:38:30 -07003890 return VOS_STATUS_SUCCESS;
3891 }
3892
3893 VOS_ASSERT(WLANTL_HO_THRESHOLD_DOWN == rssiNotification);
3894 vosStatus = csrNeighborRoamNeighborLookupDownEvent(pMac);
3895
3896 return vosStatus;
3897}
3898
3899#ifdef RSSI_HACK
3900extern int dumpCmdRSSI;
3901#endif
3902
3903/* ---------------------------------------------------------------------------
3904
3905 \fn csrNeighborRoamIndicateDisconnect
3906
3907 \brief This function is called by CSR as soon as the station disconnects from
3908 the AP. This function does the necessary cleanup of neighbor roam data
3909 structures. Neighbor roam state transitions to INIT state whenever this
3910 function is called except if the current state is REASSOCIATING
3911
3912 \param pMac - The handle returned by macOpen.
3913 sessionId - CSR session id that got disconnected
3914
3915 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
3916
3917---------------------------------------------------------------------------*/
3918eHalStatus csrNeighborRoamIndicateDisconnect(tpAniSirGlobal pMac, tANI_U8 sessionId)
3919{
3920 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003921#ifdef FEATURE_WLAN_LFR
3922 tCsrRoamConnectedProfile *pPrevProfile = &pNeighborRoamInfo->prevConnProfile;
3923#endif
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07003924 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003925
krunal soni587bf012014-02-04 12:35:11 -08003926 if (NULL == pSession)
3927 {
3928 smsLog(pMac, LOGE, FL("pSession is NULL "));
3929 return eHAL_STATUS_FAILURE;
3930 }
Kaushik, Sushant8489f472014-01-27 11:41:22 +05303931 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05303932 FL("Disconnect indication on session %d in state %s"
3933 "from BSSID : "
3934 MAC_ADDRESS_STR), sessionId,
3935 macTraceGetNeighbourRoamState(
3936 pNeighborRoamInfo->neighborRoamState),
Kaushik, Sushant8489f472014-01-27 11:41:22 +05303937 MAC_ADDR_ARRAY(pSession->connectedProfile.bssid));
Jeff Johnson295189b2012-06-20 16:38:30 -07003938
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003939#ifdef FEATURE_WLAN_LFR
3940 /*Free the current previous profile and move the current profile to prev profile.*/
3941 csrRoamFreeConnectProfile(pMac, pPrevProfile);
Srinivas Girigowda254925a2013-06-25 17:54:33 -07003942 csrRoamCopyConnectProfile(pMac, sessionId, pPrevProfile);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003943#endif
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07003944 if (NULL != pSession)
3945 {
3946 if (NULL != pSession->pCurRoamProfile)
3947 {
3948 if (VOS_STA_MODE != pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona)
3949 {
3950 smsLog(pMac, LOGE, FL("Ignoring Disconnect indication received from a non STA persona."
3951 "sessionId: %d, csrPersonna %d"), sessionId,
3952 (int)pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona);
3953 return eHAL_STATUS_SUCCESS;
3954 }
3955 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07003956
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08003957#ifdef FEATURE_WLAN_ESE
3958 if (pSession->connectedProfile.isESEAssoc)
Praveen Kumar Sirisilla8bdfac42013-10-10 17:20:48 -07003959 {
3960 vos_mem_copy(&pSession->prevApSSID, &pSession->connectedProfile.SSID,
3961 sizeof(tSirMacSSid));
3962 vos_mem_copy(pSession->prevApBssid, pSession->connectedProfile.bssid,
3963 sizeof(tSirMacAddr));
3964 pSession->prevOpChannel = pSession->connectedProfile.operationChannel;
3965 pSession->isPrevApInfoValid = TRUE;
3966 pSession->roamTS1 = vos_timer_get_system_time();
3967 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003968#endif
Praveen Kumar Sirisilla8bdfac42013-10-10 17:20:48 -07003969 } //if (NULL != pSession)
Jeff Johnson295189b2012-06-20 16:38:30 -07003970
3971#ifdef RSSI_HACK
3972 dumpCmdRSSI = -40;
3973#endif
3974 switch (pNeighborRoamInfo->neighborRoamState)
3975 {
3976 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
3977 // Stop scan and neighbor refresh timers.
3978 // These are indeed not required when we are in reassociating
3979 // state.
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05303980 vos_timer_stop(&pNeighborRoamInfo->neighborScanTimer);
3981 vos_timer_stop(&pNeighborRoamInfo->neighborResultsRefreshTimer);
3982 vos_timer_stop(&pNeighborRoamInfo->emptyScanRefreshTimer);
Madan Mohan Koyyalamudi5ad3dff2012-10-21 11:32:02 -07003983 if (!CSR_IS_ROAM_SUBSTATE_DISASSOC_HO( pMac, sessionId )) {
3984 /*
3985 * Disconnect indication during Disassoc Handoff sub-state
3986 * is received when we are trying to disconnect with the old
3987 * AP during roam. BUT, if receive a disconnect indication
3988 * outside of Disassoc Handoff sub-state, then it means that
3989 * this is a genuine disconnect and we need to clean up.
3990 * Otherwise, we will be stuck in reassoc state which will
3991 * in-turn block scans (see csrIsScanAllowed).
3992 */
3993 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT);
Varun Reddy Yeturub4dedf22013-09-13 15:58:26 -07003994 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudi5ad3dff2012-10-21 11:32:02 -07003995 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003996 break;
3997
3998 case eCSR_NEIGHBOR_ROAM_STATE_INIT:
Jeff Johnson295189b2012-06-20 16:38:30 -07003999 csrNeighborRoamResetInitStateControlInfo(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004000#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07004001 if (!csrRoamIsRoamOffloadScanEnabled(pMac))
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004002 {
4003#endif
4004 csrNeighborRoamDeregAllRssiIndication(pMac);
4005#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
4006 }
4007#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004008 break;
4009
Srikant Kuppa866893f2012-12-27 17:28:14 -08004010 case eCSR_NEIGHBOR_ROAM_STATE_CONNECTED:
4011 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
Varun Reddy Yeturub4dedf22013-09-13 15:58:26 -07004012 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
Srikant Kuppa866893f2012-12-27 17:28:14 -08004013 csrNeighborRoamResetConnectedStateControlInfo(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004014#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07004015 if (!csrRoamIsRoamOffloadScanEnabled(pMac))
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004016 {
4017#endif
4018 csrNeighborRoamDeregAllRssiIndication(pMac);
4019#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
4020 }
4021#endif
Srikant Kuppa866893f2012-12-27 17:28:14 -08004022 break;
4023
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07004024 case eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN:
4025 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT);
Varun Reddy Yeturub4dedf22013-09-13 15:58:26 -07004026 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07004027 csrNeighborRoamResetCfgListChanScanControlInfo(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004028#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07004029 if (!csrRoamIsRoamOffloadScanEnabled(pMac))
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004030 {
4031#endif
4032 csrNeighborRoamDeregAllRssiIndication(pMac);
4033#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
4034 }
4035#endif
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07004036 break;
4037
4038 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
4039 /* Stop pre-auth to reassoc interval timer */
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05304040 vos_timer_stop(&pMac->ft.ftSmeContext.preAuthReassocIntvlTimer);
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07004041 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
4042 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
4043 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
Varun Reddy Yeturub4dedf22013-09-13 15:58:26 -07004044 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudiedee8aa2012-10-15 15:36:40 -07004045 csrNeighborRoamResetPreauthControlInfo(pMac);
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07004046 csrNeighborRoamResetReportScanStateControlInfo(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004047#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07004048 if (!csrRoamIsRoamOffloadScanEnabled(pMac))
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004049 {
4050#endif
4051 csrNeighborRoamDeregAllRssiIndication(pMac);
4052#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
4053 }
4054#endif
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07004055 break;
4056
Jeff Johnson295189b2012-06-20 16:38:30 -07004057 default:
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05304058 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Received disconnect event"
4059 "in state %s"),
4060 macTraceGetNeighbourRoamState(
4061 pNeighborRoamInfo->neighborRoamState));
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07004062 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, FL("Transitioning to INIT state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004063 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
Varun Reddy Yeturub4dedf22013-09-13 15:58:26 -07004064 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudi4f292df2012-09-18 17:27:40 -07004065 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07004066 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004067#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
4068 /*Inform the Firmware to STOP Scanning as the host has a disconnect.*/
4069 if (csrRoamIsStaMode(pMac, sessionId))
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004070 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004071 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_STOP, REASON_DISCONNECTED);
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004072 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004073#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004074 return eHAL_STATUS_SUCCESS;
4075}
4076
4077/* ---------------------------------------------------------------------------
4078
4079 \fn csrNeighborRoamIndicateConnect
4080
4081 \brief This function is called by CSR as soon as the station connects to an AP.
4082 This initializes all the necessary data structures related to the
4083 associated AP and transitions the state to CONNECTED state
4084
4085 \param pMac - The handle returned by macOpen.
4086 sessionId - CSR session id that got connected
4087 vosStatus - connect status SUCCESS/FAILURE
4088
4089 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
4090
4091---------------------------------------------------------------------------*/
4092eHalStatus csrNeighborRoamIndicateConnect(tpAniSirGlobal pMac, tANI_U8 sessionId, VOS_STATUS vosStatus)
4093{
4094 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4095 eHalStatus status = eHAL_STATUS_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07004096 VOS_STATUS vstatus;
4097
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004098#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07004099 int init_ft_flag = FALSE;
4100#endif
4101
krunal soni289815a2013-07-16 16:20:19 -07004102 // if session id invalid then we need return failure
4103 if (NULL == pNeighborRoamInfo || !CSR_IS_SESSION_VALID(pMac, sessionId) ||
4104 (NULL == pMac->roam.roamSession[sessionId].pCurRoamProfile))
krunal soni48782522013-06-13 12:24:10 -07004105 {
4106 return eHAL_STATUS_FAILURE;
4107 }
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05304108 smsLog(pMac, LOG2, FL("Connect indication received with session id %d"
4109 "in state %s"),
4110 sessionId, macTraceGetNeighbourRoamState(
4111 pNeighborRoamInfo->neighborRoamState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004112
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07004113 // Bail out if this is NOT a STA persona
4114 if (pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona != VOS_STA_MODE)
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07004115 {
4116 smsLog(pMac, LOGE, FL("Ignoring Connect indication received from a non STA persona."
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07004117 "sessionId: %d, csrPersonna %d"),
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07004118 sessionId,
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07004119 (int)pMac->roam.roamSession[sessionId].pCurRoamProfile->csrPersona);
Dhanashri Atre9ae0dd12013-05-02 11:11:05 -07004120 return eHAL_STATUS_SUCCESS;
4121 }
4122
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07004123 // if a concurrent session is running
4124#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
4125 if (eANI_BOOLEAN_FALSE == CSR_IS_FASTROAM_IN_CONCURRENCY_INI_FEATURE_ENABLED(pMac))
4126 {
4127#endif
4128 if (csrIsConcurrentSessionRunning(pMac))
4129 {
4130 smsLog(pMac, LOGE, FL("Ignoring Connect indication received in multisession %d"),
4131 csrIsConcurrentSessionRunning(pMac));
4132 return eHAL_STATUS_SUCCESS;
4133 }
4134#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
4135 }
4136#endif
4137
Jeff Johnson295189b2012-06-20 16:38:30 -07004138 switch (pNeighborRoamInfo->neighborRoamState)
4139 {
4140 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
4141 if (VOS_STATUS_SUCCESS != vosStatus)
4142 {
4143 /* Just transition the state to INIT state. Rest of the clean up happens when we get next connect indication */
4144 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
Varun Reddy Yeturub4dedf22013-09-13 15:58:26 -07004145 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004146 break;
4147 }
4148 /* Fall through if the status is SUCCESS */
4149 case eCSR_NEIGHBOR_ROAM_STATE_INIT:
4150 /* Reset all the data structures here */
4151 csrNeighborRoamResetInitStateControlInfo(pMac);
4152
Jeff Johnson295189b2012-06-20 16:38:30 -07004153 pNeighborRoamInfo->csrSessionId = sessionId;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08004154
4155#ifdef FEATURE_WLAN_LFR
4156 /*
4157 * Initialize the occupied list ONLY if we are
4158 * transitioning from INIT state to CONNECTED state.
4159 */
4160 if (eCSR_NEIGHBOR_ROAM_STATE_INIT == pNeighborRoamInfo->neighborRoamState)
4161 csrInitOccupiedChannelsList(pMac);
4162#endif
4163 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CONNECTED);
4164
Jeff Johnson295189b2012-06-20 16:38:30 -07004165 vos_mem_copy(pNeighborRoamInfo->currAPbssid,
4166 pMac->roam.roamSession[sessionId].connectedProfile.bssid, sizeof(tCsrBssid));
4167 pNeighborRoamInfo->currAPoperationChannel = pMac->roam.roamSession[sessionId].connectedProfile.operationChannel;
4168 pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
4169 pNeighborRoamInfo->neighborScanTimerInfo.sessionId = sessionId;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08004170 pNeighborRoamInfo->currentNeighborLookupThreshold =
4171 pNeighborRoamInfo->cfgParams.neighborLookupThreshold;
4172#ifdef FEATURE_WLAN_LFR
4173 pNeighborRoamInfo->uEmptyScanCount = 0;
Srikant Kuppa866893f2012-12-27 17:28:14 -08004174 pNeighborRoamInfo->lookupDOWNRssi = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08004175 pNeighborRoamInfo->uScanMode = DEFAULT_SCAN;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08004176#endif
4177
Jeff Johnson295189b2012-06-20 16:38:30 -07004178
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004179#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07004180 /* Now we can clear the preauthDone that was saved as we are connected afresh */
4181 csrNeighborRoamFreeRoamableBSSList(pMac, &pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
4182#endif
4183
4184#ifdef WLAN_FEATURE_VOWIFI_11R
4185 // Based on the auth scheme tell if we are 11r
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08004186 if ( csrIsAuthType11r( pMac->roam.roamSession[sessionId].connectedProfile.AuthType,
4187 pMac->roam.roamSession[sessionId].connectedProfile.MDID.mdiePresent))
Jeff Johnson295189b2012-06-20 16:38:30 -07004188 {
4189 if (pMac->roam.configParam.isFastTransitionEnabled)
4190 init_ft_flag = TRUE;
4191 pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_TRUE;
4192 }
4193 else
4194 pNeighborRoamInfo->is11rAssoc = eANI_BOOLEAN_FALSE;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -07004195 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("11rAssoc is = %d"), pNeighborRoamInfo->is11rAssoc);
Jeff Johnson295189b2012-06-20 16:38:30 -07004196#endif
4197
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004198#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -07004199 // Based on the auth scheme tell if we are 11r
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004200 if (pMac->roam.roamSession[sessionId].connectedProfile.isESEAssoc)
Jeff Johnson295189b2012-06-20 16:38:30 -07004201 {
4202 if (pMac->roam.configParam.isFastTransitionEnabled)
4203 init_ft_flag = TRUE;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004204 pNeighborRoamInfo->isESEAssoc = eANI_BOOLEAN_TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004205 }
4206 else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004207 pNeighborRoamInfo->isESEAssoc = eANI_BOOLEAN_FALSE;
4208 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("isESEAssoc is = %d ft = %d"),
4209 pNeighborRoamInfo->isESEAssoc, init_ft_flag);
Jeff Johnson295189b2012-06-20 16:38:30 -07004210
4211#endif
4212
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004213#ifdef FEATURE_WLAN_LFR
4214 // If "Legacy Fast Roaming" is enabled
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05304215 if (csrRoamIsFastRoamEnabled(pMac, sessionId))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004216 {
4217 init_ft_flag = TRUE;
4218 }
4219#endif
4220
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004221#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07004222 if ( init_ft_flag == TRUE )
4223 {
4224 /* Initialize all the data structures needed for the 11r FT Preauth */
Jeff Johnson295189b2012-06-20 16:38:30 -07004225 pNeighborRoamInfo->FTRoamInfo.currentNeighborRptRetryNum = 0;
4226 csrNeighborRoamPurgePreauthFailedList(pMac);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004227#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07004228 if (csrRoamIsRoamOffloadScanEnabled(pMac))
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004229 {
4230 /*If this is not a INFRA type BSS, then do not send the command
4231 * down to firmware.Do not send the START command for other session
4232 * connections.*/
4233 if(csrRoamIsStaMode(pMac, sessionId))
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004234 {
4235 pNeighborRoamInfo->uOsRequestedHandoff = 0;
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07004236 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_START, REASON_CONNECT);
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004237 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004238 } else {
4239#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004240
4241 NEIGHBOR_ROAM_DEBUG(pMac, LOG2, FL("Registering neighbor lookup DOWN event with TL, RSSI = %d"), pNeighborRoamInfo->currentNeighborLookupThreshold);
4242 /* Register Neighbor Lookup threshold callback with TL for DOWN event only */
Jeff Johnson43971f52012-07-17 12:26:56 -07004243 vstatus = WLANTL_RegRSSIIndicationCB(pMac->roam.gVosContext, (v_S7_t)pNeighborRoamInfo->currentNeighborLookupThreshold * (-1),
Jeff Johnson295189b2012-06-20 16:38:30 -07004244 WLANTL_HO_THRESHOLD_DOWN,
4245 csrNeighborRoamNeighborLookupDOWNCallback,
4246 VOS_MODULE_ID_SME, pMac);
Srikant Kuppa866893f2012-12-27 17:28:14 -08004247#ifdef FEATURE_WLAN_LFR
4248 pNeighborRoamInfo->lookupDOWNRssi = 0;
4249#endif
Jeff Johnson43971f52012-07-17 12:26:56 -07004250 if(!VOS_IS_STATUS_SUCCESS(vstatus))
Jeff Johnson295189b2012-06-20 16:38:30 -07004251 {
4252 //err msg
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004253 smsLog(pMac, LOGW, FL(" Couldn't register csrNeighborRoamNeighborLookupDOWNCallback with TL: Status = %d"), vstatus);
Jeff Johnson43971f52012-07-17 12:26:56 -07004254 status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004255 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004256#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
4257 }
4258#endif /* WLAN_FEATURE_ROAM_SCAN_OFFLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004259 }
4260#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004261 break;
4262 default:
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05304263 smsLog(pMac, LOGE, FL("Connect event received in invalid state %s"
4264 "..Ignoring..."),
4265 macTraceGetNeighbourRoamState(
4266 pNeighborRoamInfo->neighborRoamState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004267 break;
4268 }
4269 return status;
4270}
4271
4272
4273#ifdef WLAN_FEATURE_VOWIFI_11R
4274/* ---------------------------------------------------------------------------
4275
Jeff Johnson295189b2012-06-20 16:38:30 -07004276 \fn csrNeighborRoamPurgePreauthFailedList
4277
4278 \brief This function purges all the MAC addresses in the pre-auth fail list
4279
4280 \param pMac - The handle returned by macOpen.
4281
4282 \return VOID
4283
4284---------------------------------------------------------------------------*/
4285void csrNeighborRoamPurgePreauthFailedList(tpAniSirGlobal pMac)
4286{
4287 tANI_U8 i;
4288
4289 for (i = 0; i < pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.numMACAddress; i++)
4290 {
4291 vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.macAddress[i], sizeof(tSirMacAddr));
4292 }
4293 pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthFailList.numMACAddress = 0;
4294
4295 return;
4296}
4297
4298/* ---------------------------------------------------------------------------
4299
4300 \fn csrNeighborRoamInit11rAssocInfo
4301
4302 \brief This function initializes 11r related neighbor roam data structures
4303
4304 \param pMac - The handle returned by macOpen.
4305
4306 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
4307
4308---------------------------------------------------------------------------*/
4309eHalStatus csrNeighborRoamInit11rAssocInfo(tpAniSirGlobal pMac)
4310{
4311 eHalStatus status;
4312 tpCsr11rAssocNeighborInfo pFTRoamInfo = &pMac->roam.neighborRoamInfo.FTRoamInfo;
4313
4314 pMac->roam.neighborRoamInfo.is11rAssoc = eANI_BOOLEAN_FALSE;
4315 pMac->roam.neighborRoamInfo.cfgParams.maxNeighborRetries = pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries;
4316 pFTRoamInfo->neighborReportTimeout = CSR_NEIGHBOR_ROAM_REPORT_QUERY_TIMEOUT;
4317 pFTRoamInfo->PEPreauthRespTimeout = CSR_NEIGHBOR_ROAM_PREAUTH_RSP_WAIT_MULTIPLIER * pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
4318 pFTRoamInfo->neighborRptPending = eANI_BOOLEAN_FALSE;
4319 pFTRoamInfo->preauthRspPending = eANI_BOOLEAN_FALSE;
4320
Jeff Johnson295189b2012-06-20 16:38:30 -07004321 pMac->roam.neighborRoamInfo.FTRoamInfo.currentNeighborRptRetryNum = 0;
4322 pMac->roam.neighborRoamInfo.FTRoamInfo.numBssFromNeighborReport = 0;
4323 vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.neighboReportBssInfo,
4324 sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
4325
4326
4327 status = csrLLOpen(pMac->hHdd, &pFTRoamInfo->preAuthDoneList);
4328 if (eHAL_STATUS_SUCCESS != status)
4329 {
4330 smsLog(pMac, LOGE, FL("LL Open of preauth done AP List failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004331 return eHAL_STATUS_RESOURCES;
4332 }
4333 return status;
4334}
4335#endif /* WLAN_FEATURE_VOWIFI_11R */
4336
4337/* ---------------------------------------------------------------------------
4338
4339 \fn csrNeighborRoamInit
4340
4341 \brief This function initializes neighbor roam data structures
4342
4343 \param pMac - The handle returned by macOpen.
4344
4345 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
4346
4347---------------------------------------------------------------------------*/
4348eHalStatus csrNeighborRoamInit(tpAniSirGlobal pMac)
4349{
4350 eHalStatus status;
4351 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4352
4353 pNeighborRoamInfo->neighborRoamState = eCSR_NEIGHBOR_ROAM_STATE_CLOSED;
4354 pNeighborRoamInfo->prevNeighborRoamState = eCSR_NEIGHBOR_ROAM_STATE_CLOSED;
4355 pNeighborRoamInfo->csrSessionId = CSR_SESSION_ID_INVALID;
4356 pNeighborRoamInfo->cfgParams.maxChannelScanTime = pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime;
4357 pNeighborRoamInfo->cfgParams.minChannelScanTime = pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime;
4358 pNeighborRoamInfo->cfgParams.maxNeighborRetries = 0;
4359 pNeighborRoamInfo->cfgParams.neighborLookupThreshold = pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
4360 pNeighborRoamInfo->cfgParams.neighborReassocThreshold = pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold;
4361 pNeighborRoamInfo->cfgParams.neighborScanPeriod = pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod;
4362 pNeighborRoamInfo->cfgParams.neighborResultsRefreshPeriod = pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
Srinivas Girigowdade697412013-02-14 16:31:48 -08004363 pNeighborRoamInfo->cfgParams.emptyScanRefreshPeriod = pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
4364
Srinivas Girigowdade697412013-02-14 16:31:48 -08004365 pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels =
Jeff Johnson295189b2012-06-20 16:38:30 -07004366 pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels;
4367
Srinivas Girigowdade697412013-02-14 16:31:48 -08004368 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList =
Jeff Johnson295189b2012-06-20 16:38:30 -07004369 vos_mem_malloc(pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels);
4370
4371 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
4372 {
4373 smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed"));
4374 return eHAL_STATUS_RESOURCES;
4375 }
4376
4377 /* Update the roam global structure from CFG */
Kiet Lam64c1b492013-07-12 13:56:44 +05304378 vos_mem_copy(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList,
Jeff Johnson295189b2012-06-20 16:38:30 -07004379 pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList,
4380 pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels);
4381
4382 vos_mem_set(pNeighborRoamInfo->currAPbssid, sizeof(tCsrBssid), 0);
4383 pNeighborRoamInfo->currentNeighborLookupThreshold = pMac->roam.neighborRoamInfo.cfgParams.neighborLookupThreshold;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08004384#ifdef FEATURE_WLAN_LFR
Srikant Kuppa866893f2012-12-27 17:28:14 -08004385 pNeighborRoamInfo->lookupDOWNRssi = 0;
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08004386 pNeighborRoamInfo->uEmptyScanCount = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08004387 pNeighborRoamInfo->uScanMode = DEFAULT_SCAN;
Kiet Lam64c1b492013-07-12 13:56:44 +05304388 vos_mem_set(&pNeighborRoamInfo->prevConnProfile, sizeof(tCsrRoamConnectedProfile), 0);
Madan Mohan Koyyalamudidd3c9662012-11-09 17:39:30 -08004389#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004390 pNeighborRoamInfo->scanRspPending = eANI_BOOLEAN_FALSE;
4391
4392 pNeighborRoamInfo->neighborScanTimerInfo.pMac = pMac;
4393 pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05304394 status = vos_timer_init(&pNeighborRoamInfo->neighborScanTimer, VOS_TIMER_TYPE_SW,
Jeff Johnson295189b2012-06-20 16:38:30 -07004395 csrNeighborRoamNeighborScanTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
4396
4397 if (eHAL_STATUS_SUCCESS != status)
4398 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08004399 smsLog(pMac, LOGE, FL("Neighbor scan timer allocation failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004400 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
4401 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
4402 return eHAL_STATUS_RESOURCES;
4403 }
4404
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05304405 status = vos_timer_init(&pNeighborRoamInfo->neighborResultsRefreshTimer, VOS_TIMER_TYPE_SW,
Jeff Johnson295189b2012-06-20 16:38:30 -07004406 csrNeighborRoamResultsRefreshTimerCallback, (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
4407
4408 if (eHAL_STATUS_SUCCESS != status)
4409 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08004410 smsLog(pMac, LOGE, FL("Neighbor results refresh timer allocation failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004411 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
4412 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05304413 vos_timer_destroy(&pNeighborRoamInfo->neighborScanTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07004414 return eHAL_STATUS_RESOURCES;
4415 }
4416
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05304417 status = vos_timer_init(&pNeighborRoamInfo->emptyScanRefreshTimer, VOS_TIMER_TYPE_SW,
Srinivas Girigowdade697412013-02-14 16:31:48 -08004418 csrNeighborRoamEmptyScanRefreshTimerCallback,
4419 (void *)&pNeighborRoamInfo->neighborScanTimerInfo);
4420
4421 if (eHAL_STATUS_SUCCESS != status)
4422 {
4423 smsLog(pMac, LOGE, FL("Empty scan refresh timer allocation failed"));
4424 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
4425 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05304426 vos_timer_destroy(&pNeighborRoamInfo->neighborScanTimer);
4427 vos_timer_destroy(&pNeighborRoamInfo->neighborResultsRefreshTimer);
Srinivas Girigowdade697412013-02-14 16:31:48 -08004428 return eHAL_STATUS_RESOURCES;
4429 }
4430
Jeff Johnson295189b2012-06-20 16:38:30 -07004431 status = csrLLOpen(pMac->hHdd, &pNeighborRoamInfo->roamableAPList);
4432 if (eHAL_STATUS_SUCCESS != status)
4433 {
4434 smsLog(pMac, LOGE, FL("LL Open of roamable AP List failed"));
4435 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
4436 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05304437 vos_timer_destroy(&pNeighborRoamInfo->neighborScanTimer);
4438 vos_timer_destroy(&pNeighborRoamInfo->neighborResultsRefreshTimer);
4439 vos_timer_destroy(&pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07004440 return eHAL_STATUS_RESOURCES;
4441 }
4442
4443 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX;
4444 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
4445 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
4446 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
4447 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
4448
4449#ifdef WLAN_FEATURE_VOWIFI_11R
4450 status = csrNeighborRoamInit11rAssocInfo(pMac);
4451 if (eHAL_STATUS_SUCCESS != status)
4452 {
4453 smsLog(pMac, LOGE, FL("LL Open of roamable AP List failed"));
4454 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
4455 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05304456 vos_timer_destroy(&pNeighborRoamInfo->neighborScanTimer);
4457 vos_timer_destroy(&pNeighborRoamInfo->neighborResultsRefreshTimer);
4458 vos_timer_destroy(&pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07004459 csrLLClose(&pNeighborRoamInfo->roamableAPList);
4460 return eHAL_STATUS_RESOURCES;
4461 }
4462#endif
4463 /* Initialize this with the current tick count */
4464 pNeighborRoamInfo->scanRequestTimeStamp = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd);
4465
4466 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
Varun Reddy Yeturub4dedf22013-09-13 15:58:26 -07004467 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004468 return eHAL_STATUS_SUCCESS;
4469}
4470
4471/* ---------------------------------------------------------------------------
4472
4473 \fn csrNeighborRoamClose
4474
4475 \brief This function closes/frees all the neighbor roam data structures
4476
4477 \param pMac - The handle returned by macOpen.
4478
4479 \return VOID
4480
4481---------------------------------------------------------------------------*/
4482void csrNeighborRoamClose(tpAniSirGlobal pMac)
4483{
4484 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4485
4486 if (eCSR_NEIGHBOR_ROAM_STATE_CLOSED == pNeighborRoamInfo->neighborRoamState)
4487 {
Madan Mohan Koyyalamudi8b7f1e62012-10-05 14:56:51 -07004488 smsLog(pMac, LOGW, FL("Neighbor Roam Algorithm Already Closed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004489 return;
4490 }
4491
4492 if (pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
4493 vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
4494
4495 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
4496
4497 pNeighborRoamInfo->neighborScanTimerInfo.pMac = NULL;
4498 pNeighborRoamInfo->neighborScanTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05304499 vos_timer_destroy(&pNeighborRoamInfo->neighborScanTimer);
4500 vos_timer_destroy(&pNeighborRoamInfo->neighborResultsRefreshTimer);
4501 vos_timer_destroy(&pNeighborRoamInfo->emptyScanRefreshTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07004502
4503 /* Should free up the nodes in the list before closing the double Linked list */
4504 csrNeighborRoamFreeRoamableBSSList(pMac, &pNeighborRoamInfo->roamableAPList);
4505 csrLLClose(&pNeighborRoamInfo->roamableAPList);
4506
4507 if (pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
4508 {
4509 vos_mem_free(pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList);
4510 }
4511
4512 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
4513 pNeighborRoamInfo->roamChannelInfo.currentChanIndex = CSR_NEIGHBOR_ROAM_INVALID_CHANNEL_INDEX;
4514 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels = 0;
4515 pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList = NULL;
4516 pNeighborRoamInfo->roamChannelInfo.chanListScanInProgress = eANI_BOOLEAN_FALSE;
4517 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
4518
4519 /* Free the profile.. */
4520 csrReleaseProfile(pMac, &pNeighborRoamInfo->csrNeighborRoamProfile);
Sandeep Pc4818ef2012-12-13 14:19:25 -08004521#ifdef FEATURE_WLAN_LFR
Sandeep Pc2b00f62012-12-12 16:44:44 -08004522 csrRoamFreeConnectProfile(pMac, &pNeighborRoamInfo->prevConnProfile);
Sandeep Pc4818ef2012-12-13 14:19:25 -08004523#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004524#ifdef WLAN_FEATURE_VOWIFI_11R
4525 pMac->roam.neighborRoamInfo.FTRoamInfo.currentNeighborRptRetryNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004526 pMac->roam.neighborRoamInfo.FTRoamInfo.numBssFromNeighborReport = 0;
4527 vos_mem_zero(pMac->roam.neighborRoamInfo.FTRoamInfo.neighboReportBssInfo,
4528 sizeof(tCsrNeighborReportBssInfo) * MAX_BSS_IN_NEIGHBOR_RPT);
4529 csrNeighborRoamFreeRoamableBSSList(pMac, &pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
4530 csrLLClose(&pMac->roam.neighborRoamInfo.FTRoamInfo.preAuthDoneList);
4531#endif /* WLAN_FEATURE_VOWIFI_11R */
4532
4533 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_CLOSED)
4534
4535 return;
4536}
4537
4538/* ---------------------------------------------------------------------------
4539
4540 \fn csrNeighborRoamRequestHandoff
4541
4542 \brief This function triggers actual switching from one AP to the new AP.
4543 It issues disassociate with reason code as Handoff and CSR as a part of
4544 handling disassoc rsp, issues reassociate to the new AP
4545
4546 \param pMac - The handle returned by macOpen.
4547
4548 \return VOID
4549
4550---------------------------------------------------------------------------*/
4551void csrNeighborRoamRequestHandoff(tpAniSirGlobal pMac)
4552{
4553
4554 tCsrRoamInfo roamInfo;
4555 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4556 tANI_U32 sessionId = pNeighborRoamInfo->csrSessionId;
4557 tCsrNeighborRoamBSSInfo handoffNode;
4558 extern void csrRoamRoamingStateDisassocRspProcessor( tpAniSirGlobal pMac, tSirSmeDisassocRsp *pSmeDisassocRsp );
4559 tANI_U32 roamId = 0;
Kiet Lam1cc95392013-11-22 15:59:36 +05304560 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07004561
Yue Maef608272013-04-08 23:09:17 -07004562#ifdef FEATURE_WLAN_LFR_METRICS
4563 tCsrRoamInfo *roamInfoMetrics;
4564#endif
4565
Jeff Johnson295189b2012-06-20 16:38:30 -07004566 if (pMac->roam.neighborRoamInfo.neighborRoamState != eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE)
4567 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05304568 smsLog(pMac, LOGE, FL("Roam requested when Neighbor roam is in %s state"),
4569 macTraceGetNeighbourRoamState(
4570 pMac->roam.neighborRoamInfo.neighborRoamState));
Jeff Johnson295189b2012-06-20 16:38:30 -07004571 return;
4572 }
4573
4574 vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo));
4575 csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId, &roamInfo, roamId, eCSR_ROAM_FT_START,
4576 eSIR_SME_SUCCESS);
4577
4578 vos_mem_zero(&roamInfo, sizeof(tCsrRoamInfo));
4579 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING)
4580
4581 csrNeighborRoamGetHandoffAPInfo(pMac, &handoffNode);
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08004582 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Arif Hussain24bafea2013-11-15 15:10:03 -08004583 FL("HANDOFF CANDIDATE BSSID "MAC_ADDRESS_STR),
4584 MAC_ADDR_ARRAY(handoffNode.pBssDescription->bssId));
Yue Maef608272013-04-08 23:09:17 -07004585
4586#ifdef FEATURE_WLAN_LFR_METRICS
4587 /* LFR metrics - pre-auth completion metric.
4588 Send the event to supplicant that pre-auth successfully completed */
4589 roamInfoMetrics = vos_mem_malloc(sizeof(tCsrRoamInfo));
4590 if (NULL == roamInfoMetrics)
4591 {
4592 smsLog(pMac, LOG1, FL("Memory allocation failed!"));
4593 }
4594 else
4595 {
4596 vos_mem_copy((void *)roamInfoMetrics->bssid,
4597 (void *)&handoffNode.pBssDescription->bssId, sizeof(tCsrBssid));
4598 csrRoamCallCallback(pMac, pNeighborRoamInfo->csrSessionId,
4599 roamInfoMetrics, 0, eCSR_ROAM_HANDOVER_SUCCESS, 0);
4600 vos_mem_free(pRoamInfo);
4601 }
4602#endif
4603
Jeff Johnson295189b2012-06-20 16:38:30 -07004604 /* Free the profile.. Just to make sure we dont leak memory here */
4605 csrReleaseProfile(pMac, &pNeighborRoamInfo->csrNeighborRoamProfile);
4606 /* Create the Handoff AP profile. Copy the currently connected profile and update only the BSSID and channel number
4607 This should happen before issuing disconnect */
Kiet Lam1cc95392013-11-22 15:59:36 +05304608 status = csrRoamCopyConnectedProfile(pMac,
4609 pNeighborRoamInfo->csrSessionId,
4610 &pNeighborRoamInfo->csrNeighborRoamProfile);
4611 if(eHAL_STATUS_SUCCESS != status)
4612 {
4613 VOS_TRACE (VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4614 FL("csrRoamCopyConnectedProfile returned failed %d"), status);
4615 return;
4616 }
4617
Jeff Johnson295189b2012-06-20 16:38:30 -07004618 vos_mem_copy(pNeighborRoamInfo->csrNeighborRoamProfile.BSSIDs.bssid, handoffNode.pBssDescription->bssId, sizeof(tSirMacAddr));
4619 pNeighborRoamInfo->csrNeighborRoamProfile.ChannelInfo.ChannelList[0] = handoffNode.pBssDescription->channelId;
4620
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004621 NEIGHBOR_ROAM_DEBUG(pMac, LOGW, " csrRoamHandoffRequested: disassociating with current AP");
Jeff Johnson295189b2012-06-20 16:38:30 -07004622
4623 if(!HAL_STATUS_SUCCESS(csrRoamIssueDisassociateCmd(pMac, sessionId, eCSR_DISCONNECT_REASON_HANDOFF)))
4624 {
Kiran Kumar Lokere3334fbb2013-03-07 12:36:05 -08004625 smsLog(pMac, LOGW, "csrRoamHandoffRequested: fail to issue disassociate");
Jeff Johnson295189b2012-06-20 16:38:30 -07004626 return;
4627 }
4628
4629 //notify HDD for handoff, providing the BSSID too
4630 roamInfo.reasonCode = eCsrRoamReasonBetterAP;
4631
4632 vos_mem_copy(roamInfo.bssid,
4633 handoffNode.pBssDescription->bssId,
4634 sizeof( tCsrBssid ));
4635
4636 csrRoamCallCallback(pMac, sessionId, &roamInfo, 0, eCSR_ROAM_ROAMING_START, eCSR_ROAM_RESULT_NONE);
4637
4638
4639 return;
4640}
4641
4642/* ---------------------------------------------------------------------------
4643
4644 \fn csrNeighborRoamIsHandoffInProgress
4645
4646 \brief This function returns whether handoff is in progress or not based on
4647 the current neighbor roam state
4648
4649 \param pMac - The handle returned by macOpen.
4650 is11rReassoc - Return whether reassoc is of type 802.11r reassoc
4651
4652 \return eANI_BOOLEAN_TRUE if reassoc in progress, eANI_BOOLEAN_FALSE otherwise
4653
4654---------------------------------------------------------------------------*/
4655tANI_BOOLEAN csrNeighborRoamIsHandoffInProgress(tpAniSirGlobal pMac)
4656{
4657 if (eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING == pMac->roam.neighborRoamInfo.neighborRoamState)
4658 return eANI_BOOLEAN_TRUE;
4659
4660 return eANI_BOOLEAN_FALSE;
4661}
4662
Madan Mohan Koyyalamudi5e32b962012-11-28 16:07:55 -08004663#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(WLAN_FEATURE_NEIGHBOR_ROAMING)
Jeff Johnson295189b2012-06-20 16:38:30 -07004664/* ---------------------------------------------------------------------------
4665
4666 \fn csrNeighborRoamIs11rAssoc
4667
4668 \brief This function returns whether the current association is a 11r assoc or not
4669
4670 \param pMac - The handle returned by macOpen.
4671
4672 \return eANI_BOOLEAN_TRUE if current assoc is 11r, eANI_BOOLEAN_FALSE otherwise
4673
4674---------------------------------------------------------------------------*/
4675tANI_BOOLEAN csrNeighborRoamIs11rAssoc(tpAniSirGlobal pMac)
4676{
4677 return pMac->roam.neighborRoamInfo.is11rAssoc;
4678}
4679#endif /* WLAN_FEATURE_VOWIFI_11R */
4680
4681
4682/* ---------------------------------------------------------------------------
4683
4684 \fn csrNeighborRoamGetHandoffAPInfo
4685
4686 \brief This function returns the best possible AP for handoff. For 11R case, it
4687 returns the 1st entry from pre-auth done list. For non-11r case, it returns
4688 the 1st entry from roamable AP list
4689
4690 \param pMac - The handle returned by macOpen.
4691 pHandoffNode - AP node that is the handoff candidate returned
4692
4693 \return VOID
4694
4695---------------------------------------------------------------------------*/
4696void csrNeighborRoamGetHandoffAPInfo(tpAniSirGlobal pMac, tpCsrNeighborRoamBSSInfo pHandoffNode)
4697{
4698 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4699 tpCsrNeighborRoamBSSInfo pBssNode;
4700
4701 VOS_ASSERT(NULL != pHandoffNode);
4702
4703#ifdef WLAN_FEATURE_VOWIFI_11R
4704 if (pNeighborRoamInfo->is11rAssoc)
4705 {
4706 /* Always the BSS info in the head is the handoff candidate */
4707 pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL);
4708 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList));
4709 }
4710 else
4711#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004712#ifdef FEATURE_WLAN_ESE
4713 if (pNeighborRoamInfo->isESEAssoc)
Jeff Johnson295189b2012-06-20 16:38:30 -07004714 {
4715 /* Always the BSS info in the head is the handoff candidate */
4716 pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL);
4717 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList));
4718 }
4719 else
4720#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004721#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi03aae5f2012-11-28 01:51:22 +05304722 if (csrRoamIsFastRoamEnabled(pMac, CSR_SESSION_ID_INVALID))
Jeff Johnson04dd8a82012-06-29 20:41:40 -07004723 {
4724 /* Always the BSS info in the head is the handoff candidate */
4725 pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->FTRoamInfo.preAuthDoneList, NULL);
4726 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->FTRoamInfo.preAuthDoneList));
4727 }
4728 else
4729#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004730 {
4731 pBssNode = csrNeighborRoamGetRoamableAPListNextEntry(pMac, &pNeighborRoamInfo->roamableAPList, NULL);
4732 NEIGHBOR_ROAM_DEBUG(pMac, LOG1, FL("Number of Handoff candidates = %d"), csrLLCount(&pNeighborRoamInfo->roamableAPList));
4733 }
4734 vos_mem_copy(pHandoffNode, pBssNode, sizeof(tCsrNeighborRoamBSSInfo));
4735
4736 return;
4737}
4738
4739/* ---------------------------------------------------------------------------
4740 \brief This function returns TRUE if preauth is completed
4741
4742 \param pMac - The handle returned by macOpen.
4743
4744 \return boolean
4745
4746---------------------------------------------------------------------------*/
4747tANI_BOOLEAN csrNeighborRoamStatePreauthDone(tpAniSirGlobal pMac)
4748{
4749 return (pMac->roam.neighborRoamInfo.neighborRoamState ==
4750 eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE);
4751}
4752
4753/* ---------------------------------------------------------------------------
4754 \brief In the event that we are associated with AP1 and we have
4755 completed pre auth with AP2. Then we receive a deauth/disassoc from
4756 AP1.
4757 At this point neighbor roam is in pre auth done state, pre auth timer
4758 is running. We now handle this case by stopping timer and clearing
4759 the pre-auth state. We basically clear up and just go to disconnected
4760 state.
4761
4762 \param pMac - The handle returned by macOpen.
4763
4764 \return boolean
4765---------------------------------------------------------------------------*/
4766void csrNeighborRoamTranistionPreauthDoneToDisconnected(tpAniSirGlobal pMac)
4767{
Varun Reddy Yeturub4dedf22013-09-13 15:58:26 -07004768 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07004769 if (pMac->roam.neighborRoamInfo.neighborRoamState !=
4770 eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE) return;
4771
4772 // Stop timer
Madan Mohan Koyyalamudia48c6812013-07-11 12:01:37 +05304773 vos_timer_stop(&pMac->ft.ftSmeContext.preAuthReassocIntvlTimer);
Jeff Johnson295189b2012-06-20 16:38:30 -07004774
4775 // Transition to init state
4776 CSR_NEIGHBOR_ROAM_STATE_TRANSITION(eCSR_NEIGHBOR_ROAM_STATE_INIT)
Varun Reddy Yeturub4dedf22013-09-13 15:58:26 -07004777 pNeighborRoamInfo->roamChannelInfo.IAPPNeighborListReceived = eANI_BOOLEAN_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004778}
4779
Srikant Kuppafef66a72013-01-30 17:32:44 -08004780/* ---------------------------------------------------------------------------
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08004781 \brief This function returns TRUE if background scan triggered by
4782 LFR is in progress.
Srikant Kuppafef66a72013-01-30 17:32:44 -08004783
4784 \param halHandle - The handle from HDD context.
4785
4786 \return boolean
4787
4788---------------------------------------------------------------------------*/
4789tANI_BOOLEAN csrNeighborRoamScanRspPending (tHalHandle hHal)
4790{
4791 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4792 return (pMac->roam.neighborRoamInfo.scanRspPending);
4793}
4794
Srinivas Girigowdaa553c462013-03-07 19:42:52 -08004795/* ---------------------------------------------------------------------------
4796 \brief This function returns TRUE if STA is in the middle of roaming states
4797
4798 \param halHandle - The handle from HDD context.
4799
4800 \return boolean
4801
4802---------------------------------------------------------------------------*/
4803tANI_BOOLEAN csrNeighborMiddleOfRoaming (tHalHandle hHal)
4804{
4805 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4806 tANI_BOOLEAN val = (eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4807 (eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4808 (eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4809 (eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN == pMac->roam.neighborRoamInfo.neighborRoamState) ||
4810 (eCSR_NEIGHBOR_ROAM_STATE_CFG_CHAN_LIST_SCAN == pMac->roam.neighborRoamInfo.neighborRoamState);
4811 return (val);
4812}
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004813#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
4814/* ---------------------------------------------------------------------------
Srinivas Girigowdaa553c462013-03-07 19:42:52 -08004815
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004816 \fn csrNeighborRoamCandidateFoundIndHdlr
4817
4818 \brief This function is called by CSR as soon as TL posts the candidate
4819 found indication to SME via MC thread
4820
4821 \param pMac - The handle returned by macOpen.
4822 pMsg - Msg sent by PE
4823
4824 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
4825
4826---------------------------------------------------------------------------*/
4827eHalStatus csrNeighborRoamCandidateFoundIndHdlr(tpAniSirGlobal pMac, void* pMsg)
4828{
4829 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4830 eHalStatus status = eHAL_STATUS_SUCCESS;
4831 /* we must be in connected state, if not ignore it */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004832 if ((eCSR_NEIGHBOR_ROAM_STATE_CONNECTED != pNeighborRoamInfo->neighborRoamState)
4833 || (pNeighborRoamInfo->uOsRequestedHandoff))
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004834 {
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004835 smsLog(pMac, LOGE, FL("Received in not CONNECTED state OR uOsRequestedHandoff is set. Ignore it"));
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07004836 status = eHAL_STATUS_FAILURE;
4837 }
4838 else
4839 {
4840 /* We are about to start a fresh scan cycle,
4841 * purge non-P2P results from the past */
4842 csrScanFlushSelectiveResult(pMac, VOS_FALSE);
4843 /* Once it gets the candidates found indication from PE, will issue a scan
4844 - req to PE with “freshScan” in scanreq structure set as follows:
4845 0x42 - Return & purge LFR scan results
4846 */
4847 status = csrScanRequestLfrResult(pMac, pNeighborRoamInfo->csrSessionId,
4848 csrNeighborRoamScanResultRequestCallback, pMac);
4849 }
4850
4851 return status;
4852}
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004853
4854/* ---------------------------------------------------------------------------
4855
4856 \fn csrNeighborRoamProcessHandoffReq
4857
4858 \brief This function is called start with the handoff process. First do a
4859 SSID scan for the BSSID provided
4860
4861 \param pMac - The handle returned by macOpen.
4862
4863 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
4864
4865---------------------------------------------------------------------------*/
4866eHalStatus csrNeighborRoamProcessHandoffReq(tpAniSirGlobal pMac)
4867{
4868 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4869 eHalStatus status = eHAL_STATUS_SUCCESS;
4870 tANI_U32 roamId;
4871 tCsrRoamProfile *pProfile = NULL;
4872 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pNeighborRoamInfo->csrSessionId );
4873 tANI_U8 i = 0;
4874
krunal soni587bf012014-02-04 12:35:11 -08004875 if (NULL == pSession)
4876 {
4877 smsLog(pMac, LOGE, FL("pSession is NULL "));
4878 return eHAL_STATUS_FAILURE;
4879 }
4880
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004881 do
4882 {
4883 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
Kiet Lam64c1b492013-07-12 13:56:44 +05304884 pProfile = vos_mem_malloc(sizeof(tCsrRoamProfile));
4885 if ( NULL == pProfile )
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004886 {
4887 smsLog(pMac, LOGE, FL("Memory alloc failed"));
Kiet Lam64c1b492013-07-12 13:56:44 +05304888 return eHAL_STATUS_FAILURE;
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004889 }
Kiet Lam64c1b492013-07-12 13:56:44 +05304890 vos_mem_set(pProfile, sizeof(tCsrRoamProfile), 0);
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004891 status = csrRoamCopyProfile(pMac, pProfile, pSession->pCurRoamProfile);
4892 if(!HAL_STATUS_SUCCESS(status))
4893 {
4894 smsLog(pMac, LOGE, FL("Profile copy failed"));
4895 break;
4896 }
4897
4898 //Add the BSSID & Channel
4899 pProfile->BSSIDs.numOfBSSIDs = 1;
4900 pProfile->BSSIDs.bssid = vos_mem_malloc(sizeof(tSirMacAddr) * pProfile->BSSIDs.numOfBSSIDs);
4901 if (NULL == pProfile->BSSIDs.bssid)
4902 {
4903 smsLog(pMac, LOGE, FL("mem alloc failed for BSSID"));
4904 status = eHAL_STATUS_FAILURE;
4905 break;
4906 }
4907
4908 vos_mem_zero(pProfile->BSSIDs.bssid, sizeof(tSirMacAddr) * pProfile->BSSIDs.numOfBSSIDs);
4909
4910 /* Populate the BSSID from handoff info received from HDD */
4911 for (i = 0; i < pProfile->BSSIDs.numOfBSSIDs; i++)
4912 {
4913 vos_mem_copy(&pProfile->BSSIDs.bssid[i],
4914 pNeighborRoamInfo->handoffReqInfo.bssid, sizeof(tSirMacAddr));
4915 }
4916
4917 pProfile->ChannelInfo.numOfChannels = 1;
4918 pProfile->ChannelInfo.ChannelList =
Kiet Lam64c1b492013-07-12 13:56:44 +05304919 vos_mem_malloc(sizeof(*pProfile->ChannelInfo.ChannelList) *
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004920 pProfile->ChannelInfo.numOfChannels);
4921 if (NULL == pProfile->ChannelInfo.ChannelList)
4922 {
4923 smsLog(pMac, LOGE, FL("mem alloc failed for ChannelList"));
4924 status = eHAL_STATUS_FAILURE;
4925 break;
4926 }
4927 pProfile->ChannelInfo.ChannelList[0] = pNeighborRoamInfo->handoffReqInfo.channel;
4928
4929 //clean up csr cache first
4930 //csrScanFlushSelectiveResult(pMac, VOS_FALSE);
4931 //do a SSID scan
4932 status = csrScanForSSID(pMac, pNeighborRoamInfo->csrSessionId, pProfile, roamId, FALSE);
4933 if(!HAL_STATUS_SUCCESS(status))
4934 {
4935 smsLog(pMac, LOGE, FL("SSID scan failed"));
4936 }
4937 }while(0);
4938
4939 if(NULL != pProfile)
4940 {
4941 csrReleaseProfile(pMac, pProfile);
Kiet Lam64c1b492013-07-12 13:56:44 +05304942 vos_mem_free(pProfile);
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07004943 }
4944
4945 return status;
4946}
4947
4948/* ---------------------------------------------------------------------------
4949
4950 \fn csrNeighborRoamSssidScanDone
4951
4952 \brief This function is called once SSID scan is done. If SSID scan failed
4953 to find our candidate add an entry to csr scan cache ourself before starting
4954 the handoff process
4955
4956 \param pMac - The handle returned by macOpen.
4957
4958 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
4959
4960---------------------------------------------------------------------------*/
4961eHalStatus csrNeighborRoamSssidScanDone(tpAniSirGlobal pMac, eHalStatus status)
4962{
4963 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
4964 eHalStatus hstatus;
4965
4966 smsLog(pMac, LOGE, FL("called "));
4967
4968 /* we must be in connected state, if not ignore it */
4969 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED != pNeighborRoamInfo->neighborRoamState)
4970 {
4971 smsLog(pMac, LOGE, FL("Received in not CONNECTED state. Ignore it"));
4972 return eHAL_STATUS_FAILURE;
4973 }
4974
4975 //if SSID scan failed to find our candidate add an entry to csr scan cache ourself
4976 if(!HAL_STATUS_SUCCESS(status))
4977 {
4978 smsLog(pMac, LOGE, FL("Add an entry to csr scan cache"));
4979 hstatus = csrScanCreateEntryInScanCache(pMac, pNeighborRoamInfo->csrSessionId,
4980 pNeighborRoamInfo->handoffReqInfo.bssid,
4981 pNeighborRoamInfo->handoffReqInfo.channel);
4982 if (eHAL_STATUS_SUCCESS != hstatus)
4983 {
4984 smsLog(pMac, LOGE, FL("csrScanCreateEntryInScanCache failed with status %d"), hstatus);
4985 return eHAL_STATUS_FAILURE;
4986 }
4987 }
4988
4989 /* Now we have completed scanning for the candidate provided by HDD. Let move on to HO*/
4990 hstatus = csrNeighborRoamProcessScanComplete(pMac);
4991
4992 if (eHAL_STATUS_SUCCESS != hstatus)
4993 {
4994 smsLog(pMac, LOGE, FL("Neighbor scan process complete failed with status %d"), hstatus);
4995 return eHAL_STATUS_FAILURE;
4996 }
4997 return eHAL_STATUS_SUCCESS;
4998}
4999
5000/* ---------------------------------------------------------------------------
5001
5002 \fn csrNeighborRoamHandoffReqHdlr
5003
5004 \brief This function is called by CSR as soon as it gets a handoff request
5005 to SME via MC thread
5006
5007 \param pMac - The handle returned by macOpen.
5008 pMsg - Msg sent by HDD
5009
5010 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
5011
5012---------------------------------------------------------------------------*/
5013eHalStatus csrNeighborRoamHandoffReqHdlr(tpAniSirGlobal pMac, void* pMsg)
5014{
5015 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
5016 tAniHandoffReq *pHandoffReqInfo;
5017 eHalStatus status = eHAL_STATUS_SUCCESS;
5018 /* we must be in connected state, if not ignore it */
5019 if (eCSR_NEIGHBOR_ROAM_STATE_CONNECTED != pNeighborRoamInfo->neighborRoamState)
5020 {
5021 smsLog(pMac, LOGE, FL("Received in not CONNECTED state. Ignore it"));
5022 status = eHAL_STATUS_FAILURE;
5023 }
5024 else
5025 {
5026 //save the handoff info came from HDD as part of the reassoc req
5027 pHandoffReqInfo = (tAniHandoffReq *)pMsg;
5028 if (NULL != pHandoffReqInfo)
5029 {
5030 //sanity check
5031 if (VOS_FALSE == vos_mem_compare(pHandoffReqInfo->bssid,
5032 pNeighborRoamInfo->currAPbssid,
5033 sizeof(tSirMacAddr)))
5034 {
5035
5036 pNeighborRoamInfo->handoffReqInfo.channel = pHandoffReqInfo->channel;
5037 vos_mem_copy(pNeighborRoamInfo->handoffReqInfo.bssid,
5038 pHandoffReqInfo->bssid,
5039 6);
5040 pNeighborRoamInfo->uOsRequestedHandoff = 1;
5041 status = csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_STOP,
5042 REASON_OS_REQUESTED_ROAMING_NOW);
5043 if (eHAL_STATUS_SUCCESS != status)
5044 {
5045 smsLog(pMac, LOGE, FL("csrRoamOffloadScan failed"));
5046 pNeighborRoamInfo->uOsRequestedHandoff = 0;
5047 }
5048 }
5049 else
5050 {
5051 smsLog(pMac, LOGE, FL("Received req has same BSSID as current AP!!"));
5052 status = eHAL_STATUS_FAILURE;
5053 }
5054 }
5055 else
5056 {
5057 smsLog(pMac, LOGE, FL("Received msg is NULL"));
5058 status = eHAL_STATUS_FAILURE;
5059 }
5060 }
5061
5062 return status;
5063}
5064
5065/* ---------------------------------------------------------------------------
5066
5067 \fn csrNeighborRoamProceedWithHandoffReq
5068
5069 \brief This function is called by CSR as soon as it gets rsp back for
5070 ROAM_SCAN_OFFLOAD_STOP with reason REASON_OS_REQUESTED_ROAMING_NOW
5071
5072 \param pMac - The handle returned by macOpen.
5073
5074 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
5075
5076---------------------------------------------------------------------------*/
5077eHalStatus csrNeighborRoamProceedWithHandoffReq(tpAniSirGlobal pMac)
5078{
5079 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
5080 eHalStatus status = eHAL_STATUS_SUCCESS;
5081 /* we must be in connected state, if not ignore it */
5082 if ((eCSR_NEIGHBOR_ROAM_STATE_CONNECTED != pNeighborRoamInfo->neighborRoamState)
5083 || (!pNeighborRoamInfo->uOsRequestedHandoff))
5084 {
5085 smsLog(pMac, LOGE, FL("Received in not CONNECTED state or uOsRequestedHandoff is not set. Ignore it"));
5086 status = eHAL_STATUS_FAILURE;
5087 }
5088 else
5089 {
5090 //Let's go ahead with handoff
5091 status = csrNeighborRoamProcessHandoffReq(pMac);
5092 }
5093 if(!HAL_STATUS_SUCCESS(status))
5094 {
5095 pNeighborRoamInfo->uOsRequestedHandoff = 0;
5096 }
5097 return status;
5098}
5099
5100/* ---------------------------------------------------------------------------
5101
Varun Reddy Yeturue3af4282013-06-07 00:56:52 -07005102 \fn csrNeighborRoamStartLfrScan
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07005103
5104 \brief This function is called if HDD requested handoff failed for some
Varun Reddy Yeturue3af4282013-06-07 00:56:52 -07005105 reason. start the LFR logic at that point.By the time, this function is
5106 called, a STOP command has already been issued.
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07005107
5108 \param pMac - The handle returned by macOpen.
5109
5110 \return eHAL_STATUS_SUCCESS on success, corresponding error code otherwise
5111
5112---------------------------------------------------------------------------*/
Varun Reddy Yeturue3af4282013-06-07 00:56:52 -07005113eHalStatus csrNeighborRoamStartLfrScan(tpAniSirGlobal pMac)
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07005114{
5115 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
5116 pNeighborRoamInfo->uOsRequestedHandoff = 0;
5117 /* There is no candidate or We are not roaming Now.
5118 * Inform the FW to restart Roam Offload Scan */
Varun Reddy Yeturue3af4282013-06-07 00:56:52 -07005119 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_START, REASON_NO_CAND_FOUND_OR_NOT_ROAMING_NOW);
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07005120
5121 return eHAL_STATUS_SUCCESS;
5122}
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07005123#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07005124#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */