blob: de6faba9611d2275a18b14e4d63ab5038e0fec4d [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/**=========================================================================
43
44 \file smeApi.c
45
46 \brief Definitions for SME APIs
47
48 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
49
50 Qualcomm Confidential and Proprietary.
51
52 ========================================================================*/
53
54/*===========================================================================
55
56 EDIT HISTORY FOR FILE
57
58
59 This section contains comments describing changes made to the module.
60 Notice that changes are listed in reverse chronological order.
61
62
63
64 when who what, where, why
65---------- --- --------------------------------------------------------
6606/03/10 js Added support to hostapd driven
67 * deauth/disassoc/mic failure
68
69===========================================================================*/
70
71/*--------------------------------------------------------------------------
72 Include Files
73 ------------------------------------------------------------------------*/
74
Jeff Johnson295189b2012-06-20 16:38:30 -070075
76#include "smsDebug.h"
77#include "sme_Api.h"
78#include "csrInsideApi.h"
79#include "smeInside.h"
80#include "csrInternal.h"
81#include "wlan_qct_wda.h"
82#include "halMsgApi.h"
Katya Nigam70d68332013-09-16 16:49:45 +053083#include "vos_trace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070084#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070085
86
87
Jeff Johnson295189b2012-06-20 16:38:30 -070088extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
89
90#include <wlan_qct_pal_api.h>
Katya Nigam70d68332013-09-16 16:49:45 +053091#define LOG_SIZE 256
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080092#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053093#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080094
Jeff Johnson295189b2012-06-20 16:38:30 -070095// TxMB Functions
96extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
97 tANI_U32 size, tSmeCmd **ppCmd );
98extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
99extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Jeff Johnson295189b2012-06-20 16:38:30 -0700100extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
101extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
102extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
103extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
104extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
105extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -0700106
107static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
108static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
109
110eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
111
112eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
113
Amar Singhal0d15bd52013-10-12 23:13:13 -0700114eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
115
Jeff Johnson295189b2012-06-20 16:38:30 -0700116eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
117
118eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
119
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700120#ifdef FEATURE_WLAN_LFR
121tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
122#endif
123
Chet Lanctot186b5732013-03-18 10:26:30 -0700124#ifdef WLAN_FEATURE_11W
125eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
126 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
127#endif
128
Jeff Johnson295189b2012-06-20 16:38:30 -0700129//Internal SME APIs
130eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
131{
132 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
133
134 if(psSme)
135 {
136 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
137 {
138 status = eHAL_STATUS_SUCCESS;
139 }
140 }
141
142 return (status);
143}
144
145
146eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
147{
148 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
149
150 if(psSme)
151 {
152 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
153 {
154 status = eHAL_STATUS_SUCCESS;
155 }
156 }
157
158 return (status);
159}
160
161
162
163static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
164{
165 eHalStatus status;
166 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530167 tANI_U32 cmd_idx;
Jeff Johnson295189b2012-06-20 16:38:30 -0700168
169 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530170 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
171 &pMac->sme.smeCmdActiveList)))
172 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700173
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530174 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
175 &pMac->sme.smeCmdPendingList)))
176 goto end;
177
178 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
179 &pMac->sme.smeScanCmdActiveList)))
180 goto end;
181
182 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
183 &pMac->sme.smeScanCmdPendingList)))
184 goto end;
185
186 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
187 &pMac->sme.smeCmdFreeList)))
188 goto end;
189
Kiet Lam64c1b492013-07-12 13:56:44 +0530190 pCmd = vos_mem_malloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
191 if ( NULL == pCmd )
192 status = eHAL_STATUS_FAILURE;
193 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530194 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530195 status = eHAL_STATUS_SUCCESS;
196
197 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
198 pMac->sme.pSmeCmdBufAddr = pCmd;
199
200 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
201 {
202 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530203 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530204 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700205 }
206
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530207end:
208 if (!HAL_STATUS_SUCCESS(status))
209 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
210 status);
211
Jeff Johnson295189b2012-06-20 16:38:30 -0700212 return (status);
213}
214
215
216void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
217{
218 pCmd->command = eSmeNoCommand;
219 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
220}
221
222
223
224static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
225{
226 tListElem *pEntry;
227 tSmeCmd *pCommand;
228
229 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
230 {
231 //TODO: base on command type to call release functions
232 //reinitialize different command types so they can be reused
233 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
234 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
235 }
236}
237
238static void purgeSmeCmdList(tpAniSirGlobal pMac)
239{
240 //release any out standing commands back to free command list
241 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
242 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530243 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
244 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700245}
246
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530247void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
248 tDblLinkList *pList)
Jeff Johnson295189b2012-06-20 16:38:30 -0700249{
250 //release any out standing commands back to free command list
251 tListElem *pEntry, *pNext;
252 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700253 tDblLinkList localList;
254
255 vos_mem_zero(&localList, sizeof(tDblLinkList));
256 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
257 {
258 smsLog(pMac, LOGE, FL(" failed to open list"));
259 return;
260 }
261
262 csrLLLock(pList);
263 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
264 while(pEntry != NULL)
265 {
266 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
267 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
268 if(pCommand->sessionId == sessionId)
269 {
270 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
271 {
272 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
273 }
274 }
275 pEntry = pNext;
276 }
277 csrLLUnlock(pList);
278
279 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
280 {
281 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
282 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
283 }
284 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700285}
286
287
288static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
289{
290 eHalStatus status = eHAL_STATUS_SUCCESS;
291
292 purgeSmeCmdList(pMac);
293 csrLLClose(&pMac->sme.smeCmdPendingList);
294 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530295 csrLLClose(&pMac->sme.smeScanCmdPendingList);
296 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700297 csrLLClose(&pMac->sme.smeCmdFreeList);
298
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800299 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
300 if(status != eHAL_STATUS_SUCCESS)
301 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800302 smsLog(pMac, LOGE,
303 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800304 goto done;
305 }
306
Jeff Johnson295189b2012-06-20 16:38:30 -0700307 if(NULL != pMac->sme.pSmeCmdBufAddr)
308 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530309 vos_mem_free(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700310 pMac->sme.pSmeCmdBufAddr = NULL;
311 }
312
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800313 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
314 if(status != eHAL_STATUS_SUCCESS)
315 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800316 smsLog(pMac, LOGE,
317 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800318 }
319done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700320 return (status);
321}
322
323
324void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
325{
Jeff Johnson295189b2012-06-20 16:38:30 -0700326 switch( pCmd->command )
327 {
328 case eSmeCommandScan:
329 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
330 break;
331
332 case eSmeCommandRoam:
333 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
334 break;
335
336 case eSmeCommandWmStatusChange:
337 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
338 break;
339
340 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800341 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700342 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
343 break;
344
345 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800346 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700347 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
348 break;
349
350 default:
351 break;
352 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700353}
354
355tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
356{
357 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
358 tListElem *pEntry;
359
360 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
361
362 // If we can get another MS Msg buffer, then we are ok. Just link
363 // the entry onto the linked list. (We are using the linked list
364 // to keep track of tfhe message buffers).
365 if ( pEntry )
366 {
367 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
368 }
369 else {
370 int idx = 1;
371
372 //Cannot change pRetCmd here since it needs to return later.
373 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
374 if( pEntry )
375 {
376 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
377 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800378 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
380 if(pTempCmd)
381 {
382 if( eSmeCsrCommandMask & pTempCmd->command )
383 {
384 //CSR command is stuck. See what the reason code is for that command
385 dumpCsrCommandInfo(pMac, pTempCmd);
386 }
387 } //if(pTempCmd)
388
389 //dump what is in the pending queue
390 csrLLLock(&pMac->sme.smeCmdPendingList);
391 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
392 while(pEntry)
393 {
394 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800395 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700396 idx++, pTempCmd->command );
397 if( eSmeCsrCommandMask & pTempCmd->command )
398 {
399 //CSR command is stuck. See what the reason code is for that command
400 dumpCsrCommandInfo(pMac, pTempCmd);
401 }
402 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
403 }
404 csrLLUnlock(&pMac->sme.smeCmdPendingList);
405
406 //There may be some more command in CSR's own pending queue
407 csrLLLock(&pMac->roam.roamCmdPendingList);
408 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
409 while(pEntry)
410 {
411 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800412 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700413 idx++, pTempCmd->command );
414 dumpCsrCommandInfo(pMac, pTempCmd);
415 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
416 }
417 csrLLUnlock(&pMac->roam.roamCmdPendingList);
418 }
419
420 return( pRetCmd );
421}
422
423
424void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
425{
426 if ( fHighPriority )
427 {
428 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
429 }
430 else
431 {
432 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
433 }
434
435 // process the command queue...
436 smeProcessPendingQueue( pMac );
437
438 return;
439}
440
441
442static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
443{
444 eSmeCommandType pmcCommand = eSmeNoCommand;
445 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
446 tPmcState pmcState;
447 eHalStatus status;
448
449 do
450 {
451 pmcState = pmcGetPmcState(pMac);
452
453 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
454 if( !HAL_STATUS_SUCCESS(status) )
455 {
456 //PMC state is not right for the command, drop it
457 return ( eSmeDropCommand );
458 }
459 if( fFullPowerNeeded ) break;
460 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
461 ( eSmeCommandDelTs == pCommand->command ) );
462 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700463#ifdef FEATURE_OEM_DATA_SUPPORT
464 fFullPowerNeeded = (pmcState == IMPS &&
465 eSmeCommandOemDataReq == pCommand->command);
466 if(fFullPowerNeeded) break;
467#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700468 fFullPowerNeeded = (pmcState == IMPS &&
469 eSmeCommandRemainOnChannel == pCommand->command);
470 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 } while(0);
472
473 if( fFullPowerNeeded )
474 {
475 switch( pmcState )
476 {
477 case IMPS:
478 case STANDBY:
479 pmcCommand = eSmeCommandExitImps;
480 break;
481
482 case BMPS:
483 pmcCommand = eSmeCommandExitBmps;
484 break;
485
486 case UAPSD:
487 pmcCommand = eSmeCommandExitUapsd;
488 break;
489
490 case WOWL:
491 pmcCommand = eSmeCommandExitWowl;
492 break;
493
494 default:
495 break;
496 }
497 }
498
499 return ( pmcCommand );
500}
501
502
503//For commands that need to do extra cleanup.
504static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
505{
506 if( eSmePmcCommandMask & pCommand->command )
507 {
508 pmcAbortCommand( pMac, pCommand, fStopping );
509 }
510 else if ( eSmeCsrCommandMask & pCommand->command )
511 {
512 csrAbortCommand( pMac, pCommand, fStopping );
513 }
514 else
515 {
516 switch( pCommand->command )
517 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 case eSmeCommandRemainOnChannel:
519 if (NULL != pCommand->u.remainChlCmd.callback)
520 {
521 remainOnChanCallback callback =
522 pCommand->u.remainChlCmd.callback;
523 /* process the msg */
524 if( callback )
525 {
526 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
527 eCSR_SCAN_ABORT );
528 }
529 }
530 smeReleaseCommand( pMac, pCommand );
531 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700532 default:
533 smeReleaseCommand( pMac, pCommand );
534 break;
535 }
536 }
537}
538
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530539tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
540 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
541{
542 tListElem *pCurEntry = NULL;
543 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700544
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530545 /* Go through the list and return the command whose session id is not
546 * matching with the current ongoing scan cmd sessionId */
547 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
548 while (pCurEntry)
549 {
550 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
551 if (pCommand->sessionId != sessionId)
552 {
553 smsLog(pMac, LOG1, "selected the command with different sessionId");
554 return pCurEntry;
555 }
556
557 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
558 }
559
560 smsLog(pMac, LOG1, "No command pending with different sessionId");
561 return NULL;
562}
563
564tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
565{
566 tListElem *pEntry;
567 tSmeCmd *pCommand;
568 tListElem *pSmeEntry;
569 tSmeCmd *pSmeCommand;
570 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
571
572 csrLLLock( &pMac->sme.smeScanCmdActiveList );
573 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
574 LL_ACCESS_NOLOCK ))
575 {
576 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
577 LL_ACCESS_LOCK))
578 {
579 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
580 LL_ACCESS_LOCK );
581 if (pEntry)
582 {
583 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
584 //We cannot execute any command in wait-for-key state until setKey is through.
585 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
586 {
587 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
588 {
589 smsLog(pMac, LOGE,
590 " Cannot process command(%d) while waiting for key",
591 pCommand->command);
592 status = eANI_BOOLEAN_FALSE;
593 goto end;
594 }
595 }
596
597 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
598 LL_ACCESS_LOCK )))
599 {
600 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
601 LL_ACCESS_LOCK);
602 if (pEntry)
603 {
604 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
605 Link) ;
606
607 /* if scan is running on one interface and SME recei
608 ves the next command on the same interface then
609 dont the allow the command to be queued to
610 smeCmdPendingList. If next scan is allowed on
611 the same interface the CSR state machine will
612 get screwed up. */
613 if (pSmeCommand->sessionId == pCommand->sessionId)
614 {
615 status = eANI_BOOLEAN_FALSE;
616 goto end;
617 }
618 }
619 }
620 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
621 pEntry, LL_ACCESS_LOCK ) )
622 {
623 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
624 &pCommand->Link, LL_ACCESS_NOLOCK );
625
626 switch (pCommand->command)
627 {
628 case eSmeCommandScan:
629 smsLog(pMac, LOG1,
630 " Processing scan offload command ");
631 csrProcessScanCommand( pMac, pCommand );
632 break;
633 default:
634 smsLog(pMac, LOGE,
635 " Something wrong, wrong command enqueued"
636 " to smeScanCmdPendingList");
637 pEntry = csrLLRemoveHead(
638 &pMac->sme.smeScanCmdActiveList,
639 LL_ACCESS_NOLOCK );
640 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
641 smeReleaseCommand( pMac, pCommand );
642 break;
643 }
644 }
645 }
646 }
647 }
648end:
649 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
650 return status;
651}
Jeff Johnson295189b2012-06-20 16:38:30 -0700652
653tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
654{
655 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
656 eHalStatus status = eHAL_STATUS_SUCCESS;
657 tListElem *pEntry;
658 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530659 tListElem *pSmeEntry;
660 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700661 eSmeCommandType pmcCommand = eSmeNoCommand;
662
663 // if the ActiveList is empty, then nothing is active so we can process a
664 // pending command...
665 //alwasy lock active list before locking pending list
666 csrLLLock( &pMac->sme.smeCmdActiveList );
667 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
668 {
669 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
670 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530671 /* If scan command is pending in the smeScanCmdActive list
672 * then pick the command from smeCmdPendingList which is
673 * not matching with the scan command session id.
674 * At any point of time only one command will be allowed
675 * on a single session. */
676 if ((pMac->fScanOffload) &&
677 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
678 LL_ACCESS_LOCK)))
679 {
680 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
681 LL_ACCESS_LOCK);
682 if (pSmeEntry)
683 {
684 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
685
686 pEntry = csrGetCmdToProcess(pMac,
687 &pMac->sme.smeCmdPendingList,
688 pSmeCommand->sessionId,
689 LL_ACCESS_LOCK);
690 goto sme_process_cmd;
691 }
692 }
693
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 //Peek the command
695 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530696sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700697 if( pEntry )
698 {
699 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530700
Jeff Johnson295189b2012-06-20 16:38:30 -0700701 //We cannot execute any command in wait-for-key state until setKey is through.
702 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) )
703 {
704 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
705 {
706 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800707 smsLog(pMac, LOGE, " Cannot process command(%d) while waiting for key", pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530708 fContinue = eANI_BOOLEAN_FALSE;
709 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700710 }
711 }
712 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
713 if( eSmeDropCommand == pmcCommand )
714 {
715 //This command is not ok for current PMC state
716 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
717 {
718 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
719 }
720 csrLLUnlock( &pMac->sme.smeCmdActiveList );
721 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530722 fContinue = eANI_BOOLEAN_TRUE;
723 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 }
725 else if( eSmeNoCommand != pmcCommand )
726 {
727 tExitBmpsInfo exitBmpsInfo;
728 void *pv = NULL;
729 tANI_U32 size = 0;
730 tSmeCmd *pPmcCmd = NULL;
731
732 if( eSmeCommandExitBmps == pmcCommand )
733 {
734 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
735 pv = (void *)&exitBmpsInfo;
736 size = sizeof(tExitBmpsInfo);
737 }
738 //pmcCommand has to be one of the exit power save command
739 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
740 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
741 {
742 //Force this command to wake up the chip
743 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
744 csrLLUnlock( &pMac->sme.smeCmdActiveList );
745 fContinue = pmcProcessCommand( pMac, pPmcCmd );
746 if( fContinue )
747 {
748 //The command failed, remove it
749 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
750 {
751 pmcReleaseCommand( pMac, pPmcCmd );
752 }
753 }
754 }
755 else
756 {
757 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800758 smsLog( pMac, LOGE, FL( "Cannot issue command(0x%X) to wake up the chip. Status = %d"), pmcCommand, status );
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 //Let it retry
760 fContinue = eANI_BOOLEAN_TRUE;
761 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530762 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700763 }
764 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
765 {
766 // we can reuse the pCommand
767
768 // Insert the command onto the ActiveList...
769 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
770
771 // .... and process the command.
772
773 switch ( pCommand->command )
774 {
775
776 case eSmeCommandScan:
777 csrLLUnlock( &pMac->sme.smeCmdActiveList );
778 status = csrProcessScanCommand( pMac, pCommand );
779 break;
780
781 case eSmeCommandRoam:
782 csrLLUnlock( &pMac->sme.smeCmdActiveList );
783 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800784 if(!HAL_STATUS_SUCCESS(status))
785 {
786 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
787 &pCommand->Link, LL_ACCESS_LOCK ) )
788 {
789 csrReleaseCommandRoam( pMac, pCommand );
790 }
791 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700792 break;
793
794 case eSmeCommandWmStatusChange:
795 csrLLUnlock( &pMac->sme.smeCmdActiveList );
796 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
797 break;
798
799 case eSmeCommandSetKey:
800 csrLLUnlock( &pMac->sme.smeCmdActiveList );
801 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
802 if(!HAL_STATUS_SUCCESS(status))
803 {
804 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
805 &pCommand->Link, LL_ACCESS_LOCK ) )
806 {
807 csrReleaseCommandSetKey( pMac, pCommand );
808 }
809 }
810 break;
811
812 case eSmeCommandRemoveKey:
813 csrLLUnlock( &pMac->sme.smeCmdActiveList );
814 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
815 if(!HAL_STATUS_SUCCESS(status))
816 {
817 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
818 &pCommand->Link, LL_ACCESS_LOCK ) )
819 {
820 csrReleaseCommandRemoveKey( pMac, pCommand );
821 }
822 }
823 break;
824
825 case eSmeCommandAddStaSession:
826 csrLLUnlock( &pMac->sme.smeCmdActiveList );
827 csrProcessAddStaSessionCommand( pMac, pCommand );
828 break;
829 case eSmeCommandDelStaSession:
830 csrLLUnlock( &pMac->sme.smeCmdActiveList );
831 csrProcessDelStaSessionCommand( pMac, pCommand );
832 break;
833
Jeff Johnsone7245742012-09-05 17:12:55 -0700834#ifdef FEATURE_OEM_DATA_SUPPORT
835 case eSmeCommandOemDataReq:
836 csrLLUnlock(&pMac->sme.smeCmdActiveList);
837 oemData_ProcessOemDataReqCommand(pMac, pCommand);
838 break;
839#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 case eSmeCommandRemainOnChannel:
841 csrLLUnlock(&pMac->sme.smeCmdActiveList);
842 p2pProcessRemainOnChannelCmd(pMac, pCommand);
843 break;
844 case eSmeCommandNoAUpdate:
845 csrLLUnlock( &pMac->sme.smeCmdActiveList );
846 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 case eSmeCommandEnterImps:
848 case eSmeCommandExitImps:
849 case eSmeCommandEnterBmps:
850 case eSmeCommandExitBmps:
851 case eSmeCommandEnterUapsd:
852 case eSmeCommandExitUapsd:
853 case eSmeCommandEnterWowl:
854 case eSmeCommandExitWowl:
855 csrLLUnlock( &pMac->sme.smeCmdActiveList );
856 fContinue = pmcProcessCommand( pMac, pCommand );
857 if( fContinue )
858 {
859 //The command failed, remove it
860 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
861 &pCommand->Link, LL_ACCESS_LOCK ) )
862 {
863 pmcReleaseCommand( pMac, pCommand );
864 }
865 }
866 break;
867
868 //Treat standby differently here because caller may not be able to handle
869 //the failure so we do our best here
870 case eSmeCommandEnterStandby:
871 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
872 {
873 //It can continue
874 csrLLUnlock( &pMac->sme.smeCmdActiveList );
875 fContinue = pmcProcessCommand( pMac, pCommand );
876 if( fContinue )
877 {
878 //The command failed, remove it
879 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
880 &pCommand->Link, LL_ACCESS_LOCK ) )
881 {
882 pmcReleaseCommand( pMac, pCommand );
883 }
884 }
885 }
886 else
887 {
888 //Need to issue a disconnect first before processing this command
889 tSmeCmd *pNewCmd;
890
891 //We need to re-run the command
892 fContinue = eANI_BOOLEAN_TRUE;
893 //Pull off the standby command first
894 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
895 &pCommand->Link, LL_ACCESS_NOLOCK ) )
896 {
897 csrLLUnlock( &pMac->sme.smeCmdActiveList );
898 //Need to call CSR function here because the disconnect command
899 //is handled by CSR
900 pNewCmd = csrGetCommandBuffer( pMac );
901 if( NULL != pNewCmd )
902 {
903 //Put the standby command to the head of the pending list first
904 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
905 LL_ACCESS_LOCK );
906 pNewCmd->command = eSmeCommandRoam;
907 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
908 //Put the disassoc command before the standby command
909 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
910 LL_ACCESS_LOCK );
911 }
912 else
913 {
914 //Continue the command here
915 fContinue = pmcProcessCommand( pMac, pCommand );
916 if( fContinue )
917 {
918 //The command failed, remove it
919 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
920 &pCommand->Link, LL_ACCESS_LOCK ) )
921 {
922 pmcReleaseCommand( pMac, pCommand );
923 }
924 }
925 }
926 }
927 else
928 {
929 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800930 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700931 VOS_ASSERT(0);
932 }
933 }
934 break;
935
936 case eSmeCommandAddTs:
937 case eSmeCommandDelTs:
938 csrLLUnlock( &pMac->sme.smeCmdActiveList );
939#ifndef WLAN_MDM_CODE_REDUCTION_OPT
940 fContinue = qosProcessCommand( pMac, pCommand );
941 if( fContinue )
942 {
943 //The command failed, remove it
944 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
945 &pCommand->Link, LL_ACCESS_NOLOCK ) )
946 {
947//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
948 qosReleaseCommand( pMac, pCommand );
949//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
950 }
951 }
952#endif
953 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800954#ifdef FEATURE_WLAN_TDLS
955 case eSmeCommandTdlsSendMgmt:
956 case eSmeCommandTdlsAddPeer:
957 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530958 case eSmeCommandTdlsLinkEstablish:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800959#ifdef FEATURE_WLAN_TDLS_INTERNAL
960 case eSmeCommandTdlsDiscovery:
961 case eSmeCommandTdlsLinkSetup:
962 case eSmeCommandTdlsLinkTear:
963 case eSmeCommandTdlsEnterUapsd:
964 case eSmeCommandTdlsExitUapsd:
965#endif
966 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -0800967 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800968 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800969
970 csrLLUnlock( &pMac->sme.smeCmdActiveList );
971 status = csrTdlsProcessCmd( pMac, pCommand );
972 }
973 break ;
974#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700975
976 default:
977 //something is wrong
978 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800979 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700980 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
981 csrLLUnlock( &pMac->sme.smeCmdActiveList );
982 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
983 smeReleaseCommand( pMac, pCommand );
984 status = eHAL_STATUS_FAILURE;
985 break;
986 }
987 if(!HAL_STATUS_SUCCESS(status))
988 {
989 fContinue = eANI_BOOLEAN_TRUE;
990 }
991 }//if(pEntry)
992 else
993 {
994 //This is odd. Some one else pull off the command.
995 csrLLUnlock( &pMac->sme.smeCmdActiveList );
996 }
997 }
998 else
999 {
1000 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1001 }
1002 }
1003 else
1004 {
1005 //No command waiting
1006 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1007 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1008 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1009 {
1010 tANI_U32 nTime = 0;
1011
1012 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1013 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1014 {
1015 csrScanStartIdleScanTimer(pMac, nTime);
1016 }
1017 }
1018 }
1019 }
1020 else {
1021 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1022 }
1023
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301024sme_process_scan_queue:
1025 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1026 fContinue = eANI_BOOLEAN_FALSE;
1027
Jeff Johnson295189b2012-06-20 16:38:30 -07001028 return ( fContinue );
1029}
1030
1031void smeProcessPendingQueue( tpAniSirGlobal pMac )
1032{
1033 while( smeProcessCommand( pMac ) );
1034}
1035
1036
1037tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1038{
1039 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1040 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1041}
1042
1043
1044
1045//Global APIs
1046
1047/*--------------------------------------------------------------------------
1048
1049 \brief sme_Open() - Initialze all SME modules and put them at idle state
1050
1051 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1052 successfully return, all modules are at idle state ready to start.
1053
1054 smeOpen must be called before any other SME APIs can be involved.
1055 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001056 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001057 \param hHal - The handle returned by macOpen.
1058
1059 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1060
1061 Other status means SME is failed to be initialized
1062 \sa
1063
1064 --------------------------------------------------------------------------*/
1065eHalStatus sme_Open(tHalHandle hHal)
1066{
1067 eHalStatus status = eHAL_STATUS_FAILURE;
1068 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1069
1070 do {
1071 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001072 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001073 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1074 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001075 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001076 status = eHAL_STATUS_FAILURE;
1077 break;
1078 }
1079
1080 status = ccmOpen(hHal);
1081 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1082 smsLog( pMac, LOGE,
1083 "ccmOpen failed during initialization with status=%d", status );
1084 break;
1085 }
1086
1087 status = csrOpen(pMac);
1088 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1089 smsLog( pMac, LOGE,
1090 "csrOpen failed during initialization with status=%d", status );
1091 break;
1092 }
1093
1094 status = pmcOpen(hHal);
1095 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1096 smsLog( pMac, LOGE,
1097 "pmcOpen failed during initialization with status=%d", status );
1098 break;
1099 }
1100
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001101#ifdef FEATURE_WLAN_TDLS
1102 pMac->isTdlsPowerSaveProhibited = 0;
1103#endif
1104
Jeff Johnson295189b2012-06-20 16:38:30 -07001105#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1106 status = sme_QosOpen(pMac);
1107 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1108 smsLog( pMac, LOGE,
1109 "Qos open failed during initialization with status=%d", status );
1110 break;
1111 }
1112
1113 status = btcOpen(pMac);
1114 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1115 smsLog( pMac, LOGE,
1116 "btcOpen open failed during initialization with status=%d", status );
1117 break;
1118 }
1119#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001120#ifdef FEATURE_OEM_DATA_SUPPORT
1121 status = oemData_OemDataReqOpen(pMac);
1122 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1123 smsLog(pMac, LOGE,
1124 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1125 break;
1126 }
1127#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001128
1129 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1130 break;
1131
Jeff Johnson295189b2012-06-20 16:38:30 -07001132 {
1133 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1134 if ( NULL == pvosGCtx ){
1135 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1136 status = eHAL_STATUS_FAILURE;
1137 break;
1138 }
1139
1140 status = WLANSAP_Open( pvosGCtx );
1141 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1142 smsLog( pMac, LOGE,
1143 "WLANSAP_Open open failed during initialization with status=%d", status );
1144 break;
1145 }
1146 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001147#if defined WLAN_FEATURE_VOWIFI
1148 status = rrmOpen(pMac);
1149 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1150 smsLog( pMac, LOGE,
1151 "rrmOpen open failed during initialization with status=%d", status );
1152 break;
1153 }
1154#endif
1155
1156#if defined WLAN_FEATURE_VOWIFI_11R
1157 sme_FTOpen(pMac);
1158#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001159 sme_p2pOpen(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001160
1161 }while (0);
1162
1163 return status;
1164}
1165
Jeff Johnson295189b2012-06-20 16:38:30 -07001166/*--------------------------------------------------------------------------
1167
1168 \brief sme_set11dinfo() - Set the 11d information about valid channels
1169 and there power using information from nvRAM
1170 This function is called only for AP.
1171
Srinivas Girigowdade697412013-02-14 16:31:48 -08001172 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001173
1174 \param hHal - The handle returned by macOpen.
1175 \Param pSmeConfigParams - a pointer to a caller allocated object of
1176 typedef struct _smeConfigParams.
1177
1178 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1179
1180 Other status means SME is failed to update the config parameters.
1181 \sa
1182--------------------------------------------------------------------------*/
1183
1184eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1185{
1186 eHalStatus status = eHAL_STATUS_FAILURE;
1187 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1188
1189 if (NULL == pSmeConfigParams ) {
1190 smsLog( pMac, LOGE,
1191 "Empty config param structure for SME, nothing to update");
1192 return status;
1193 }
1194
1195 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1196 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001197 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001198 status );
1199 }
1200 return status;
1201}
1202
1203/*--------------------------------------------------------------------------
1204
1205 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1206
Srinivas Girigowdade697412013-02-14 16:31:48 -08001207 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001208
1209 \param hHal - The handle returned by HostapdAdapter.
1210 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1211
1212 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1213
1214 Other status means, failed to get the current regulatory domain.
1215 \sa
1216--------------------------------------------------------------------------*/
1217
1218eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1219{
1220 eHalStatus status = eHAL_STATUS_FAILURE;
1221 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1222
1223 if (NULL == domainIdSoftAp ) {
1224 smsLog( pMac, LOGE, "Uninitialized domain Id");
1225 return status;
1226 }
1227
1228 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1229 status = eHAL_STATUS_SUCCESS;
1230
1231 return status;
1232}
1233
1234
1235eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1236{
1237 eHalStatus status = eHAL_STATUS_FAILURE;
1238 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1239
1240 if (NULL == apCntryCode ) {
1241 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1242 return status;
1243 }
1244
1245 status = csrSetRegInfo(hHal, apCntryCode );
1246 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001247 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001248 status );
1249 }
1250 return status;
1251}
1252
Jeff Johnson295189b2012-06-20 16:38:30 -07001253#ifdef FEATURE_WLAN_SCAN_PNO
1254/*--------------------------------------------------------------------------
1255
1256 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
1257
1258 It is used at driver start up to inform RIVA of the default channel
1259 configuration.
1260
Srinivas Girigowdade697412013-02-14 16:31:48 -08001261 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001262
1263 \param hHal - The handle returned by macOpen.
1264
1265 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1266
1267 Other status means SME is failed to update the channel config.
1268 \sa
1269
1270 --------------------------------------------------------------------------*/
1271eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1272{
1273 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1274
1275 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
1276 &pMac->scan.base20MHzChannels, FALSE);
1277 return eHAL_STATUS_SUCCESS;
1278}
1279#endif // FEATURE_WLAN_SCAN_PNLO
1280
1281/*--------------------------------------------------------------------------
1282
1283 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1284
1285 The function updates some configuration for modules in SME, CCM, CSR, etc
1286 during SMEs close open sequence.
1287
1288 Modules inside SME apply the new configuration at the next transaction.
1289
Srinivas Girigowdade697412013-02-14 16:31:48 -08001290 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001291
1292 \param hHal - The handle returned by macOpen.
1293 \Param pSmeConfigParams - a pointer to a caller allocated object of
1294 typedef struct _smeConfigParams.
1295
1296 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1297
1298 Other status means SME is failed to update the config parameters.
1299 \sa
1300
1301 --------------------------------------------------------------------------*/
1302eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1303{
1304 eHalStatus status = eHAL_STATUS_FAILURE;
1305 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1306
1307 if (NULL == pSmeConfigParams ) {
1308 smsLog( pMac, LOGE,
1309 "Empty config param structure for SME, nothing to update");
1310 return status;
1311 }
1312
1313 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1314
1315 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001316 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001317 status );
1318 }
1319#if defined WLAN_FEATURE_P2P_INTERNAL
1320 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1321
1322 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001323 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001324 status );
1325 }
1326#endif
1327#if defined WLAN_FEATURE_VOWIFI
1328 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1329
1330 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001331 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001332 status );
1333 }
1334#endif
1335 //For SOC, CFG is set before start
1336 //We don't want to apply global CFG in connect state because that may cause some side affect
1337 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001338 csrIsAllSessionDisconnected( pMac) )
1339 {
1340 csrSetGlobalCfgs(pMac);
1341 }
1342
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301343 /* update the directed scan offload setting */
1344 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1345
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301346 if (pMac->fScanOffload)
1347 {
1348 /* If scan offload is enabled then lim has allow the sending of
1349 scan request to firmware even in powersave mode. The firmware has
1350 to take care of exiting from power save mode */
1351 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1352 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1353
1354 if (eHAL_STATUS_SUCCESS != status)
1355 {
1356 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1357 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1358 }
1359 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001360 return status;
1361}
1362
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301363#ifdef WLAN_FEATURE_GTK_OFFLOAD
1364void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1365 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1366{
1367 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1368
1369 if (NULL == pMac)
1370 {
1371 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1372 "%s: pMac is null", __func__);
1373 return ;
1374 }
1375 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1376 {
1377 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1378 "%s: HDD callback is null", __func__);
1379 return ;
1380 }
1381 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1382 pGtkOffloadGetInfoRsp);
1383}
1384#endif
1385
Jeff Johnson295189b2012-06-20 16:38:30 -07001386/* ---------------------------------------------------------------------------
1387 \fn sme_ChangeConfigParams
1388 \brief The SME API exposed for HDD to provide config params to SME during
1389 SMEs stop -> start sequence.
1390
1391 If HDD changed the domain that will cause a reset. This function will
1392 provide the new set of 11d information for the new domain. Currrently this
1393 API provides info regarding 11d only at reset but we can extend this for
1394 other params (PMC, QoS) which needs to be initialized again at reset.
1395
Srinivas Girigowdade697412013-02-14 16:31:48 -08001396 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001397
1398 \param hHal - The handle returned by macOpen.
1399
1400 \Param
1401 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1402 currently provides 11d related information like Country code,
1403 Regulatory domain, valid channel list, Tx power per channel, a
1404 list with active/passive scan allowed per valid channel.
1405
1406 \return eHalStatus
1407 ---------------------------------------------------------------------------*/
1408eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1409 tCsrUpdateConfigParam *pUpdateConfigParam)
1410{
1411 eHalStatus status = eHAL_STATUS_FAILURE;
1412 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1413
1414 if (NULL == pUpdateConfigParam ) {
1415 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001416 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001417 return status;
1418 }
1419
1420 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1421
1422 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001423 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001424 status );
1425 }
1426
1427 return status;
1428
1429}
1430
1431/*--------------------------------------------------------------------------
1432
1433 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1434 that the NIC is ready tio run.
1435
1436 The function is called by HDD at the end of initialization stage so PE/HAL can
1437 enable the NIC to running state.
1438
Srinivas Girigowdade697412013-02-14 16:31:48 -08001439 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001440 \param hHal - The handle returned by macOpen.
1441
1442 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1443 successfully.
1444
1445 Other status means SME failed to send the message to PE.
1446 \sa
1447
1448 --------------------------------------------------------------------------*/
1449eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1450{
1451 tSirSmeReadyReq Msg;
1452 eHalStatus status = eHAL_STATUS_FAILURE;
1453 tPmcPowerState powerState;
1454 tPmcSwitchState hwWlanSwitchState;
1455 tPmcSwitchState swWlanSwitchState;
1456 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1457
1458 do
1459 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001460
1461 Msg.messageType = eWNI_SME_SYS_READY_IND;
1462 Msg.length = sizeof( tSirSmeReadyReq );
1463
1464 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1465 {
1466 status = eHAL_STATUS_SUCCESS;
1467 }
1468 else
1469 {
1470 smsLog( pMac, LOGE,
1471 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1472 break;
1473 }
1474
1475 status = pmcQueryPowerState( hHal, &powerState,
1476 &hwWlanSwitchState, &swWlanSwitchState );
1477 if ( ! HAL_STATUS_SUCCESS( status ) )
1478 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001479 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001480 status );
1481 break;
1482 }
1483
1484 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1485 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1486 {
1487 status = csrReady(pMac);
1488 if ( ! HAL_STATUS_SUCCESS( status ) )
1489 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001490 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001491 break;
1492 }
1493 status = pmcReady(hHal);
1494 if ( ! HAL_STATUS_SUCCESS( status ) )
1495 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001496 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001497 break;
1498 }
1499#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1500 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1501 {
1502 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001503 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001504 break;
1505 }
1506#endif
1507
1508#if defined WLAN_FEATURE_VOWIFI
1509 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1510 {
1511 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001512 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001513 break;
1514 }
1515#endif
1516 }
1517 pMac->sme.state = SME_STATE_READY;
1518 } while( 0 );
1519
1520 return status;
1521}
1522
1523/*--------------------------------------------------------------------------
1524
1525 \brief sme_Start() - Put all SME modules at ready state.
1526
1527 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1528 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001529 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001530 \param hHal - The handle returned by macOpen.
1531
1532 \return eHAL_STATUS_SUCCESS - SME is ready.
1533
1534 Other status means SME is failed to start
1535 \sa
1536
1537 --------------------------------------------------------------------------*/
1538eHalStatus sme_Start(tHalHandle hHal)
1539{
1540 eHalStatus status = eHAL_STATUS_FAILURE;
1541 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1542
1543 do
1544 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001545 status = csrStart(pMac);
1546 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001547 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001548 status );
1549 break;
1550 }
1551
1552 status = pmcStart(hHal);
1553 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001554 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001555 status );
1556 break;
1557 }
1558
Jeff Johnson295189b2012-06-20 16:38:30 -07001559 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1560 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001561 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001562 status );
1563 break;
1564 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001565 pMac->sme.state = SME_STATE_START;
1566 }while (0);
1567
1568 return status;
1569}
1570
1571
1572#ifdef WLAN_FEATURE_PACKET_FILTERING
1573/******************************************************************************
1574*
1575* Name: sme_PCFilterMatchCountResponseHandler
1576*
1577* Description:
1578* Invoke Packet Coalescing Filter Match Count callback routine
1579*
1580* Parameters:
1581* hHal - HAL handle for device
1582* pMsg - Pointer to tRcvFltPktMatchRsp structure
1583*
1584* Returns: eHalStatus
1585*
1586******************************************************************************/
1587eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1588{
1589 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1590 eHalStatus status = eHAL_STATUS_SUCCESS;
1591 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1592
1593 if (NULL == pMsg)
1594 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001595 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001596 status = eHAL_STATUS_FAILURE;
1597 }
1598 else
1599 {
1600 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001601 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001602
1603 /* Call Packet Coalescing Filter Match Count callback routine. */
1604 if (pMac->pmc.FilterMatchCountCB != NULL)
1605 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1606 pRcvFltPktMatchRsp);
1607
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001608 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001609 pRcvFltPktMatchRsp->status);
1610
1611 pMac->pmc.FilterMatchCountCB = NULL;
1612 pMac->pmc.FilterMatchCountCBContext = NULL;
1613 }
1614
1615 return(status);
1616}
1617#endif // WLAN_FEATURE_PACKET_FILTERING
1618
1619
Chet Lanctot186b5732013-03-18 10:26:30 -07001620#ifdef WLAN_FEATURE_11W
1621/*------------------------------------------------------------------
1622 *
1623 * Handle the unprotected management frame indication from LIM and
1624 * forward it to HDD.
1625 *
1626 *------------------------------------------------------------------*/
1627
1628eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1629 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1630{
1631 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1632 eHalStatus status = eHAL_STATUS_SUCCESS;
1633 tCsrRoamInfo pRoamInfo = {0};
1634 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1635
1636 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1637 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1638 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1639
1640 /* forward the mgmt frame to HDD */
1641 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1642
1643 return status;
1644}
1645#endif
1646
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001647#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
1648/*------------------------------------------------------------------
1649 *
1650 * Handle the tsm ie indication from LIM and forward it to HDD.
1651 *
1652 *------------------------------------------------------------------*/
1653
1654eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1655{
1656 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1657 eHalStatus status = eHAL_STATUS_SUCCESS;
1658 tCsrRoamInfo pRoamInfo = {0};
1659 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1660
1661 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1662 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1663 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1664
1665 /* forward the tsm ie information to HDD */
1666 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1667
1668 return status;
1669}
1670
1671/* ---------------------------------------------------------------------------
1672 \fn sme_SetCCKMIe
1673 \brief function to store the CCKM IE passed from supplicant and use it while packing
1674 reassociation request
1675 \param hHal - HAL handle for device
1676 \param pCckmIe - pointer to CCKM IE data
1677 \param pCckmIeLen - length of the CCKM IE
1678 \- return Success or failure
1679 -------------------------------------------------------------------------*/
1680eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1681 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1682{
1683 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1684 eHalStatus status = eHAL_STATUS_SUCCESS;
1685
1686 status = sme_AcquireGlobalLock( &pMac->sme );
1687 if ( HAL_STATUS_SUCCESS( status ) )
1688 {
1689 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1690 sme_ReleaseGlobalLock( &pMac->sme );
1691 }
1692 return status;
1693}
1694
1695#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
1696
Chet Lanctot186b5732013-03-18 10:26:30 -07001697
Jeff Johnson295189b2012-06-20 16:38:30 -07001698/*--------------------------------------------------------------------------
1699
1700 \brief sme_ProcessMsg() - The main message processor for SME.
1701
1702 The function is called by a message dispatcher when to process a message
1703 targeted for SME.
1704
Srinivas Girigowdade697412013-02-14 16:31:48 -08001705 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001706 \param hHal - The handle returned by macOpen.
1707 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1708
1709 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1710
1711 Other status means SME failed to process the message to HAL.
1712 \sa
1713
1714 --------------------------------------------------------------------------*/
1715eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1716{
1717 eHalStatus status = eHAL_STATUS_FAILURE;
1718 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1719
1720 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001721 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001722 return status;
1723 }
1724
1725 status = sme_AcquireGlobalLock( &pMac->sme );
1726 if ( HAL_STATUS_SUCCESS( status ) )
1727 {
1728 if( SME_IS_START(pMac) )
1729 {
1730 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1731 case eWNI_PMC_ENTER_BMPS_RSP:
1732 case eWNI_PMC_EXIT_BMPS_RSP:
1733 case eWNI_PMC_EXIT_BMPS_IND:
1734 case eWNI_PMC_ENTER_IMPS_RSP:
1735 case eWNI_PMC_EXIT_IMPS_RSP:
1736 case eWNI_PMC_SMPS_STATE_IND:
1737 case eWNI_PMC_ENTER_UAPSD_RSP:
1738 case eWNI_PMC_EXIT_UAPSD_RSP:
1739 case eWNI_PMC_ENTER_WOWL_RSP:
1740 case eWNI_PMC_EXIT_WOWL_RSP:
1741 //PMC
1742 if (pMsg->bodyptr)
1743 {
1744 pmcMessageProcessor(hHal, pMsg->bodyptr);
1745 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301746 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001747 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001748 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001749 }
1750 break;
1751
1752 case WNI_CFG_SET_CNF:
1753 case WNI_CFG_DNLD_CNF:
1754 case WNI_CFG_GET_RSP:
1755 case WNI_CFG_ADD_GRP_ADDR_CNF:
1756 case WNI_CFG_DEL_GRP_ADDR_CNF:
1757 //CCM
1758 if (pMsg->bodyptr)
1759 {
1760 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1761 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301762 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001763 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001764 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001765 }
1766 break;
1767
1768 case eWNI_SME_ADDTS_RSP:
1769 case eWNI_SME_DELTS_RSP:
1770 case eWNI_SME_DELTS_IND:
1771#ifdef WLAN_FEATURE_VOWIFI_11R
1772 case eWNI_SME_FT_AGGR_QOS_RSP:
1773#endif
1774 //QoS
1775 if (pMsg->bodyptr)
1776 {
1777#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1778 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05301779 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001780#endif
1781 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001782 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001783 }
1784 break;
1785#if defined WLAN_FEATURE_VOWIFI
1786 case eWNI_SME_NEIGHBOR_REPORT_IND:
1787 case eWNI_SME_BEACON_REPORT_REQ_IND:
1788#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001789 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001790#endif
1791 if ( pMsg->bodyptr )
1792 {
1793 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05301794 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001795 }
1796 else
1797 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001798 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001799 }
1800 break;
1801#endif
1802
Jeff Johnsone7245742012-09-05 17:12:55 -07001803#ifdef FEATURE_OEM_DATA_SUPPORT
1804 //Handle the eWNI_SME_OEM_DATA_RSP:
1805 case eWNI_SME_OEM_DATA_RSP:
1806 if(pMsg->bodyptr)
1807 {
1808 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
1809 vos_mem_free(pMsg->bodyptr);
1810 }
1811 else
1812 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001813 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07001814 }
1815 smeProcessPendingQueue( pMac );
1816 break;
1817#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001818
1819 case eWNI_SME_ADD_STA_SELF_RSP:
1820 if(pMsg->bodyptr)
1821 {
1822 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
1823 vos_mem_free(pMsg->bodyptr);
1824 }
1825 else
1826 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001827 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001828 }
1829 break;
1830 case eWNI_SME_DEL_STA_SELF_RSP:
1831 if(pMsg->bodyptr)
1832 {
1833 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
1834 vos_mem_free(pMsg->bodyptr);
1835 }
1836 else
1837 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001838 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001839 }
1840 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001841 case eWNI_SME_REMAIN_ON_CHN_RSP:
1842 if(pMsg->bodyptr)
1843 {
1844 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
1845 vos_mem_free(pMsg->bodyptr);
1846 }
1847 else
1848 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001849 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001850 }
1851 break;
1852 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
1853 if(pMsg->bodyptr)
1854 {
1855 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
1856 vos_mem_free(pMsg->bodyptr);
1857 }
1858 else
1859 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001860 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RDY_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001861 }
1862 break;
1863 case eWNI_SME_MGMT_FRM_IND:
1864 if(pMsg->bodyptr)
1865 {
1866 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
1867 vos_mem_free(pMsg->bodyptr);
1868 }
1869 else
1870 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001871 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001872 }
1873 break;
1874 case eWNI_SME_ACTION_FRAME_SEND_CNF:
1875 if(pMsg->bodyptr)
1876 {
1877 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
1878 vos_mem_free(pMsg->bodyptr);
1879 }
1880 else
1881 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001882 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001883 }
1884 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001885 case eWNI_SME_COEX_IND:
1886 if(pMsg->bodyptr)
1887 {
1888 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
1889 vos_mem_free(pMsg->bodyptr);
1890 }
1891 else
1892 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001893 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001894 }
1895 break;
1896
1897#ifdef FEATURE_WLAN_SCAN_PNO
1898 case eWNI_SME_PREF_NETWORK_FOUND_IND:
1899 if(pMsg->bodyptr)
1900 {
1901 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
1902 vos_mem_free(pMsg->bodyptr);
1903 }
1904 else
1905 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001906 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001907 }
1908 break;
1909#endif // FEATURE_WLAN_SCAN_PNO
1910
1911 case eWNI_SME_TX_PER_HIT_IND:
1912 if (pMac->sme.pTxPerHitCallback)
1913 {
1914 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
1915 }
1916 break;
1917
1918 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07001919 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 {
1921 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
1922 vos_mem_free(pMsg->bodyptr);
1923 }
1924 else
1925 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07001926 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
1927 }
1928 break;
1929
1930 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
1931 if (pMsg->bodyptr)
1932 {
1933 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
1934 vos_mem_free(pMsg->bodyptr);
1935 }
1936 else
1937 {
1938 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 }
1940 break;
1941
1942#ifdef WLAN_FEATURE_PACKET_FILTERING
1943 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
1944 if(pMsg->bodyptr)
1945 {
1946 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
1947 vos_mem_free(pMsg->bodyptr);
1948 }
1949 else
1950 {
1951 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001952 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001953 }
1954 break;
1955#endif // WLAN_FEATURE_PACKET_FILTERING
1956 case eWNI_SME_PRE_SWITCH_CHL_IND:
1957 {
1958 status = sme_HandlePreChannelSwitchInd(pMac);
1959 break;
1960 }
1961
1962 case eWNI_SME_POST_SWITCH_CHL_IND:
1963 {
1964 status = sme_HandlePostChannelSwitchInd(pMac);
1965 break;
1966 }
1967
1968#ifdef WLAN_WAKEUP_EVENTS
1969 case eWNI_SME_WAKE_REASON_IND:
1970 if(pMsg->bodyptr)
1971 {
1972 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
1973 vos_mem_free(pMsg->bodyptr);
1974 }
1975 else
1976 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001977 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001978 }
1979 break;
1980#endif // WLAN_WAKEUP_EVENTS
1981
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001982#ifdef FEATURE_WLAN_TDLS
1983 /*
1984 * command rescived from PE, SME tdls msg processor shall be called
1985 * to process commands recieved from PE
1986 */
1987 case eWNI_SME_TDLS_SEND_MGMT_RSP:
1988 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08001989 case eWNI_SME_TDLS_DEL_STA_RSP:
1990 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001991 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001992 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301993 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001994#ifdef FEATURE_WLAN_TDLS_INTERNAL
1995 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
1996 case eWNI_SME_TDLS_DISCOVERY_START_IND:
1997 case eWNI_SME_TDLS_LINK_START_RSP:
1998 case eWNI_SME_TDLS_LINK_START_IND:
1999 case eWNI_SME_TDLS_TEARDOWN_RSP:
2000 case eWNI_SME_TDLS_TEARDOWN_IND:
2001 case eWNI_SME_ADD_TDLS_PEER_IND:
2002 case eWNI_SME_DELETE_TDLS_PEER_IND:
2003#endif
2004 {
2005 if (pMsg->bodyptr)
2006 {
2007 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302008 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002009 }
2010 else
2011 {
2012 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002013 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002014 }
2015 break;
2016 }
2017#endif
2018
Chet Lanctot186b5732013-03-18 10:26:30 -07002019#ifdef WLAN_FEATURE_11W
2020 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2021 if (pMsg->bodyptr)
2022 {
2023 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2024 vos_mem_free(pMsg->bodyptr);
2025 }
2026 else
2027 {
2028 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2029 }
2030 break;
2031#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002032#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
2033 case eWNI_SME_TSM_IE_IND:
2034 {
2035 if (pMsg->bodyptr)
2036 {
2037 sme_TsmIeInd(pMac, pMsg->bodyptr);
2038 vos_mem_free(pMsg->bodyptr);
2039 }
2040 else
2041 {
2042 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2043 }
2044 break;
2045 }
2046#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002047#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2048 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2049 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2050 break;
2051#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002052
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302053#ifdef WLAN_FEATURE_GTK_OFFLOAD
2054 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2055 if (pMsg->bodyptr)
2056 {
2057 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
2058 vos_mem_free(pMsg->bodyptr);
2059 }
2060 else
2061 {
2062 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2063 }
2064 break ;
2065#endif
Leo Chang9056f462013-08-01 19:21:11 -07002066
2067#ifdef FEATURE_WLAN_LPHB
2068 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002069 case eWNI_SME_LPHB_IND:
2070 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002071 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002072 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002073 }
2074 vos_mem_free(pMsg->bodyptr);
2075
2076 break;
2077#endif /* FEATURE_WLAN_LPHB */
2078
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 default:
2080
2081 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2082 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2083 {
2084 //CSR
2085 if (pMsg->bodyptr)
2086 {
2087 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302088 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 }
2090 else
2091 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002092 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002093 }
2094 }
2095 else
2096 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002097 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002098 pMsg->type);
2099 if (pMsg->bodyptr)
2100 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302101 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002102 }
2103 }
2104 }//switch
2105 } //SME_IS_START
2106 else
2107 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002108 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002109 if (pMsg->bodyptr)
2110 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302111 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002112 }
2113 }
2114 sme_ReleaseGlobalLock( &pMac->sme );
2115 }
2116 else
2117 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002118 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002119 if (pMsg->bodyptr)
2120 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302121 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002122 }
2123 }
2124
2125 return status;
2126}
2127
2128
2129//No need to hold the global lock here because this function can only be called
2130//after sme_Stop.
2131v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2132{
2133 if( pMsg )
2134 {
2135 if (pMsg->bodyptr)
2136 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302137 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002138 }
2139 }
2140
2141}
2142
2143
2144/*--------------------------------------------------------------------------
2145
2146 \brief sme_Stop() - Stop all SME modules and put them at idle state
2147
2148 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2149 return, all modules are at idle state ready to start.
2150
Srinivas Girigowdade697412013-02-14 16:31:48 -08002151 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002152 \param hHal - The handle returned by macOpen
2153
2154 \return eHAL_STATUS_SUCCESS - SME is stopped.
2155
2156 Other status means SME is failed to stop but caller should still
2157 consider SME is stopped.
2158 \sa
2159
2160 --------------------------------------------------------------------------*/
2161eHalStatus sme_Stop(tHalHandle hHal, tANI_BOOLEAN pmcFlag)
2162{
2163 eHalStatus status = eHAL_STATUS_FAILURE;
2164 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2165 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2166
Jeff Johnson295189b2012-06-20 16:38:30 -07002167 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2168 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002169 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002170 status );
2171 fail_status = status;
2172 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002173
2174 p2pStop(hHal);
2175
2176 if(pmcFlag)
2177 {
2178 status = pmcStop(hHal);
2179 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002180 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002181 status );
2182 fail_status = status;
2183 }
2184 }
2185
2186 status = csrStop(pMac);
2187 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002188 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002189 status );
2190 fail_status = status;
2191 }
2192
2193 ccmStop(hHal);
2194
2195 purgeSmeCmdList(pMac);
2196
2197 if (!HAL_STATUS_SUCCESS( fail_status )) {
2198 status = fail_status;
2199 }
2200
2201 pMac->sme.state = SME_STATE_STOP;
2202
2203 return status;
2204}
2205
2206/*--------------------------------------------------------------------------
2207
2208 \brief sme_Close() - Release all SME modules and their resources.
2209
2210 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2211 return, all modules are at closed state.
2212
2213 No SME APIs can be involved after smeClose except smeOpen.
2214 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002215 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002216 \param hHal - The handle returned by macOpen
2217
2218 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2219
2220 Other status means SME is failed to be closed but caller still cannot
2221 call any other SME functions except smeOpen.
2222 \sa
2223
2224 --------------------------------------------------------------------------*/
2225eHalStatus sme_Close(tHalHandle hHal)
2226{
2227 eHalStatus status = eHAL_STATUS_FAILURE;
2228 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2229 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2230
2231 status = csrClose(pMac);
2232 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002233 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002234 status );
2235 fail_status = status;
2236 }
2237
Jeff Johnson295189b2012-06-20 16:38:30 -07002238 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2239 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002240 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 status );
2242 fail_status = status;
2243 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002244
2245#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2246 status = btcClose(hHal);
2247 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002248 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002249 status );
2250 fail_status = status;
2251 }
2252
2253 status = sme_QosClose(pMac);
2254 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002255 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002256 status );
2257 fail_status = status;
2258 }
2259#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002260#ifdef FEATURE_OEM_DATA_SUPPORT
2261 status = oemData_OemDataReqClose(hHal);
2262 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002263 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002264 status );
2265 fail_status = status;
2266 }
2267#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002268
2269 status = ccmClose(hHal);
2270 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002271 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 status );
2273 fail_status = status;
2274 }
2275
2276 status = pmcClose(hHal);
2277 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002278 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 status );
2280 fail_status = status;
2281 }
2282#if defined WLAN_FEATURE_VOWIFI
2283 status = rrmClose(hHal);
2284 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002285 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002286 status );
2287 fail_status = status;
2288 }
2289#endif
2290
2291#if defined WLAN_FEATURE_VOWIFI_11R
2292 sme_FTClose(hHal);
2293#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002294 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002295
2296 freeSmeCmdList(pMac);
2297
2298 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2299 {
2300 fail_status = eHAL_STATUS_FAILURE;
2301 }
2302
2303 if (!HAL_STATUS_SUCCESS( fail_status )) {
2304 status = fail_status;
2305 }
2306
2307 pMac->sme.state = SME_STATE_STOP;
2308
2309 return status;
2310}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002311#ifdef FEATURE_WLAN_LFR
2312tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2313{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002314#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002315 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2316 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2317 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2318 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2319 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2320 return eANI_BOOLEAN_FALSE;
2321 default:
2322 return eANI_BOOLEAN_TRUE;
2323 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002324#else
2325 /*
2326 * TODO: always return TRUE for now until
2327 * we figure out why we could be stuck in
2328 * one of the roaming states forever.
2329 */
2330 return eANI_BOOLEAN_TRUE;
2331#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002332}
2333#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002334/* ---------------------------------------------------------------------------
2335 \fn sme_ScanRequest
2336 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002337 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002338 \param pScanRequestID - pointer to an object to get back the request ID
2339 \param callback - a callback function that scan calls upon finish, will not
2340 be called if csrScanRequest returns error
2341 \param pContext - a pointer passed in for the callback
2342 \return eHalStatus
2343 ---------------------------------------------------------------------------*/
2344eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2345 tANI_U32 *pScanRequestID,
2346 csrScanCompleteCallback callback, void *pContext)
2347{
2348 eHalStatus status = eHAL_STATUS_FAILURE;
2349 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2350
2351 smsLog(pMac, LOG2, FL("enter"));
2352 do
2353 {
2354 if(pMac->scan.fScanEnable)
2355 {
2356 status = sme_AcquireGlobalLock( &pMac->sme );
2357 if ( HAL_STATUS_SUCCESS( status ) )
2358 {
2359 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002360#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002361 if(csrIsScanAllowed(pMac))
2362 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002363#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002364 status = csrScanRequest( hHal, sessionId, pscanReq,
2365 pScanRequestID, callback, pContext );
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002366#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002367 }
2368 else
2369 {
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002370 smsLog(pMac, LOGE, FL("Scan denied in state %d (sub-state %d)"),
2371 pMac->roam.neighborRoamInfo.neighborRoamState,
2372 pMac->roam.curSubState[sessionId]);
2373 /*HandOff is in progress. So schedule this scan later*/
2374 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002375 }
2376#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002377 }
2378
2379 sme_ReleaseGlobalLock( &pMac->sme );
2380 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002381 else
2382 {
2383 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2384 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002385 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002386 else
2387 {
2388 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2389 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002390 } while( 0 );
2391
2392 return (status);
2393
2394
2395}
2396
2397/* ---------------------------------------------------------------------------
2398 \fn sme_ScanGetResult
2399 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002400 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002401 \param pFilter - If pFilter is NULL, all cached results are returned
2402 \param phResult - an object for the result.
2403 \return eHalStatus
2404 ---------------------------------------------------------------------------*/
2405eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2406 tScanResultHandle *phResult)
2407{
2408 eHalStatus status = eHAL_STATUS_FAILURE;
2409 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2410
2411 smsLog(pMac, LOG2, FL("enter"));
2412 status = sme_AcquireGlobalLock( &pMac->sme );
2413 if ( HAL_STATUS_SUCCESS( status ) )
2414 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002415 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002416 sme_ReleaseGlobalLock( &pMac->sme );
2417 }
2418 smsLog(pMac, LOG2, FL("exit status %d"), status);
2419
2420 return (status);
2421}
2422
2423
2424/* ---------------------------------------------------------------------------
2425 \fn sme_ScanFlushResult
2426 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002427 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002428 \return eHalStatus
2429 ---------------------------------------------------------------------------*/
2430eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2431{
2432 eHalStatus status = eHAL_STATUS_FAILURE;
2433 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2434
2435 status = sme_AcquireGlobalLock( &pMac->sme );
2436 if ( HAL_STATUS_SUCCESS( status ) )
2437 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002438 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002439 sme_ReleaseGlobalLock( &pMac->sme );
2440 }
2441
2442 return (status);
2443}
2444
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002445eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2446{
2447 eHalStatus status = eHAL_STATUS_FAILURE;
2448 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2449
2450 status = sme_AcquireGlobalLock( &pMac->sme );
2451 if ( HAL_STATUS_SUCCESS( status ) )
2452 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302453 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002454 sme_ReleaseGlobalLock( &pMac->sme );
2455 }
2456
2457 return (status);
2458}
Jeff Johnson295189b2012-06-20 16:38:30 -07002459
2460/* ---------------------------------------------------------------------------
2461 \fn sme_ScanResultGetFirst
2462 \brief a wrapper function to request CSR to returns the first element of
2463 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002464 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002465 \param hScanResult - returned from csrScanGetResult
2466 \return tCsrScanResultInfo * - NULL if no result
2467 ---------------------------------------------------------------------------*/
2468tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2469 tScanResultHandle hScanResult)
2470{
2471 eHalStatus status = eHAL_STATUS_FAILURE;
2472 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2473 tCsrScanResultInfo *pRet = NULL;
2474
2475 status = sme_AcquireGlobalLock( &pMac->sme );
2476 if ( HAL_STATUS_SUCCESS( status ) )
2477 {
2478 pRet = csrScanResultGetFirst( pMac, hScanResult );
2479 sme_ReleaseGlobalLock( &pMac->sme );
2480 }
2481
2482 return (pRet);
2483}
2484
2485
2486/* ---------------------------------------------------------------------------
2487 \fn sme_ScanResultGetNext
2488 \brief a wrapper function to request CSR to returns the next element of
2489 scan result. It can be called without calling csrScanResultGetFirst
2490 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002491 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002492 \param hScanResult - returned from csrScanGetResult
2493 \return Null if no result or reach the end
2494 ---------------------------------------------------------------------------*/
2495tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2496 tScanResultHandle hScanResult)
2497{
2498 eHalStatus status = eHAL_STATUS_FAILURE;
2499 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2500 tCsrScanResultInfo *pRet = NULL;
2501
2502 status = sme_AcquireGlobalLock( &pMac->sme );
2503 if ( HAL_STATUS_SUCCESS( status ) )
2504 {
2505 pRet = csrScanResultGetNext( pMac, hScanResult );
2506 sme_ReleaseGlobalLock( &pMac->sme );
2507 }
2508
2509 return (pRet);
2510}
2511
2512
2513/* ---------------------------------------------------------------------------
2514 \fn sme_ScanSetBGScanparams
2515 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002516 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002517 \param pScanReq - BG scan request structure
2518 \return eHalStatus
2519 ---------------------------------------------------------------------------*/
2520eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2521{
2522 eHalStatus status = eHAL_STATUS_FAILURE;
2523 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2524
2525 if( NULL != pScanReq )
2526 {
2527 status = sme_AcquireGlobalLock( &pMac->sme );
2528 if ( HAL_STATUS_SUCCESS( status ) )
2529 {
2530 status = csrScanSetBGScanparams( hHal, pScanReq );
2531 sme_ReleaseGlobalLock( &pMac->sme );
2532 }
2533 }
2534
2535 return (status);
2536}
2537
2538
2539/* ---------------------------------------------------------------------------
2540 \fn sme_ScanResultPurge
2541 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2542 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002543 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002544 \param hScanResult - returned from csrScanGetResult. hScanResult is
2545 considered gone by
2546 calling this function and even before this function reutrns.
2547 \return eHalStatus
2548 ---------------------------------------------------------------------------*/
2549eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2550{
2551 eHalStatus status = eHAL_STATUS_FAILURE;
2552 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2553
2554 status = sme_AcquireGlobalLock( &pMac->sme );
2555 if ( HAL_STATUS_SUCCESS( status ) )
2556 {
2557 status = csrScanResultPurge( hHal, hScanResult );
2558 sme_ReleaseGlobalLock( &pMac->sme );
2559 }
2560
2561 return (status);
2562}
2563
2564/* ---------------------------------------------------------------------------
2565 \fn sme_ScanGetPMKIDCandidateList
2566 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002567 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002568 \param pPmkidList - caller allocated buffer point to an array of
2569 tPmkidCandidateInfo
2570 \param pNumItems - pointer to a variable that has the number of
2571 tPmkidCandidateInfo allocated when retruning, this is
2572 either the number needed or number of items put into
2573 pPmkidList
2574 \return eHalStatus - when fail, it usually means the buffer allocated is not
2575 big enough and pNumItems
2576 has the number of tPmkidCandidateInfo.
2577 \Note: pNumItems is a number of tPmkidCandidateInfo,
2578 not sizeof(tPmkidCandidateInfo) * something
2579 ---------------------------------------------------------------------------*/
2580eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
2581 tPmkidCandidateInfo *pPmkidList,
2582 tANI_U32 *pNumItems )
2583{
2584 eHalStatus status = eHAL_STATUS_FAILURE;
2585 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2586
2587 status = sme_AcquireGlobalLock( &pMac->sme );
2588 if ( HAL_STATUS_SUCCESS( status ) )
2589 {
2590 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2591 sme_ReleaseGlobalLock( &pMac->sme );
2592 }
2593
2594 return (status);
2595}
2596
2597/*----------------------------------------------------------------------------
2598 \fn sme_RoamRegisterLinkQualityIndCallback
2599
2600 \brief
2601 a wrapper function to allow HDD to register a callback handler with CSR for
2602 link quality indications.
2603
2604 Only one callback may be registered at any time.
2605 In order to deregister the callback, a NULL cback may be provided.
2606
2607 Registration happens in the task context of the caller.
2608
2609 \param callback - Call back being registered
2610 \param pContext - user data
2611
2612 DEPENDENCIES: After CSR open
2613
2614 \return eHalStatus
2615-----------------------------------------------------------------------------*/
2616eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2617 csrRoamLinkQualityIndCallback callback,
2618 void *pContext)
2619{
2620 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2621}
2622
2623/* ---------------------------------------------------------------------------
2624 \fn sme_RoamRegisterCallback
2625 \brief a wrapper function to allow HDD to register a callback with CSR.
2626 Unlike scan, roam has one callback for all the roam requests
2627 \param callback - a callback function that roam calls upon when state changes
2628 \param pContext - a pointer passed in for the callback
2629 \return eHalStatus
2630 ---------------------------------------------------------------------------*/
2631eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2632 csrRoamCompleteCallback callback,
2633 void *pContext)
2634{
2635 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2636}
2637
2638eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2639{
2640 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2641 return pMac->roam.configParam.phyMode;
2642}
2643
2644/* ---------------------------------------------------------------------------
2645 \fn sme_RoamConnect
2646 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002647 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002648 \param sessionId - the sessionId returned by sme_OpenSession.
2649 \param pProfile - description of the network to which to connect
2650 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2651 from csrScanGetResult
2652 \param pRoamId - to get back the request ID
2653 \return eHalStatus
2654 ---------------------------------------------------------------------------*/
2655eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2656 tANI_U32 *pRoamId)
2657{
2658 eHalStatus status = eHAL_STATUS_FAILURE;
2659 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2660
2661 smsLog(pMac, LOG2, FL("enter"));
2662 status = sme_AcquireGlobalLock( &pMac->sme );
2663 if ( HAL_STATUS_SUCCESS( status ) )
2664 {
2665 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2666 {
2667 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2668 }
2669 else
2670 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002671 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002672 status = eHAL_STATUS_INVALID_PARAMETER;
2673 }
2674 sme_ReleaseGlobalLock( &pMac->sme );
2675 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002676 else
2677 {
2678 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2679 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002680
2681 return (status);
2682}
2683
2684/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05302685
2686 \fn sme_SetPhyMode
2687
2688 \brief Changes the PhyMode.
2689
2690 \param hHal - The handle returned by macOpen.
2691
2692 \param phyMode new phyMode which is to set
2693
2694 \return eHalStatus SUCCESS.
2695
2696 -------------------------------------------------------------------------------*/
2697eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
2698{
2699 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2700
2701 if (NULL == pMac)
2702 {
2703 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2704 "%s: invalid context", __func__);
2705 return eHAL_STATUS_FAILURE;
2706 }
2707
2708 pMac->roam.configParam.phyMode = phyMode;
2709 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
2710 pMac->roam.configParam.phyMode,
2711 pMac->roam.configParam.ProprietaryRatesEnabled);
2712
2713 return eHAL_STATUS_SUCCESS;
2714}
2715
2716/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07002717 \fn sme_RoamReassoc
2718 \brief a wrapper function to request CSR to inititiate a re-association
2719 \param pProfile - can be NULL to join the currently connected AP. In that
2720 case modProfileFields should carry the modified field(s) which could trigger
2721 reassoc
2722 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2723 that might need modification dynamically once STA is up & running and this
2724 could trigger a reassoc
2725 \param pRoamId - to get back the request ID
2726 \return eHalStatus
2727 -------------------------------------------------------------------------------*/
2728eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2729 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002730 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002731{
2732 eHalStatus status = eHAL_STATUS_FAILURE;
2733 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2734
2735 smsLog(pMac, LOG2, FL("enter"));
2736 status = sme_AcquireGlobalLock( &pMac->sme );
2737 if ( HAL_STATUS_SUCCESS( status ) )
2738 {
2739 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2740 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07002741 if((NULL == pProfile) && (fForce == 1))
2742 {
2743 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
2744 /* to force the AP initiate fresh 802.1x authentication need to clear
2745 * the PMKID cache for that set the following boolean. this is needed
2746 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
2747 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002748 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
2749 }
2750 else
2751 {
2752 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
2753 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002754 }
2755 else
2756 {
2757 status = eHAL_STATUS_INVALID_PARAMETER;
2758 }
2759 sme_ReleaseGlobalLock( &pMac->sme );
2760 }
2761
2762 return (status);
2763}
2764
2765/* ---------------------------------------------------------------------------
2766 \fn sme_RoamConnectToLastProfile
2767 \brief a wrapper function to request CSR to disconnect and reconnect with
2768 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08002769 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002770 \return eHalStatus. It returns fail if currently connected
2771 ---------------------------------------------------------------------------*/
2772eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
2773{
2774 eHalStatus status = eHAL_STATUS_FAILURE;
2775 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2776
2777 status = sme_AcquireGlobalLock( &pMac->sme );
2778 if ( HAL_STATUS_SUCCESS( status ) )
2779 {
2780 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2781 {
2782 status = csrRoamConnectToLastProfile( pMac, sessionId );
2783 }
2784 else
2785 {
2786 status = eHAL_STATUS_INVALID_PARAMETER;
2787 }
2788 sme_ReleaseGlobalLock( &pMac->sme );
2789 }
2790
2791 return (status);
2792}
2793
2794/* ---------------------------------------------------------------------------
2795 \fn sme_RoamDisconnect
2796 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08002797 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002798 \param reason -- To indicate the reason for disconnecting. Currently, only
2799 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
2800 \return eHalStatus
2801 ---------------------------------------------------------------------------*/
2802eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
2803{
2804 eHalStatus status = eHAL_STATUS_FAILURE;
2805 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2806
2807 smsLog(pMac, LOG2, FL("enter"));
2808 status = sme_AcquireGlobalLock( &pMac->sme );
2809 if ( HAL_STATUS_SUCCESS( status ) )
2810 {
2811 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2812 {
2813 status = csrRoamDisconnect( pMac, sessionId, reason );
2814 }
2815 else
2816 {
2817 status = eHAL_STATUS_INVALID_PARAMETER;
2818 }
2819 sme_ReleaseGlobalLock( &pMac->sme );
2820 }
2821
2822 return (status);
2823}
2824
Jeff Johnson295189b2012-06-20 16:38:30 -07002825/* ---------------------------------------------------------------------------
2826 \fn sme_RoamStopBss
2827 \brief To stop BSS for Soft AP. This is an asynchronous API.
2828 \param hHal - Global structure
2829 \param sessionId - sessionId of SoftAP
2830 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2831 -------------------------------------------------------------------------------*/
2832eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
2833{
2834 eHalStatus status = eHAL_STATUS_FAILURE;
2835 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2836
2837 smsLog(pMac, LOG2, FL("enter"));
2838 status = sme_AcquireGlobalLock( &pMac->sme );
2839 if ( HAL_STATUS_SUCCESS( status ) )
2840 {
2841 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2842 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05302843 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07002844 }
2845 else
2846 {
2847 status = eHAL_STATUS_INVALID_PARAMETER;
2848 }
2849 sme_ReleaseGlobalLock( &pMac->sme );
2850 }
2851
2852 return (status);
2853}
2854
2855/* ---------------------------------------------------------------------------
2856 \fn sme_RoamDisconnectSta
2857 \brief To disassociate a station. This is an asynchronous API.
2858 \param hHal - Global structure
2859 \param sessionId - sessionId of SoftAP
2860 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2861 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2862 -------------------------------------------------------------------------------*/
2863eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
2864 tANI_U8 *pPeerMacAddr)
2865{
2866 eHalStatus status = eHAL_STATUS_FAILURE;
2867 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2868
2869 if ( NULL == pMac )
2870 {
2871 VOS_ASSERT(0);
2872 return status;
2873 }
2874
2875 status = sme_AcquireGlobalLock( &pMac->sme );
2876 if ( HAL_STATUS_SUCCESS( status ) )
2877 {
2878 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2879 {
2880 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302881 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002882 }
2883 else
2884 {
2885 status = eHAL_STATUS_INVALID_PARAMETER;
2886 }
2887 sme_ReleaseGlobalLock( &pMac->sme );
2888 }
2889
2890 return (status);
2891}
2892
2893/* ---------------------------------------------------------------------------
2894 \fn sme_RoamDeauthSta
2895 \brief To disassociate a station. This is an asynchronous API.
2896 \param hHal - Global structure
2897 \param sessionId - sessionId of SoftAP
2898 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2899 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2900 -------------------------------------------------------------------------------*/
2901eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
2902 tANI_U8 *pPeerMacAddr)
2903{
2904 eHalStatus status = eHAL_STATUS_FAILURE;
2905 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2906
2907 if ( NULL == pMac )
2908 {
2909 VOS_ASSERT(0);
2910 return status;
2911 }
2912
2913 status = sme_AcquireGlobalLock( &pMac->sme );
2914 if ( HAL_STATUS_SUCCESS( status ) )
2915 {
2916 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2917 {
2918 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302919 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002920 }
2921 else
2922 {
2923 status = eHAL_STATUS_INVALID_PARAMETER;
2924 }
2925 sme_ReleaseGlobalLock( &pMac->sme );
2926 }
2927
2928 return (status);
2929}
2930
2931/* ---------------------------------------------------------------------------
2932 \fn sme_RoamTKIPCounterMeasures
2933 \brief To start or stop TKIP counter measures. This is an asynchronous API.
2934 \param sessionId - sessionId of SoftAP
2935 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2936 \return eHalStatus
2937 -------------------------------------------------------------------------------*/
2938eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
2939 tANI_BOOLEAN bEnable)
2940{
2941 eHalStatus status = eHAL_STATUS_FAILURE;
2942 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2943
2944 if ( NULL == pMac )
2945 {
2946 VOS_ASSERT(0);
2947 return status;
2948 }
2949
2950 status = sme_AcquireGlobalLock( &pMac->sme );
2951 if ( HAL_STATUS_SUCCESS( status ) )
2952 {
2953 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2954 {
2955 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
2956 }
2957 else
2958 {
2959 status = eHAL_STATUS_INVALID_PARAMETER;
2960 }
2961 sme_ReleaseGlobalLock( &pMac->sme );
2962 }
2963
2964 return (status);
2965}
2966
2967/* ---------------------------------------------------------------------------
2968 \fn sme_RoamGetAssociatedStas
2969 \brief To probe the list of associated stations from various modules of CORE stack.
2970 \This is an asynchronous API.
2971 \param sessionId - sessionId of SoftAP
2972 \param modId - Module from whom list of associtated stations is to be probed.
2973 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
2974 \param pUsrContext - Opaque HDD context
2975 \param pfnSapEventCallback - Sap event callback in HDD
2976 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
2977 \return eHalStatus
2978 -------------------------------------------------------------------------------*/
2979eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
2980 VOS_MODULE_ID modId, void *pUsrContext,
2981 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
2982{
2983 eHalStatus status = eHAL_STATUS_FAILURE;
2984 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2985
2986 if ( NULL == pMac )
2987 {
2988 VOS_ASSERT(0);
2989 return status;
2990 }
2991
2992 status = sme_AcquireGlobalLock( &pMac->sme );
2993 if ( HAL_STATUS_SUCCESS( status ) )
2994 {
2995 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2996 {
2997 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
2998 }
2999 else
3000 {
3001 status = eHAL_STATUS_INVALID_PARAMETER;
3002 }
3003 sme_ReleaseGlobalLock( &pMac->sme );
3004 }
3005
3006 return (status);
3007}
3008
3009/* ---------------------------------------------------------------------------
3010 \fn sme_RoamGetWpsSessionOverlap
3011 \brief To get the WPS PBC session overlap information.
3012 \This is an asynchronous API.
3013 \param sessionId - sessionId of SoftAP
3014 \param pUsrContext - Opaque HDD context
3015 \param pfnSapEventCallback - Sap event callback in HDD
3016 \pRemoveMac - pointer to Mac address which needs to be removed from session
3017 \return eHalStatus
3018 -------------------------------------------------------------------------------*/
3019eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
3020 void *pUsrContext, void
3021 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3022{
3023 eHalStatus status = eHAL_STATUS_FAILURE;
3024 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3025
3026 if ( NULL == pMac )
3027 {
3028 VOS_ASSERT(0);
3029 return status;
3030 }
3031
3032 status = sme_AcquireGlobalLock( &pMac->sme );
3033 if ( HAL_STATUS_SUCCESS( status ) )
3034 {
3035 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3036 {
3037 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3038 }
3039 else
3040 {
3041 status = eHAL_STATUS_INVALID_PARAMETER;
3042 }
3043 sme_ReleaseGlobalLock( &pMac->sme );
3044 }
3045
3046 return (status);
3047}
3048
Jeff Johnson295189b2012-06-20 16:38:30 -07003049
3050/* ---------------------------------------------------------------------------
3051 \fn sme_RoamGetConnectState
3052 \brief a wrapper function to request CSR to return the current connect state
3053 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003054 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003055 \return eHalStatus
3056 ---------------------------------------------------------------------------*/
3057eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3058{
3059 eHalStatus status = eHAL_STATUS_FAILURE;
3060 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3061
3062 status = sme_AcquireGlobalLock( &pMac->sme );
3063 if ( HAL_STATUS_SUCCESS( status ) )
3064 {
3065 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3066 {
3067 status = csrRoamGetConnectState( pMac, sessionId, pState );
3068 }
3069 else
3070 {
3071 status = eHAL_STATUS_INVALID_PARAMETER;
3072 }
3073 sme_ReleaseGlobalLock( &pMac->sme );
3074 }
3075
3076 return (status);
3077}
3078
3079/* ---------------------------------------------------------------------------
3080 \fn sme_RoamGetConnectProfile
3081 \brief a wrapper function to request CSR to return the current connect
3082 profile. Caller must call csrRoamFreeConnectProfile after it is done
3083 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003084 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003085 \param pProfile - pointer to a caller allocated structure
3086 tCsrRoamConnectedProfile
3087 \return eHalStatus. Failure if not connected
3088 ---------------------------------------------------------------------------*/
3089eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3090 tCsrRoamConnectedProfile *pProfile)
3091{
3092 eHalStatus status = eHAL_STATUS_FAILURE;
3093 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3094
3095 status = sme_AcquireGlobalLock( &pMac->sme );
3096 if ( HAL_STATUS_SUCCESS( status ) )
3097 {
3098 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3099 {
3100 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3101 }
3102 else
3103 {
3104 status = eHAL_STATUS_INVALID_PARAMETER;
3105 }
3106 sme_ReleaseGlobalLock( &pMac->sme );
3107 }
3108
3109 return (status);
3110}
3111
3112/* ---------------------------------------------------------------------------
3113 \fn sme_RoamFreeConnectProfile
3114 \brief a wrapper function to request CSR to free and reinitialize the
3115 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003116 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003117 \param pProfile - pointer to a caller allocated structure
3118 tCsrRoamConnectedProfile
3119 \return eHalStatus.
3120 ---------------------------------------------------------------------------*/
3121eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3122 tCsrRoamConnectedProfile *pProfile)
3123{
3124 eHalStatus status = eHAL_STATUS_FAILURE;
3125 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3126
3127 status = sme_AcquireGlobalLock( &pMac->sme );
3128 if ( HAL_STATUS_SUCCESS( status ) )
3129 {
3130 status = csrRoamFreeConnectProfile( pMac, pProfile );
3131 sme_ReleaseGlobalLock( &pMac->sme );
3132 }
3133
3134 return (status);
3135}
3136
3137/* ---------------------------------------------------------------------------
3138 \fn sme_RoamSetPMKIDCache
3139 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003140 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003141 \param pPMKIDCache - caller allocated buffer point to an array of
3142 tPmkidCacheInfo
3143 \param numItems - a variable that has the number of tPmkidCacheInfo
3144 allocated when retruning, this is either the number needed
3145 or number of items put into pPMKIDCache
3146 \return eHalStatus - when fail, it usually means the buffer allocated is not
3147 big enough and pNumItems has the number of
3148 tPmkidCacheInfo.
3149 \Note: pNumItems is a number of tPmkidCacheInfo,
3150 not sizeof(tPmkidCacheInfo) * something
3151 ---------------------------------------------------------------------------*/
3152eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
3153 tANI_U32 numItems )
3154{
3155 eHalStatus status = eHAL_STATUS_FAILURE;
3156 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3157
3158 status = sme_AcquireGlobalLock( &pMac->sme );
3159 if ( HAL_STATUS_SUCCESS( status ) )
3160 {
3161 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3162 {
3163 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
3164 }
3165 else
3166 {
3167 status = eHAL_STATUS_INVALID_PARAMETER;
3168 }
3169 sme_ReleaseGlobalLock( &pMac->sme );
3170 }
3171
3172 return (status);
3173}
3174
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003175eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId, tANI_U8 *pBSSId )
3176{
3177 eHalStatus status = eHAL_STATUS_FAILURE;
3178 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3179 status = sme_AcquireGlobalLock( &pMac->sme );
3180 if ( HAL_STATUS_SUCCESS( status ) )
3181 {
3182 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3183 {
3184 status = csrRoamDelPMKIDfromCache( pMac, sessionId, pBSSId );
3185 }
3186 else
3187 {
3188 status = eHAL_STATUS_INVALID_PARAMETER;
3189 }
3190 sme_ReleaseGlobalLock( &pMac->sme );
3191 }
3192 return (status);
3193}
Jeff Johnson295189b2012-06-20 16:38:30 -07003194/* ---------------------------------------------------------------------------
3195 \fn sme_RoamGetSecurityReqIE
3196 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3197 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003198 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003199 \param pLen - caller allocated memory that has the length of pBuf as input.
3200 Upon returned, *pLen has the needed or IE length in pBuf.
3201 \param pBuf - Caller allocated memory that contain the IE field, if any,
3202 upon return
3203 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3204 \return eHalStatus - when fail, it usually means the buffer allocated is not
3205 big enough
3206 ---------------------------------------------------------------------------*/
3207eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3208 tANI_U8 *pBuf, eCsrSecurityType secType)
3209{
3210 eHalStatus status = eHAL_STATUS_FAILURE;
3211 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3212
3213 status = sme_AcquireGlobalLock( &pMac->sme );
3214 if ( HAL_STATUS_SUCCESS( status ) )
3215 {
3216 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3217 {
3218 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3219 }
3220 else
3221 {
3222 status = eHAL_STATUS_INVALID_PARAMETER;
3223 }
3224 sme_ReleaseGlobalLock( &pMac->sme );
3225 }
3226
3227 return (status);
3228}
3229
3230/* ---------------------------------------------------------------------------
3231 \fn sme_RoamGetSecurityRspIE
3232 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3233 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003234 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003235 \param pLen - caller allocated memory that has the length of pBuf as input.
3236 Upon returned, *pLen has the needed or IE length in pBuf.
3237 \param pBuf - Caller allocated memory that contain the IE field, if any,
3238 upon return
3239 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3240 \return eHalStatus - when fail, it usually means the buffer allocated is not
3241 big enough
3242 ---------------------------------------------------------------------------*/
3243eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3244 tANI_U8 *pBuf, eCsrSecurityType secType)
3245{
3246 eHalStatus status = eHAL_STATUS_FAILURE;
3247 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3248
3249 status = sme_AcquireGlobalLock( &pMac->sme );
3250 if ( HAL_STATUS_SUCCESS( status ) )
3251 {
3252 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3253 {
3254 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3255 }
3256 else
3257 {
3258 status = eHAL_STATUS_INVALID_PARAMETER;
3259 }
3260 sme_ReleaseGlobalLock( &pMac->sme );
3261 }
3262
3263 return (status);
3264
3265}
3266
3267
3268/* ---------------------------------------------------------------------------
3269 \fn sme_RoamGetNumPMKIDCache
3270 \brief a wrapper function to request CSR to return number of PMKID cache
3271 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003272 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003273 \return tANI_U32 - the number of PMKID cache entries
3274 ---------------------------------------------------------------------------*/
3275tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3276{
3277 eHalStatus status = eHAL_STATUS_FAILURE;
3278 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3279 tANI_U32 numPmkidCache = 0;
3280
3281 status = sme_AcquireGlobalLock( &pMac->sme );
3282 if ( HAL_STATUS_SUCCESS( status ) )
3283 {
3284 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3285 {
3286 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3287 status = eHAL_STATUS_SUCCESS;
3288 }
3289 else
3290 {
3291 status = eHAL_STATUS_INVALID_PARAMETER;
3292 }
3293 sme_ReleaseGlobalLock( &pMac->sme );
3294 }
3295
3296 return (numPmkidCache);
3297}
3298
3299/* ---------------------------------------------------------------------------
3300 \fn sme_RoamGetPMKIDCache
3301 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003302 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003303 \param pNum - caller allocated memory that has the space of the number of
3304 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3305 needed or actually number in tPmkidCacheInfo.
3306 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3307 any, upon return
3308 \return eHalStatus - when fail, it usually means the buffer allocated is not
3309 big enough
3310 ---------------------------------------------------------------------------*/
3311eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3312 tPmkidCacheInfo *pPmkidCache)
3313{
3314 eHalStatus status = eHAL_STATUS_FAILURE;
3315 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3316
3317 status = sme_AcquireGlobalLock( &pMac->sme );
3318 if ( HAL_STATUS_SUCCESS( status ) )
3319 {
3320 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3321 {
3322 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3323 }
3324 else
3325 {
3326 status = eHAL_STATUS_INVALID_PARAMETER;
3327 }
3328 sme_ReleaseGlobalLock( &pMac->sme );
3329 }
3330
3331 return (status);
3332}
3333
3334
3335/* ---------------------------------------------------------------------------
3336 \fn sme_GetConfigParam
3337 \brief a wrapper function that HDD calls to get the global settings
3338 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003339 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003340 \param pParam - caller allocated memory
3341 \return eHalStatus
3342 ---------------------------------------------------------------------------*/
3343eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3344{
3345 eHalStatus status = eHAL_STATUS_FAILURE;
3346 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3347
3348 status = sme_AcquireGlobalLock( &pMac->sme );
3349 if ( HAL_STATUS_SUCCESS( status ) )
3350 {
3351 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3352 if (status != eHAL_STATUS_SUCCESS)
3353 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003354 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003355 sme_ReleaseGlobalLock( &pMac->sme );
3356 return status;
3357 }
3358#if defined WLAN_FEATURE_P2P_INTERNAL
3359 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3360 if (status != eHAL_STATUS_SUCCESS)
3361 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003362 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003363 sme_ReleaseGlobalLock( &pMac->sme );
3364 return status;
3365 }
3366#endif
3367 sme_ReleaseGlobalLock( &pMac->sme );
3368 }
3369
3370 return (status);
3371}
3372
3373/* ---------------------------------------------------------------------------
3374 \fn sme_CfgSetInt
3375 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003376 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003377 \param cfgId - Configuration Parameter ID (type) for STA.
3378 \param ccmValue - The information related to Configuration Parameter ID
3379 which needs to be saved in CFG
3380 \param callback - To be registered by CSR with CCM. Once the CFG done with
3381 saving the information in the database, it notifies CCM &
3382 then the callback will be invoked to notify.
3383 \param toBeSaved - To save the request for future reference
3384 \return eHalStatus
3385 ---------------------------------------------------------------------------*/
3386eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3387 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3388{
3389 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3390}
3391
3392/* ---------------------------------------------------------------------------
3393 \fn sme_CfgSetStr
3394 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003395 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003396 \param cfgId - Configuration Parameter ID (type) for STA.
3397 \param pStr - Pointer to the byte array which carries the information needs
3398 to be saved in CFG
3399 \param length - Length of the data to be saved
3400 \param callback - To be registered by CSR with CCM. Once the CFG done with
3401 saving the information in the database, it notifies CCM &
3402 then the callback will be invoked to notify.
3403 \param toBeSaved - To save the request for future reference
3404 \return eHalStatus
3405 ---------------------------------------------------------------------------*/
3406eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3407 tANI_U32 length, tCcmCfgSetCallback callback,
3408 eAniBoolean toBeSaved)
3409{
3410 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3411}
3412
3413/* ---------------------------------------------------------------------------
3414 \fn sme_GetModifyProfileFields
3415 \brief HDD or SME - QOS calls this function to get the current values of
3416 connected profile fields, changing which can cause reassoc.
3417 This function must be called after CFG is downloaded and STA is in connected
3418 state. Also, make sure to call this function to get the current profile
3419 fields before calling the reassoc. So that pModifyProfileFields will have
3420 all the latest values plus the one(s) has been updated as part of reassoc
3421 request.
3422 \param pModifyProfileFields - pointer to the connected profile fields
3423 changing which can cause reassoc
3424
3425 \return eHalStatus
3426 -------------------------------------------------------------------------------*/
3427eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3428 tCsrRoamModifyProfileFields * pModifyProfileFields)
3429{
3430 eHalStatus status = eHAL_STATUS_FAILURE;
3431 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3432
3433 status = sme_AcquireGlobalLock( &pMac->sme );
3434 if ( HAL_STATUS_SUCCESS( status ) )
3435 {
3436 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3437 {
3438 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3439 }
3440 else
3441 {
3442 status = eHAL_STATUS_INVALID_PARAMETER;
3443 }
3444 sme_ReleaseGlobalLock( &pMac->sme );
3445 }
3446
3447 return (status);
3448}
3449
3450/*--------------------------------------------------------------------------
3451 \fn sme_SetConfigPowerSave
3452 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3453 For BMPS related configuration, this function also updates the CFG
3454 and sends a message to FW to pick up the new values. Note: Calling
3455 this function only updates the configuration and does not enable
3456 the specified power save mode.
3457 \param hHal - The handle returned by macOpen.
3458 \param psMode - Power Saving mode being modified
3459 \param pConfigParams - a pointer to a caller allocated object of type
3460 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3461 \return eHalStatus
3462 --------------------------------------------------------------------------*/
3463eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3464 void *pConfigParams)
3465{
3466 eHalStatus status = eHAL_STATUS_FAILURE;
3467 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3468
3469 if (NULL == pConfigParams ) {
3470 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3471 "nothing to update");
3472 return eHAL_STATUS_FAILURE;
3473 }
3474
3475 status = sme_AcquireGlobalLock( &pMac->sme );
3476 if ( HAL_STATUS_SUCCESS( status ) )
3477 {
3478 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3479 sme_ReleaseGlobalLock( &pMac->sme );
3480 }
3481
3482 return (status);
3483}
3484
3485/*--------------------------------------------------------------------------
3486 \fn sme_GetConfigPowerSave
3487 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3488 \param hHal - The handle returned by macOpen.
3489 \param psMode - Power Saving mode
3490 \param pConfigParams - a pointer to a caller allocated object of type
3491 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3492 \return eHalStatus
3493 --------------------------------------------------------------------------*/
3494eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3495 void *pConfigParams)
3496{
3497 eHalStatus status = eHAL_STATUS_FAILURE;
3498 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3499
3500 if (NULL == pConfigParams ) {
3501 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3502 "nothing to update");
3503 return eHAL_STATUS_FAILURE;
3504 }
3505
3506 status = sme_AcquireGlobalLock( &pMac->sme );
3507 if ( HAL_STATUS_SUCCESS( status ) )
3508 {
3509 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3510 sme_ReleaseGlobalLock( &pMac->sme );
3511 }
3512
3513 return (status);
3514}
3515
3516/* ---------------------------------------------------------------------------
3517 \fn sme_SignalPowerEvent
3518 \brief Signals to PMC that a power event has occurred. Used for putting
3519 the chip into deep sleep mode.
3520 \param hHal - The handle returned by macOpen.
3521 \param event - the event that has occurred
3522 \return eHalStatus
3523 ---------------------------------------------------------------------------*/
3524eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3525{
3526 eHalStatus status = eHAL_STATUS_FAILURE;
3527 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3528
3529 status = sme_AcquireGlobalLock( &pMac->sme );
3530 if ( HAL_STATUS_SUCCESS( status ) )
3531 {
3532 status = pmcSignalPowerEvent(hHal, event);
3533 sme_ReleaseGlobalLock( &pMac->sme );
3534 }
3535
3536 return (status);
3537}
3538
3539/* ---------------------------------------------------------------------------
3540 \fn sme_EnablePowerSave
3541 \brief Enables one of the power saving modes.
3542 \param hHal - The handle returned by macOpen.
3543 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3544 while the chip is operating in Full Power, PMC will start
3545 a timer that will try to put the chip in BMPS mode after
3546 expiry.
3547 \return eHalStatus
3548 ---------------------------------------------------------------------------*/
3549eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3550{
3551 eHalStatus status = eHAL_STATUS_FAILURE;
3552 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3553
3554 status = sme_AcquireGlobalLock( &pMac->sme );
3555 if ( HAL_STATUS_SUCCESS( status ) )
3556 {
3557 status = pmcEnablePowerSave(hHal, psMode);
3558 sme_ReleaseGlobalLock( &pMac->sme );
3559 }
3560
3561 return (status);
3562}
3563
3564/* ---------------------------------------------------------------------------
3565 \fn sme_DisablePowerSave
3566 \brief Disables one of the power saving modes.
3567 \param hHal - The handle returned by macOpen.
3568 \param psMode - The power saving mode to disable. Disabling does not imply
3569 that device will be brought out of the current PS mode. This
3570 is purely a configuration API.
3571 \return eHalStatus
3572 ---------------------------------------------------------------------------*/
3573eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3574{
3575 eHalStatus status = eHAL_STATUS_FAILURE;
3576 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3577
3578 status = sme_AcquireGlobalLock( &pMac->sme );
3579 if ( HAL_STATUS_SUCCESS( status ) )
3580 {
3581 status = pmcDisablePowerSave(hHal, psMode);
3582 sme_ReleaseGlobalLock( &pMac->sme );
3583 }
3584
3585 return (status);
3586 }
3587
3588/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303589+ \fn sme_SetHostPowerSave
3590+ \brief Enables BMPS logic to be controlled by User level apps
3591+ \param hHal - The handle returned by macOpen.
3592+ \param psMode - The power saving mode to disable. Disabling does not imply
3593+ that device will be brought out of the current PS mode. This
3594+ is purely a configuration API.
3595+ \return eHalStatus
3596+ ---------------------------------------------------------------------------*/
3597eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3598{
3599 eHalStatus status = eHAL_STATUS_FAILURE;
3600 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3601
3602 pMac->pmc.isHostPsEn = psMode;
3603
3604 return (status);
3605}
3606
3607/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003608 \fn sme_StartAutoBmpsTimer
3609 \brief Starts a timer that periodically polls all the registered
3610 module for entry into Bmps mode. This timer is started only if BMPS is
3611 enabled and whenever the device is in full power.
3612 \param hHal - The handle returned by macOpen.
3613 \return eHalStatus
3614 ---------------------------------------------------------------------------*/
3615eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3616{
3617 eHalStatus status = eHAL_STATUS_FAILURE;
3618 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3619
3620 status = sme_AcquireGlobalLock( &pMac->sme );
3621 if ( HAL_STATUS_SUCCESS( status ) )
3622 {
3623 status = pmcStartAutoBmpsTimer(hHal);
3624 sme_ReleaseGlobalLock( &pMac->sme );
3625 }
3626
3627 return (status);
3628}
3629/* ---------------------------------------------------------------------------
3630 \fn sme_StopAutoBmpsTimer
3631 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3632 Stopping the timer does not cause a device state change. Only the timer
3633 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3634 \param hHal - The handle returned by macOpen.
3635 \return eHalStatus
3636 ---------------------------------------------------------------------------*/
3637eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3638{
3639 eHalStatus status = eHAL_STATUS_FAILURE;
3640 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3641
3642 status = sme_AcquireGlobalLock( &pMac->sme );
3643 if ( HAL_STATUS_SUCCESS( status ) )
3644 {
3645 status = pmcStopAutoBmpsTimer(hHal);
3646 sme_ReleaseGlobalLock( &pMac->sme );
3647 }
3648
3649 return (status);
3650}
3651/* ---------------------------------------------------------------------------
3652 \fn sme_QueryPowerState
3653 \brief Returns the current power state of the device.
3654 \param hHal - The handle returned by macOpen.
3655 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3656 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3657 \return eHalStatus
3658 ---------------------------------------------------------------------------*/
3659eHalStatus sme_QueryPowerState (
3660 tHalHandle hHal,
3661 tPmcPowerState *pPowerState,
3662 tPmcSwitchState *pSwWlanSwitchState)
3663{
3664 eHalStatus status = eHAL_STATUS_FAILURE;
3665 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3666
3667 status = sme_AcquireGlobalLock( &pMac->sme );
3668 if ( HAL_STATUS_SUCCESS( status ) )
3669 {
3670 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3671 sme_ReleaseGlobalLock( &pMac->sme );
3672 }
3673
3674 return (status);
3675}
3676
3677/* ---------------------------------------------------------------------------
3678 \fn sme_IsPowerSaveEnabled
3679 \brief Checks if the device is able to enter a particular power save mode
3680 This does not imply that the device is in a particular PS mode
3681 \param hHal - The handle returned by macOpen.
3682 \param psMode - the power saving mode
3683 \return eHalStatus
3684 ---------------------------------------------------------------------------*/
3685tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
3686{
3687 eHalStatus status = eHAL_STATUS_FAILURE;
3688 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3689 tANI_BOOLEAN result = false;
3690
3691 status = sme_AcquireGlobalLock( &pMac->sme );
3692 if ( HAL_STATUS_SUCCESS( status ) )
3693 {
3694 result = pmcIsPowerSaveEnabled(hHal, psMode);
3695 sme_ReleaseGlobalLock( &pMac->sme );
3696 return result;
3697 }
3698
3699 return false;
3700}
3701
3702/* ---------------------------------------------------------------------------
3703 \fn sme_RequestFullPower
3704 \brief Request that the device be brought to full power state. When the
3705 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
3706 is enabled. On timer expiry PMC will attempt to put the device in
3707 BMPS mode if following holds true:
3708 - BMPS mode is enabled
3709 - Polling of all modules through the Power Save Check routine passes
3710 - STA is associated to an access point
3711 \param hHal - The handle returned by macOpen.
3712 \param - callbackRoutine Callback routine invoked in case of success/failure
3713 \return eHalStatus - status
3714 eHAL_STATUS_SUCCESS - device brought to full power state
3715 eHAL_STATUS_FAILURE - device cannot be brought to full power state
3716 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
3717 ---------------------------------------------------------------------------*/
3718eHalStatus sme_RequestFullPower (
3719 tHalHandle hHal,
3720 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3721 void *callbackContext,
3722 tRequestFullPowerReason fullPowerReason)
3723{
3724 eHalStatus status = eHAL_STATUS_FAILURE;
3725 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3726
3727 status = sme_AcquireGlobalLock( &pMac->sme );
3728 if ( HAL_STATUS_SUCCESS( status ) )
3729 {
3730 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
3731 sme_ReleaseGlobalLock( &pMac->sme );
3732 }
3733
3734 return (status);
3735}
3736
3737/* ---------------------------------------------------------------------------
3738 \fn sme_RequestBmps
3739 \brief Request that the device be put in BMPS state. Request will be
3740 accepted only if BMPS mode is enabled and power save check routine
3741 passes.
3742 \param hHal - The handle returned by macOpen.
3743 \param - callbackRoutine Callback routine invoked in case of success/failure
3744 \return eHalStatus
3745 eHAL_STATUS_SUCCESS - device is in BMPS state
3746 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
3747 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
3748 ---------------------------------------------------------------------------*/
3749eHalStatus sme_RequestBmps (
3750 tHalHandle hHal,
3751 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3752 void *callbackContext)
3753{
3754 eHalStatus status = eHAL_STATUS_FAILURE;
3755 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3756
3757 status = sme_AcquireGlobalLock( &pMac->sme );
3758 if ( HAL_STATUS_SUCCESS( status ) )
3759 {
3760 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
3761 sme_ReleaseGlobalLock( &pMac->sme );
3762 }
3763
3764 return (status);
3765}
3766
3767
3768/* ---------------------------------------------------------------------------
3769 \fn sme_SetDHCPTillPowerActiveFlag
3770 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
3771 entry by PMC
3772 \param hHal - The handle returned by macOpen.
3773 ---------------------------------------------------------------------------*/
3774void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
3775{
3776 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3777
3778 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
3779 pMac->pmc.remainInPowerActiveTillDHCP = flag;
3780}
3781
3782
3783/* ---------------------------------------------------------------------------
3784 \fn sme_StartUapsd
3785 \brief Request that the device be put in UAPSD state. If the device is in
3786 Full Power it will be put in BMPS mode first and then into UAPSD
3787 mode.
3788 \param hHal - The handle returned by macOpen.
3789 \param - callbackRoutine Callback routine invoked in case of success/failure
3790 eHAL_STATUS_SUCCESS - device is in UAPSD state
3791 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
3792 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
3793 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
3794 \return eHalStatus
3795 ---------------------------------------------------------------------------*/
3796eHalStatus sme_StartUapsd (
3797 tHalHandle hHal,
3798 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3799 void *callbackContext)
3800{
3801 eHalStatus status = eHAL_STATUS_FAILURE;
3802 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3803
3804 status = sme_AcquireGlobalLock( &pMac->sme );
3805 if ( HAL_STATUS_SUCCESS( status ) )
3806 {
3807 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
3808 sme_ReleaseGlobalLock( &pMac->sme );
3809 }
3810
3811 return (status);
3812 }
3813
3814/* ---------------------------------------------------------------------------
3815 \fn sme_StopUapsd
3816 \brief Request that the device be put out of UAPSD state. Device will be
3817 put in in BMPS state after stop UAPSD completes.
3818 \param hHal - The handle returned by macOpen.
3819 \return eHalStatus
3820 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
3821 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
3822 ---------------------------------------------------------------------------*/
3823eHalStatus sme_StopUapsd (tHalHandle hHal)
3824{
3825 eHalStatus status = eHAL_STATUS_FAILURE;
3826 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3827
3828 status = sme_AcquireGlobalLock( &pMac->sme );
3829 if ( HAL_STATUS_SUCCESS( status ) )
3830 {
3831 status = pmcStopUapsd(hHal);
3832 sme_ReleaseGlobalLock( &pMac->sme );
3833 }
3834
3835 return (status);
3836}
3837
3838/* ---------------------------------------------------------------------------
3839 \fn sme_RequestStandby
3840 \brief Request that the device be put in standby. It is HDD's responsibility
3841 to bring the chip to full power and do a disassoc before calling
3842 this API.
3843 \param hHal - The handle returned by macOpen.
3844 \param - callbackRoutine Callback routine invoked in case of success/failure
3845 \return eHalStatus
3846 eHAL_STATUS_SUCCESS - device is in Standby mode
3847 eHAL_STATUS_FAILURE - device cannot be put in standby mode
3848 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
3849 ---------------------------------------------------------------------------*/
3850eHalStatus sme_RequestStandby (
3851 tHalHandle hHal,
3852 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3853 void *callbackContext)
3854{
3855 eHalStatus status = eHAL_STATUS_FAILURE;
3856 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3857
3858 smsLog( pMac, LOG1, FL("") );
3859 status = sme_AcquireGlobalLock( &pMac->sme );
3860 if ( HAL_STATUS_SUCCESS( status ) )
3861 {
3862 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
3863 sme_ReleaseGlobalLock( &pMac->sme );
3864 }
3865
3866 return (status);
3867}
3868
3869/* ---------------------------------------------------------------------------
3870 \fn sme_RegisterPowerSaveCheck
3871 \brief Register a power save check routine that is called whenever
3872 the device is about to enter one of the power save modes.
3873 \param hHal - The handle returned by macOpen.
3874 \param checkRoutine - Power save check routine to be registered
3875 \return eHalStatus
3876 eHAL_STATUS_SUCCESS - successfully registered
3877 eHAL_STATUS_FAILURE - not successfully registered
3878 ---------------------------------------------------------------------------*/
3879eHalStatus sme_RegisterPowerSaveCheck (
3880 tHalHandle hHal,
3881 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
3882{
3883 eHalStatus status = eHAL_STATUS_FAILURE;
3884 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3885
3886 status = sme_AcquireGlobalLock( &pMac->sme );
3887 if ( HAL_STATUS_SUCCESS( status ) )
3888 {
3889 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
3890 sme_ReleaseGlobalLock( &pMac->sme );
3891 }
3892
3893 return (status);
3894}
3895
3896/* ---------------------------------------------------------------------------
3897 \fn sme_DeregisterPowerSaveCheck
3898 \brief Deregister a power save check routine
3899 \param hHal - The handle returned by macOpen.
3900 \param checkRoutine - Power save check routine to be deregistered
3901 \return eHalStatus
3902 eHAL_STATUS_SUCCESS - successfully deregistered
3903 eHAL_STATUS_FAILURE - not successfully deregistered
3904 ---------------------------------------------------------------------------*/
3905eHalStatus sme_DeregisterPowerSaveCheck (
3906 tHalHandle hHal,
3907 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
3908{
3909 eHalStatus status = eHAL_STATUS_FAILURE;
3910 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3911
3912 status = sme_AcquireGlobalLock( &pMac->sme );
3913 if ( HAL_STATUS_SUCCESS( status ) )
3914 {
3915 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
3916 sme_ReleaseGlobalLock( &pMac->sme );
3917 }
3918
3919 return (status);
3920}
3921
3922/* ---------------------------------------------------------------------------
3923 \fn sme_RegisterDeviceStateUpdateInd
3924 \brief Register a callback routine that is called whenever
3925 the device enters a new device state (Full Power, BMPS, UAPSD)
3926 \param hHal - The handle returned by macOpen.
3927 \param callbackRoutine - Callback routine to be registered
3928 \param callbackContext - Cookie to be passed back during callback
3929 \return eHalStatus
3930 eHAL_STATUS_SUCCESS - successfully registered
3931 eHAL_STATUS_FAILURE - not successfully registered
3932 ---------------------------------------------------------------------------*/
3933eHalStatus sme_RegisterDeviceStateUpdateInd (
3934 tHalHandle hHal,
3935 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
3936 void *callbackContext)
3937{
3938 eHalStatus status = eHAL_STATUS_FAILURE;
3939 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3940
3941 status = sme_AcquireGlobalLock( &pMac->sme );
3942 if ( HAL_STATUS_SUCCESS( status ) )
3943 {
3944 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
3945 sme_ReleaseGlobalLock( &pMac->sme );
3946 }
3947
3948 return (status);
3949}
3950
3951/* ---------------------------------------------------------------------------
3952 \fn sme_DeregisterDeviceStateUpdateInd
3953 \brief Deregister a routine that was registered for device state changes
3954 \param hHal - The handle returned by macOpen.
3955 \param callbackRoutine - Callback routine to be deregistered
3956 \return eHalStatus
3957 eHAL_STATUS_SUCCESS - successfully deregistered
3958 eHAL_STATUS_FAILURE - not successfully deregistered
3959 ---------------------------------------------------------------------------*/
3960eHalStatus sme_DeregisterDeviceStateUpdateInd (
3961 tHalHandle hHal,
3962 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
3963{
3964 eHalStatus status = eHAL_STATUS_FAILURE;
3965 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3966
3967 status = sme_AcquireGlobalLock( &pMac->sme );
3968 if ( HAL_STATUS_SUCCESS( status ) )
3969 {
3970 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
3971 sme_ReleaseGlobalLock( &pMac->sme );
3972 }
3973
3974 return (status);
3975}
3976
3977/* ---------------------------------------------------------------------------
3978 \fn sme_WowlAddBcastPattern
3979 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
3980 do a pattern match on these patterns when Wowl is enabled during BMPS
3981 mode. Note that Firmware performs the pattern matching only on
3982 broadcast frames and while Libra is in BMPS mode.
3983 \param hHal - The handle returned by macOpen.
3984 \param pattern - Pattern to be added
3985 \return eHalStatus
3986 eHAL_STATUS_FAILURE Cannot add pattern
3987 eHAL_STATUS_SUCCESS Request accepted.
3988 ---------------------------------------------------------------------------*/
3989eHalStatus sme_WowlAddBcastPattern (
3990 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003991 tpSirWowlAddBcastPtrn pattern,
3992 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003993{
3994 eHalStatus status = eHAL_STATUS_FAILURE;
3995 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3996 status = sme_AcquireGlobalLock( &pMac->sme );
3997 if ( HAL_STATUS_SUCCESS( status ) )
3998 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003999 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004000 sme_ReleaseGlobalLock( &pMac->sme );
4001 }
4002
4003 return (status);
4004}
4005
4006/* ---------------------------------------------------------------------------
4007 \fn sme_WowlDelBcastPattern
4008 \brief Delete a pattern that was added for Pattern Byte Matching.
4009 \param hHal - The handle returned by macOpen.
4010 \param pattern - Pattern to be deleted
4011 \return eHalStatus
4012 eHAL_STATUS_FAILURE Cannot delete pattern
4013 eHAL_STATUS_SUCCESS Request accepted.
4014 ---------------------------------------------------------------------------*/
4015eHalStatus sme_WowlDelBcastPattern (
4016 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004017 tpSirWowlDelBcastPtrn pattern,
4018 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004019{
4020 eHalStatus status = eHAL_STATUS_FAILURE;
4021 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4022 status = sme_AcquireGlobalLock( &pMac->sme );
4023 if ( HAL_STATUS_SUCCESS( status ) )
4024 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004025 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004026 sme_ReleaseGlobalLock( &pMac->sme );
4027 }
4028
4029 return (status);
4030}
4031
4032/* ---------------------------------------------------------------------------
4033 \fn sme_EnterWowl
4034 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4035 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4036 SME will will cache the information that WOWL has been enabled and
4037 attempt to put the device in BMPS. On entry into BMPS, SME will
4038 enable the WOWL mode.
4039 Note 1: If we exit BMPS mode (someone requests full power), we
4040 will NOT resume WOWL when we go back to BMPS again. Request for full
4041 power (while in WOWL mode) means disable WOWL and go to full power.
4042 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4043 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4044 are required. Currently there is no requirement or use case to support
4045 UAPSD and WOWL at the same time.
4046
4047 \param hHal - The handle returned by macOpen.
4048 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4049 Used for success/failure notification by SME
4050 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4051 at the time of callback.
4052 \param wakeReasonIndCB - Callback routine provided by HDD.
4053 Used for Wake Reason Indication by SME
4054 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4055 at the time of callback.
4056 \return eHalStatus
4057 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4058 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4059 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4060 BMPS mode is entered.
4061 ---------------------------------------------------------------------------*/
4062eHalStatus sme_EnterWowl (
4063 tHalHandle hHal,
4064 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4065 void *enterWowlCallbackContext,
4066#ifdef WLAN_WAKEUP_EVENTS
4067 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4068 void *wakeIndicationCBContext,
4069#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004070 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004071{
4072 eHalStatus status = eHAL_STATUS_FAILURE;
4073 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4074 status = sme_AcquireGlobalLock( &pMac->sme );
4075 if ( HAL_STATUS_SUCCESS( status ) )
4076 {
4077 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
4078#ifdef WLAN_WAKEUP_EVENTS
4079 wakeIndicationCB, wakeIndicationCBContext,
4080#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004081 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004082 sme_ReleaseGlobalLock( &pMac->sme );
4083 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004084 return (status);
4085}
4086/* ---------------------------------------------------------------------------
4087 \fn sme_ExitWowl
4088 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4089 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4090 mode.
4091 \param hHal - The handle returned by macOpen.
4092 \return eHalStatus
4093 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4094 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4095 ---------------------------------------------------------------------------*/
4096eHalStatus sme_ExitWowl (tHalHandle hHal)
4097{
4098 eHalStatus status = eHAL_STATUS_FAILURE;
4099 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4100 status = sme_AcquireGlobalLock( &pMac->sme );
4101 if ( HAL_STATUS_SUCCESS( status ) )
4102 {
4103 status = pmcExitWowl (hHal);
4104 sme_ReleaseGlobalLock( &pMac->sme );
4105 }
4106
4107 return (status);
4108}
4109
4110/* ---------------------------------------------------------------------------
4111
4112 \fn sme_RoamSetKey
4113
4114 \brief To set encryption key. This function should be called only when connected
4115 This is an asynchronous API.
4116
4117 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4118
4119 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4120
4121 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4122
4123 FAILURE or RESOURCES The API finished and failed.
4124
4125 -------------------------------------------------------------------------------*/
4126eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4127{
4128 eHalStatus status = eHAL_STATUS_FAILURE;
4129 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4130 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004131 tANI_U32 i;
4132 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004133
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004134 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4135 {
4136 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4137 return eHAL_STATUS_FAILURE;
4138 }
4139
Jeff Johnson295189b2012-06-20 16:38:30 -07004140 status = sme_AcquireGlobalLock( &pMac->sme );
4141 if ( HAL_STATUS_SUCCESS( status ) )
4142 {
4143 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4144 if(pRoamId)
4145 {
4146 *pRoamId = roamId;
4147 }
4148
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004149 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004150
4151 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004152 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004153
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004154 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004155
4156 pSession = CSR_GET_SESSION(pMac, sessionId);
4157
Jeff Johnson32d95a32012-09-10 13:15:23 -07004158 if(!pSession)
4159 {
4160 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004161 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004162 return eHAL_STATUS_FAILURE;
4163 }
4164
Jeff Johnson295189b2012-06-20 16:38:30 -07004165 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4166 {
4167 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4168 {
4169 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4170 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4171 {
4172 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4173 }
4174 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4175 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4176 {
4177 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4178 }
4179 }
4180 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004181
4182 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4183 sme_ReleaseGlobalLock( &pMac->sme );
4184 }
4185
4186 return (status);
4187}
4188
4189
4190/* ---------------------------------------------------------------------------
4191
4192 \fn sme_RoamRemoveKey
4193
4194 \brief To set encryption key. This is an asynchronous API.
4195
4196 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4197
4198 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4199
4200 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4201
4202 FAILURE or RESOURCES The API finished and failed.
4203
4204 -------------------------------------------------------------------------------*/
4205eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4206 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4207{
4208 eHalStatus status = eHAL_STATUS_FAILURE;
4209 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4210 tANI_U32 roamId;
4211
4212 status = sme_AcquireGlobalLock( &pMac->sme );
4213 if ( HAL_STATUS_SUCCESS( status ) )
4214 {
4215 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4216 if(pRoamId)
4217 {
4218 *pRoamId = roamId;
4219 }
4220 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4221 sme_ReleaseGlobalLock( &pMac->sme );
4222 }
4223
4224 return (status);
4225}
4226
4227/* ---------------------------------------------------------------------------
4228 \fn sme_GetRssi
4229 \brief a wrapper function that client calls to register a callback to get RSSI
4230
4231 \param callback - SME sends back the requested stats using the callback
4232 \param staId - The station ID for which the stats is requested for
4233 \param pContext - user context to be passed back along with the callback
4234 \param pVosContext - vos context
4235 \return eHalStatus
4236 ---------------------------------------------------------------------------*/
4237eHalStatus sme_GetRssi(tHalHandle hHal,
4238 tCsrRssiCallback callback,
4239 tANI_U8 staId, tCsrBssid bssId,
4240 void *pContext, void* pVosContext)
4241{
4242 eHalStatus status = eHAL_STATUS_FAILURE;
4243 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4244
4245 status = sme_AcquireGlobalLock( &pMac->sme );
4246 if ( HAL_STATUS_SUCCESS( status ) )
4247 {
4248 status = csrGetRssi( pMac, callback,
4249 staId, bssId, pContext, pVosContext);
4250 sme_ReleaseGlobalLock( &pMac->sme );
4251 }
4252 return (status);
4253}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304254
4255/* ---------------------------------------------------------------------------
4256 \fn sme_GetSnr
4257 \brief a wrapper function that client calls to register a callback to
4258 get SNR
4259
4260 \param callback - SME sends back the requested stats using the callback
4261 \param staId - The station ID for which the stats is requested for
4262 \param pContext - user context to be passed back along with the callback
4263 \param pVosContext - vos context
4264 \return eHalStatus
4265 ---------------------------------------------------------------------------*/
4266eHalStatus sme_GetSnr(tHalHandle hHal,
4267 tCsrSnrCallback callback,
4268 tANI_U8 staId, tCsrBssid bssId,
4269 void *pContext)
4270{
4271 eHalStatus status = eHAL_STATUS_FAILURE;
4272 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4273
4274 status = sme_AcquireGlobalLock( &pMac->sme );
4275 if ( HAL_STATUS_SUCCESS( status ) )
4276 {
4277 status = csrGetSnr(pMac, callback,
4278 staId, bssId, pContext);
4279 sme_ReleaseGlobalLock( &pMac->sme );
4280 }
4281 return status;
4282}
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004283#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
4284/* ---------------------------------------------------------------------------
4285 \fn sme_GetRoamRssi
4286 \brief a wrapper function that client calls to register a callback to get Roam RSSI
4287
4288 \param callback - SME sends back the requested stats using the callback
4289 \param staId - The station ID for which the stats is requested for
4290 \param pContext - user context to be passed back along with the callback
4291 \param pVosContext - vos context
4292 \return eHalStatus
4293 ---------------------------------------------------------------------------*/
4294eHalStatus sme_GetRoamRssi(tHalHandle hHal,
4295 tCsrRssiCallback callback,
4296 tANI_U8 staId, tCsrBssid bssId,
4297 void *pContext, void* pVosContext)
4298{
4299 eHalStatus status = eHAL_STATUS_FAILURE;
4300 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4301
4302 status = sme_AcquireGlobalLock( &pMac->sme );
4303 if ( HAL_STATUS_SUCCESS( status ) )
4304 {
4305 status = csrGetRoamRssi( pMac, callback,
4306 staId, bssId, pContext, pVosContext);
4307 sme_ReleaseGlobalLock( &pMac->sme );
4308 }
4309 return (status);
4310}
4311#endif
4312
Jeff Johnson295189b2012-06-20 16:38:30 -07004313
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004314#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
4315/* ---------------------------------------------------------------------------
4316 \fn sme_GetTsmStats
4317 \brief a wrapper function that client calls to register a callback to get TSM Stats
4318
4319 \param callback - SME sends back the requested stats using the callback
4320 \param staId - The station ID for which the stats is requested for
4321 \param pContext - user context to be passed back along with the callback
4322 \param pVosContext - vos context
4323 \return eHalStatus
4324 ---------------------------------------------------------------------------*/
4325eHalStatus sme_GetTsmStats(tHalHandle hHal,
4326 tCsrTsmStatsCallback callback,
4327 tANI_U8 staId, tCsrBssid bssId,
4328 void *pContext, void* pVosContext, tANI_U8 tid)
4329{
4330 eHalStatus status = eHAL_STATUS_FAILURE;
4331 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4332
4333 status = sme_AcquireGlobalLock( &pMac->sme );
4334 if ( HAL_STATUS_SUCCESS( status ) )
4335 {
4336 status = csrGetTsmStats( pMac, callback,
4337 staId, bssId, pContext, pVosContext, tid);
4338 sme_ReleaseGlobalLock( &pMac->sme );
4339 }
4340 return (status);
4341}
4342#endif
4343
4344
Jeff Johnson295189b2012-06-20 16:38:30 -07004345/* ---------------------------------------------------------------------------
4346 \fn sme_GetStatistics
4347 \brief a wrapper function that client calls to register a callback to get
4348 different PHY level statistics from CSR.
4349
4350 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
4351 \param statsMask - The different category/categories of stats requester is looking for
4352 \param callback - SME sends back the requested stats using the callback
4353 \param periodicity - If requester needs periodic update in millisec, 0 means
4354 it's an one time request
4355 \param cache - If requester is happy with cached stats
4356 \param staId - The station ID for which the stats is requested for
4357 \param pContext - user context to be passed back along with the callback
4358 \return eHalStatus
4359 ---------------------------------------------------------------------------*/
4360eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
4361 tANI_U32 statsMask,
4362 tCsrStatsCallback callback,
4363 tANI_U32 periodicity, tANI_BOOLEAN cache,
4364 tANI_U8 staId, void *pContext)
4365{
4366 eHalStatus status = eHAL_STATUS_FAILURE;
4367 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4368
4369 status = sme_AcquireGlobalLock( &pMac->sme );
4370 if ( HAL_STATUS_SUCCESS( status ) )
4371 {
4372 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
4373 periodicity, cache, staId, pContext);
4374 sme_ReleaseGlobalLock( &pMac->sme );
4375 }
4376
4377 return (status);
4378
4379}
4380
4381/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05304382 \fn smeGetTLSTAState
4383 \helper function to get the TL STA State whenever the function is called.
4384
4385 \param staId - The staID to be passed to the TL
4386 to get the relevant TL STA State
4387 \return the state as tANI_U16
4388 ---------------------------------------------------------------------------*/
4389tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
4390{
4391 tANI_U16 tlSTAState = TL_INIT_STATE;
4392 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4393 eHalStatus status = eHAL_STATUS_FAILURE;
4394
4395 status = sme_AcquireGlobalLock( &pMac->sme );
4396 if ( HAL_STATUS_SUCCESS( status ) )
4397 {
4398 tlSTAState = csrGetTLSTAState( pMac, staId);
4399 sme_ReleaseGlobalLock( &pMac->sme );
4400 }
4401
4402 return tlSTAState;
4403}
4404
4405/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004406
4407 \fn sme_GetCountryCode
4408
4409 \brief To return the current country code. If no country code is applied, default country code is
4410 used to fill the buffer.
4411 If 11d supported is turned off, an error is return and the last applied/default country code is used.
4412 This is a synchronous API.
4413
4414 \param pBuf - pointer to a caller allocated buffer for returned country code.
4415
4416 \param pbLen For input, this parameter indicates how big is the buffer.
4417 Upon return, this parameter has the number of bytes for country. If pBuf
4418 doesn't have enough space, this function returns
4419 fail status and this parameter contains the number that is needed.
4420
4421 \return eHalStatus SUCCESS.
4422
4423 FAILURE or RESOURCES The API finished and failed.
4424
4425 -------------------------------------------------------------------------------*/
4426eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
4427{
4428 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4429
4430 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
4431}
4432
4433
4434/* ---------------------------------------------------------------------------
4435
4436 \fn sme_SetCountryCode
4437
4438 \brief To change the current/default country code.
4439 If 11d supported is turned off, an error is return.
4440 This is a synchronous API.
4441
4442 \param pCountry - pointer to a caller allocated buffer for the country code.
4443
4444 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
4445 whether a reset is required.
4446
4447 \return eHalStatus SUCCESS.
4448
4449 FAILURE or RESOURCES The API finished and failed.
4450
4451 -------------------------------------------------------------------------------*/
4452eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
4453{
4454 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4455
4456 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4457}
4458
4459
4460/* ---------------------------------------------------------------------------
4461 \fn sme_ResetCountryCodeInformation
4462 \brief this function is to reset the country code current being used back to EEPROM default
4463 this includes channel list and power setting. This is a synchronous API.
4464 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4465 a restart is needed to apply the change
4466 \return eHalStatus
4467 -------------------------------------------------------------------------------*/
4468eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4469{
4470 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4471
4472 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4473}
4474
4475
4476/* ---------------------------------------------------------------------------
4477 \fn sme_GetSupportedCountryCode
4478 \brief this function is to get a list of the country code current being supported
4479 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4480 this has the country code list. 3 bytes for each country code. This may be NULL if
4481 caller wants to know the needed byte count.
4482 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4483 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4484 \return eHalStatus
4485 -------------------------------------------------------------------------------*/
4486eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4487{
4488 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4489
4490 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4491}
4492
4493
4494/* ---------------------------------------------------------------------------
4495 \fn sme_GetCurrentRegulatoryDomain
4496 \brief this function is to get the current regulatory domain. This is a synchronous API.
4497 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4498 SME. The function fails if 11d support is turned off.
4499 \param pDomain - Caller allocated buffer to return the current domain.
4500 \return eHalStatus SUCCESS.
4501
4502 FAILURE or RESOURCES The API finished and failed.
4503 -------------------------------------------------------------------------------*/
4504eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4505{
4506 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4507 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4508
4509 if( pDomain )
4510 {
4511 if( csrIs11dSupported( pMac ) )
4512 {
4513 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4514 status = eHAL_STATUS_SUCCESS;
4515 }
4516 else
4517 {
4518 status = eHAL_STATUS_FAILURE;
4519 }
4520 }
4521
4522 return ( status );
4523}
4524
4525
4526/* ---------------------------------------------------------------------------
4527 \fn sme_SetRegulatoryDomain
4528 \brief this function is to set the current regulatory domain.
4529 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4530 SME. This is a synchronous API.
4531 \param domainId - indicate the domain (defined in the driver) needs to set to.
4532 See v_REGDOMAIN_t for definition
4533 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4534 a restart is needed to apply the change
4535 \return eHalStatus
4536 -------------------------------------------------------------------------------*/
4537eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4538{
4539 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4540
4541 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4542}
4543
4544
4545/* ---------------------------------------------------------------------------
4546
4547 \fn sme_GetRegulatoryDomainForCountry
4548
4549 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4550
4551 \param pCountry - pointer to a caller allocated buffer for input country code.
4552
4553 \param pDomainId Upon successful return, it is the domain that country belongs to.
4554 If it is NULL, returning success means that the country code is known.
4555
4556 \return eHalStatus SUCCESS.
4557
4558 FAILURE or RESOURCES The API finished and failed.
4559
4560 -------------------------------------------------------------------------------*/
4561eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4562{
4563 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4564
Kiet Lam6c583332013-10-14 05:37:09 +05304565 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
4566 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07004567}
4568
4569
4570
4571
4572/* ---------------------------------------------------------------------------
4573
4574 \fn sme_GetSupportedRegulatoryDomains
4575
4576 \brief To return a list of supported regulatory domains. This is a synchronous API.
4577
4578 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4579
4580 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4581 Upon return, this parameter has the number for supported domains. If pDomains
4582 doesn't have enough space for all the supported domains, this function returns
4583 fail status and this parameter contains the number that is needed.
4584
4585 \return eHalStatus SUCCESS.
4586
4587 FAILURE or RESOURCES The API finished and failed.
4588
4589 -------------------------------------------------------------------------------*/
4590eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4591{
4592 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4593
4594 //We support all domains for now
4595 if( pNumDomains )
4596 {
4597 if( NUM_REG_DOMAINS <= *pNumDomains )
4598 {
4599 status = eHAL_STATUS_SUCCESS;
4600 }
4601 *pNumDomains = NUM_REG_DOMAINS;
4602 }
4603 if( HAL_STATUS_SUCCESS( status ) )
4604 {
4605 if( pDomains )
4606 {
4607 pDomains[0] = REGDOMAIN_FCC;
4608 pDomains[1] = REGDOMAIN_ETSI;
4609 pDomains[2] = REGDOMAIN_JAPAN;
4610 pDomains[3] = REGDOMAIN_WORLD;
4611 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
4612 pDomains[5] = REGDOMAIN_APAC;
4613 pDomains[6] = REGDOMAIN_KOREA;
4614 pDomains[7] = REGDOMAIN_HI_5GHZ;
4615 pDomains[8] = REGDOMAIN_NO_5GHZ;
4616 }
4617 else
4618 {
4619 status = eHAL_STATUS_INVALID_PARAMETER;
4620 }
4621 }
4622
4623 return ( status );
4624}
4625
4626
4627//some support functions
4628tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
4629{
4630 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4631
4632 return ( csrIs11dSupported( pMac ) );
4633}
4634
4635
4636tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
4637{
4638 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4639
4640 return ( csrIs11hSupported( pMac ) );
4641}
4642
4643
4644tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
4645{
4646 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4647
4648 return ( csrIsWmmSupported( pMac ) );
4649}
4650
4651//Upper layer to get the list of the base channels to scan for passively 11d info from csr
4652eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
4653{
4654 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4655
4656 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
4657}
4658
4659/* ---------------------------------------------------------------------------
4660
4661 \fn sme_ChangeCountryCode
4662
4663 \brief Change Country code from upperlayer during WLAN driver operation.
4664 This is a synchronous API.
4665
4666 \param hHal - The handle returned by macOpen.
4667
4668 \param pCountry New Country Code String
4669
4670 \return eHalStatus SUCCESS.
4671
4672 FAILURE or RESOURCES The API finished and failed.
4673
4674 -------------------------------------------------------------------------------*/
4675eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
4676 tSmeChangeCountryCallback callback,
4677 tANI_U8 *pCountry,
4678 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304679 void* pVosContext,
4680 tAniBool countryFromUserSpace )
Jeff Johnson295189b2012-06-20 16:38:30 -07004681{
4682 eHalStatus status = eHAL_STATUS_FAILURE;
4683 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4684 vos_msg_t msg;
4685 tAniChangeCountryCodeReq *pMsg;
4686
4687 status = sme_AcquireGlobalLock( &pMac->sme );
4688 if ( HAL_STATUS_SUCCESS( status ) )
4689 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004690 smsLog(pMac, LOG1, FL(" called"));
Kiet Lam64c1b492013-07-12 13:56:44 +05304691 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
4692 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07004693 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004694 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004695 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05304696 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004697 }
4698
4699 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
4700 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05304701 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304702 pMsg->countryFromUserSpace = countryFromUserSpace;
Jeff Johnson295189b2012-06-20 16:38:30 -07004703 pMsg->changeCCCallback = callback;
4704 pMsg->pDevContext = pContext;
4705 pMsg->pVosContext = pVosContext;
4706
4707 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
4708 msg.bodyptr = pMsg;
4709 msg.reserved = 0;
4710
4711 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
4712 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004713 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05304714 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07004715 status = eHAL_STATUS_FAILURE;
4716 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004717 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004718 sme_ReleaseGlobalLock( &pMac->sme );
4719 }
4720
4721 return (status);
4722}
Amar Singhal0d15bd52013-10-12 23:13:13 -07004723
4724/*--------------------------------------------------------------------------
4725
4726 \fn sme_GenericChangeCountryCode
4727
4728 \brief Change Country code from upperlayer during WLAN driver operation.
4729 This is a synchronous API.
4730
4731 \param hHal - The handle returned by macOpen.
4732
4733 \param pCountry New Country Code String
4734
4735 \param reg_domain regulatory domain
4736
4737 \return eHalStatus SUCCESS.
4738
4739 FAILURE or RESOURCES The API finished and failed.
4740
4741-----------------------------------------------------------------------------*/
4742eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
4743 tANI_U8 *pCountry,
4744 v_REGDOMAIN_t reg_domain)
4745{
4746 eHalStatus status = eHAL_STATUS_FAILURE;
4747 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4748 vos_msg_t msg;
4749 tAniGenericChangeCountryCodeReq *pMsg;
4750
Kiet Lamcffc5862013-10-30 16:28:45 +05304751 if (NULL == pMac)
4752 {
4753 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
4754 "%s: pMac is null", __func__);
4755 return status;
4756 }
4757
Amar Singhal0d15bd52013-10-12 23:13:13 -07004758 status = sme_AcquireGlobalLock( &pMac->sme );
4759 if ( HAL_STATUS_SUCCESS( status ) )
4760 {
4761 smsLog(pMac, LOG1, FL(" called"));
4762 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg,
4763 sizeof(tAniGenericChangeCountryCodeReq));
4764
4765 if (!HAL_STATUS_SUCCESS(status))
4766 {
4767 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
4768 sme_ReleaseGlobalLock( &pMac->sme );
4769 return status;
4770 }
4771
4772 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
4773 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
4774 palCopyMemory(pMac->hHdd, pMsg->countryCode, pCountry, 3);
4775 pMsg->domain_index = reg_domain;
4776
4777 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
4778 msg.bodyptr = pMsg;
4779 msg.reserved = 0;
4780
4781 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
4782 {
4783 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
4784 palFreeMemory(pMac->hHdd, (void *)pMsg);
4785 status = eHAL_STATUS_FAILURE;
4786 }
4787 smsLog(pMac, LOG1, FL(" returned"));
4788 sme_ReleaseGlobalLock( &pMac->sme );
4789 }
4790
4791 return (status);
4792}
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05304793/* ---------------------------------------------------------------------------
4794
4795 \fn sme_DHCPStartInd
4796
4797 \brief API to signal the FW about the DHCP Start event.
4798
4799 \param hHal - HAL handle for device.
4800
4801 \param device_mode - mode(AP,SAP etc) of the device.
4802
4803 \param macAddr - MAC address of the device.
4804
4805 \return eHalStatus SUCCESS.
4806
4807 FAILURE or RESOURCES The API finished and failed.
4808 --------------------------------------------------------------------------*/
4809eHalStatus sme_DHCPStartInd( tHalHandle hHal,
4810 tANI_U8 device_mode,
4811 tANI_U8 *macAddr )
4812{
4813 eHalStatus status;
4814 VOS_STATUS vosStatus;
4815 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4816 vos_msg_t vosMessage;
4817 tAniDHCPInd *pMsg;
4818
4819 status = sme_AcquireGlobalLock(&pMac->sme);
4820 if ( eHAL_STATUS_SUCCESS == status)
4821 {
4822 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
4823 if (NULL == pMsg)
4824 {
4825 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4826 "%s: Not able to allocate memory for dhcp start", __func__);
4827 sme_ReleaseGlobalLock( &pMac->sme );
4828 return eHAL_STATUS_FAILURE;
4829 }
4830 pMsg->msgType = WDA_DHCP_START_IND;
4831 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
4832 pMsg->device_mode = device_mode;
4833 vos_mem_copy( pMsg->macAddr, macAddr, sizeof(tSirMacAddr));
4834
4835 vosMessage.type = WDA_DHCP_START_IND;
4836 vosMessage.bodyptr = pMsg;
4837 vosMessage.reserved = 0;
4838
4839 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
4840 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
4841 {
4842 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4843 "%s: Post DHCP Start MSG fail", __func__);
4844 vos_mem_free(pMsg);
4845 status = eHAL_STATUS_FAILURE;
4846 }
4847 sme_ReleaseGlobalLock( &pMac->sme );
4848 }
4849 return (status);
4850}
4851/* ---------------------------------------------------------------------------
4852 \fn sme_DHCPStopInd
4853
4854 \brief API to signal the FW about the DHCP complete event.
4855
4856 \param hHal - HAL handle for device.
4857
4858 \param device_mode - mode(AP, SAP etc) of the device.
4859
4860 \param macAddr - MAC address of the device.
4861
4862 \return eHalStatus SUCCESS.
4863 FAILURE or RESOURCES The API finished and failed.
4864 --------------------------------------------------------------------------*/
4865eHalStatus sme_DHCPStopInd( tHalHandle hHal,
4866 tANI_U8 device_mode,
4867 tANI_U8 *macAddr )
4868{
4869 eHalStatus status;
4870 VOS_STATUS vosStatus;
4871 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4872 vos_msg_t vosMessage;
4873 tAniDHCPInd *pMsg;
4874
4875 status = sme_AcquireGlobalLock(&pMac->sme);
4876 if ( eHAL_STATUS_SUCCESS == status)
4877 {
4878 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
4879 if (NULL == pMsg)
4880 {
4881 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4882 "%s: Not able to allocate memory for dhcp stop", __func__);
4883 sme_ReleaseGlobalLock( &pMac->sme );
4884 return eHAL_STATUS_FAILURE;
4885 }
4886
4887 pMsg->msgType = WDA_DHCP_STOP_IND;
4888 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
4889 pMsg->device_mode = device_mode;
4890 vos_mem_copy( pMsg->macAddr, macAddr, sizeof(tSirMacAddr));
4891
4892 vosMessage.type = WDA_DHCP_STOP_IND;
4893 vosMessage.bodyptr = pMsg;
4894 vosMessage.reserved = 0;
4895
4896 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
4897 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
4898 {
4899 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4900 "%s: Post DHCP Stop MSG fail", __func__);
4901 vos_mem_free(pMsg);
4902 status = eHAL_STATUS_FAILURE;
4903 }
4904
4905 sme_ReleaseGlobalLock( &pMac->sme );
4906 }
4907 return (status);
4908}
4909
Jeff Johnson295189b2012-06-20 16:38:30 -07004910
4911/* ---------------------------------------------------------------------------
4912 \fn sme_BtcSignalBtEvent
4913 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
4914 BT event type and the current operating mode of Libra (full power,
4915 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
4916 would be employed.
4917 \param hHal - The handle returned by macOpen.
4918 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
4919 Caller owns the memory and is responsible for freeing it.
4920 \return VOS_STATUS
4921 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
4922 if BTC execution mode is set to BTC_WLAN_ONLY
4923 or BTC_PTA_ONLY.
4924 VOS_STATUS_SUCCESS BT Event passed to HAL
4925 ---------------------------------------------------------------------------*/
4926VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
4927{
4928 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4929#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4930 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4931
4932 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4933 {
4934 status = btcSignalBTEvent (hHal, pBtEvent);
4935 sme_ReleaseGlobalLock( &pMac->sme );
4936 }
4937#endif
4938 return (status);
4939}
4940
4941/* ---------------------------------------------------------------------------
4942 \fn sme_BtcSetConfig
4943 \brief API to change the current Bluetooth Coexistence (BTC) configuration
4944 This function should be invoked only after CFG download has completed.
4945 Calling it after sme_HDDReadyInd is recommended.
4946 \param hHal - The handle returned by macOpen.
4947 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
4948 Caller owns the memory and is responsible for freeing it.
4949 \return VOS_STATUS
4950 VOS_STATUS_E_FAILURE Config not passed to HAL.
4951 VOS_STATUS_SUCCESS Config passed to HAL
4952 ---------------------------------------------------------------------------*/
4953VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4954{
4955 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4956#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4957 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4958 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4959 {
4960 status = btcSetConfig (hHal, pSmeBtcConfig);
4961 sme_ReleaseGlobalLock( &pMac->sme );
4962 }
4963#endif
4964 return (status);
4965}
4966
4967/* ---------------------------------------------------------------------------
4968 \fn sme_BtcGetConfig
4969 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
4970 \param hHal - The handle returned by macOpen.
4971 \param pSmeBtcConfig - Pointer to a caller allocated object of type
4972 tSmeBtcConfig. Caller owns the memory and is responsible
4973 for freeing it.
4974 \return VOS_STATUS
4975 VOS_STATUS_E_FAILURE - failure
4976 VOS_STATUS_SUCCESS success
4977 ---------------------------------------------------------------------------*/
4978VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4979{
4980 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4981#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4982 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4983
4984 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4985 {
4986 status = btcGetConfig (hHal, pSmeBtcConfig);
4987 sme_ReleaseGlobalLock( &pMac->sme );
4988 }
4989#endif
4990 return (status);
4991}
4992/* ---------------------------------------------------------------------------
4993 \fn sme_SetCfgPrivacy
4994 \brief API to set configure privacy parameters
4995 \param hHal - The handle returned by macOpen.
4996 \param pProfile - Pointer CSR Roam profile.
4997 \param fPrivacy - This parameter indicates status of privacy
4998
4999 \return void
5000 ---------------------------------------------------------------------------*/
5001void sme_SetCfgPrivacy( tHalHandle hHal,
5002 tCsrRoamProfile *pProfile,
5003 tANI_BOOLEAN fPrivacy
5004 )
5005{
5006 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5007 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5008 {
5009 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5010 sme_ReleaseGlobalLock( &pMac->sme );
5011 }
5012}
5013
5014#if defined WLAN_FEATURE_VOWIFI
5015/* ---------------------------------------------------------------------------
5016 \fn sme_NeighborReportRequest
5017 \brief API to request neighbor report.
5018 \param hHal - The handle returned by macOpen.
5019 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5020 tRrmNeighborReq. Caller owns the memory and is responsible
5021 for freeing it.
5022 \return VOS_STATUS
5023 VOS_STATUS_E_FAILURE - failure
5024 VOS_STATUS_SUCCESS success
5025 ---------------------------------------------------------------------------*/
5026VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5027 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5028{
5029 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5030 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5031
5032 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5033 {
5034 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5035 sme_ReleaseGlobalLock( &pMac->sme );
5036 }
5037
5038 return (status);
5039}
5040#endif
5041
5042//The following are debug APIs to support direct read/write register/memory
5043//They are placed in SME because HW cannot be access when in LOW_POWER state
5044//AND not connected. The knowledge and synchronization is done in SME
5045
5046//sme_DbgReadRegister
5047//Caller needs to validate the input values
5048VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
5049{
5050 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5051 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005052 tPmcPowerState PowerState;
5053 tANI_U32 sessionId = 0;
5054
5055 /* 1) To make Quarky work in FTM mode **************************************/
5056
5057 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5058 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005059 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005060 {
5061 return VOS_STATUS_SUCCESS;
5062 }
5063 return VOS_STATUS_E_FAILURE;
5064 }
5065
5066 /* 2) NON FTM mode driver *************************************************/
5067
5068 /* Acquire SME global lock */
5069 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5070 {
5071 return VOS_STATUS_E_FAILURE;
5072 }
5073
5074 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5075 {
5076 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5077 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5078 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005079 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005080 {
5081 status = VOS_STATUS_SUCCESS;
5082 }
5083 else
5084 {
5085 status = VOS_STATUS_E_FAILURE;
5086 }
5087 }
5088 else
5089 {
5090 status = VOS_STATUS_E_FAILURE;
5091 }
5092 }
5093
5094 /* This is a hack for Qualky/pttWniSocket
5095 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5096 if ( VOS_STATUS_SUCCESS != status )
5097 {
5098 *pRegValue = 0xDEADBEEF;
5099 status = VOS_STATUS_SUCCESS;
5100 }
5101
5102 /* Release SME global lock */
5103 sme_ReleaseGlobalLock(&pMac->sme);
5104
5105 return (status);
5106}
5107
5108
5109//sme_DbgWriteRegister
5110//Caller needs to validate the input values
5111VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
5112{
5113 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5114 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005115 tPmcPowerState PowerState;
5116 tANI_U32 sessionId = 0;
5117
5118 /* 1) To make Quarky work in FTM mode **************************************/
5119
5120 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5121 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005122 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005123 {
5124 return VOS_STATUS_SUCCESS;
5125 }
5126 return VOS_STATUS_E_FAILURE;
5127 }
5128
5129 /* 2) NON FTM mode driver *************************************************/
5130
5131 /* Acquire SME global lock */
5132 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5133 {
5134 return VOS_STATUS_E_FAILURE;
5135 }
5136
5137 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5138 {
5139 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5140 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5141 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005142 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005143 {
5144 status = VOS_STATUS_SUCCESS;
5145 }
5146 else
5147 {
5148 status = VOS_STATUS_E_FAILURE;
5149 }
5150 }
5151 else
5152 {
5153 status = VOS_STATUS_E_FAILURE;
5154 }
5155 }
5156
5157 /* Release SME global lock */
5158 sme_ReleaseGlobalLock(&pMac->sme);
5159
5160 return (status);
5161}
5162
5163
5164
5165//sme_DbgReadMemory
5166//Caller needs to validate the input values
5167//pBuf caller allocated buffer has the length of nLen
5168VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5169{
5170 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5171 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07005172 tPmcPowerState PowerState;
5173 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005174 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
5175 tANI_U32 arg1 = memAddr;
5176 tANI_U32 arg2 = nLen/4;
5177 tANI_U32 arg3 = 4;
5178 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005179 /* 1) To make Quarky work in FTM mode **************************************/
5180
5181 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5182 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005183 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005184 {
5185 return VOS_STATUS_SUCCESS;
5186 }
5187 return VOS_STATUS_E_FAILURE;
5188 }
5189
5190 /* 2) NON FTM mode driver *************************************************/
5191
5192 /* Acquire SME global lock */
5193 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5194 {
5195 return VOS_STATUS_E_FAILURE;
5196 }
5197
5198 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5199 {
5200 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5201 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5202 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005203 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005204 {
5205 status = VOS_STATUS_SUCCESS;
5206 }
5207 else
5208 {
5209 status = VOS_STATUS_E_FAILURE;
5210 }
5211 }
5212 else
5213 {
5214 status = VOS_STATUS_E_FAILURE;
5215 }
5216 }
5217
5218 /* This is a hack for Qualky/pttWniSocket
5219 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5220 if (VOS_STATUS_SUCCESS != status)
5221 {
5222 vos_mem_set(pBuf, nLen, 0xCD);
5223 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005224 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005225 }
5226
5227 /* Release SME lock */
5228 sme_ReleaseGlobalLock(&pMac->sme);
5229
5230 return (status);
5231}
5232
5233
5234//sme_DbgWriteMemory
5235//Caller needs to validate the input values
5236VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5237{
5238 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5239 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005240 tPmcPowerState PowerState;
5241 tANI_U32 sessionId = 0;
5242
5243 /* 1) To make Quarky work in FTM mode **************************************/
5244
5245 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5246 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005247 {
5248 return VOS_STATUS_SUCCESS;
5249 }
5250 return VOS_STATUS_E_FAILURE;
5251 }
5252
5253 /* 2) NON FTM mode driver *************************************************/
5254
5255 /* Acquire SME global lock */
5256 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5257 {
5258 return VOS_STATUS_E_FAILURE;
5259 }
5260
5261 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5262 {
5263 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5264 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5265 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005266 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07005267 {
5268 status = VOS_STATUS_SUCCESS;
5269 }
5270 else
5271 {
5272 status = VOS_STATUS_E_FAILURE;
5273 }
5274 }
5275 else
5276 {
5277 status = VOS_STATUS_E_FAILURE;
5278 }
5279 }
5280
5281 /* Release Global lock */
5282 sme_ReleaseGlobalLock(&pMac->sme);
5283
5284 return (status);
5285}
5286
5287
Katya Nigam70d68332013-09-16 16:49:45 +05305288void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
5289{
5290 VOS_TRACE_LEVEL vosDebugLevel;
5291 char logBuffer[LOG_SIZE];
5292 va_list marker;
5293
5294 /* getting proper Debug level */
5295 vosDebugLevel = getVosDebugLevel(loglevel);
5296
5297 /* extracting arguments from pstring */
5298 va_start( marker, pString );
5299 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
5300
5301 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
5302 va_end( marker );
5303}
5304
5305
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005306void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07005307{
5308#ifdef WLAN_DEBUG
5309 // Verify against current log level
5310 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
5311 return;
5312 else
5313 {
5314 va_list marker;
5315
5316 va_start( marker, pString ); /* Initialize variable arguments. */
5317
5318 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
5319
5320 va_end( marker ); /* Reset variable arguments. */
5321 }
5322#endif
5323}
Jeff Johnson295189b2012-06-20 16:38:30 -07005324
Jeff Johnson295189b2012-06-20 16:38:30 -07005325/* ---------------------------------------------------------------------------
5326 \fn sme_GetWcnssWlanCompiledVersion
5327 \brief This API returns the version of the WCNSS WLAN API with
5328 which the HOST driver was built
5329 \param hHal - The handle returned by macOpen.
5330 \param pVersion - Points to the Version structure to be filled
5331 \return VOS_STATUS
5332 VOS_STATUS_E_INVAL - failure
5333 VOS_STATUS_SUCCESS success
5334 ---------------------------------------------------------------------------*/
5335VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
5336 tSirVersionType *pVersion)
5337{
5338 VOS_STATUS status = VOS_STATUS_SUCCESS;
5339 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5340 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5341
5342 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5343 {
5344 if( pVersion != NULL )
5345 {
5346 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
5347 }
5348 else
5349 {
5350 status = VOS_STATUS_E_INVAL;
5351 }
5352 sme_ReleaseGlobalLock( &pMac->sme );
5353 }
5354
5355 return (status);
5356}
5357
5358
5359/* ---------------------------------------------------------------------------
5360 \fn sme_GetWcnssWlanReportedVersion
5361 \brief This API returns the version of the WCNSS WLAN API with
5362 which the WCNSS driver reports it was built
5363 \param hHal - The handle returned by macOpen.
5364 \param pVersion - Points to the Version structure to be filled
5365 \return VOS_STATUS
5366 VOS_STATUS_E_INVAL - failure
5367 VOS_STATUS_SUCCESS success
5368 ---------------------------------------------------------------------------*/
5369VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
5370 tSirVersionType *pVersion)
5371{
5372 VOS_STATUS status = VOS_STATUS_SUCCESS;
5373 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5374 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5375
5376 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5377 {
5378 if( pVersion != NULL )
5379 {
5380 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
5381 }
5382 else
5383 {
5384 status = VOS_STATUS_E_INVAL;
5385 }
5386 sme_ReleaseGlobalLock( &pMac->sme );
5387 }
5388
5389 return (status);
5390}
5391
5392
5393/* ---------------------------------------------------------------------------
5394 \fn sme_GetWcnssSoftwareVersion
5395 \brief This API returns the version string of the WCNSS driver
5396 \param hHal - The handle returned by macOpen.
5397 \param pVersion - Points to the Version string buffer to be filled
5398 \param versionBufferSize - THe size of the Version string buffer
5399 \return VOS_STATUS
5400 VOS_STATUS_E_INVAL - failure
5401 VOS_STATUS_SUCCESS success
5402 ---------------------------------------------------------------------------*/
5403VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
5404 tANI_U8 *pVersion,
5405 tANI_U32 versionBufferSize)
5406{
5407 VOS_STATUS status = VOS_STATUS_SUCCESS;
5408 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5409 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5410
5411 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5412 {
5413 if( pVersion != NULL )
5414 {
5415 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
5416 versionBufferSize);
5417 }
5418 else
5419 {
5420 status = VOS_STATUS_E_INVAL;
5421 }
5422 sme_ReleaseGlobalLock( &pMac->sme );
5423 }
5424
5425 return (status);
5426}
5427
5428
5429/* ---------------------------------------------------------------------------
5430 \fn sme_GetWcnssHardwareVersion
5431 \brief This API returns the version string of the WCNSS hardware
5432 \param hHal - The handle returned by macOpen.
5433 \param pVersion - Points to the Version string buffer to be filled
5434 \param versionBufferSize - THe size of the Version string buffer
5435 \return VOS_STATUS
5436 VOS_STATUS_E_INVAL - failure
5437 VOS_STATUS_SUCCESS success
5438 ---------------------------------------------------------------------------*/
5439VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
5440 tANI_U8 *pVersion,
5441 tANI_U32 versionBufferSize)
5442{
5443 VOS_STATUS status = VOS_STATUS_SUCCESS;
5444 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5445 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5446
5447 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5448 {
5449 if( pVersion != NULL )
5450 {
5451 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
5452 versionBufferSize);
5453 }
5454 else
5455 {
5456 status = VOS_STATUS_E_INVAL;
5457 }
5458 sme_ReleaseGlobalLock( &pMac->sme );
5459 }
5460
5461 return (status);
5462}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08005463
Jeff Johnson295189b2012-06-20 16:38:30 -07005464
5465#ifdef FEATURE_WLAN_WAPI
5466/* ---------------------------------------------------------------------------
5467 \fn sme_RoamSetBKIDCache
5468 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
5469 candidate list.
5470 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5471 it is opened (by calling halOpen).
5472 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
5473 \param numItems - a variable that has the number of tBkidCacheInfo allocated
5474 when retruning, this is the number of items put into pBKIDCache
5475 \return eHalStatus - when fail, it usually means the buffer allocated is not
5476 big enough and pNumItems has the number of tBkidCacheInfo.
5477 ---------------------------------------------------------------------------*/
5478eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
5479 tANI_U32 numItems )
5480{
5481 eHalStatus status = eHAL_STATUS_FAILURE;
5482 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5483
5484 status = sme_AcquireGlobalLock( &pMac->sme );
5485 if ( HAL_STATUS_SUCCESS( status ) )
5486 {
5487 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
5488 sme_ReleaseGlobalLock( &pMac->sme );
5489 }
5490
5491 return (status);
5492}
5493
5494/* ---------------------------------------------------------------------------
5495 \fn sme_RoamGetBKIDCache
5496 \brief The SME API exposed to HDD to allow HDD to request SME to return its
5497 BKID cache.
5498 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5499 it is opened (by calling halOpen).
5500 \param pNum - caller allocated memory that has the space of the number of
5501 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
5502 in SME cache.
5503 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
5504 upon return
5505 \return eHalStatus - when fail, it usually means the buffer allocated is not
5506 big enough.
5507 ---------------------------------------------------------------------------*/
5508eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
5509 tBkidCacheInfo *pBkidCache)
5510{
5511 eHalStatus status = eHAL_STATUS_FAILURE;
5512 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5513
5514 status = sme_AcquireGlobalLock( &pMac->sme );
5515 if ( HAL_STATUS_SUCCESS( status ) )
5516 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005517 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005518 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
5519 sme_ReleaseGlobalLock( &pMac->sme );
5520 }
5521
5522 return (status);
5523}
5524
5525/* ---------------------------------------------------------------------------
5526 \fn sme_RoamGetNumBKIDCache
5527 \brief The SME API exposed to HDD to allow HDD to request SME to return the
5528 number of BKID cache entries.
5529 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5530 it is opened (by calling halOpen).
5531 \return tANI_U32 - the number of BKID cache entries.
5532 ---------------------------------------------------------------------------*/
5533tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
5534{
5535 eHalStatus status = eHAL_STATUS_FAILURE;
5536 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5537 tANI_U32 numBkidCache = 0;
5538
5539 status = sme_AcquireGlobalLock( &pMac->sme );
5540 if ( HAL_STATUS_SUCCESS( status ) )
5541 {
5542 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
5543 sme_ReleaseGlobalLock( &pMac->sme );
5544 }
5545
5546 return (numBkidCache);
5547}
5548
5549/* ---------------------------------------------------------------------------
5550 \fn sme_ScanGetBKIDCandidateList
5551 \brief a wrapper function to return the BKID candidate list
5552 \param pBkidList - caller allocated buffer point to an array of
5553 tBkidCandidateInfo
5554 \param pNumItems - pointer to a variable that has the number of
5555 tBkidCandidateInfo allocated when retruning, this is
5556 either the number needed or number of items put into
5557 pPmkidList
5558 \return eHalStatus - when fail, it usually means the buffer allocated is not
5559 big enough and pNumItems
5560 has the number of tBkidCandidateInfo.
5561 \Note: pNumItems is a number of tBkidCandidateInfo,
5562 not sizeof(tBkidCandidateInfo) * something
5563 ---------------------------------------------------------------------------*/
5564eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
5565 tBkidCandidateInfo *pBkidList,
5566 tANI_U32 *pNumItems )
5567{
5568 eHalStatus status = eHAL_STATUS_FAILURE;
5569 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5570
5571 status = sme_AcquireGlobalLock( &pMac->sme );
5572 if ( HAL_STATUS_SUCCESS( status ) )
5573 {
5574 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
5575 sme_ReleaseGlobalLock( &pMac->sme );
5576 }
5577
5578 return (status);
5579}
5580#endif /* FEATURE_WLAN_WAPI */
5581
Jeff Johnsone7245742012-09-05 17:12:55 -07005582#ifdef FEATURE_OEM_DATA_SUPPORT
5583
5584/*****************************************************************************
5585 OEM DATA related modifications and function additions
5586 *****************************************************************************/
5587
5588/* ---------------------------------------------------------------------------
5589 \fn sme_getOemDataRsp
5590 \brief a wrapper function to obtain the OEM DATA RSP
5591 \param pOemDataRsp - A pointer to the response object
5592 \param pContext - a pointer passed in for the callback
5593 \return eHalStatus
5594 ---------------------------------------------------------------------------*/
5595eHalStatus sme_getOemDataRsp(tHalHandle hHal,
5596 tOemDataRsp **pOemDataRsp)
5597{
5598 eHalStatus status = eHAL_STATUS_SUCCESS;
5599 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5600
5601 do
5602 {
5603 //acquire the lock for the sme object
5604 status = sme_AcquireGlobalLock(&pMac->sme);
5605
5606 if(!HAL_STATUS_SUCCESS(status))
5607 {
5608 break;
5609 }
5610
5611 if(pMac->oemData.pOemDataRsp != NULL)
5612 {
5613 *pOemDataRsp = pMac->oemData.pOemDataRsp;
5614 }
5615 else
5616 {
5617 status = eHAL_STATUS_FAILURE;
5618 }
5619
5620 //release the lock for the sme object
5621 sme_ReleaseGlobalLock( &pMac->sme );
5622
5623 } while(0);
5624
5625 return status;
5626}
5627
5628/* ---------------------------------------------------------------------------
5629 \fn sme_OemDataReq
5630 \brief a wrapper function for OEM DATA REQ
5631 \param sessionId - session id to be used.
5632 \param pOemDataReqId - pointer to an object to get back the request ID
5633 \param callback - a callback function that is called upon finish
5634 \param pContext - a pointer passed in for the callback
5635 \return eHalStatus
5636 ---------------------------------------------------------------------------*/
5637eHalStatus sme_OemDataReq(tHalHandle hHal,
5638 tANI_U8 sessionId,
5639 tOemDataReqConfig *pOemDataReqConfig,
5640 tANI_U32 *pOemDataReqID,
5641 oemData_OemDataReqCompleteCallback callback,
5642 void *pContext)
5643{
5644 eHalStatus status = eHAL_STATUS_SUCCESS;
5645 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5646
5647 do
5648 {
5649 //acquire the lock for the sme object
5650 status = sme_AcquireGlobalLock(&pMac->sme);
5651 if(HAL_STATUS_SUCCESS(status))
5652 {
5653 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
5654
5655 if(pOemDataReqID)
5656 {
5657 *pOemDataReqID = lOemDataReqId;
5658 }
5659 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005660 {
5661 sme_ReleaseGlobalLock( &pMac->sme );
5662 return eHAL_STATUS_FAILURE;
5663 }
Jeff Johnsone7245742012-09-05 17:12:55 -07005664
5665 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
5666
5667 //release the lock for the sme object
5668 sme_ReleaseGlobalLock( &pMac->sme );
5669 }
5670 } while(0);
5671
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005672 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07005673
5674 return(status);
5675}
5676
5677#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07005678
5679/*--------------------------------------------------------------------------
5680
5681 \brief sme_OpenSession() - Open a session for scan/roam operation.
5682
5683 This is a synchronous API.
5684
5685
5686 \param hHal - The handle returned by macOpen.
5687 \param callback - A pointer to the function caller specifies for roam/connect status indication
5688 \param pContext - The context passed with callback
5689 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
5690 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
5691
5692 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
5693
5694 Other status means SME is failed to open the session.
5695 eHAL_STATUS_RESOURCES - no more session available.
5696 \sa
5697
5698 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07005699eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
5700 void *pContext, tANI_U8 *pSelfMacAddr,
5701 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005702{
5703 eHalStatus status;
5704 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5705
5706 if( NULL == pbSessionId )
5707 {
5708 status = eHAL_STATUS_INVALID_PARAMETER;
5709 }
5710 else
5711 {
5712 status = sme_AcquireGlobalLock( &pMac->sme );
5713 if ( HAL_STATUS_SUCCESS( status ) )
5714 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07005715 status = csrRoamOpenSession(pMac, callback, pContext,
5716 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005717
5718 sme_ReleaseGlobalLock( &pMac->sme );
5719 }
5720 }
5721
5722 return ( status );
5723}
5724
5725
5726/*--------------------------------------------------------------------------
5727
5728 \brief sme_CloseSession() - Open a session for scan/roam operation.
5729
5730 This is a synchronous API.
5731
5732
5733 \param hHal - The handle returned by macOpen.
5734
5735 \param sessionId - A previous opened session's ID.
5736
5737 \return eHAL_STATUS_SUCCESS - session is closed.
5738
5739 Other status means SME is failed to open the session.
5740 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
5741 \sa
5742
5743 --------------------------------------------------------------------------*/
5744eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
5745 csrRoamSessionCloseCallback callback, void *pContext)
5746{
5747 eHalStatus status;
5748 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5749
5750 status = sme_AcquireGlobalLock( &pMac->sme );
5751 if ( HAL_STATUS_SUCCESS( status ) )
5752 {
5753 status = csrRoamCloseSession( pMac, sessionId, FALSE,
5754 callback, pContext );
5755
5756 sme_ReleaseGlobalLock( &pMac->sme );
5757 }
5758
5759 return ( status );
5760}
5761
Jeff Johnson295189b2012-06-20 16:38:30 -07005762/* ---------------------------------------------------------------------------
5763
5764 \fn sme_RoamUpdateAPWPSIE
5765
5766 \brief To update AP's WPS IE. This function should be called after SME AP session is created
5767 This is an asynchronous API.
5768
5769 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
5770
5771 \return eHalStatus – SUCCESS –
5772
5773 FAILURE or RESOURCES – The API finished and failed.
5774
5775 -------------------------------------------------------------------------------*/
5776eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
5777{
5778
5779 eHalStatus status = eHAL_STATUS_FAILURE;
5780 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5781
5782 status = sme_AcquireGlobalLock( &pMac->sme );
5783 if ( HAL_STATUS_SUCCESS( status ) )
5784 {
5785
5786 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
5787
5788 sme_ReleaseGlobalLock( &pMac->sme );
5789 }
5790
5791 return (status);
5792}
5793/* ---------------------------------------------------------------------------
5794
5795 \fn sme_RoamUpdateAPWPARSNIEs
5796
5797 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
5798 This is an asynchronous API.
5799
5800 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
5801
5802 \return eHalStatus – SUCCESS –
5803
5804 FAILURE or RESOURCES – The API finished and failed.
5805
5806 -------------------------------------------------------------------------------*/
5807eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
5808{
5809
5810 eHalStatus status = eHAL_STATUS_FAILURE;
5811 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5812
5813 status = sme_AcquireGlobalLock( &pMac->sme );
5814 if ( HAL_STATUS_SUCCESS( status ) )
5815 {
5816
5817 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
5818
5819 sme_ReleaseGlobalLock( &pMac->sme );
5820 }
5821
5822 return (status);
5823}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005824/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005825
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005826 \fn sme_ChangeMCCBeaconInterval
5827
5828 \brief To update P2P-GO beaconInterval. This function should be called after
5829 disassociating all the station is done
5830 This is an asynchronous API.
5831
5832 \param
5833
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005834 \return eHalStatus SUCCESS
5835 FAILURE or RESOURCES
5836 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005837
5838 -------------------------------------------------------------------------------*/
5839eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
5840{
5841 eHalStatus status = eHAL_STATUS_FAILURE;
5842 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5843
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005844 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005845 status = sme_AcquireGlobalLock( &pMac->sme );
5846 if ( HAL_STATUS_SUCCESS( status ) )
5847 {
5848 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
5849 sme_ReleaseGlobalLock( &pMac->sme );
5850 }
5851 return (status);
5852}
Jeff Johnson295189b2012-06-20 16:38:30 -07005853
5854/*-------------------------------------------------------------------------------*
5855
5856 \fn sme_sendBTAmpEvent
5857
5858 \brief to receive the coex priorty request from BT-AMP PAL
5859 and send the BT_AMP link state to HAL
5860
5861 \param btAmpEvent - btAmpEvent
5862
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005863 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07005864
5865 FAILURE: API failed
5866
5867-------------------------------------------------------------------------------*/
5868
5869eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
5870{
5871 vos_msg_t msg;
5872 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
5873 eHalStatus status = eHAL_STATUS_FAILURE;
5874
5875 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tpSmeBtAmpEvent));
5876 if (NULL == ptrSmeBtAmpEvent)
5877 {
5878 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005879 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005880 return status;
5881 }
5882
5883 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
5884 msg.type = WDA_SIGNAL_BTAMP_EVENT;
5885 msg.reserved = 0;
5886 msg.bodyptr = ptrSmeBtAmpEvent;
5887
5888 //status = halFW_SendBTAmpEventMesg(pMac, event);
5889
5890 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
5891 {
5892 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005893 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005894 vos_mem_free(ptrSmeBtAmpEvent);
5895 return status;
5896 }
5897
5898 return eHAL_STATUS_SUCCESS;
5899
5900}
5901
5902/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05305903 \fn smeIssueFastRoamNeighborAPEvent
5904 \brief API to trigger fast BSS roam independent of RSSI triggers
5905 \param hHal - The handle returned by macOpen.
5906 \param bssid - Pointer to the BSSID to roam to.
5907 \param fastRoamTrig - Trigger to Scan or roam
5908 \return eHalStatus
5909 ---------------------------------------------------------------------------*/
5910eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
5911 tANI_U8 *bssid,
5912 tSmeFastRoamTrigger fastRoamTrig)
5913{
5914 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5915 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
5916 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5917 eHalStatus status = eHAL_STATUS_SUCCESS;
5918
5919 status = sme_AcquireGlobalLock( &pMac->sme );
5920 if ( HAL_STATUS_SUCCESS( status ) )
5921 {
5922 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
5923 "%s: invoked", __func__);
5924
5925 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
5926 {
5927 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
5928 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
5929 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
5930 (void *)bssid, sizeof(tSirMacAddr));
5931 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID %x %x %x %x %x %x",
5932 pNeighborRoamInfo->cfgRoambssId[0], pNeighborRoamInfo->cfgRoambssId[1],
5933 pNeighborRoamInfo->cfgRoambssId[2], pNeighborRoamInfo->cfgRoambssId[3],
5934 pNeighborRoamInfo->cfgRoambssId[4], pNeighborRoamInfo->cfgRoambssId[5]);
5935
5936 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
5937 if (VOS_STATUS_SUCCESS != vosStatus)
5938 {
5939 smsLog(pMac, LOGE,
5940 FL("CFG Channel list scan state failed with status %d "),
5941 vosStatus);
5942 }
5943 }
5944 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
5945 {
5946 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
5947 (void *)bssid, sizeof(tSirMacAddr));
5948 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
5949 smsLog(pMac, LOG1, "Roam to BSSID %x-%x-%x-%x-%x-%x",
5950 pNeighborRoamInfo->cfgRoambssId[0], pNeighborRoamInfo->cfgRoambssId[1],
5951 pNeighborRoamInfo->cfgRoambssId[2], pNeighborRoamInfo->cfgRoambssId[3],
5952 pNeighborRoamInfo->cfgRoambssId[4], pNeighborRoamInfo->cfgRoambssId[5]);
5953
5954 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
5955 0,
5956 pMac,
5957 0);
5958
5959 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
5960 {
5961 smsLog(pMac,
5962 LOGE,
5963 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
5964 vosStatus);
5965 }
5966 }
5967 sme_ReleaseGlobalLock( &pMac->sme );
5968 }
5969 return vosStatus;
5970}
5971/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005972 \fn sme_SetHostOffload
5973 \brief API to set the host offload feature.
5974 \param hHal - The handle returned by macOpen.
5975 \param pRequest - Pointer to the offload request.
5976 \return eHalStatus
5977 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005978eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
5979 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005980{
5981 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07005982 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005983
5984 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5985 {
5986#ifdef WLAN_NS_OFFLOAD
5987 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
5988 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005989 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005990 }
5991 else
5992#endif //WLAN_NS_OFFLOAD
5993 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005994 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005995 }
5996 sme_ReleaseGlobalLock( &pMac->sme );
5997 }
5998
5999 return (status);
6000}
6001
6002#ifdef WLAN_FEATURE_GTK_OFFLOAD
6003/* ---------------------------------------------------------------------------
6004 \fn sme_SetGTKOffload
6005 \brief API to set GTK offload information.
6006 \param hHal - The handle returned by macOpen.
6007 \param pRequest - Pointer to the GTK offload request.
6008 \return eHalStatus
6009 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006010eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
6011 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006012{
6013 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6014 eHalStatus status;
6015
6016 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6017 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006018 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006019 sme_ReleaseGlobalLock( &pMac->sme );
6020 }
6021
6022 return (status);
6023}
6024
6025/* ---------------------------------------------------------------------------
6026 \fn sme_GetGTKOffload
6027 \brief API to get GTK offload information.
6028 \param hHal - The handle returned by macOpen.
6029 \param pRequest - Pointer to the GTK offload response.
6030 \return eHalStatus
6031 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006032eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
6033 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07006034{
6035 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6036 eHalStatus status;
6037
6038 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6039 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006040 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006041 sme_ReleaseGlobalLock( &pMac->sme );
6042 }
6043
6044 return (status);
6045}
6046#endif // WLAN_FEATURE_GTK_OFFLOAD
6047
6048/* ---------------------------------------------------------------------------
6049 \fn sme_SetKeepAlive
6050 \brief API to set the Keep Alive feature.
6051 \param hHal - The handle returned by macOpen.
6052 \param pRequest - Pointer to the Keep Alive request.
6053 \return eHalStatus
6054 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07006055eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
6056 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006057{
6058 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6059 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07006060 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6061 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006062 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006063 sme_ReleaseGlobalLock( &pMac->sme );
6064 }
6065
6066 return (status);
6067}
6068
6069#ifdef FEATURE_WLAN_SCAN_PNO
6070/* ---------------------------------------------------------------------------
6071 \fn sme_SetPreferredNetworkList
6072 \brief API to set the Preferred Network List Offload feature.
6073 \param hHal - The handle returned by macOpen.
6074 \param pRequest - Pointer to the offload request.
6075 \return eHalStatus
6076 ---------------------------------------------------------------------------*/
6077eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
6078{
6079 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6080 eHalStatus status;
6081
6082 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6083 {
6084 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
6085 sme_ReleaseGlobalLock( &pMac->sme );
6086 }
6087
6088 return (status);
6089}
6090
6091eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
6092{
6093 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6094 eHalStatus status;
6095
6096 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6097 {
6098 pmcSetRssiFilter(hHal, rssiThreshold);
6099 sme_ReleaseGlobalLock( &pMac->sme );
6100 }
6101
6102 return (status);
6103}
6104
6105#endif // FEATURE_WLAN_SCAN_PNO
6106
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006107eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07006108{
6109 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6110 eHalStatus status;
6111
6112 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6113 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006114 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07006115 sme_ReleaseGlobalLock( &pMac->sme );
6116 }
6117
6118 return (status);
6119}
6120
6121/* ---------------------------------------------------------------------------
6122 \fn sme_AbortMacScan
6123 \brief API to cancel MAC scan.
6124 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306125 \param sessionId - sessionId on which we need to abort scan.
Jeff Johnson295189b2012-06-20 16:38:30 -07006126 \return VOS_STATUS
6127 VOS_STATUS_E_FAILURE - failure
6128 VOS_STATUS_SUCCESS success
6129 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306130eHalStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006131{
6132 eHalStatus status;
6133 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6134
6135 status = sme_AcquireGlobalLock( &pMac->sme );
6136 if ( HAL_STATUS_SUCCESS( status ) )
6137 {
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306138 status = csrScanAbortMacScan(pMac, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006139
6140 sme_ReleaseGlobalLock( &pMac->sme );
6141 }
6142
6143 return ( status );
6144}
6145
6146/* ----------------------------------------------------------------------------
6147 \fn sme_GetOperationChannel
6148 \brief API to get current channel on which STA is parked
6149 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006150 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07006151 \returns eHAL_STATUS_SUCCESS
6152 eHAL_STATUS_FAILURE
6153-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006154eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006155{
Jeff Johnson295189b2012-06-20 16:38:30 -07006156 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6157 tCsrRoamSession *pSession;
6158
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006159 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07006160 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006161 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006162
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006163 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
6164 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006165 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006166 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
6167 {
6168 *pChannel =pSession->connectedProfile.operationChannel;
6169 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006170 }
6171 }
6172 return eHAL_STATUS_FAILURE;
6173}// sme_GetOperationChannel ends here
6174
Jeff Johnson295189b2012-06-20 16:38:30 -07006175/* ---------------------------------------------------------------------------
6176
6177 \fn sme_RegisterMgtFrame
6178
6179 \brief To register managment frame of specified type and subtype.
6180 \param frameType - type of the frame that needs to be passed to HDD.
6181 \param matchData - data which needs to be matched before passing frame
6182 to HDD.
6183 \param matchDataLen - Length of matched data.
6184 \return eHalStatus
6185 -------------------------------------------------------------------------------*/
6186eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
6187 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6188{
6189 eHalStatus status = eHAL_STATUS_SUCCESS;
6190 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6191
6192 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6193 {
6194 tSirRegisterMgmtFrame *pMsg;
6195 tANI_U16 len;
6196 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006197
6198 if(!pSession)
6199 {
6200 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006201 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006202 return eHAL_STATUS_FAILURE;
6203 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006204
6205 if( !pSession->sessionActive )
6206 {
6207 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006208 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006209 sme_ReleaseGlobalLock( &pMac->sme );
6210 return eHAL_STATUS_FAILURE;
6211 }
6212
6213 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6214
Kiet Lam64c1b492013-07-12 13:56:44 +05306215 pMsg = vos_mem_malloc(len);
6216 if ( NULL == pMsg )
6217 status = eHAL_STATUS_FAILURE;
6218 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006219 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306220 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006221 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
6222 pMsg->length = len;
6223 pMsg->sessionId = sessionId;
6224 pMsg->registerFrame = VOS_TRUE;
6225 pMsg->frameType = frameType;
6226 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306227 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006228 status = palSendMBMessage(pMac->hHdd, pMsg);
6229 }
6230 sme_ReleaseGlobalLock( &pMac->sme );
6231 }
6232 return status;
6233}
6234
6235/* ---------------------------------------------------------------------------
6236
6237 \fn sme_DeregisterMgtFrame
6238
6239 \brief To De-register managment frame of specified type and subtype.
6240 \param frameType - type of the frame that needs to be passed to HDD.
6241 \param matchData - data which needs to be matched before passing frame
6242 to HDD.
6243 \param matchDataLen - Length of matched data.
6244 \return eHalStatus
6245 -------------------------------------------------------------------------------*/
6246eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
6247 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6248{
6249 eHalStatus status = eHAL_STATUS_SUCCESS;
6250 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6251
6252 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6253 {
6254 tSirRegisterMgmtFrame *pMsg;
6255 tANI_U16 len;
6256 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006257
6258 if(!pSession)
6259 {
6260 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006261 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006262 return eHAL_STATUS_FAILURE;
6263 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006264
6265 if( !pSession->sessionActive )
6266 {
6267 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006268 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006269 sme_ReleaseGlobalLock( &pMac->sme );
6270 return eHAL_STATUS_FAILURE;
6271 }
6272
6273 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6274
Kiet Lam64c1b492013-07-12 13:56:44 +05306275 pMsg = vos_mem_malloc(len);
6276 if ( NULL == pMsg )
6277 status = eHAL_STATUS_FAILURE;
6278 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006279 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306280 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006281 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
6282 pMsg->length = len;
6283 pMsg->registerFrame = VOS_FALSE;
6284 pMsg->frameType = frameType;
6285 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306286 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006287 status = palSendMBMessage(pMac->hHdd, pMsg);
6288 }
6289 sme_ReleaseGlobalLock( &pMac->sme );
6290 }
6291 return status;
6292}
6293
6294/* ---------------------------------------------------------------------------
6295 \fn sme_RemainOnChannel
6296 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
6297 \param hHal - The handle returned by macOpen.
6298 \param pRequest - channel
6299 \param duration - duration in ms
6300 \param callback - HDD registered callback to process reaminOnChannelRsp
6301 \param context - HDD Callback param
6302 \return eHalStatus
6303 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006304eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
6305 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306306 remainOnChanCallback callback,
6307 void *pContext,
6308 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07006309{
6310 eHalStatus status = eHAL_STATUS_SUCCESS;
6311 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6312
6313 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6314 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306315 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
6316 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07006317#ifdef WLAN_FEATURE_P2P_INTERNAL
6318 , eP2PRemainOnChnReasonUnknown
6319#endif
6320 );
6321 sme_ReleaseGlobalLock( &pMac->sme );
6322 }
6323 return(status);
6324}
6325
6326/* ---------------------------------------------------------------------------
6327 \fn sme_ReportProbeReq
6328 \brief API to enable/disable forwarding of probeReq to apps in p2p.
6329 \param hHal - The handle returned by macOpen.
6330 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
6331 \return eHalStatus
6332 ---------------------------------------------------------------------------*/
6333
6334#ifndef WLAN_FEATURE_CONCURRENT_P2P
6335eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
6336{
6337 eHalStatus status = eHAL_STATUS_SUCCESS;
6338 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6339
6340 do
6341 {
6342 //acquire the lock for the sme object
6343 status = sme_AcquireGlobalLock(&pMac->sme);
6344 if(HAL_STATUS_SUCCESS(status))
6345 {
6346 /* call set in context */
6347 pMac->p2pContext.probeReqForwarding = flag;
6348 //release the lock for the sme object
6349 sme_ReleaseGlobalLock( &pMac->sme );
6350 }
6351 } while(0);
6352
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006353 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006354
6355 return(status);
6356}
6357
6358/* ---------------------------------------------------------------------------
6359 \fn sme_updateP2pIe
6360 \brief API to set the P2p Ie in p2p context
6361 \param hHal - The handle returned by macOpen.
6362 \param p2pIe - Ptr to p2pIe from HDD.
6363 \param p2pIeLength: length of p2pIe
6364 \return eHalStatus
6365 ---------------------------------------------------------------------------*/
6366
6367eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
6368{
6369 eHalStatus status = eHAL_STATUS_SUCCESS;
6370 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6371
6372 //acquire the lock for the sme object
6373 status = sme_AcquireGlobalLock(&pMac->sme);
6374 if(HAL_STATUS_SUCCESS(status))
6375 {
6376 if(NULL != pMac->p2pContext.probeRspIe){
6377 vos_mem_free(pMac->p2pContext.probeRspIe);
6378 pMac->p2pContext.probeRspIeLength = 0;
6379 }
6380
6381 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
6382 if (NULL == pMac->p2pContext.probeRspIe)
6383 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006384 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006385 pMac->p2pContext.probeRspIeLength = 0;
6386 status = eHAL_STATUS_FAILURE;
6387 }
6388 else
6389 {
6390 pMac->p2pContext.probeRspIeLength = p2pIeLength;
6391
6392 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
6393 pMac->p2pContext.probeRspIe,
6394 pMac->p2pContext.probeRspIeLength );
6395 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
6396 p2pIeLength);
6397 }
6398
6399 //release the lock for the sme object
6400 sme_ReleaseGlobalLock( &pMac->sme );
6401 }
6402
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006403 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006404
6405 return(status);
6406}
6407#endif
6408
6409/* ---------------------------------------------------------------------------
6410 \fn sme_sendAction
6411 \brief API to send action frame from supplicant.
6412 \param hHal - The handle returned by macOpen.
6413 \return eHalStatus
6414 ---------------------------------------------------------------------------*/
6415
6416eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006417 const tANI_U8 *pBuf, tANI_U32 len,
6418 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07006419{
6420 eHalStatus status = eHAL_STATUS_SUCCESS;
6421 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6422
6423 //acquire the lock for the sme object
6424 status = sme_AcquireGlobalLock(&pMac->sme);
6425 if(HAL_STATUS_SUCCESS(status))
6426 {
Jeff Johnsone7245742012-09-05 17:12:55 -07006427 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07006428 //release the lock for the sme object
6429 sme_ReleaseGlobalLock( &pMac->sme );
6430 }
6431
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006432 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006433
6434 return(status);
6435}
6436
6437eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
6438{
6439 eHalStatus status = eHAL_STATUS_SUCCESS;
6440 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6441
6442 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6443 {
6444 status = p2pCancelRemainOnChannel (hHal, sessionId);
6445 sme_ReleaseGlobalLock( &pMac->sme );
6446 }
6447 return(status);
6448}
6449
6450//Power Save Related
6451eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
6452{
6453 eHalStatus status = eHAL_STATUS_SUCCESS;
6454 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6455
6456 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6457 {
6458 status = p2pSetPs (hHal, data);
6459 sme_ReleaseGlobalLock( &pMac->sme );
6460 }
6461 return(status);
6462}
6463
Jeff Johnson295189b2012-06-20 16:38:30 -07006464
6465/* ---------------------------------------------------------------------------
6466
6467 \fn sme_ConfigureRxpFilter
6468
6469 \brief
6470 SME will pass this request to lower mac to set/reset the filter on RXP for
6471 multicast & broadcast traffic.
6472
6473 \param
6474
6475 hHal - The handle returned by macOpen.
6476
6477 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
6478 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
6479 on this param. In future we can use this as a mask to set various types of
6480 filters as suggested below:
6481 FILTER_ALL_MULTICAST:
6482 FILTER_ALL_BROADCAST:
6483 FILTER_ALL_MULTICAST_BROADCAST:
6484
6485
6486 \return eHalStatus
6487
6488
6489--------------------------------------------------------------------------- */
6490eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
6491 tpSirWlanSetRxpFilters wlanRxpFilterParam)
6492{
6493 eHalStatus status = eHAL_STATUS_SUCCESS;
6494 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6495 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6496 vos_msg_t vosMessage;
6497
6498 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6499 {
6500 /* serialize the req through MC thread */
6501 vosMessage.bodyptr = wlanRxpFilterParam;
6502 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
6503 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6504 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6505 {
6506 status = eHAL_STATUS_FAILURE;
6507 }
6508 sme_ReleaseGlobalLock( &pMac->sme );
6509 }
6510 return(status);
6511}
6512
Jeff Johnson295189b2012-06-20 16:38:30 -07006513/* ---------------------------------------------------------------------------
6514
6515 \fn sme_ConfigureSuspendInd
6516
6517 \brief
6518 SME will pass this request to lower mac to Indicate that the wlan needs to
6519 be suspended
6520
6521 \param
6522
6523 hHal - The handle returned by macOpen.
6524
6525 wlanSuspendParam- Depicts the wlan suspend params
6526
6527
6528 \return eHalStatus
6529
6530
6531--------------------------------------------------------------------------- */
6532eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
6533 tpSirWlanSuspendParam wlanSuspendParam)
6534{
6535 eHalStatus status = eHAL_STATUS_SUCCESS;
6536 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6537 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6538 vos_msg_t vosMessage;
6539
6540 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6541 {
6542 /* serialize the req through MC thread */
6543 vosMessage.bodyptr = wlanSuspendParam;
6544 vosMessage.type = WDA_WLAN_SUSPEND_IND;
6545 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6546 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6547 {
6548 status = eHAL_STATUS_FAILURE;
6549 }
6550 sme_ReleaseGlobalLock( &pMac->sme );
6551 }
6552 return(status);
6553}
6554
6555/* ---------------------------------------------------------------------------
6556
6557 \fn sme_ConfigureResumeReq
6558
6559 \brief
6560 SME will pass this request to lower mac to Indicate that the wlan needs to
6561 be Resumed
6562
6563 \param
6564
6565 hHal - The handle returned by macOpen.
6566
6567 wlanResumeParam- Depicts the wlan resume params
6568
6569
6570 \return eHalStatus
6571
6572
6573--------------------------------------------------------------------------- */
6574eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
6575 tpSirWlanResumeParam wlanResumeParam)
6576{
6577 eHalStatus status = eHAL_STATUS_SUCCESS;
6578 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6579 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6580 vos_msg_t vosMessage;
6581
6582 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6583 {
6584 /* serialize the req through MC thread */
6585 vosMessage.bodyptr = wlanResumeParam;
6586 vosMessage.type = WDA_WLAN_RESUME_REQ;
6587 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6588 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6589 {
6590 status = eHAL_STATUS_FAILURE;
6591 }
6592 sme_ReleaseGlobalLock( &pMac->sme );
6593 }
6594 return(status);
6595}
6596
Jeff Johnson295189b2012-06-20 16:38:30 -07006597/* ---------------------------------------------------------------------------
6598
6599 \fn sme_GetInfraSessionId
6600
6601 \brief To get the session ID for infra session, if connected
6602 This is a synchronous API.
6603
6604 \param hHal - The handle returned by macOpen.
6605
6606 \return sessionid, -1 if infra session is not connected
6607
6608 -------------------------------------------------------------------------------*/
6609tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
6610{
6611 eHalStatus status = eHAL_STATUS_FAILURE;
6612 tANI_S8 sessionid = -1;
6613 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6614
6615 status = sme_AcquireGlobalLock( &pMac->sme );
6616 if ( HAL_STATUS_SUCCESS( status ) )
6617 {
6618
6619 sessionid = csrGetInfraSessionId( pMac);
6620
6621 sme_ReleaseGlobalLock( &pMac->sme );
6622 }
6623
6624 return (sessionid);
6625}
6626
6627/* ---------------------------------------------------------------------------
6628
6629 \fn sme_GetInfraOperationChannel
6630
6631 \brief To get the operating channel for infra session, if connected
6632 This is a synchronous API.
6633
6634 \param hHal - The handle returned by macOpen.
6635 \param sessionId - the sessionId returned by sme_OpenSession.
6636
6637 \return operating channel, 0 if infra session is not connected
6638
6639 -------------------------------------------------------------------------------*/
6640tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
6641{
6642 eHalStatus status = eHAL_STATUS_FAILURE;
6643 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6644 tANI_U8 channel = 0;
6645 status = sme_AcquireGlobalLock( &pMac->sme );
6646 if ( HAL_STATUS_SUCCESS( status ) )
6647 {
6648
6649 channel = csrGetInfraOperationChannel( pMac, sessionId);
6650
6651 sme_ReleaseGlobalLock( &pMac->sme );
6652 }
6653
6654 return (channel);
6655}
6656
6657//This routine will return poerating channel on which other BSS is operating to be used for concurrency mode.
6658//If other BSS is not up or not connected it will return 0
6659tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
6660{
6661 eHalStatus status = eHAL_STATUS_FAILURE;
6662 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6663 tANI_U8 channel = 0;
6664 status = sme_AcquireGlobalLock( &pMac->sme );
6665 if ( HAL_STATUS_SUCCESS( status ) )
6666 {
6667
6668 channel = csrGetConcurrentOperationChannel( pMac );
6669 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006670 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07006671 sme_ReleaseGlobalLock( &pMac->sme );
6672 }
6673
6674 return (channel);
6675}
6676
6677#ifdef FEATURE_WLAN_SCAN_PNO
6678/******************************************************************************
6679*
6680* Name: sme_PreferredNetworkFoundInd
6681*
6682* Description:
6683* Invoke Preferred Network Found Indication
6684*
6685* Parameters:
6686* hHal - HAL handle for device
6687* pMsg - found network description
6688*
6689* Returns: eHalStatus
6690*
6691******************************************************************************/
6692eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
6693{
6694 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6695 eHalStatus status = eHAL_STATUS_SUCCESS;
6696 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07006697 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
6698 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006699
6700 if (NULL == pMsg)
6701 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006702 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006703 status = eHAL_STATUS_FAILURE;
6704 }
6705 else
6706 {
6707 if (pPrefNetworkFoundInd->ssId.length > 0)
6708 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07006709 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
6710 pPrefNetworkFoundInd->ssId.length);
6711 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
6712 dumpSsId[ssIdLength] = 0;
6713 smsLog(pMac, LOG2, "%s:SSID=%s frame length %d",
6714 __func__, dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07006715
Srikant Kuppa066904f2013-05-07 13:56:02 -07006716 //Save the frame to scan result
6717 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
6718 {
6719 //we may have a frame
6720 status = csrScanSavePreferredNetworkFound(pMac,
6721 pPrefNetworkFoundInd);
6722 if (!HAL_STATUS_SUCCESS(status))
6723 {
6724 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
6725 }
6726 }
6727 else
6728 {
6729 smsLog(pMac, LOGE, FL(" not enough data length %d needed %d"),
6730 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07006731 }
6732
Srikant Kuppa066904f2013-05-07 13:56:02 -07006733 /* Call Preferred Netowrk Found Indication callback routine. */
6734 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
6735 {
6736 pMac->pmc.prefNetwFoundCB(
6737 pMac->pmc.preferredNetworkFoundIndCallbackContext,
6738 pPrefNetworkFoundInd);
6739 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006740 }
6741 else
6742 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006743 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006744 status = eHAL_STATUS_FAILURE;
6745 }
6746 }
6747
6748
6749 return(status);
6750}
6751
6752#endif // FEATURE_WLAN_SCAN_PNO
6753
6754
6755eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
6756{
6757 eHalStatus status = eHAL_STATUS_FAILURE;
6758 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6759
6760 status = sme_AcquireGlobalLock( &pMac->sme );
6761 if ( HAL_STATUS_SUCCESS( status ) )
6762 {
6763 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
6764 sme_ReleaseGlobalLock( &pMac->sme );
6765 }
6766
6767 return (status);
6768}
6769
6770
6771/* ---------------------------------------------------------------------------
6772
6773 \fn sme_SetTxPerTracking
6774
6775 \brief Set Tx PER tracking configuration parameters
6776
6777 \param hHal - The handle returned by macOpen.
6778 \param pTxPerTrackingConf - Tx PER configuration parameters
6779
6780 \return eHalStatus
6781
6782 -------------------------------------------------------------------------------*/
6783eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
6784 void (*pCallbackfn) (void *pCallbackContext),
6785 void *pCallbackContext,
6786 tpSirTxPerTrackingParam pTxPerTrackingParam)
6787{
6788 vos_msg_t msg;
6789 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
6790 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6791
6792 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6793 {
6794 pMac->sme.pTxPerHitCallback = pCallbackfn;
6795 pMac->sme.pTxPerHitCbContext = pCallbackContext;
6796 sme_ReleaseGlobalLock( &pMac->sme );
6797 }
6798
6799 // free this memory in failure case or WDA request callback function
6800 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
6801 if (NULL == pTxPerTrackingParamReq)
6802 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006803 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for tSirTxPerTrackingParam", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006804 return eHAL_STATUS_FAILURE;
6805 }
6806
Kiet Lam64c1b492013-07-12 13:56:44 +05306807 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
6808 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07006809 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
6810 msg.reserved = 0;
6811 msg.bodyptr = pTxPerTrackingParamReq;
6812
6813 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6814 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006815 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_TX_PER_TRACKING_REQ message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006816 vos_mem_free(pTxPerTrackingParamReq);
6817 return eHAL_STATUS_FAILURE;
6818 }
6819
6820 return eHAL_STATUS_SUCCESS;
6821}
6822
6823/* ---------------------------------------------------------------------------
6824
6825 \fn sme_HandleChangeCountryCode
6826
6827 \brief Change Country code, Reg Domain and channel list
6828
6829 \details Country Code Priority
6830 0 = 11D > Configured Country > NV
6831 1 = Configured Country > 11D > NV
6832 If Supplicant country code is priority than 11d is disabled.
6833 If 11D is enabled, we update the country code after every scan.
6834 Hence when Supplicant country code is priority, we don't need 11D info.
6835 Country code from Supplicant is set as current courtry code.
6836 User can send reset command XX (instead of country code) to reset the
6837 country code to default values which is read from NV.
6838 In case of reset, 11D is enabled and default NV code is Set as current country code
6839 If 11D is priority,
6840 Than Supplicant country code code is set to default code. But 11D code is set as current country code
6841
6842 \param pMac - The handle returned by macOpen.
6843 \param pMsgBuf - MSG Buffer
6844
6845 \return eHalStatus
6846
6847 -------------------------------------------------------------------------------*/
6848eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
6849{
6850 eHalStatus status = eHAL_STATUS_SUCCESS;
6851 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07006852 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07006853 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6854 static uNvTables nvTables;
6855 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
6856
6857
6858 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
6859 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
6860 {
6861 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6862
6863 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
6864
6865 /* read the country code from NV and use it */
6866 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
6867 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306868 vos_mem_copy(pMsg->countryCode,
6869 nvTables.defaultCountryTable.countryCode,
6870 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006871 }
6872 else
6873 {
6874 status = eHAL_STATUS_FAILURE;
6875 return status;
6876 }
6877 }
6878 else
6879 {
6880 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05306881 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
6882 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07006883 {
6884 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
6885 }
6886 }
6887
6888 /* WEXT set country code means
6889 * 11D should be supported?
6890 * 11D Channel should be enforced?
6891 * 11D Country code should be matched?
6892 * 11D Reg Domian should be matched?
6893 * Country string changed */
6894 if(pMac->roam.configParam.Is11dSupportEnabled &&
6895 pMac->roam.configParam.fEnforce11dChannels &&
6896 pMac->roam.configParam.fEnforceCountryCodeMatch &&
6897 pMac->roam.configParam.fEnforceDefaultDomain &&
6898 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
6899 {
6900 /* All 11D related options are already enabled
6901 * Country string is not changed
6902 * Do not need do anything for country code change request */
6903 return eHAL_STATUS_SUCCESS;
6904 }
6905
6906 /* Set Current Country code and Current Regulatory domain */
6907 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
6908 if(eHAL_STATUS_SUCCESS != status)
6909 {
6910 /* Supplicant country code failed. So give 11D priority */
6911 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6912 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
6913 return status;
6914 }
6915
Jeff Johnson295189b2012-06-20 16:38:30 -07006916 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05306917 vos_mem_copy(pMac->scan.countryCodeDefault,
6918 pMac->scan.countryCodeCurrent,
6919 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07006920
6921 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05306922 status = csrGetRegulatoryDomainForCountry(pMac,
6923 pMac->scan.countryCodeCurrent,
6924 (v_REGDOMAIN_t *) &domainIdIoctl,
6925 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07006926 if ( status != eHAL_STATUS_SUCCESS )
6927 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006928 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006929 return status;
6930 }
6931
6932 status = WDA_SetRegDomain(pMac, domainIdIoctl);
6933
6934 if ( status != eHAL_STATUS_SUCCESS )
6935 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006936 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006937 return status;
6938 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07006939 else
6940 {
6941 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
6942 //set again if we find AP with 11d info during scan
6943 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
6944 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07006945 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07006946 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
6947 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
6948 }
6949 }
Kiet Lam6c583332013-10-14 05:37:09 +05306950#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07006951 /* set to default domain ID */
6952 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
6953
6954 /* get the channels based on new cc */
6955 status = csrInitGetChannels( pMac );
6956
6957 if ( status != eHAL_STATUS_SUCCESS )
6958 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006959 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07006960 return status;
6961 }
6962
6963 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08006964 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05306965#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07006966 if( pMsg->changeCCCallback )
6967 {
6968 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
6969 }
6970
6971 return eHAL_STATUS_SUCCESS;
6972}
6973
Amar Singhal0d15bd52013-10-12 23:13:13 -07006974/* ---------------------------------------------------------------------------
6975
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07006976 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07006977
6978 \brief Change Country code, Reg Domain and channel list
6979
6980 If Supplicant country code is priority than 11d is disabled.
6981 If 11D is enabled, we update the country code after every scan.
6982 Hence when Supplicant country code is priority, we don't need 11D info.
6983 Country code from Supplicant is set as current country code.
6984
6985 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07006986 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07006987
6988 \return eHalStatus
6989
6990 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07006991eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
6992 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07006993{
6994 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07006995 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05306996 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07006997
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07006998 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07006999 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7000
Kiet Lam6c583332013-10-14 05:37:09 +05307001 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
7002 VOS_COUNTRY_CODE_LEN) == 0)
7003 {
7004 is11dCountry = VOS_TRUE;
7005 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007006
7007 /* if Supplicant country code has priority, disable 11d */
Kiet Lam6c583332013-10-14 05:37:09 +05307008 if (!is11dCountry && pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007009 {
7010 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7011 }
7012
7013 palCopyMemory(pMac->hHdd, pMac->scan.countryCodeCurrent, pMsg->countryCode,
7014 WNI_CFG_COUNTRY_CODE_LEN);
7015
Amar Singhal0d15bd52013-10-12 23:13:13 -07007016 status = WDA_SetRegDomain(pMac, reg_domain_id);
7017
Kiet Lam6c583332013-10-14 05:37:09 +05307018 if (VOS_FALSE == is11dCountry )
7019 {
7020 /* overwrite the defualt country code */
7021 palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault,
7022 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
7023 /* set to default domain ID */
7024 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7025 }
7026
Amar Singhal0d15bd52013-10-12 23:13:13 -07007027 if ( status != eHAL_STATUS_SUCCESS )
7028 {
7029 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05307030 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007031 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007032 else
7033 {
7034 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7035 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007036 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7037 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007038 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007039 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007040 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7041 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7042 }
7043 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007044
Amar Singhal0d15bd52013-10-12 23:13:13 -07007045 /* get the channels based on new cc */
7046 status = csrInitGetChannels(pMac);
7047
7048 if ( status != eHAL_STATUS_SUCCESS )
7049 {
7050 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7051 return status;
7052 }
7053
7054 /* reset info based on new cc, and we are done */
7055 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05307056 if (VOS_TRUE == is11dCountry)
7057 {
7058 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
7059 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
7060 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
7061 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007062
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007063 smsLog(pMac, LOG1, FL(" returned"));
7064 return eHAL_STATUS_SUCCESS;
7065}
7066
7067/* ---------------------------------------------------------------------------
7068
Kiet Lamcffc5862013-10-30 16:28:45 +05307069 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007070
7071 \brief Update Country code in the driver if set by kernel as world
7072
7073 If 11D is enabled, we update the country code after every scan & notify kernel.
7074 This is to make sure kernel & driver are in sync in case of CC found in
7075 driver but not in kernel database
7076
7077 \param pMac - The handle returned by macOpen.
7078 \param pMsg - Carrying new CC set in kernel
7079
7080 \return eHalStatus
7081
7082 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05307083eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007084{
Kiet Lamcffc5862013-10-30 16:28:45 +05307085 eHalStatus status;
7086
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007087 smsLog(pMac, LOG1, FL(" called"));
7088
7089 //this is to make sure kernel & driver are in sync in case of CC found in
7090 //driver but not in kernel database
7091 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
7092 {
7093 smsLog( pMac, LOGW, FL("Setting countryCode11d to world CC"));
7094 palCopyMemory(pMac->hHdd, pMac->scan.countryCode11d, pMsg->countryCode,
7095 WNI_CFG_COUNTRY_CODE_LEN);
7096 }
Kiet Lamcffc5862013-10-30 16:28:45 +05307097
7098 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD);
7099
7100 if ( status != eHAL_STATUS_SUCCESS )
7101 {
7102 smsLog( pMac, LOGE, FL(" fail to set regId") );
7103 return status;
7104 }
7105 else
7106 {
7107 status = csrInitGetChannels(pMac);
7108 if ( status != eHAL_STATUS_SUCCESS )
7109 {
7110 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7111 }
7112 else
7113 {
7114 csrInitChannelList(pMac);
7115 }
7116 }
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007117 smsLog(pMac, LOG1, FL(" returned"));
7118 return eHAL_STATUS_SUCCESS;
7119}
7120
7121/* ---------------------------------------------------------------------------
7122
7123 \fn sme_HandleGenericChangeCountryCode
7124
7125 \brief Change Country code, Reg Domain and channel list
7126
7127 If Supplicant country code is priority than 11d is disabled.
7128 If 11D is enabled, we update the country code after every scan.
7129 Hence when Supplicant country code is priority, we don't need 11D info.
7130 Country code from kernel is set as current country code.
7131
7132 \param pMac - The handle returned by macOpen.
7133 \param pMsgBuf - message buffer
7134
7135 \return eHalStatus
7136
7137 -------------------------------------------------------------------------------*/
7138eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7139{
7140 tAniGenericChangeCountryCodeReq *pMsg;
7141 v_REGDOMAIN_t reg_domain_id;
7142
7143 smsLog(pMac, LOG1, FL(" called"));
7144 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
7145 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7146
7147 if (REGDOMAIN_COUNT == reg_domain_id)
7148 {
Kiet Lamcffc5862013-10-30 16:28:45 +05307149 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007150 }
7151 else
7152 {
7153 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
7154 }
7155 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007156 return eHAL_STATUS_SUCCESS;
7157}
7158
Jeff Johnson295189b2012-06-20 16:38:30 -07007159#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08007160eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07007161{
7162 tpSirRcvFltMcAddrList pRequestBuf;
7163 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007164 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07007165 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007166
7167 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05307168 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007169 pMulticastAddrs->ulMulticastAddrCnt,
7170 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07007171
7172 /*
7173 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08007174 */
7175 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
7176 csrIsConnStateInfra(pMac, sessionId))
7177 {
7178 pSession = CSR_GET_SESSION( pMac, sessionId );
7179 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007180
7181 if(pSession == NULL )
7182 {
7183 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007184 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07007185 return eHAL_STATUS_FAILURE;
7186 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007187
Jeff Johnson295189b2012-06-20 16:38:30 -07007188 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
7189 if (NULL == pRequestBuf)
7190 {
7191 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007192 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007193 return eHAL_STATUS_FAILED_ALLOC;
7194 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007195
7196 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
7197 {
7198 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
7199 "indication as we are not connected", __func__);
7200 vos_mem_free(pRequestBuf);
7201 return eHAL_STATUS_FAILURE;
7202 }
7203
Jeff Johnson295189b2012-06-20 16:38:30 -07007204 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
7205
Kiet Lam64c1b492013-07-12 13:56:44 +05307206 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
7207 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007208 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
7209 sizeof(tSirMacAddr));
7210
Jeff Johnson295189b2012-06-20 16:38:30 -07007211 msg.type = WDA_8023_MULTICAST_LIST_REQ;
7212 msg.reserved = 0;
7213 msg.bodyptr = pRequestBuf;
7214 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7215 {
7216 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007217 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007218 vos_mem_free(pRequestBuf);
7219 return eHAL_STATUS_FAILURE;
7220 }
7221
7222 return eHAL_STATUS_SUCCESS;
7223}
7224
Jeff Johnsone7245742012-09-05 17:12:55 -07007225eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
7226 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007227{
7228 tpSirRcvPktFilterCfgType pRequestBuf;
7229 v_SINT_t allocSize;
7230 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007231 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7232 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007233 v_U8_t idx=0;
7234
7235 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007236 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007237 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
7238
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07007239 allocSize = sizeof(tSirRcvPktFilterCfgType);
7240
Jeff Johnson295189b2012-06-20 16:38:30 -07007241 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007242
7243 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007244 {
7245 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007246 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007247 return eHAL_STATUS_FAILED_ALLOC;
7248 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007249
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007250 if( NULL == pSession )
7251 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007252 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007253 vos_mem_free(pRequestBuf);
7254 return eHAL_STATUS_FAILURE;
7255 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007256
Kiet Lam64c1b492013-07-12 13:56:44 +05307257 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
7258 sizeof(tSirMacAddr));
7259 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
7260 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007261 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
7262
Jeff Johnson295189b2012-06-20 16:38:30 -07007263 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
7264 msg.reserved = 0;
7265 msg.bodyptr = pRequestBuf;
7266
7267 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
7268 "FT %d FID %d ",
7269 pRequestBuf->filterType, pRequestBuf->filterId);
7270
7271 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
7272 "params %d CT %d",
7273 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
7274
7275 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
7276 {
7277
7278 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007279 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07007280 pRequestBuf->paramsData[idx].protocolLayer,
7281 pRequestBuf->paramsData[idx].cmpFlag);
7282
7283 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007284 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007285 pRequestBuf->paramsData[idx].dataOffset,
7286 pRequestBuf->paramsData[idx].dataLength);
7287
7288 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007289 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007290 pRequestBuf->paramsData[idx].compareData[0],
7291 pRequestBuf->paramsData[idx].compareData[1],
7292 pRequestBuf->paramsData[idx].compareData[2],
7293 pRequestBuf->paramsData[idx].compareData[3],
7294 pRequestBuf->paramsData[idx].compareData[4],
7295 pRequestBuf->paramsData[idx].compareData[5]);
7296
7297 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007298 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007299 pRequestBuf->paramsData[idx].dataMask[0],
7300 pRequestBuf->paramsData[idx].dataMask[1],
7301 pRequestBuf->paramsData[idx].dataMask[2],
7302 pRequestBuf->paramsData[idx].dataMask[3],
7303 pRequestBuf->paramsData[idx].dataMask[4],
7304 pRequestBuf->paramsData[idx].dataMask[5]);
7305
7306 }
7307
7308 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7309 {
7310 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007311 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007312 vos_mem_free(pRequestBuf);
7313 return eHAL_STATUS_FAILURE;
7314 }
7315
7316 return eHAL_STATUS_SUCCESS;
7317}
7318
7319eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
7320 FilterMatchCountCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007321 void *callbackContext,
7322 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007323{
7324 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7325 eHalStatus status;
7326
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007327 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007328
7329 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
7330 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007331 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007332 sme_ReleaseGlobalLock( &pMac->sme );
7333 }
7334
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007335 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007336
7337 return (status);
7338}
7339
Jeff Johnsone7245742012-09-05 17:12:55 -07007340eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
7341 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007342{
7343 tpSirRcvFltPktClearParam pRequestBuf;
7344 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007345 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7346 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007347
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007348 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007349 pRcvFltPktClearParam->filterId);
7350
7351 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007352 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007353 {
7354 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
7355 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007356 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007357 return eHAL_STATUS_FAILED_ALLOC;
7358 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007359 if( NULL == pSession )
7360 {
7361 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007362 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007363 vos_mem_free(pRequestBuf);
7364 return eHAL_STATUS_FAILURE;
7365 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007366
Kiet Lam64c1b492013-07-12 13:56:44 +05307367 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
7368 sizeof(tSirMacAddr));
7369 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
7370 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007371
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007372 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
7373
Jeff Johnson295189b2012-06-20 16:38:30 -07007374 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
7375 msg.reserved = 0;
7376 msg.bodyptr = pRequestBuf;
7377 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7378 {
7379 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007380 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007381 vos_mem_free(pRequestBuf);
7382 return eHAL_STATUS_FAILURE;
7383 }
7384
7385 return eHAL_STATUS_SUCCESS;
7386}
7387#endif // WLAN_FEATURE_PACKET_FILTERING
7388
7389/* ---------------------------------------------------------------------------
7390 \fn sme_PreChannelSwitchIndFullPowerCB
7391 \brief call back function for the PMC full power request because of pre
7392 channel switch.
7393 \param callbackContext
7394 \param status
7395 ---------------------------------------------------------------------------*/
7396void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
7397 eHalStatus status)
7398{
7399 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
7400 tSirMbMsg *pMsg;
7401 tANI_U16 msgLen;
7402
7403 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05307404 pMsg = vos_mem_malloc(msgLen);
7405 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07007406 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307407 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007408 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
7409 pMsg->msgLen = pal_cpu_to_be16(msgLen);
7410 status = palSendMBMessage(pMac->hHdd, pMsg);
7411 }
7412
7413 return;
7414}
7415
7416/* ---------------------------------------------------------------------------
7417 \fn sme_HandlePreChannelSwitchInd
7418 \brief Processes the indcation from PE for pre-channel switch.
7419 \param hHal
7420 \- The handle returned by macOpen. return eHalStatus
7421 ---------------------------------------------------------------------------*/
7422eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
7423{
7424 eHalStatus status = eHAL_STATUS_FAILURE;
7425 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7426 status = sme_AcquireGlobalLock( &pMac->sme );
7427 if ( HAL_STATUS_SUCCESS( status ) )
7428 {
7429 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
7430 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
7431 sme_ReleaseGlobalLock( &pMac->sme );
7432 }
7433
7434 return (status);
7435}
7436
7437/* ---------------------------------------------------------------------------
7438 \fn sme_HandlePostChannelSwitchInd
7439 \brief Processes the indcation from PE for post-channel switch.
7440 \param hHal
7441 \- The handle returned by macOpen. return eHalStatus
7442 ---------------------------------------------------------------------------*/
7443eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
7444{
7445 eHalStatus status = eHAL_STATUS_FAILURE;
7446 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7447
7448 status = sme_AcquireGlobalLock( &pMac->sme );
7449 if ( HAL_STATUS_SUCCESS( status ) )
7450 {
7451 status = pmcRequestBmps(hHal, NULL, NULL);
7452 sme_ReleaseGlobalLock( &pMac->sme );
7453 }
7454
7455 return (status);
7456}
7457
7458/* ---------------------------------------------------------------------------
7459
7460 \fn sme_IsChannelValid
7461
7462 \brief To check if the channel is valid for currently established domain
7463 This is a synchronous API.
7464
7465 \param hHal - The handle returned by macOpen.
7466 \param channel - channel to verify
7467
7468 \return TRUE/FALSE, TRUE if channel is valid
7469
7470 -------------------------------------------------------------------------------*/
7471tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
7472{
7473 eHalStatus status = eHAL_STATUS_FAILURE;
7474 tANI_BOOLEAN valid = FALSE;
7475 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7476
7477 status = sme_AcquireGlobalLock( &pMac->sme );
7478 if ( HAL_STATUS_SUCCESS( status ) )
7479 {
7480
7481 valid = csrRoamIsChannelValid( pMac, channel);
7482
7483 sme_ReleaseGlobalLock( &pMac->sme );
7484 }
7485
7486 return (valid);
7487}
7488
7489/* ---------------------------------------------------------------------------
7490 \fn sme_SetFreqBand
7491 \brief Used to set frequency band.
7492 \param hHal
7493 \eBand band value to be configured
7494 \- return eHalStatus
7495 -------------------------------------------------------------------------*/
7496eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
7497{
7498 eHalStatus status = eHAL_STATUS_FAILURE;
7499 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7500
7501 status = sme_AcquireGlobalLock( &pMac->sme );
7502 if ( HAL_STATUS_SUCCESS( status ) )
7503 {
7504 status = csrSetBand(hHal, eBand);
7505 sme_ReleaseGlobalLock( &pMac->sme );
7506 }
7507 return status;
7508}
7509
7510/* ---------------------------------------------------------------------------
7511 \fn sme_GetFreqBand
7512 \brief Used to get the current band settings.
7513 \param hHal
7514 \pBand pointer to hold band value
7515 \- return eHalStatus
7516 -------------------------------------------------------------------------*/
7517eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
7518{
7519 eHalStatus status = eHAL_STATUS_FAILURE;
7520 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7521
7522 status = sme_AcquireGlobalLock( &pMac->sme );
7523 if ( HAL_STATUS_SUCCESS( status ) )
7524 {
7525 *pBand = csrGetCurrentBand( hHal );
7526 sme_ReleaseGlobalLock( &pMac->sme );
7527 }
7528 return status;
7529}
7530
7531#ifdef WLAN_WAKEUP_EVENTS
7532/******************************************************************************
7533 \fn sme_WakeReasonIndCallback
7534
7535 \brief
7536 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
7537
7538 \param hHal - HAL handle for device
7539 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
7540
7541 \return eHalStatus
7542******************************************************************************/
7543eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
7544{
7545 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7546 eHalStatus status = eHAL_STATUS_SUCCESS;
7547 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
7548
7549 if (NULL == pMsg)
7550 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007551 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007552 status = eHAL_STATUS_FAILURE;
7553 }
7554 else
7555 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007556 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07007557
7558 /* Call Wake Reason Indication callback routine. */
7559 if (pMac->pmc.wakeReasonIndCB != NULL)
7560 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
7561
7562 pMac->pmc.wakeReasonIndCB = NULL;
7563 pMac->pmc.wakeReasonIndCBContext = NULL;
7564
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007565 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07007566 }
7567
7568 return(status);
7569}
7570#endif // WLAN_WAKEUP_EVENTS
7571
7572
7573/* ---------------------------------------------------------------------------
7574
7575 \fn sme_SetMaxTxPower
7576
7577 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
7578 not persist over reboots.
7579
7580 \param hHal
7581 \param pBssid BSSID to set the power cap for
7582 \param pBssid pSelfMacAddress self MAC Address
7583 \param pBssid power to set in dB
7584 \- return eHalStatus
7585
7586 -------------------------------------------------------------------------------*/
7587eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
7588 tSirMacAddr pSelfMacAddress, v_S7_t dB)
7589{
7590 vos_msg_t msg;
7591 tpMaxTxPowerParams pMaxTxParams = NULL;
7592
7593 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
7594 if (NULL == pMaxTxParams)
7595 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007596 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to allocate memory for pMaxTxParams", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007597 return eHAL_STATUS_FAILURE;
7598 }
7599
7600 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05307601 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07007602 SIR_MAC_ADDR_LENGTH);
7603 pMaxTxParams->power = dB;
7604
7605 msg.type = WDA_SET_MAX_TX_POWER_REQ;
7606 msg.reserved = 0;
7607 msg.bodyptr = pMaxTxParams;
7608
7609 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7610 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007611 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post WDA_SET_MAX_TX_POWER_REQ message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007612 vos_mem_free(pMaxTxParams);
7613 return eHAL_STATUS_FAILURE;
7614 }
7615
7616 return eHAL_STATUS_SUCCESS;
7617}
7618
Jeff Johnson295189b2012-06-20 16:38:30 -07007619/* ---------------------------------------------------------------------------
7620
schang86c22c42013-03-13 18:41:24 -07007621 \fn sme_SetTxPower
7622
7623 \brief Set Transmit Power dynamically. Note: this setting will
7624 not persist over reboots.
7625
7626 \param hHal
7627 \param sessionId Target Session ID
7628 \param mW power to set in mW
7629 \- return eHalStatus
7630
7631 -------------------------------------------------------------------------------*/
7632eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
7633{
7634
7635 eHalStatus status = eHAL_STATUS_FAILURE;
7636 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7637
7638 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
7639 status = sme_AcquireGlobalLock(&pMac->sme);
7640 if (HAL_STATUS_SUCCESS(status))
7641 {
7642 status = csrSetTxPower(pMac, sessionId, mW);
7643 sme_ReleaseGlobalLock(&pMac->sme);
7644 }
7645 return status;
7646}
7647
7648/* ---------------------------------------------------------------------------
7649
Jeff Johnson295189b2012-06-20 16:38:30 -07007650 \fn sme_HideSSID
7651
7652 \brief hide/show SSID dynamically. Note: this setting will
7653 not persist over reboots.
7654
7655 \param hHal
7656 \param sessionId
7657 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
7658 \- return eHalStatus
7659
7660 -------------------------------------------------------------------------------*/
7661eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
7662{
7663 eHalStatus status = eHAL_STATUS_SUCCESS;
7664 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7665 tANI_U16 len;
7666
7667 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7668 {
7669 tpSirUpdateParams pMsg;
7670 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007671
7672 if(!pSession)
7673 {
7674 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007675 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007676 return eHAL_STATUS_FAILURE;
7677 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007678
7679 if( !pSession->sessionActive )
7680 VOS_ASSERT(0);
7681
7682 /* Create the message and send to lim */
7683 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05307684 pMsg = vos_mem_malloc(len);
7685 if ( NULL == pMsg )
7686 status = eHAL_STATUS_FAILURE;
7687 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007688 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307689 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007690 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
7691 pMsg->length = len;
7692 /* Data starts from here */
7693 pMsg->sessionId = sessionId;
7694 pMsg->ssidHidden = ssidHidden;
7695 status = palSendMBMessage(pMac->hHdd, pMsg);
7696 }
7697 sme_ReleaseGlobalLock( &pMac->sme );
7698 }
7699 return status;
7700}
Jeff Johnson295189b2012-06-20 16:38:30 -07007701
7702/* ---------------------------------------------------------------------------
7703
7704 \fn sme_SetTmLevel
7705 \brief Set Thermal Mitigation Level to RIVA
7706 \param hHal - The handle returned by macOpen.
7707 \param newTMLevel - new Thermal Mitigation Level
7708 \param tmMode - Thermal Mitigation handle mode, default 0
7709 \return eHalStatus
7710 ---------------------------------------------------------------------------*/
7711eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
7712{
7713 eHalStatus status = eHAL_STATUS_SUCCESS;
7714 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7715 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7716 vos_msg_t vosMessage;
7717 tAniSetTmLevelReq *setTmLevelReq = NULL;
7718
7719 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7720 {
7721 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05307722 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07007723 {
7724 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007725 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007726 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07007727 return eHAL_STATUS_FAILURE;
7728 }
7729
7730 setTmLevelReq->tmMode = tmMode;
7731 setTmLevelReq->newTmLevel = newTMLevel;
7732
7733 /* serialize the req through MC thread */
7734 vosMessage.bodyptr = setTmLevelReq;
7735 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
7736 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7737 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7738 {
7739 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007740 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007741 vos_mem_free(setTmLevelReq);
7742 status = eHAL_STATUS_FAILURE;
7743 }
7744 sme_ReleaseGlobalLock( &pMac->sme );
7745 }
7746 return(status);
7747}
7748
7749/*---------------------------------------------------------------------------
7750
7751 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
7752 Host and FW.
7753
7754 \param hHal - HAL handle for device
7755
7756 \return NONE
7757
7758---------------------------------------------------------------------------*/
7759void sme_featureCapsExchange( tHalHandle hHal)
7760{
7761 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
7762 WDA_featureCapsExchange(vosContext);
7763}
Jeff Johnsond13512a2012-07-17 11:42:19 -07007764
Yathish9f22e662012-12-10 14:21:35 -08007765/*---------------------------------------------------------------------------
7766
7767 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
7768 in Host.
7769
7770 \param hHal - HAL handle for device
7771
7772 \return NONE
7773
7774---------------------------------------------------------------------------*/
7775void sme_disableFeatureCapablity(tANI_U8 feature_index)
7776{
7777 WDA_disableCapablityFeature(feature_index);
7778}
7779
7780
Jeff Johnsond13512a2012-07-17 11:42:19 -07007781
7782/* ---------------------------------------------------------------------------
7783
7784 \fn sme_GetDefaultCountryCode
7785
7786 \brief Get the default country code from NV
7787
7788 \param hHal
7789 \param pCountry
7790 \- return eHalStatus
7791
7792 -------------------------------------------------------------------------------*/
7793eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
7794{
7795 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7796 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
7797}
7798
7799/* ---------------------------------------------------------------------------
7800
7801 \fn sme_GetCurrentCountryCode
7802
7803 \brief Get the current country code
7804
7805 \param hHal
7806 \param pCountry
7807 \- return eHalStatus
7808
7809 -------------------------------------------------------------------------------*/
7810eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
7811{
7812 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7813 return csrGetCurrentCountryCode(pMac, pCountry);
7814}
7815
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07007816/* ---------------------------------------------------------------------------
7817 \fn sme_transportDebug
7818 \brief Dynamically monitoring Transport channels
7819 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07007820 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08007821 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07007822 \param toggleStallDetect Enable stall detect feature
7823 This feature will take effect to data performance
7824 Not integrate till fully verification
7825 \- return NONE
7826 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07007827void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07007828{
schang6295e542013-03-12 15:31:23 -07007829 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7830
7831 if (NULL == pMac)
7832 {
7833 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
7834 "%s: invalid context", __func__);
7835 return;
7836 }
7837 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07007838}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007839
Kiran4a17ebe2013-01-31 10:43:43 -08007840/* ---------------------------------------------------------------------------
7841 \fn sme_ResetPowerValuesFor5G
7842 \brief Reset the power values for 5G band with NV power values.
7843 \param hHal - HAL handle for device
7844 \- return NONE
7845 -------------------------------------------------------------------------*/
7846void sme_ResetPowerValuesFor5G (tHalHandle hHal)
7847{
7848 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
7849 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
7850 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
7851}
7852
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007853#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
7854/* ---------------------------------------------------------------------------
7855 \fn sme_UpdateRoamPrefer5GHz
7856 \brief enable/disable Roam prefer 5G runtime option
7857 This function is called through dynamic setConfig callback function
7858 to configure the Roam prefer 5G runtime option
7859 \param hHal - HAL handle for device
7860 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
7861 \- return Success or failure
7862 -------------------------------------------------------------------------*/
7863
7864eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
7865{
7866 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08007867 eHalStatus status = eHAL_STATUS_SUCCESS;
7868
7869 status = sme_AcquireGlobalLock( &pMac->sme );
7870 if ( HAL_STATUS_SUCCESS( status ) )
7871 {
7872 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7873 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
7874 pMac->roam.configParam.nRoamPrefer5GHz,
7875 nRoamPrefer5GHz);
7876 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
7877 sme_ReleaseGlobalLock( &pMac->sme );
7878 }
7879
7880 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007881}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08007882
7883/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007884 \fn sme_setRoamIntraBand
7885 \brief enable/disable Intra band roaming
7886 This function is called through dynamic setConfig callback function
7887 to configure the intra band roaming
7888 \param hHal - HAL handle for device
7889 \param nRoamIntraBand Enable/Disable Intra band roaming
7890 \- return Success or failure
7891 -------------------------------------------------------------------------*/
7892eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
7893{
7894 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7895 eHalStatus status = eHAL_STATUS_SUCCESS;
7896
7897 status = sme_AcquireGlobalLock( &pMac->sme );
7898 if ( HAL_STATUS_SUCCESS( status ) )
7899 {
7900 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7901 "%s: gRoamIntraBand is changed from %d to %d", __func__,
7902 pMac->roam.configParam.nRoamIntraBand,
7903 nRoamIntraBand);
7904 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
7905 sme_ReleaseGlobalLock( &pMac->sme );
7906 }
7907
7908 return status ;
7909}
7910
7911/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007912 \fn sme_UpdateRoamScanNProbes
7913 \brief function to update roam scan N probes
7914 This function is called through dynamic setConfig callback function
7915 to update roam scan N probes
7916 \param hHal - HAL handle for device
7917 \param nProbes number of probe requests to be sent out
7918 \- return Success or failure
7919 -------------------------------------------------------------------------*/
7920eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
7921{
7922 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7923 eHalStatus status = eHAL_STATUS_SUCCESS;
7924
7925 status = sme_AcquireGlobalLock( &pMac->sme );
7926 if ( HAL_STATUS_SUCCESS( status ) )
7927 {
7928 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7929 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
7930 pMac->roam.configParam.nProbes,
7931 nProbes);
7932 pMac->roam.configParam.nProbes = nProbes;
7933 sme_ReleaseGlobalLock( &pMac->sme );
7934 }
7935#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7936 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7937 {
7938 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7939 REASON_NPROBES_CHANGED);
7940 }
7941#endif
7942 return status ;
7943}
7944
7945/* ---------------------------------------------------------------------------
7946 \fn sme_UpdateRoamScanHomeAwayTime
7947 \brief function to update roam scan Home away time
7948 This function is called through dynamic setConfig callback function
7949 to update roam scan home away time
7950 \param hHal - HAL handle for device
7951 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07007952 \param bSendOffloadCmd If TRUE then send offload command to firmware
7953 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007954 \- return Success or failure
7955 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07007956eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
7957 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007958{
7959 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7960 eHalStatus status = eHAL_STATUS_SUCCESS;
7961
7962 status = sme_AcquireGlobalLock( &pMac->sme );
7963 if ( HAL_STATUS_SUCCESS( status ) )
7964 {
7965 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7966 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
7967 pMac->roam.configParam.nRoamScanHomeAwayTime,
7968 nRoamScanHomeAwayTime);
7969 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
7970 sme_ReleaseGlobalLock( &pMac->sme );
7971 }
7972
7973#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07007974 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007975 {
7976 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7977 REASON_HOME_AWAY_TIME_CHANGED);
7978 }
7979#endif
7980 return status;
7981}
7982
7983
7984/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007985 \fn sme_getRoamIntraBand
7986 \brief get Intra band roaming
7987 \param hHal - HAL handle for device
7988 \- return Success or failure
7989 -------------------------------------------------------------------------*/
7990v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
7991{
7992 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7993 return pMac->roam.configParam.nRoamIntraBand;
7994}
7995
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007996/* ---------------------------------------------------------------------------
7997 \fn sme_getRoamScanNProbes
7998 \brief get N Probes
7999 \param hHal - HAL handle for device
8000 \- return Success or failure
8001 -------------------------------------------------------------------------*/
8002v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
8003{
8004 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8005 return pMac->roam.configParam.nProbes;
8006}
8007
8008/* ---------------------------------------------------------------------------
8009 \fn sme_getRoamScanHomeAwayTime
8010 \brief get Roam scan home away time
8011 \param hHal - HAL handle for device
8012 \- return Success or failure
8013 -------------------------------------------------------------------------*/
8014v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
8015{
8016 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8017 return pMac->roam.configParam.nRoamScanHomeAwayTime;
8018}
8019
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008020
8021/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008022 \fn sme_UpdateImmediateRoamRssiDiff
8023 \brief Update nImmediateRoamRssiDiff
8024 This function is called through dynamic setConfig callback function
8025 to configure nImmediateRoamRssiDiff
8026 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
8027 \param hHal - HAL handle for device
8028 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
8029 candidate and current AP.
8030 \- return Success or failure
8031 -------------------------------------------------------------------------*/
8032
8033eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
8034{
8035 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008036 eHalStatus status = eHAL_STATUS_SUCCESS;
8037
8038 status = sme_AcquireGlobalLock( &pMac->sme );
8039 if ( HAL_STATUS_SUCCESS( status ) )
8040 {
8041 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8042 "LFR runtime successfully set immediate roam rssi diff to %d - old value is %d - roam state is %d",
8043 nImmediateRoamRssiDiff,
8044 pMac->roam.configParam.nImmediateRoamRssiDiff,
8045 pMac->roam.neighborRoamInfo.neighborRoamState);
8046 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
8047 sme_ReleaseGlobalLock( &pMac->sme );
8048 }
8049
8050 return status ;
8051}
8052
8053/* ---------------------------------------------------------------------------
8054 \fn sme_UpdateRoamRssiDiff
8055 \brief Update RoamRssiDiff
8056 This function is called through dynamic setConfig callback function
8057 to configure RoamRssiDiff
8058 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
8059 \param hHal - HAL handle for device
8060 \param RoamRssiDiff - minimum rssi difference between potential
8061 candidate and current AP.
8062 \- return Success or failure
8063 -------------------------------------------------------------------------*/
8064
8065eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
8066{
8067 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8068 eHalStatus status = eHAL_STATUS_SUCCESS;
8069
8070 status = sme_AcquireGlobalLock( &pMac->sme );
8071 if ( HAL_STATUS_SUCCESS( status ) )
8072 {
8073 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8074 "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %d",
8075 RoamRssiDiff,
8076 pMac->roam.configParam.RoamRssiDiff,
8077 pMac->roam.neighborRoamInfo.neighborRoamState);
8078 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
8079 sme_ReleaseGlobalLock( &pMac->sme );
8080 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008081#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8082 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8083 {
8084 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
8085 }
8086#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008087 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008088}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008089
8090/*--------------------------------------------------------------------------
8091 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
8092 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8093 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008094 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008095 \param hHal - The handle returned by macOpen.
8096 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
8097 Other status means SME is failed to update isFastTransitionEnabled.
8098 \sa
8099 --------------------------------------------------------------------------*/
8100eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
8101 v_BOOL_t isFastTransitionEnabled)
8102{
8103 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008104 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008105
Srinivas Girigowdade697412013-02-14 16:31:48 -08008106 status = sme_AcquireGlobalLock( &pMac->sme );
8107 if ( HAL_STATUS_SUCCESS( status ) )
8108 {
8109 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8110 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
8111 pMac->roam.configParam.isFastTransitionEnabled,
8112 isFastTransitionEnabled);
8113 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
8114 sme_ReleaseGlobalLock( &pMac->sme );
8115 }
8116
8117 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008118}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008119
8120/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008121 \fn sme_UpdateWESMode
8122 \brief Update WES Mode
8123 This function is called through dynamic setConfig callback function
8124 to configure isWESModeEnabled
8125 \param hHal - HAL handle for device
8126 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
8127 Other status means SME is failed to update isWESModeEnabled.
8128 -------------------------------------------------------------------------*/
8129
8130eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
8131{
8132 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8133 eHalStatus status = eHAL_STATUS_SUCCESS;
8134
8135 status = sme_AcquireGlobalLock( &pMac->sme );
8136 if ( HAL_STATUS_SUCCESS( status ) )
8137 {
8138 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8139 "LFR runtime successfully set WES Mode to %d - old value is %d - roam state is %d",
8140 isWESModeEnabled,
8141 pMac->roam.configParam.isWESModeEnabled,
8142 pMac->roam.neighborRoamInfo.neighborRoamState);
8143 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
8144 sme_ReleaseGlobalLock( &pMac->sme );
8145 }
8146
8147 return status ;
8148}
8149
8150/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008151 \fn sme_SetRoamScanControl
8152 \brief Set roam scan control
8153 This function is called to set roam scan control
8154 if roam scan control is set to 0, roaming scan cache is cleared
8155 any value other than 0 is treated as invalid value
8156 \param hHal - HAL handle for device
8157 \return eHAL_STATUS_SUCCESS - SME update config successfully.
8158 Other status means SME failure to update
8159 -------------------------------------------------------------------------*/
8160eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
8161{
8162 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8163 eHalStatus status = eHAL_STATUS_SUCCESS;
8164
8165 status = sme_AcquireGlobalLock( &pMac->sme );
8166 if ( HAL_STATUS_SUCCESS( status ) )
8167 {
8168 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8169 "LFR runtime successfully set roam scan control to %d - old value is %d - roam state is %d",
8170 roamScanControl,
8171 pMac->roam.configParam.nRoamScanControl,
8172 pMac->roam.neighborRoamInfo.neighborRoamState);
8173 pMac->roam.configParam.nRoamScanControl = roamScanControl;
8174 if ( 0 == roamScanControl)
8175 {
8176 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8177 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008178 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008179#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8180 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8181 {
8182 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
8183 }
8184#endif
8185 }
8186 sme_ReleaseGlobalLock( &pMac->sme );
8187 }
8188 return status ;
8189}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008190#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */
8191
8192#ifdef FEATURE_WLAN_LFR
8193/*--------------------------------------------------------------------------
8194 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
8195 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8196 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008197 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008198 \param hHal - The handle returned by macOpen.
8199 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
8200 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
8201 \sa
8202 --------------------------------------------------------------------------*/
8203eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008204 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008205{
8206 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8207
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008208 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
8209 {
8210 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8211 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8212 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8213 isFastRoamIniFeatureEnabled);
8214 return eHAL_STATUS_SUCCESS;
8215 }
8216
Srinivas Girigowdade697412013-02-14 16:31:48 -08008217 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8218 "%s: FastRoamEnabled is changed from %d to %d", __func__,
8219 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8220 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008221 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008222 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008223
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008224 return eHAL_STATUS_SUCCESS;
8225}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008226
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08008227/*--------------------------------------------------------------------------
8228 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
8229 Enable/disable LFR MAWC support at runtime
8230 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8231 isMAWCIniFeatureEnabled.
8232 This is a synchronous call
8233 \param hHal - The handle returned by macOpen.
8234 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
8235 Other status means SME is failed to update MAWCEnabled.
8236 \sa
8237 --------------------------------------------------------------------------*/
8238eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
8239 const v_BOOL_t MAWCEnabled)
8240{
8241 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8242 eHalStatus status = eHAL_STATUS_SUCCESS;
8243
8244 status = sme_AcquireGlobalLock( &pMac->sme );
8245 if ( HAL_STATUS_SUCCESS( status ) )
8246 {
8247 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8248 "%s: MAWCEnabled is changed from %d to %d", __func__,
8249 pMac->roam.configParam.MAWCEnabled,
8250 MAWCEnabled);
8251 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
8252 sme_ReleaseGlobalLock( &pMac->sme );
8253 }
8254
8255 return status ;
8256
8257}
8258
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008259#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8260/*--------------------------------------------------------------------------
8261 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
8262 This is a synchronuous call
8263 \param hHal - The handle returned by macOpen.
8264 \return eHAL_STATUS_SUCCESS
8265 Other status means SME is failed
8266 \sa
8267 --------------------------------------------------------------------------*/
8268
8269eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
8270 v_BOOL_t bFastRoamInConIniFeatureEnabled)
8271{
8272
8273 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8274 eHalStatus status = eHAL_STATUS_SUCCESS;
8275
8276 status = sme_AcquireGlobalLock( &pMac->sme );
8277 if ( HAL_STATUS_SUCCESS( status ) )
8278 {
8279 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
8280 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
8281 {
8282 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
8283 }
8284 sme_ReleaseGlobalLock( &pMac->sme );
8285 }
8286
8287 return status;
8288}
8289#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008290#endif /* FEATURE_WLAN_LFR */
8291
8292#ifdef FEATURE_WLAN_CCX
8293/*--------------------------------------------------------------------------
8294 \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime
8295 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8296 isCcxIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008297 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008298 \param hHal - The handle returned by macOpen.
8299 \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully.
8300 Other status means SME is failed to update isCcxIniFeatureEnabled.
8301 \sa
8302 --------------------------------------------------------------------------*/
8303
8304eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008305 const v_BOOL_t isCcxIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008306{
8307 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8308
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008309 if (pMac->roam.configParam.isCcxIniFeatureEnabled == isCcxIniFeatureEnabled)
8310 {
8311 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8312 "%s: CCX Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8313 pMac->roam.configParam.isCcxIniFeatureEnabled,
8314 isCcxIniFeatureEnabled);
8315 return eHAL_STATUS_SUCCESS;
8316 }
8317
Srinivas Girigowdade697412013-02-14 16:31:48 -08008318 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8319 "%s: CcxEnabled is changed from %d to %d", __func__,
8320 pMac->roam.configParam.isCcxIniFeatureEnabled,
8321 isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008322 pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008323 csrNeighborRoamUpdateCcxModeEnabled(pMac, isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008324
8325 if(TRUE == isCcxIniFeatureEnabled)
8326 {
8327 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008328 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07008329
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008330#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8331 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8332 {
8333 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CCX_INI_CFG_CHANGED);
8334 }
8335#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008336 return eHAL_STATUS_SUCCESS;
8337}
8338#endif /* FEATURE_WLAN_CCX */
8339
8340/*--------------------------------------------------------------------------
8341 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
8342 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8343 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008344 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008345 \param hHal - The handle returned by macOpen.
8346 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
8347 Other status means SME is failed to update fEnableFwRssiMonitoring.
8348 \sa
8349 --------------------------------------------------------------------------*/
8350
8351eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
8352 v_BOOL_t fEnableFwRssiMonitoring)
8353{
8354 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
8355
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008356 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
8357 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
8358 {
8359 halStatus = eHAL_STATUS_FAILURE;
8360 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008361 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008362 }
8363
8364 return (halStatus);
8365}
8366
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008367#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08008368/*--------------------------------------------------------------------------
8369 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
8370 This is a synchronous call
8371 \param hHal - The handle returned by macOpen.
8372 \return eHAL_STATUS_SUCCESS - SME update config successful.
8373 Other status means SME is failed to update
8374 \sa
8375 --------------------------------------------------------------------------*/
8376eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
8377 v_U8_t neighborLookupRssiThreshold)
8378{
8379 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8380 eHalStatus status = eHAL_STATUS_SUCCESS;
8381
8382 status = sme_AcquireGlobalLock( &pMac->sme );
8383 if ( HAL_STATUS_SUCCESS( status ) )
8384 {
8385 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
8386 if (HAL_STATUS_SUCCESS(status))
8387 {
8388 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8389 "LFR runtime successfully set Lookup threshold to %d - old value is %d - roam state is %d",
8390 neighborLookupRssiThreshold,
8391 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
8392 pMac->roam.neighborRoamInfo.neighborRoamState);
8393 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
8394 neighborLookupRssiThreshold;
8395 }
8396 sme_ReleaseGlobalLock( &pMac->sme );
8397 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008398 return status;
8399}
8400
8401/*--------------------------------------------------------------------------
8402 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
8403 This is a synchronous call
8404 \param hHal - The handle returned by macOpen.
8405 \return eHAL_STATUS_SUCCESS - SME update config successful.
8406 Other status means SME is failed to update
8407 \sa
8408 --------------------------------------------------------------------------*/
8409eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
8410 v_U8_t neighborReassocRssiThreshold)
8411{
8412 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8413 eHalStatus status = eHAL_STATUS_SUCCESS;
8414
8415 status = sme_AcquireGlobalLock( &pMac->sme );
8416 if ( HAL_STATUS_SUCCESS( status ) )
8417 {
8418 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8419 "LFR runtime successfully set Reassoc threshold to %d - old value is %d - roam state is %d",
8420 neighborReassocRssiThreshold,
8421 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
8422 pMac->roam.neighborRoamInfo.neighborRoamState);
8423 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
8424 neighborReassocRssiThreshold;
8425 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
8426 neighborReassocRssiThreshold;
8427 sme_ReleaseGlobalLock( &pMac->sme );
8428 }
8429
8430 return status ;
8431}
8432
8433
8434/*--------------------------------------------------------------------------
8435 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
8436 This is a synchronous call
8437 \param hHal - The handle returned by macOpen.
8438 \return eHAL_STATUS_SUCCESS - SME update config successful.
8439 Other status means SME is failed to update
8440 \sa
8441 --------------------------------------------------------------------------*/
8442v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
8443{
8444 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8445 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
8446}
8447
8448/*--------------------------------------------------------------------------
8449 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
8450 This is a synchronous call
8451 \param hHal - The handle returned by macOpen.
8452 \return eHAL_STATUS_SUCCESS - SME update config successful.
8453 Other status means SME is failed to update
8454 \sa
8455 --------------------------------------------------------------------------*/
8456eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
8457 v_U16_t neighborScanResultsRefreshPeriod)
8458{
8459 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8460 eHalStatus status = eHAL_STATUS_SUCCESS;
8461
8462 status = sme_AcquireGlobalLock( &pMac->sme );
8463 if ( HAL_STATUS_SUCCESS( status ) )
8464 {
8465 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8466 "LFR runtime successfully set roam scan refresh period to %d - old value is %d - roam state is %d",
8467 neighborScanResultsRefreshPeriod,
8468 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
8469 pMac->roam.neighborRoamInfo.neighborRoamState);
8470 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
8471 neighborScanResultsRefreshPeriod;
8472 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
8473 neighborScanResultsRefreshPeriod;
8474
8475 sme_ReleaseGlobalLock( &pMac->sme );
8476 }
8477
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008478#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8479 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8480 {
8481 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8482 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
8483 }
8484#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008485 return status ;
8486}
8487
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008488#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8489/*--------------------------------------------------------------------------
8490 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
8491 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8492 gRoamScanOffloadEnabled.
8493 This is a synchronous call
8494 \param hHal - The handle returned by macOpen.
8495 \return eHAL_STATUS_SUCCESS - SME update config successfully.
8496 Other status means SME is failed to update.
8497 \sa
8498 --------------------------------------------------------------------------*/
8499
8500eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
8501 v_BOOL_t nRoamScanOffloadEnabled)
8502{
8503 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8504 eHalStatus status = eHAL_STATUS_SUCCESS;
8505
8506 status = sme_AcquireGlobalLock( &pMac->sme );
8507 if ( HAL_STATUS_SUCCESS( status ) )
8508 {
8509 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8510 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
8511 pMac->roam.configParam.isRoamOffloadScanEnabled,
8512 nRoamScanOffloadEnabled);
8513 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
8514 sme_ReleaseGlobalLock( &pMac->sme );
8515 }
8516
8517 return status ;
8518}
8519#endif
8520
Srinivas Girigowdade697412013-02-14 16:31:48 -08008521/*--------------------------------------------------------------------------
8522 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
8523 This is a synchronous call
8524 \param hHal - The handle returned by macOpen.
8525 \return v_U16_t - Neighbor scan results refresh period value
8526 \sa
8527 --------------------------------------------------------------------------*/
8528v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
8529{
8530 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8531 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
8532}
8533
8534/*--------------------------------------------------------------------------
8535 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
8536 This is a synchronuous call
8537 \param hHal - The handle returned by macOpen.
8538 \return eHAL_STATUS_SUCCESS - SME update config successful.
8539 Other status means SME is failed to update
8540 \sa
8541 --------------------------------------------------------------------------*/
8542v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
8543{
8544 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8545 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
8546}
8547
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008548/* ---------------------------------------------------------------------------
8549 \fn sme_UpdateEmptyScanRefreshPeriod
8550 \brief Update nEmptyScanRefreshPeriod
8551 This function is called through dynamic setConfig callback function
8552 to configure nEmptyScanRefreshPeriod
8553 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
8554 \param hHal - HAL handle for device
8555 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
8556 \- return Success or failure
8557 -------------------------------------------------------------------------*/
8558
8559eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
8560{
8561 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8562 eHalStatus status = eHAL_STATUS_SUCCESS;
8563
8564 status = sme_AcquireGlobalLock( &pMac->sme );
8565 if ( HAL_STATUS_SUCCESS( status ) )
8566 {
8567 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8568 "LFR runtime successfully set roam scan period to %d - old value is %d - roam state is %d",
8569 nEmptyScanRefreshPeriod,
8570 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
8571 pMac->roam.neighborRoamInfo.neighborRoamState);
8572 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
8573 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
8574 sme_ReleaseGlobalLock( &pMac->sme );
8575 }
8576
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07008577#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8578 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8579 {
8580 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8581 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
8582 }
8583#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008584 return status ;
8585}
8586
8587/* ---------------------------------------------------------------------------
8588 \fn sme_setNeighborScanMinChanTime
8589 \brief Update nNeighborScanMinChanTime
8590 This function is called through dynamic setConfig callback function
8591 to configure gNeighborScanChannelMinTime
8592 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
8593 \param hHal - HAL handle for device
8594 \param nNeighborScanMinChanTime - Channel minimum dwell time
8595 \- return Success or failure
8596 -------------------------------------------------------------------------*/
8597eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
8598{
8599 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8600 eHalStatus status = eHAL_STATUS_SUCCESS;
8601
8602 status = sme_AcquireGlobalLock( &pMac->sme );
8603 if ( HAL_STATUS_SUCCESS( status ) )
8604 {
8605 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8606 "LFR runtime successfully set channel min dwell time to %d - old value is %d - roam state is %d",
8607 nNeighborScanMinChanTime,
8608 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
8609 pMac->roam.neighborRoamInfo.neighborRoamState);
8610 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
8611 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
8612 sme_ReleaseGlobalLock( &pMac->sme );
8613 }
8614
8615 return status ;
8616}
8617
8618/* ---------------------------------------------------------------------------
8619 \fn sme_setNeighborScanMaxChanTime
8620 \brief Update nNeighborScanMaxChanTime
8621 This function is called through dynamic setConfig callback function
8622 to configure gNeighborScanChannelMaxTime
8623 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
8624 \param hHal - HAL handle for device
8625 \param nNeighborScanMinChanTime - Channel maximum dwell time
8626 \- return Success or failure
8627 -------------------------------------------------------------------------*/
8628eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
8629{
8630 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8631 eHalStatus status = eHAL_STATUS_SUCCESS;
8632
8633 status = sme_AcquireGlobalLock( &pMac->sme );
8634 if ( HAL_STATUS_SUCCESS( status ) )
8635 {
8636 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8637 "LFR runtime successfully set channel max dwell time to %d - old value is %d - roam state is %d",
8638 nNeighborScanMaxChanTime,
8639 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
8640 pMac->roam.neighborRoamInfo.neighborRoamState);
8641 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
8642 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
8643 sme_ReleaseGlobalLock( &pMac->sme );
8644 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07008645#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8646 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8647 {
8648 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8649 REASON_SCAN_CH_TIME_CHANGED);
8650 }
8651#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008652
8653 return status ;
8654}
8655
8656/* ---------------------------------------------------------------------------
8657 \fn sme_getNeighborScanMinChanTime
8658 \brief get neighbor scan min channel time
8659 \param hHal - The handle returned by macOpen.
8660 \return v_U16_t - channel min time value
8661 -------------------------------------------------------------------------*/
8662v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
8663{
8664 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8665 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
8666}
8667
8668/* ---------------------------------------------------------------------------
8669 \fn sme_getNeighborScanMaxChanTime
8670 \brief get neighbor scan max channel time
8671 \param hHal - The handle returned by macOpen.
8672 \return v_U16_t - channel max time value
8673 -------------------------------------------------------------------------*/
8674v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
8675{
8676 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8677 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
8678}
8679
8680/* ---------------------------------------------------------------------------
8681 \fn sme_setNeighborScanPeriod
8682 \brief Update nNeighborScanPeriod
8683 This function is called through dynamic setConfig callback function
8684 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07008685 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008686 \param hHal - HAL handle for device
8687 \param nNeighborScanPeriod - neighbor scan period
8688 \- return Success or failure
8689 -------------------------------------------------------------------------*/
8690eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
8691{
8692 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8693 eHalStatus status = eHAL_STATUS_SUCCESS;
8694
8695 status = sme_AcquireGlobalLock( &pMac->sme );
8696 if ( HAL_STATUS_SUCCESS( status ) )
8697 {
8698 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8699 "LFR runtime successfully set neighbor scan period to %d - old value is %d - roam state is %d",
8700 nNeighborScanPeriod,
8701 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
8702 pMac->roam.neighborRoamInfo.neighborRoamState);
8703 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
8704 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
8705 sme_ReleaseGlobalLock( &pMac->sme );
8706 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07008707#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8708 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8709 {
8710 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8711 REASON_SCAN_HOME_TIME_CHANGED);
8712 }
8713#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008714
8715 return status ;
8716}
8717
8718/* ---------------------------------------------------------------------------
8719 \fn sme_getNeighborScanPeriod
8720 \brief get neighbor scan period
8721 \param hHal - The handle returned by macOpen.
8722 \return v_U16_t - neighbor scan period
8723 -------------------------------------------------------------------------*/
8724v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
8725{
8726 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8727 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
8728}
8729
8730#endif
8731
Srinivas Girigowdade697412013-02-14 16:31:48 -08008732#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008733
Srinivas Girigowdade697412013-02-14 16:31:48 -08008734/*--------------------------------------------------------------------------
8735 \brief sme_getRoamRssiDiff() - get Roam rssi diff
8736 This is a synchronous call
8737 \param hHal - The handle returned by macOpen.
8738 \return v_U16_t - Rssi diff value
8739 \sa
8740 --------------------------------------------------------------------------*/
8741v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
8742{
8743 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8744 return pMac->roam.configParam.RoamRssiDiff;
8745}
8746
8747/*--------------------------------------------------------------------------
8748 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
8749 This is a synchronous call
8750 \param hHal - The handle returned by macOpen.
8751 \return eHAL_STATUS_SUCCESS - SME update config successful.
8752 Other status means SME is failed to update
8753 \sa
8754 --------------------------------------------------------------------------*/
8755eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
8756 tANI_U8 numChannels)
8757{
8758 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8759 eHalStatus status = eHAL_STATUS_SUCCESS;
8760 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008761 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08008762 tANI_U8 newChannelList[128] = {0};
8763 tANI_U8 i = 0, j = 0;
8764
8765 status = sme_AcquireGlobalLock( &pMac->sme );
8766 if ( HAL_STATUS_SUCCESS( status ) )
8767 {
8768 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
8769 {
8770 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
8771 {
8772 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
8773 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
8774 }
8775 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008776 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008777 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Srinivas Girigowdade697412013-02-14 16:31:48 -08008778 status = csrUpdateBgScanConfigIniChannelList(pMac, csrGetCurrentBand(hHal));
8779
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008780 if ( HAL_STATUS_SUCCESS( status ))
Srinivas Girigowdade697412013-02-14 16:31:48 -08008781 {
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008782 sme_SetRoamScanControl(hHal, 1);
8783 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08008784 {
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008785 j = 0;
8786 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
8787 {
8788 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
8789 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
8790 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008791 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008792
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008793 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8794 "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d",
8795 newChannelList, oldChannelList,
8796 pMac->roam.neighborRoamInfo.neighborRoamState);
8797 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008798 sme_ReleaseGlobalLock( &pMac->sme );
8799 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008800#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8801 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8802 {
8803 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
8804 }
8805#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008806
8807 return status ;
8808}
8809
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008810
8811#ifdef FEATURE_WLAN_CCX_UPLOAD
8812/*--------------------------------------------------------------------------
8813 \brief sme_SetCcxRoamScanChannelList() - set ccx roam scan channel list
8814 This is a synchronuous call
8815 \param hHal - The handle returned by macOpen.
8816 \return eHAL_STATUS_SUCCESS - SME update config successful.
8817 Other status means SME is failed to update
8818 \sa
8819 --------------------------------------------------------------------------*/
8820eHalStatus sme_SetCcxRoamScanChannelList(tHalHandle hHal,
8821 tANI_U8 *pChannelList,
8822 tANI_U8 numChannels)
8823{
8824 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8825 eHalStatus status = eHAL_STATUS_SUCCESS;
8826 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
8827 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
8828 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
8829 tANI_U8 newChannelList[128] = {0};
8830 tANI_U8 i = 0, j = 0;
8831
8832 status = sme_AcquireGlobalLock( &pMac->sme );
8833 if ( HAL_STATUS_SUCCESS( status ) )
8834 {
8835 if (NULL != currChannelListInfo->ChannelList)
8836 {
8837 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
8838 {
8839 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
8840 currChannelListInfo->ChannelList[i]);
8841 }
8842 }
8843 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
8844
8845 if ( HAL_STATUS_SUCCESS( status ))
8846 {
8847 if (NULL != currChannelListInfo->ChannelList)
8848 {
8849 j = 0;
8850 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
8851 {
8852 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
8853 currChannelListInfo->ChannelList[i]);
8854 }
8855 }
8856
8857 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8858 "CCX roam scan channel list successfully set to %s - old value is %s - roam state is %d",
8859 newChannelList, oldChannelList,
8860 pMac->roam.neighborRoamInfo.neighborRoamState);
8861 }
8862 sme_ReleaseGlobalLock( &pMac->sme );
8863 }
8864#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8865 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8866 {
8867 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
8868 }
8869#endif
8870
8871 return status ;
8872}
8873#endif
8874
Srinivas Girigowdade697412013-02-14 16:31:48 -08008875/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -08008876 \brief csrUpdateBgScanConfigIniChannelList() - Update bgscan roam cache
8877 This is a synchronous call
8878 \param hHal - The handle returned by macOpen.
8879 \return eHAL_STATUS_SUCCESS - SME update config successful.
8880 Other status means SME is failed to update
8881 \sa
8882 --------------------------------------------------------------------------*/
8883eHalStatus sme_UpdateBgScanConfigIniChannelList(tHalHandle hHal,
8884 eCsrBand eBand)
8885{
8886 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8887 return csrUpdateBgScanConfigIniChannelList(pMac, eBand);
8888}
8889
8890/*--------------------------------------------------------------------------
8891 \brief sme_getRoamScanChannelList() - get roam scan channel list
8892 This is a synchronous call
8893 \param hHal - The handle returned by macOpen.
8894 \return eHAL_STATUS_SUCCESS - SME update config successful.
8895 Other status means SME is failed to update
8896 \sa
8897 --------------------------------------------------------------------------*/
8898eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
8899 tANI_U8 *pNumChannels)
8900{
8901 int i = 0;
8902 tANI_U8 *pOutPtr = pChannelList;
8903 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8904 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
8905 eHalStatus status = eHAL_STATUS_SUCCESS;
8906
8907 status = sme_AcquireGlobalLock( &pMac->sme );
8908 if ( HAL_STATUS_SUCCESS( status ) )
8909 {
8910 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
8911 {
8912 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
8913 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008914 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08008915 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008916 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08008917 }
8918
8919 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
8920 for (i = 0; i < (*pNumChannels); i++)
8921 {
8922 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
8923 }
8924 pOutPtr[i] = '\0';
8925 sme_ReleaseGlobalLock( &pMac->sme );
8926 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008927 return status ;
8928}
8929
8930/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008931 \brief sme_getIsCcxFeatureEnabled() - get CCX feature enabled or not
8932 This is a synchronuous call
8933 \param hHal - The handle returned by macOpen.
8934 \return TRUE (1) - if the CCX feature is enabled
8935 FALSE (0) - if feature is disabled (compile or runtime)
8936 \sa
8937 --------------------------------------------------------------------------*/
8938tANI_BOOLEAN sme_getIsCcxFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08008939{
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008940#ifdef FEATURE_WLAN_CCX
Srinivas Girigowdade697412013-02-14 16:31:48 -08008941 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008942 return csrRoamIsCcxIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008943#else
8944 return eANI_BOOLEAN_FALSE;
8945#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008946}
8947
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008948/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008949 \brief sme_GetWESMode() - get WES Mode
8950 This is a synchronous call
8951 \param hHal - The handle returned by macOpen
8952 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
8953 \sa
8954 --------------------------------------------------------------------------*/
8955v_BOOL_t sme_GetWESMode(tHalHandle hHal)
8956{
8957 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8958 return pMac->roam.configParam.isWESModeEnabled;
8959}
8960
8961/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008962 \brief sme_GetRoamScanControl() - get scan control
8963 This is a synchronous call
8964 \param hHal - The handle returned by macOpen.
8965 \return v_BOOL_t - Enabled(1)/Disabled(0)
8966 \sa
8967 --------------------------------------------------------------------------*/
8968v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
8969{
8970 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8971 return pMac->roam.configParam.nRoamScanControl;
8972}
8973#endif
8974
8975/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008976 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
8977 This is a synchronuous call
8978 \param hHal - The handle returned by macOpen.
8979 \return TRUE (1) - if the feature is enabled
8980 FALSE (0) - if feature is disabled (compile or runtime)
8981 \sa
8982 --------------------------------------------------------------------------*/
8983tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
8984{
8985#ifdef FEATURE_WLAN_LFR
8986 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8987 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
8988#else
8989 return eANI_BOOLEAN_FALSE;
8990#endif
8991}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008992
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008993/*--------------------------------------------------------------------------
8994 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
8995 This is a synchronuous call
8996 \param hHal - The handle returned by macOpen.
8997 \return TRUE (1) - if the feature is enabled
8998 FALSE (0) - if feature is disabled (compile or runtime)
8999 \sa
9000 --------------------------------------------------------------------------*/
9001tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
9002{
9003#ifdef WLAN_FEATURE_VOWIFI_11R
9004 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9005 return pMac->roam.configParam.isFastTransitionEnabled;
9006#else
9007 return eANI_BOOLEAN_FALSE;
9008#endif
9009}
9010
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009011
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009012/* ---------------------------------------------------------------------------
9013 \fn sme_IsFeatureSupportedByFW
9014 \brief Check if an feature is enabled by FW
9015
9016 \param feattEnumValue - Enumeration value from placeHolderInCapBitmap
9017 \- return 1/0 (TRUE/FALSE)
9018 -------------------------------------------------------------------------*/
9019tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
9020{
9021 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
9022}
9023#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05309024
9025/* ---------------------------------------------------------------------------
9026 \fn sme_SendTdlsMgmtFrame
9027 \brief API to send TDLS management frames.
9028
9029 \param peerMac - peer's Mac Adress.
9030 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
9031 \- return VOS_STATUS_SUCCES
9032 -------------------------------------------------------------------------*/
9033VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
9034 tANI_U8 sessionId,
9035 tSirMacAddr peerMac,
9036 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
9037{
9038 eHalStatus status = eHAL_STATUS_SUCCESS;
9039 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9040
9041 status = sme_AcquireGlobalLock( &pMac->sme );
9042
9043 if ( HAL_STATUS_SUCCESS( status ) )
9044 {
9045 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
9046 sme_ReleaseGlobalLock( &pMac->sme );
9047 }
9048 return status ;
9049}
9050
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009051/* ---------------------------------------------------------------------------
9052 \fn sme_SendTdlsMgmtFrame
9053 \brief API to send TDLS management frames.
9054
9055 \param peerMac - peer's Mac Adress.
9056 \param frame_type - Type of TDLS mgmt frame to be sent.
9057 \param dialog - dialog token used in the frame.
9058 \param status - status to be incuded in the frame.
9059 \param buf - additional IEs to be included
9060 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08009061 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009062 \- return VOS_STATUS_SUCCES
9063 -------------------------------------------------------------------------*/
9064VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Hoonki Leea34dd892013-02-05 22:56:02 -08009065 tANI_U8 frame_type, tANI_U8 dialog, tANI_U16 statusCode, tANI_U8 *buf, tANI_U8 len, tANI_U8 responder)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009066{
9067 eHalStatus status = eHAL_STATUS_SUCCESS;
9068 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
9069 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9070
9071 status = sme_AcquireGlobalLock( &pMac->sme );
9072 if ( HAL_STATUS_SUCCESS( status ) )
9073 {
9074 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9075 sendTdlsReq.frameType = frame_type;
9076 sendTdlsReq.buf = buf;
9077 sendTdlsReq.len = len;
9078 sendTdlsReq.dialog = dialog;
9079 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08009080 sendTdlsReq.responder = responder;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009081
9082 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
9083
9084 sme_ReleaseGlobalLock( &pMac->sme );
9085 }
9086
9087 return status ;
9088
9089}
9090/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08009091 \fn sme_ChangeTdlsPeerSta
9092 \brief API to Update TDLS peer sta parameters.
9093
9094 \param peerMac - peer's Mac Adress.
9095 \param staParams - Peer Station Parameters
9096 \- return VOS_STATUS_SUCCES
9097 -------------------------------------------------------------------------*/
9098VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
9099 tCsrStaParams *pstaParams)
9100{
9101 eHalStatus status = eHAL_STATUS_SUCCESS;
9102 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9103
9104 status = sme_AcquireGlobalLock( &pMac->sme );
9105 if ( HAL_STATUS_SUCCESS( status ) )
9106 {
9107 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
9108
9109 sme_ReleaseGlobalLock( &pMac->sme );
9110 }
9111
9112 return status ;
9113
9114}
9115
9116/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009117 \fn sme_AddTdlsPeerSta
9118 \brief API to Add TDLS peer sta entry.
9119
9120 \param peerMac - peer's Mac Adress.
9121 \- return VOS_STATUS_SUCCES
9122 -------------------------------------------------------------------------*/
9123VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9124{
9125 eHalStatus status = eHAL_STATUS_SUCCESS;
9126 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9127
9128 status = sme_AcquireGlobalLock( &pMac->sme );
9129 if ( HAL_STATUS_SUCCESS( status ) )
9130 {
9131 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
9132
9133 sme_ReleaseGlobalLock( &pMac->sme );
9134 }
9135
9136 return status ;
9137
9138}
9139/* ---------------------------------------------------------------------------
9140 \fn sme_DeleteTdlsPeerSta
9141 \brief API to Delete TDLS peer sta entry.
9142
9143 \param peerMac - peer's Mac Adress.
9144 \- return VOS_STATUS_SUCCES
9145 -------------------------------------------------------------------------*/
9146VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9147{
9148 eHalStatus status = eHAL_STATUS_SUCCESS;
9149 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9150
9151 status = sme_AcquireGlobalLock( &pMac->sme );
9152 if ( HAL_STATUS_SUCCESS( status ) )
9153 {
9154 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
9155
9156 sme_ReleaseGlobalLock( &pMac->sme );
9157 }
9158
9159 return status ;
9160
9161}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07009162/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07009163 \fn sme_SetTdlsPowerSaveProhibited
9164 \API to set/reset the isTdlsPowerSaveProhibited.
9165
9166 \- return void
9167 -------------------------------------------------------------------------*/
9168void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
9169{
9170 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9171
9172 pMac->isTdlsPowerSaveProhibited = val;
9173 return;
9174}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009175#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +05309176/* ---------------------------------------------------------------------------
9177 \fn sme_IsPmcBmps
9178 \API to Check if PMC state is BMPS.
9179
9180 \- return v_BOOL_t
9181 -------------------------------------------------------------------------*/
9182v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
9183{
9184 return (BMPS == pmcGetPmcState(hHal));
9185}
9186
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009187#ifdef FEATURE_WLAN_TDLS_INTERNAL
9188/*
9189 * SME API to start TDLS discovery Procedure
9190 */
9191VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9192{
9193 VOS_STATUS status = VOS_STATUS_SUCCESS;
9194 tCsrTdlsDisRequest disReq = {{0}} ;
9195 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9196 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
9197
9198 return status ;
9199
9200}
9201
9202/*
9203 * Process TDLS discovery results
9204 */
9205v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
9206 tSmeTdlsDisResult *disResult, v_U8_t listType)
9207{
9208 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
9209 tSirTdlsPeerInfo *peerInfo = NULL ;
9210 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9211 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
9212 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
9213 tListElem *pEntry = NULL ;
9214 v_U8_t peerCnt = 0 ;
9215
9216 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009217 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009218 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
9219 while(pEntry)
9220 {
9221 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
9222 tdlsPeerStaLink) ;
9223 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
9224
9225 switch(listType)
9226 {
9227 case TDLS_SETUP_LIST:
9228 {
9229 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
9230 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309231 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9232 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009233 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9234 peerCnt++ ;
9235 }
9236 break ;
9237 }
9238 case TDLS_DIS_LIST:
9239 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309240 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9241 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009242 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9243 peerCnt++ ;
9244 break ;
9245 }
9246 default:
9247 {
9248 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009249 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009250 break ;
9251 }
9252 }
9253
9254 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
9255 }
9256
9257 return peerCnt ;
9258
9259}
9260
9261/*
9262 * SME API to start TDLS link setup Procedure.
9263 */
9264VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9265{
9266 VOS_STATUS status = VOS_STATUS_SUCCESS;
9267 tCsrTdlsSetupRequest setupReq = {{0}} ;
9268 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9269 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
9270 return status ;
9271
9272}
9273
9274/*
9275 * SME API to start TDLS link Teardown Procedure.
9276 */
9277VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9278{
9279 VOS_STATUS status = VOS_STATUS_SUCCESS;
9280 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
9281 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9282 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
9283 return status ;
9284
9285}
9286
9287#endif /* FEATURE_WLAN_TDLS */
9288
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -07009289eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
9290{
9291 eHalStatus status = eHAL_STATUS_FAILURE;
9292 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9293
9294 smsLog(pMac, LOG2, FL("enter"));
9295 status = sme_AcquireGlobalLock( &pMac->sme );
9296 if ( HAL_STATUS_SUCCESS( status ) )
9297 {
9298 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
9299 sme_ReleaseGlobalLock( &pMac->sme );
9300 }
9301 smsLog(pMac, LOG2, FL("exit status %d"), status);
9302
9303 return (status);
9304}
9305
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -07009306/*
9307 * SME API to enable/disable WLAN driver initiated SSR
9308 */
9309void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
9310{
9311 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9312 eHalStatus status = eHAL_STATUS_SUCCESS;
9313
9314 status = sme_AcquireGlobalLock(&pMac->sme);
9315 if (HAL_STATUS_SUCCESS(status))
9316 {
9317 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9318 "SSR level is changed %d", enableSSR);
9319 /* not serializing this messsage, as this is only going
9320 * to set a variable in WDA/WDI
9321 */
9322 WDA_SetEnableSSR(enableSSR);
9323 sme_ReleaseGlobalLock(&pMac->sme);
9324 }
9325 return;
9326}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009327
9328/*
9329 * SME API to determine the channel bonding mode
9330 */
9331VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
9332{
9333 tSmeConfigParams smeConfig;
9334 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9335
9336 if (
9337#ifdef WLAN_FEATURE_11AC
9338 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
9339 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
9340#endif
9341 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
9342 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode
9343 )
9344 {
9345 return VOS_STATUS_SUCCESS;
9346 }
9347
9348 /* If channel bonding mode is not required */
9349 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
9350 return VOS_STATUS_SUCCESS;
9351 }
9352
9353 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
9354 sme_GetConfigParam(pMac, &smeConfig);
9355
9356#ifdef WLAN_FEATURE_11AC
9357 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
9358 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
9359 {
9360 if ( channel== 36 || channel == 52 || channel == 100 ||
9361 channel == 116 || channel == 149 )
9362 {
9363 smeConfig.csrConfig.channelBondingMode5GHz =
9364 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
9365 }
9366 else if ( channel == 40 || channel == 56 || channel == 104 ||
9367 channel == 120 || channel == 153 )
9368 {
9369 smeConfig.csrConfig.channelBondingMode5GHz =
9370 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
9371 }
9372 else if ( channel == 44 || channel == 60 || channel == 108 ||
9373 channel == 124 || channel == 157 )
9374 {
9375 smeConfig.csrConfig.channelBondingMode5GHz =
9376 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1;
9377 }
9378 else if ( channel == 48 || channel == 64 || channel == 112 ||
9379 channel == 128 || channel == 161 )
9380 {
9381 smeConfig.csrConfig.channelBondingMode5GHz =
9382 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
9383 }
9384 else if ( channel == 165 )
9385 {
9386 smeConfig.csrConfig.channelBondingMode5GHz = 0;
9387 }
9388 }
9389#endif
9390
9391 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
9392 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
9393 {
9394 if ( channel== 40 || channel == 48 || channel == 56 ||
9395 channel == 64 || channel == 104 || channel == 112 ||
9396 channel == 120 || channel == 128 || channel == 136 ||
9397 channel == 144 || channel == 153 || channel == 161 )
9398 {
9399 smeConfig.csrConfig.channelBondingMode5GHz = 1;
9400 }
9401 else if ( channel== 36 || channel == 44 || channel == 52 ||
9402 channel == 60 || channel == 100 || channel == 108 ||
9403 channel == 116 || channel == 124 || channel == 132 ||
9404 channel == 140 || channel == 149 || channel == 157 )
9405 {
9406 smeConfig.csrConfig.channelBondingMode5GHz = 2;
9407 }
9408 else if ( channel == 165 )
9409 {
9410 smeConfig.csrConfig.channelBondingMode5GHz = 0;
9411 }
9412 }
9413 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Jeff Johnsonce8ad512013-10-30 12:34:42 -07009414 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009415
9416 sme_UpdateConfig (pMac, &smeConfig);
9417 return VOS_STATUS_SUCCESS;
9418}
9419
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07009420/*--------------------------------------------------------------------------
9421
9422 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
9423 \param hHal - The handle returned by macOpen.
9424 \param currDeviceMode - Current operating device mode.
9425 --------------------------------------------------------------------------*/
9426
9427void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
9428{
9429 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9430 pMac->sme.currDeviceMode = currDeviceMode;
9431 return;
9432}
9433
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07009434#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9435/*--------------------------------------------------------------------------
9436 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
9437 from CSR.
9438 This is a synchronous call
9439 \param hHal - The handle returned by macOpen
9440 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
9441 BSSID, channel etc.)
9442 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
9443 Other status means SME is failed to send the request.
9444 \sa
9445 --------------------------------------------------------------------------*/
9446
9447eHalStatus sme_HandoffRequest(tHalHandle hHal,
9448 tCsrHandoffRequest *pHandoffInfo)
9449{
9450 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9451 eHalStatus status = eHAL_STATUS_SUCCESS;
9452
9453 status = sme_AcquireGlobalLock( &pMac->sme );
9454 if ( HAL_STATUS_SUCCESS( status ) )
9455 {
9456 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9457 "%s: invoked", __func__);
9458 status = csrHandoffRequest(pMac, pHandoffInfo);
9459 sme_ReleaseGlobalLock( &pMac->sme );
9460 }
9461
9462 return status ;
9463}
9464#endif
9465
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -07009466/*
9467 * SME API to check if there is any infra station or
9468 * P2P client is connected
9469 */
9470VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
9471{
9472 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9473 if(csrIsInfraConnected(pMac))
9474 {
9475 return VOS_STATUS_SUCCESS;
9476 }
9477 return VOS_STATUS_E_FAILURE;
9478}
9479
Leo Chang9056f462013-08-01 19:21:11 -07009480
9481#ifdef FEATURE_WLAN_LPHB
9482/* ---------------------------------------------------------------------------
9483 \fn sme_LPHBConfigReq
9484 \API to make configuration LPHB within FW.
9485 \param hHal - The handle returned by macOpen
9486 \param lphdReq - LPHB request argument by client
9487 \param pCallbackfn - LPHB timeout notification callback function pointer
9488 \- return Configuration message posting status, SUCCESS or Fail
9489 -------------------------------------------------------------------------*/
9490eHalStatus sme_LPHBConfigReq
9491(
9492 tHalHandle hHal,
9493 tSirLPHBReq *lphdReq,
9494 void (*pCallbackfn)(void *pAdapter, void *indParam)
9495)
9496{
9497 eHalStatus status = eHAL_STATUS_SUCCESS;
9498 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
9499 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9500 vos_msg_t vosMessage;
9501
9502 status = sme_AcquireGlobalLock(&pMac->sme);
9503 if (eHAL_STATUS_SUCCESS == status)
9504 {
9505 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
9506 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -07009507 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -07009508 {
9509 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9510 "%s: Indication Call back did not registered", __func__);
9511 sme_ReleaseGlobalLock(&pMac->sme);
9512 return eHAL_STATUS_FAILURE;
9513 }
9514 else if (NULL != pCallbackfn)
9515 {
Leo Changd9df8aa2013-09-26 13:32:26 -07009516 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -07009517 }
9518
9519 /* serialize the req through MC thread */
9520 vosMessage.bodyptr = lphdReq;
9521 vosMessage.type = WDA_LPHB_CONF_REQ;
9522 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
9523 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
9524 {
9525 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9526 "%s: Post Config LPHB MSG fail", __func__);
9527 status = eHAL_STATUS_FAILURE;
9528 }
9529 sme_ReleaseGlobalLock(&pMac->sme);
9530 }
9531
9532 return(status);
9533}
9534#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -07009535/*--------------------------------------------------------------------------
9536 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
9537 scan parameter.
9538 This is a synchronous call
9539 \param hHal - The handle returned by macOpen
9540 \return NONE.
9541 \sa
9542 --------------------------------------------------------------------------*/
9543void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
9544 tANI_U8 nNumP2PChan)
9545{
9546 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9547
9548 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
9549 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
9550
9551 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9552 "%s: SCAN nNumStaChanCombinedConc : %d,"
9553 "nNumP2PChanCombinedConc : %d ",
9554 __func__, nNumStaChan, nNumP2PChan);
9555
9556 return;
9557
9558}
Leo Chang9056f462013-08-01 19:21:11 -07009559
Yue Mab9c86f42013-08-14 15:59:08 -07009560/* ---------------------------------------------------------------------------
9561 \fn sme_AddPeriodicTxPtrn
9562 \brief API to Periodic TX Pattern Offload feature
9563 \param hHal - The handle returned by macOpen
9564 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
9565 \return eHalStatus
9566 ---------------------------------------------------------------------------*/
9567eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
9568 *addPeriodicTxPtrnParams)
9569{
9570 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9571 eHalStatus status;
9572 vos_msg_t msg;
9573
9574 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
9575 {
9576 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
9577 msg.bodyptr = addPeriodicTxPtrnParams;
9578
9579 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
9580 {
9581 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
9582 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
9583 __func__);
9584
9585 sme_ReleaseGlobalLock(&pMac->sme);
9586 return eHAL_STATUS_FAILURE;
9587 }
9588
9589 sme_ReleaseGlobalLock(&pMac->sme);
9590 return eHAL_STATUS_SUCCESS;
9591 }
9592
9593 return status;
9594}
9595
9596/* ---------------------------------------------------------------------------
9597 \fn sme_DelPeriodicTxPtrn
9598 \brief API to Periodic TX Pattern Offload feature
9599 \param hHal - The handle returned by macOpen
9600 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
9601 \return eHalStatus
9602 ---------------------------------------------------------------------------*/
9603eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
9604 *delPeriodicTxPtrnParams)
9605{
9606 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9607 eHalStatus status;
9608 vos_msg_t msg;
9609
9610 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
9611 {
9612 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
9613 msg.bodyptr = delPeriodicTxPtrnParams;
9614
9615 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
9616 {
9617 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
9618 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
9619 __func__);
9620
9621 sme_ReleaseGlobalLock(&pMac->sme);
9622 return eHAL_STATUS_FAILURE;
9623 }
9624
9625 sme_ReleaseGlobalLock(&pMac->sme);
9626 return eHAL_STATUS_SUCCESS;
9627 }
9628
9629 return status;
9630}
9631
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -07009632void smeGetCommandQStatus( tHalHandle hHal )
9633{
9634 tSmeCmd *pTempCmd = NULL;
9635 tListElem *pEntry;
9636 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9637
9638 if (NULL == pMac)
9639 {
Kiet Lamcffc5862013-10-30 16:28:45 +05309640 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
9641 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -07009642 return;
9643 }
9644
9645 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
9646 if( pEntry )
9647 {
9648 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
9649 }
9650 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
9651 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
9652 if(pTempCmd)
9653 {
9654 if( eSmeCsrCommandMask & pTempCmd->command )
9655 {
9656 //CSR command is stuck. See what the reason code is for that command
9657 dumpCsrCommandInfo(pMac, pTempCmd);
9658 }
9659 } //if(pTempCmd)
9660
9661 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
9662 csrLLCount(&pMac->sme.smeCmdPendingList));
9663
9664 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
9665 csrLLCount(&pMac->roam.roamCmdPendingList));
9666
9667 return;
9668}
Rajeev79dbe4c2013-10-05 11:03:42 +05309669
9670#ifdef FEATURE_WLAN_BATCH_SCAN
9671/* ---------------------------------------------------------------------------
9672 \fn sme_SetBatchScanReq
9673 \brief API to set batch scan request in FW
9674 \param hHal - The handle returned by macOpen.
9675 \param pRequest - Pointer to the batch request.
9676 \param sessionId - session ID
9677 \param callbackRoutine - HDD callback which needs to be invoked after
9678 getting set batch scan response from FW
9679 \param callbackContext - pAdapter context
9680 \return eHalStatus
9681 ---------------------------------------------------------------------------*/
9682eHalStatus sme_SetBatchScanReq
9683(
9684 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
9685 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
9686 void *callbackContext
9687)
9688{
9689 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9690 eHalStatus status;
9691
9692 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
9693 {
9694 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
9695 callbackContext);
9696 sme_ReleaseGlobalLock( &pMac->sme );
9697 }
9698
9699 return status;
9700}
9701
9702/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -07009703 \fn sme_SendRateUpdateInd
9704 \brief API to Update rate
9705 \param hHal - The handle returned by macOpen
9706 \param rateUpdateParams - Pointer to rate update params
9707 \return eHalStatus
9708 ---------------------------------------------------------------------------*/
9709eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
9710{
9711 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9712 eHalStatus status;
9713 vos_msg_t msg;
9714
9715 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
9716 {
9717 msg.type = WDA_RATE_UPDATE_IND;
9718 msg.bodyptr = rateUpdateParams;
9719
9720 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
9721 {
9722 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
9723 "to post WDA_SET_RMC_RATE_IND to WDA!",
9724 __func__);
9725
9726 sme_ReleaseGlobalLock(&pMac->sme);
9727 return eHAL_STATUS_FAILURE;
9728 }
9729
9730 sme_ReleaseGlobalLock(&pMac->sme);
9731 return eHAL_STATUS_SUCCESS;
9732 }
9733
9734 return status;
9735}
9736
9737/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +05309738 \fn sme_TriggerBatchScanResultInd
9739 \brief API to trigger batch scan result indications from FW
9740 \param hHal - The handle returned by macOpen.
9741 \param pRequest - Pointer to get batch request.
9742 \param sessionId - session ID
9743 \param callbackRoutine - HDD callback which needs to be invoked after
9744 getting batch scan result indication from FW
9745 \param callbackContext - pAdapter context
9746 \return eHalStatus
9747 ---------------------------------------------------------------------------*/
9748eHalStatus sme_TriggerBatchScanResultInd
9749(
9750 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
9751 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
9752 void *callbackContext
9753)
9754{
9755 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9756 eHalStatus status;
9757
9758 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
9759 {
9760 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
9761 callbackRoutine, callbackContext);
9762 sme_ReleaseGlobalLock( &pMac->sme );
9763 }
9764
9765 return status;
9766}
9767
9768
9769/* ---------------------------------------------------------------------------
9770 \fn sme_StopBatchScanInd
9771 \brief API to stop batch scan request in FW
9772 \param hHal - The handle returned by macOpen.
9773 \param pRequest - Pointer to the batch request.
9774 \param sessionId - session ID
9775 \return eHalStatus
9776 ---------------------------------------------------------------------------*/
9777eHalStatus sme_StopBatchScanInd
9778(
9779 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
9780)
9781{
9782 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9783 eHalStatus status;
9784
9785 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
9786 {
9787 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
9788 sme_ReleaseGlobalLock( &pMac->sme );
9789 }
9790
9791 return status;
9792}
9793
9794#endif