blob: a995be1306d32abeabd1ae267f406d05953ff8eb [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"
83
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>
Jeff Johnson295189b2012-06-20 16:38:30 -070091
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080092#define READ_MEMORY_DUMP_CMD 9
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080093
Jeff Johnson295189b2012-06-20 16:38:30 -070094// TxMB Functions
95extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
96 tANI_U32 size, tSmeCmd **ppCmd );
97extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
98extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Jeff Johnson295189b2012-06-20 16:38:30 -070099extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
100extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
101extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
102extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
103extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
104extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -0700105
106static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
107static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
108
109eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
110
111eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
112
113eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
114
115eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
116
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700117#ifdef FEATURE_WLAN_LFR
118tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
119#endif
120
Chet Lanctot186b5732013-03-18 10:26:30 -0700121#ifdef WLAN_FEATURE_11W
122eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
123 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
124#endif
125
Jeff Johnson295189b2012-06-20 16:38:30 -0700126//Internal SME APIs
127eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
128{
129 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
130
131 if(psSme)
132 {
133 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
134 {
135 status = eHAL_STATUS_SUCCESS;
136 }
137 }
138
139 return (status);
140}
141
142
143eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
144{
145 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
146
147 if(psSme)
148 {
149 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
150 {
151 status = eHAL_STATUS_SUCCESS;
152 }
153 }
154
155 return (status);
156}
157
158
159
160static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
161{
162 eHalStatus status;
163 tSmeCmd *pCmd;
164
165 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
166 if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdActiveList)))
167 {
168 if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdPendingList)))
169 {
170 if(HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd, &pMac->sme.smeCmdFreeList)))
171 {
172 status = palAllocateMemory(pMac->hHdd, (void **)&pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
173 if(HAL_STATUS_SUCCESS(status))
174 {
175 tANI_U32 c;
176
177 palZeroMemory(pMac->hHdd, pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
178 pMac->sme.pSmeCmdBufAddr = pCmd;
179 for(c = 0; c < pMac->sme.totalSmeCmd; c++)
180 {
181 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd[c].Link, LL_ACCESS_LOCK);
182 }
183 }
184 }
185 }
186 }
187
188 return (status);
189}
190
191
192void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
193{
194 pCmd->command = eSmeNoCommand;
195 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
196}
197
198
199
200static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
201{
202 tListElem *pEntry;
203 tSmeCmd *pCommand;
204
205 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
206 {
207 //TODO: base on command type to call release functions
208 //reinitialize different command types so they can be reused
209 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
210 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
211 }
212}
213
214static void purgeSmeCmdList(tpAniSirGlobal pMac)
215{
216 //release any out standing commands back to free command list
217 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
218 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
219}
220
221void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId)
222{
223 //release any out standing commands back to free command list
224 tListElem *pEntry, *pNext;
225 tSmeCmd *pCommand;
226 tDblLinkList *pList = &pMac->sme.smeCmdPendingList;
227 tDblLinkList localList;
228
229 vos_mem_zero(&localList, sizeof(tDblLinkList));
230 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
231 {
232 smsLog(pMac, LOGE, FL(" failed to open list"));
233 return;
234 }
235
236 csrLLLock(pList);
237 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
238 while(pEntry != NULL)
239 {
240 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
241 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
242 if(pCommand->sessionId == sessionId)
243 {
244 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
245 {
246 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
247 }
248 }
249 pEntry = pNext;
250 }
251 csrLLUnlock(pList);
252
253 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
254 {
255 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
256 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
257 }
258 csrLLClose(&localList);
259
260}
261
262
263static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
264{
265 eHalStatus status = eHAL_STATUS_SUCCESS;
266
267 purgeSmeCmdList(pMac);
268 csrLLClose(&pMac->sme.smeCmdPendingList);
269 csrLLClose(&pMac->sme.smeCmdActiveList);
270 csrLLClose(&pMac->sme.smeCmdFreeList);
271
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800272 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
273 if(status != eHAL_STATUS_SUCCESS)
274 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800275 smsLog(pMac, LOGE,
276 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800277 goto done;
278 }
279
Jeff Johnson295189b2012-06-20 16:38:30 -0700280 if(NULL != pMac->sme.pSmeCmdBufAddr)
281 {
282 status = palFreeMemory(pMac->hHdd, pMac->sme.pSmeCmdBufAddr);
283 pMac->sme.pSmeCmdBufAddr = NULL;
284 }
285
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800286 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
287 if(status != eHAL_STATUS_SUCCESS)
288 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800289 smsLog(pMac, LOGE,
290 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800291 }
292done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 return (status);
294}
295
296
297void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
298{
299#ifdef WLAN_DEBUG
300 switch( pCmd->command )
301 {
302 case eSmeCommandScan:
303 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
304 break;
305
306 case eSmeCommandRoam:
307 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
308 break;
309
310 case eSmeCommandWmStatusChange:
311 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
312 break;
313
314 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800315 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700316 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
317 break;
318
319 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800320 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700321 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
322 break;
323
324 default:
325 break;
326 }
327#endif //#ifdef WLAN_DEBUG
328}
329
330tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
331{
332 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
333 tListElem *pEntry;
334
335 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
336
337 // If we can get another MS Msg buffer, then we are ok. Just link
338 // the entry onto the linked list. (We are using the linked list
339 // to keep track of tfhe message buffers).
340 if ( pEntry )
341 {
342 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
343 }
344 else {
345 int idx = 1;
346
347 //Cannot change pRetCmd here since it needs to return later.
348 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
349 if( pEntry )
350 {
351 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
352 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800353 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
355 if(pTempCmd)
356 {
357 if( eSmeCsrCommandMask & pTempCmd->command )
358 {
359 //CSR command is stuck. See what the reason code is for that command
360 dumpCsrCommandInfo(pMac, pTempCmd);
361 }
362 } //if(pTempCmd)
363
364 //dump what is in the pending queue
365 csrLLLock(&pMac->sme.smeCmdPendingList);
366 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
367 while(pEntry)
368 {
369 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800370 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700371 idx++, pTempCmd->command );
372 if( eSmeCsrCommandMask & pTempCmd->command )
373 {
374 //CSR command is stuck. See what the reason code is for that command
375 dumpCsrCommandInfo(pMac, pTempCmd);
376 }
377 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
378 }
379 csrLLUnlock(&pMac->sme.smeCmdPendingList);
380
381 //There may be some more command in CSR's own pending queue
382 csrLLLock(&pMac->roam.roamCmdPendingList);
383 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
384 while(pEntry)
385 {
386 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800387 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 idx++, pTempCmd->command );
389 dumpCsrCommandInfo(pMac, pTempCmd);
390 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
391 }
392 csrLLUnlock(&pMac->roam.roamCmdPendingList);
393 }
394
395 return( pRetCmd );
396}
397
398
399void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
400{
401 if ( fHighPriority )
402 {
403 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
404 }
405 else
406 {
407 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
408 }
409
410 // process the command queue...
411 smeProcessPendingQueue( pMac );
412
413 return;
414}
415
416
417static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
418{
419 eSmeCommandType pmcCommand = eSmeNoCommand;
420 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
421 tPmcState pmcState;
422 eHalStatus status;
423
424 do
425 {
426 pmcState = pmcGetPmcState(pMac);
427
428 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
429 if( !HAL_STATUS_SUCCESS(status) )
430 {
431 //PMC state is not right for the command, drop it
432 return ( eSmeDropCommand );
433 }
434 if( fFullPowerNeeded ) break;
435 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
436 ( eSmeCommandDelTs == pCommand->command ) );
437 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700438#ifdef FEATURE_OEM_DATA_SUPPORT
439 fFullPowerNeeded = (pmcState == IMPS &&
440 eSmeCommandOemDataReq == pCommand->command);
441 if(fFullPowerNeeded) break;
442#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 fFullPowerNeeded = (pmcState == IMPS &&
444 eSmeCommandRemainOnChannel == pCommand->command);
445 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 } while(0);
447
448 if( fFullPowerNeeded )
449 {
450 switch( pmcState )
451 {
452 case IMPS:
453 case STANDBY:
454 pmcCommand = eSmeCommandExitImps;
455 break;
456
457 case BMPS:
458 pmcCommand = eSmeCommandExitBmps;
459 break;
460
461 case UAPSD:
462 pmcCommand = eSmeCommandExitUapsd;
463 break;
464
465 case WOWL:
466 pmcCommand = eSmeCommandExitWowl;
467 break;
468
469 default:
470 break;
471 }
472 }
473
474 return ( pmcCommand );
475}
476
477
478//For commands that need to do extra cleanup.
479static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
480{
481 if( eSmePmcCommandMask & pCommand->command )
482 {
483 pmcAbortCommand( pMac, pCommand, fStopping );
484 }
485 else if ( eSmeCsrCommandMask & pCommand->command )
486 {
487 csrAbortCommand( pMac, pCommand, fStopping );
488 }
489 else
490 {
491 switch( pCommand->command )
492 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 case eSmeCommandRemainOnChannel:
494 if (NULL != pCommand->u.remainChlCmd.callback)
495 {
496 remainOnChanCallback callback =
497 pCommand->u.remainChlCmd.callback;
498 /* process the msg */
499 if( callback )
500 {
501 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
502 eCSR_SCAN_ABORT );
503 }
504 }
505 smeReleaseCommand( pMac, pCommand );
506 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 default:
508 smeReleaseCommand( pMac, pCommand );
509 break;
510 }
511 }
512}
513
514
515
516tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
517{
518 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
519 eHalStatus status = eHAL_STATUS_SUCCESS;
520 tListElem *pEntry;
521 tSmeCmd *pCommand;
522 eSmeCommandType pmcCommand = eSmeNoCommand;
523
524 // if the ActiveList is empty, then nothing is active so we can process a
525 // pending command...
526 //alwasy lock active list before locking pending list
527 csrLLLock( &pMac->sme.smeCmdActiveList );
528 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
529 {
530 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
531 {
532 //Peek the command
533 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
534 if( pEntry )
535 {
536 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
537 //We cannot execute any command in wait-for-key state until setKey is through.
538 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) )
539 {
540 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
541 {
542 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800543 smsLog(pMac, LOGE, " Cannot process command(%d) while waiting for key", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 return ( eANI_BOOLEAN_FALSE );
545 }
546 }
547 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
548 if( eSmeDropCommand == pmcCommand )
549 {
550 //This command is not ok for current PMC state
551 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
552 {
553 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
554 }
555 csrLLUnlock( &pMac->sme.smeCmdActiveList );
556 //tell caller to continue
557 return (eANI_BOOLEAN_TRUE);
558 }
559 else if( eSmeNoCommand != pmcCommand )
560 {
561 tExitBmpsInfo exitBmpsInfo;
562 void *pv = NULL;
563 tANI_U32 size = 0;
564 tSmeCmd *pPmcCmd = NULL;
565
566 if( eSmeCommandExitBmps == pmcCommand )
567 {
568 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
569 pv = (void *)&exitBmpsInfo;
570 size = sizeof(tExitBmpsInfo);
571 }
572 //pmcCommand has to be one of the exit power save command
573 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
574 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
575 {
576 //Force this command to wake up the chip
577 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
578 csrLLUnlock( &pMac->sme.smeCmdActiveList );
579 fContinue = pmcProcessCommand( pMac, pPmcCmd );
580 if( fContinue )
581 {
582 //The command failed, remove it
583 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
584 {
585 pmcReleaseCommand( pMac, pPmcCmd );
586 }
587 }
588 }
589 else
590 {
591 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800592 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 -0700593 //Let it retry
594 fContinue = eANI_BOOLEAN_TRUE;
595 }
596 return fContinue;
597 }
598 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
599 {
600 // we can reuse the pCommand
601
602 // Insert the command onto the ActiveList...
603 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
604
605 // .... and process the command.
606
607 switch ( pCommand->command )
608 {
609
610 case eSmeCommandScan:
611 csrLLUnlock( &pMac->sme.smeCmdActiveList );
612 status = csrProcessScanCommand( pMac, pCommand );
613 break;
614
615 case eSmeCommandRoam:
616 csrLLUnlock( &pMac->sme.smeCmdActiveList );
617 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800618 if(!HAL_STATUS_SUCCESS(status))
619 {
620 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
621 &pCommand->Link, LL_ACCESS_LOCK ) )
622 {
623 csrReleaseCommandRoam( pMac, pCommand );
624 }
625 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 break;
627
628 case eSmeCommandWmStatusChange:
629 csrLLUnlock( &pMac->sme.smeCmdActiveList );
630 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
631 break;
632
633 case eSmeCommandSetKey:
634 csrLLUnlock( &pMac->sme.smeCmdActiveList );
635 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
636 if(!HAL_STATUS_SUCCESS(status))
637 {
638 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
639 &pCommand->Link, LL_ACCESS_LOCK ) )
640 {
641 csrReleaseCommandSetKey( pMac, pCommand );
642 }
643 }
644 break;
645
646 case eSmeCommandRemoveKey:
647 csrLLUnlock( &pMac->sme.smeCmdActiveList );
648 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
649 if(!HAL_STATUS_SUCCESS(status))
650 {
651 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
652 &pCommand->Link, LL_ACCESS_LOCK ) )
653 {
654 csrReleaseCommandRemoveKey( pMac, pCommand );
655 }
656 }
657 break;
658
659 case eSmeCommandAddStaSession:
660 csrLLUnlock( &pMac->sme.smeCmdActiveList );
661 csrProcessAddStaSessionCommand( pMac, pCommand );
662 break;
663 case eSmeCommandDelStaSession:
664 csrLLUnlock( &pMac->sme.smeCmdActiveList );
665 csrProcessDelStaSessionCommand( pMac, pCommand );
666 break;
667
Jeff Johnsone7245742012-09-05 17:12:55 -0700668#ifdef FEATURE_OEM_DATA_SUPPORT
669 case eSmeCommandOemDataReq:
670 csrLLUnlock(&pMac->sme.smeCmdActiveList);
671 oemData_ProcessOemDataReqCommand(pMac, pCommand);
672 break;
673#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 case eSmeCommandRemainOnChannel:
675 csrLLUnlock(&pMac->sme.smeCmdActiveList);
676 p2pProcessRemainOnChannelCmd(pMac, pCommand);
677 break;
678 case eSmeCommandNoAUpdate:
679 csrLLUnlock( &pMac->sme.smeCmdActiveList );
680 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 case eSmeCommandEnterImps:
682 case eSmeCommandExitImps:
683 case eSmeCommandEnterBmps:
684 case eSmeCommandExitBmps:
685 case eSmeCommandEnterUapsd:
686 case eSmeCommandExitUapsd:
687 case eSmeCommandEnterWowl:
688 case eSmeCommandExitWowl:
689 csrLLUnlock( &pMac->sme.smeCmdActiveList );
690 fContinue = pmcProcessCommand( pMac, pCommand );
691 if( fContinue )
692 {
693 //The command failed, remove it
694 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
695 &pCommand->Link, LL_ACCESS_LOCK ) )
696 {
697 pmcReleaseCommand( pMac, pCommand );
698 }
699 }
700 break;
701
702 //Treat standby differently here because caller may not be able to handle
703 //the failure so we do our best here
704 case eSmeCommandEnterStandby:
705 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
706 {
707 //It can continue
708 csrLLUnlock( &pMac->sme.smeCmdActiveList );
709 fContinue = pmcProcessCommand( pMac, pCommand );
710 if( fContinue )
711 {
712 //The command failed, remove it
713 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
714 &pCommand->Link, LL_ACCESS_LOCK ) )
715 {
716 pmcReleaseCommand( pMac, pCommand );
717 }
718 }
719 }
720 else
721 {
722 //Need to issue a disconnect first before processing this command
723 tSmeCmd *pNewCmd;
724
725 //We need to re-run the command
726 fContinue = eANI_BOOLEAN_TRUE;
727 //Pull off the standby command first
728 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
729 &pCommand->Link, LL_ACCESS_NOLOCK ) )
730 {
731 csrLLUnlock( &pMac->sme.smeCmdActiveList );
732 //Need to call CSR function here because the disconnect command
733 //is handled by CSR
734 pNewCmd = csrGetCommandBuffer( pMac );
735 if( NULL != pNewCmd )
736 {
737 //Put the standby command to the head of the pending list first
738 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
739 LL_ACCESS_LOCK );
740 pNewCmd->command = eSmeCommandRoam;
741 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
742 //Put the disassoc command before the standby command
743 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
744 LL_ACCESS_LOCK );
745 }
746 else
747 {
748 //Continue the command here
749 fContinue = pmcProcessCommand( pMac, pCommand );
750 if( fContinue )
751 {
752 //The command failed, remove it
753 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
754 &pCommand->Link, LL_ACCESS_LOCK ) )
755 {
756 pmcReleaseCommand( pMac, pCommand );
757 }
758 }
759 }
760 }
761 else
762 {
763 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800764 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 VOS_ASSERT(0);
766 }
767 }
768 break;
769
770 case eSmeCommandAddTs:
771 case eSmeCommandDelTs:
772 csrLLUnlock( &pMac->sme.smeCmdActiveList );
773#ifndef WLAN_MDM_CODE_REDUCTION_OPT
774 fContinue = qosProcessCommand( pMac, pCommand );
775 if( fContinue )
776 {
777 //The command failed, remove it
778 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
779 &pCommand->Link, LL_ACCESS_NOLOCK ) )
780 {
781//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
782 qosReleaseCommand( pMac, pCommand );
783//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
784 }
785 }
786#endif
787 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800788#ifdef FEATURE_WLAN_TDLS
789 case eSmeCommandTdlsSendMgmt:
790 case eSmeCommandTdlsAddPeer:
791 case eSmeCommandTdlsDelPeer:
792#ifdef FEATURE_WLAN_TDLS_INTERNAL
793 case eSmeCommandTdlsDiscovery:
794 case eSmeCommandTdlsLinkSetup:
795 case eSmeCommandTdlsLinkTear:
796 case eSmeCommandTdlsEnterUapsd:
797 case eSmeCommandTdlsExitUapsd:
798#endif
799 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -0800800 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800801 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800802
803 csrLLUnlock( &pMac->sme.smeCmdActiveList );
804 status = csrTdlsProcessCmd( pMac, pCommand );
805 }
806 break ;
807#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700808
809 default:
810 //something is wrong
811 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800812 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700813 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
814 csrLLUnlock( &pMac->sme.smeCmdActiveList );
815 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
816 smeReleaseCommand( pMac, pCommand );
817 status = eHAL_STATUS_FAILURE;
818 break;
819 }
820 if(!HAL_STATUS_SUCCESS(status))
821 {
822 fContinue = eANI_BOOLEAN_TRUE;
823 }
824 }//if(pEntry)
825 else
826 {
827 //This is odd. Some one else pull off the command.
828 csrLLUnlock( &pMac->sme.smeCmdActiveList );
829 }
830 }
831 else
832 {
833 csrLLUnlock( &pMac->sme.smeCmdActiveList );
834 }
835 }
836 else
837 {
838 //No command waiting
839 csrLLUnlock( &pMac->sme.smeCmdActiveList );
840 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
841 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
842 {
843 tANI_U32 nTime = 0;
844
845 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
846 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
847 {
848 csrScanStartIdleScanTimer(pMac, nTime);
849 }
850 }
851 }
852 }
853 else {
854 csrLLUnlock( &pMac->sme.smeCmdActiveList );
855 }
856
857 return ( fContinue );
858}
859
860void smeProcessPendingQueue( tpAniSirGlobal pMac )
861{
862 while( smeProcessCommand( pMac ) );
863}
864
865
866tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
867{
868 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
869 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
870}
871
872
873
874//Global APIs
875
876/*--------------------------------------------------------------------------
877
878 \brief sme_Open() - Initialze all SME modules and put them at idle state
879
880 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
881 successfully return, all modules are at idle state ready to start.
882
883 smeOpen must be called before any other SME APIs can be involved.
884 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -0800885 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 \param hHal - The handle returned by macOpen.
887
888 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
889
890 Other status means SME is failed to be initialized
891 \sa
892
893 --------------------------------------------------------------------------*/
894eHalStatus sme_Open(tHalHandle hHal)
895{
896 eHalStatus status = eHAL_STATUS_FAILURE;
897 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
898
899 do {
900 pMac->sme.state = SME_STATE_STOP;
901 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
902 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800903 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -0700904 status = eHAL_STATUS_FAILURE;
905 break;
906 }
907
908 status = ccmOpen(hHal);
909 if ( ! HAL_STATUS_SUCCESS( status ) ) {
910 smsLog( pMac, LOGE,
911 "ccmOpen failed during initialization with status=%d", status );
912 break;
913 }
914
915 status = csrOpen(pMac);
916 if ( ! HAL_STATUS_SUCCESS( status ) ) {
917 smsLog( pMac, LOGE,
918 "csrOpen failed during initialization with status=%d", status );
919 break;
920 }
921
922 status = pmcOpen(hHal);
923 if ( ! HAL_STATUS_SUCCESS( status ) ) {
924 smsLog( pMac, LOGE,
925 "pmcOpen failed during initialization with status=%d", status );
926 break;
927 }
928
Gopichand Nakkala34d1b062013-03-19 15:28:33 -0700929#ifdef FEATURE_WLAN_TDLS
930 pMac->isTdlsPowerSaveProhibited = 0;
931#endif
932
Jeff Johnson295189b2012-06-20 16:38:30 -0700933#ifndef WLAN_MDM_CODE_REDUCTION_OPT
934 status = sme_QosOpen(pMac);
935 if ( ! HAL_STATUS_SUCCESS( status ) ) {
936 smsLog( pMac, LOGE,
937 "Qos open failed during initialization with status=%d", status );
938 break;
939 }
940
941 status = btcOpen(pMac);
942 if ( ! HAL_STATUS_SUCCESS( status ) ) {
943 smsLog( pMac, LOGE,
944 "btcOpen open failed during initialization with status=%d", status );
945 break;
946 }
947#endif
Jeff Johnsone7245742012-09-05 17:12:55 -0700948#ifdef FEATURE_OEM_DATA_SUPPORT
949 status = oemData_OemDataReqOpen(pMac);
950 if ( ! HAL_STATUS_SUCCESS( status ) ) {
951 smsLog(pMac, LOGE,
952 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
953 break;
954 }
955#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700956
957 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
958 break;
959
Jeff Johnson295189b2012-06-20 16:38:30 -0700960 {
961 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
962 if ( NULL == pvosGCtx ){
963 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
964 status = eHAL_STATUS_FAILURE;
965 break;
966 }
967
968 status = WLANSAP_Open( pvosGCtx );
969 if ( ! HAL_STATUS_SUCCESS( status ) ) {
970 smsLog( pMac, LOGE,
971 "WLANSAP_Open open failed during initialization with status=%d", status );
972 break;
973 }
974 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700975#if defined WLAN_FEATURE_VOWIFI
976 status = rrmOpen(pMac);
977 if ( ! HAL_STATUS_SUCCESS( status ) ) {
978 smsLog( pMac, LOGE,
979 "rrmOpen open failed during initialization with status=%d", status );
980 break;
981 }
982#endif
983
984#if defined WLAN_FEATURE_VOWIFI_11R
985 sme_FTOpen(pMac);
986#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700987 sme_p2pOpen(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700988
989 }while (0);
990
991 return status;
992}
993
Jeff Johnson295189b2012-06-20 16:38:30 -0700994/*--------------------------------------------------------------------------
995
996 \brief sme_set11dinfo() - Set the 11d information about valid channels
997 and there power using information from nvRAM
998 This function is called only for AP.
999
Srinivas Girigowdade697412013-02-14 16:31:48 -08001000 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001001
1002 \param hHal - The handle returned by macOpen.
1003 \Param pSmeConfigParams - a pointer to a caller allocated object of
1004 typedef struct _smeConfigParams.
1005
1006 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1007
1008 Other status means SME is failed to update the config parameters.
1009 \sa
1010--------------------------------------------------------------------------*/
1011
1012eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1013{
1014 eHalStatus status = eHAL_STATUS_FAILURE;
1015 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1016
1017 if (NULL == pSmeConfigParams ) {
1018 smsLog( pMac, LOGE,
1019 "Empty config param structure for SME, nothing to update");
1020 return status;
1021 }
1022
1023 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1024 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001025 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001026 status );
1027 }
1028 return status;
1029}
1030
1031/*--------------------------------------------------------------------------
1032
1033 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1034
Srinivas Girigowdade697412013-02-14 16:31:48 -08001035 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001036
1037 \param hHal - The handle returned by HostapdAdapter.
1038 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1039
1040 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1041
1042 Other status means, failed to get the current regulatory domain.
1043 \sa
1044--------------------------------------------------------------------------*/
1045
1046eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1047{
1048 eHalStatus status = eHAL_STATUS_FAILURE;
1049 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1050
1051 if (NULL == domainIdSoftAp ) {
1052 smsLog( pMac, LOGE, "Uninitialized domain Id");
1053 return status;
1054 }
1055
1056 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1057 status = eHAL_STATUS_SUCCESS;
1058
1059 return status;
1060}
1061
1062
1063eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1064{
1065 eHalStatus status = eHAL_STATUS_FAILURE;
1066 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1067
1068 if (NULL == apCntryCode ) {
1069 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1070 return status;
1071 }
1072
1073 status = csrSetRegInfo(hHal, apCntryCode );
1074 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001075 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001076 status );
1077 }
1078 return status;
1079}
1080
Jeff Johnson295189b2012-06-20 16:38:30 -07001081#ifdef FEATURE_WLAN_SCAN_PNO
1082/*--------------------------------------------------------------------------
1083
1084 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
1085
1086 It is used at driver start up to inform RIVA of the default channel
1087 configuration.
1088
Srinivas Girigowdade697412013-02-14 16:31:48 -08001089 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001090
1091 \param hHal - The handle returned by macOpen.
1092
1093 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1094
1095 Other status means SME is failed to update the channel config.
1096 \sa
1097
1098 --------------------------------------------------------------------------*/
1099eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1100{
1101 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1102
1103 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
1104 &pMac->scan.base20MHzChannels, FALSE);
1105 return eHAL_STATUS_SUCCESS;
1106}
1107#endif // FEATURE_WLAN_SCAN_PNLO
1108
1109/*--------------------------------------------------------------------------
1110
1111 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1112
1113 The function updates some configuration for modules in SME, CCM, CSR, etc
1114 during SMEs close open sequence.
1115
1116 Modules inside SME apply the new configuration at the next transaction.
1117
Srinivas Girigowdade697412013-02-14 16:31:48 -08001118 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001119
1120 \param hHal - The handle returned by macOpen.
1121 \Param pSmeConfigParams - a pointer to a caller allocated object of
1122 typedef struct _smeConfigParams.
1123
1124 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1125
1126 Other status means SME is failed to update the config parameters.
1127 \sa
1128
1129 --------------------------------------------------------------------------*/
1130eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1131{
1132 eHalStatus status = eHAL_STATUS_FAILURE;
1133 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1134
1135 if (NULL == pSmeConfigParams ) {
1136 smsLog( pMac, LOGE,
1137 "Empty config param structure for SME, nothing to update");
1138 return status;
1139 }
1140
1141 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1142
1143 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001144 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001145 status );
1146 }
1147#if defined WLAN_FEATURE_P2P_INTERNAL
1148 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1149
1150 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001151 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001152 status );
1153 }
1154#endif
1155#if defined WLAN_FEATURE_VOWIFI
1156 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1157
1158 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001159 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001160 status );
1161 }
1162#endif
1163 //For SOC, CFG is set before start
1164 //We don't want to apply global CFG in connect state because that may cause some side affect
1165 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001166 csrIsAllSessionDisconnected( pMac) )
1167 {
1168 csrSetGlobalCfgs(pMac);
1169 }
1170
1171 return status;
1172}
1173
1174/* ---------------------------------------------------------------------------
1175 \fn sme_ChangeConfigParams
1176 \brief The SME API exposed for HDD to provide config params to SME during
1177 SMEs stop -> start sequence.
1178
1179 If HDD changed the domain that will cause a reset. This function will
1180 provide the new set of 11d information for the new domain. Currrently this
1181 API provides info regarding 11d only at reset but we can extend this for
1182 other params (PMC, QoS) which needs to be initialized again at reset.
1183
Srinivas Girigowdade697412013-02-14 16:31:48 -08001184 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001185
1186 \param hHal - The handle returned by macOpen.
1187
1188 \Param
1189 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1190 currently provides 11d related information like Country code,
1191 Regulatory domain, valid channel list, Tx power per channel, a
1192 list with active/passive scan allowed per valid channel.
1193
1194 \return eHalStatus
1195 ---------------------------------------------------------------------------*/
1196eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1197 tCsrUpdateConfigParam *pUpdateConfigParam)
1198{
1199 eHalStatus status = eHAL_STATUS_FAILURE;
1200 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1201
1202 if (NULL == pUpdateConfigParam ) {
1203 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001204 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001205 return status;
1206 }
1207
1208 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1209
1210 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001211 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001212 status );
1213 }
1214
1215 return status;
1216
1217}
1218
1219/*--------------------------------------------------------------------------
1220
1221 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1222 that the NIC is ready tio run.
1223
1224 The function is called by HDD at the end of initialization stage so PE/HAL can
1225 enable the NIC to running state.
1226
Srinivas Girigowdade697412013-02-14 16:31:48 -08001227 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001228 \param hHal - The handle returned by macOpen.
1229
1230 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1231 successfully.
1232
1233 Other status means SME failed to send the message to PE.
1234 \sa
1235
1236 --------------------------------------------------------------------------*/
1237eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1238{
1239 tSirSmeReadyReq Msg;
1240 eHalStatus status = eHAL_STATUS_FAILURE;
1241 tPmcPowerState powerState;
1242 tPmcSwitchState hwWlanSwitchState;
1243 tPmcSwitchState swWlanSwitchState;
1244 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1245
1246 do
1247 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001248
1249 Msg.messageType = eWNI_SME_SYS_READY_IND;
1250 Msg.length = sizeof( tSirSmeReadyReq );
1251
1252 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1253 {
1254 status = eHAL_STATUS_SUCCESS;
1255 }
1256 else
1257 {
1258 smsLog( pMac, LOGE,
1259 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1260 break;
1261 }
1262
1263 status = pmcQueryPowerState( hHal, &powerState,
1264 &hwWlanSwitchState, &swWlanSwitchState );
1265 if ( ! HAL_STATUS_SUCCESS( status ) )
1266 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001267 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001268 status );
1269 break;
1270 }
1271
1272 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1273 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1274 {
1275 status = csrReady(pMac);
1276 if ( ! HAL_STATUS_SUCCESS( status ) )
1277 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001278 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001279 break;
1280 }
1281 status = pmcReady(hHal);
1282 if ( ! HAL_STATUS_SUCCESS( status ) )
1283 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001284 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001285 break;
1286 }
1287#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1288 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1289 {
1290 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001291 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001292 break;
1293 }
1294#endif
1295
1296#if defined WLAN_FEATURE_VOWIFI
1297 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1298 {
1299 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001300 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001301 break;
1302 }
1303#endif
1304 }
1305 pMac->sme.state = SME_STATE_READY;
1306 } while( 0 );
1307
1308 return status;
1309}
1310
1311/*--------------------------------------------------------------------------
1312
1313 \brief sme_Start() - Put all SME modules at ready state.
1314
1315 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1316 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001317 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001318 \param hHal - The handle returned by macOpen.
1319
1320 \return eHAL_STATUS_SUCCESS - SME is ready.
1321
1322 Other status means SME is failed to start
1323 \sa
1324
1325 --------------------------------------------------------------------------*/
1326eHalStatus sme_Start(tHalHandle hHal)
1327{
1328 eHalStatus status = eHAL_STATUS_FAILURE;
1329 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1330
1331 do
1332 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001333 status = csrStart(pMac);
1334 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001335 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001336 status );
1337 break;
1338 }
1339
1340 status = pmcStart(hHal);
1341 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001342 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001343 status );
1344 break;
1345 }
1346
Jeff Johnson295189b2012-06-20 16:38:30 -07001347 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1348 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001349 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001350 status );
1351 break;
1352 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001353 pMac->sme.state = SME_STATE_START;
1354 }while (0);
1355
1356 return status;
1357}
1358
1359
1360#ifdef WLAN_FEATURE_PACKET_FILTERING
1361/******************************************************************************
1362*
1363* Name: sme_PCFilterMatchCountResponseHandler
1364*
1365* Description:
1366* Invoke Packet Coalescing Filter Match Count callback routine
1367*
1368* Parameters:
1369* hHal - HAL handle for device
1370* pMsg - Pointer to tRcvFltPktMatchRsp structure
1371*
1372* Returns: eHalStatus
1373*
1374******************************************************************************/
1375eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1376{
1377 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1378 eHalStatus status = eHAL_STATUS_SUCCESS;
1379 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1380
1381 if (NULL == pMsg)
1382 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001383 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001384 status = eHAL_STATUS_FAILURE;
1385 }
1386 else
1387 {
1388 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001389 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001390
1391 /* Call Packet Coalescing Filter Match Count callback routine. */
1392 if (pMac->pmc.FilterMatchCountCB != NULL)
1393 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1394 pRcvFltPktMatchRsp);
1395
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001396 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001397 pRcvFltPktMatchRsp->status);
1398
1399 pMac->pmc.FilterMatchCountCB = NULL;
1400 pMac->pmc.FilterMatchCountCBContext = NULL;
1401 }
1402
1403 return(status);
1404}
1405#endif // WLAN_FEATURE_PACKET_FILTERING
1406
1407
Chet Lanctot186b5732013-03-18 10:26:30 -07001408#ifdef WLAN_FEATURE_11W
1409/*------------------------------------------------------------------
1410 *
1411 * Handle the unprotected management frame indication from LIM and
1412 * forward it to HDD.
1413 *
1414 *------------------------------------------------------------------*/
1415
1416eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1417 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1418{
1419 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1420 eHalStatus status = eHAL_STATUS_SUCCESS;
1421 tCsrRoamInfo pRoamInfo = {0};
1422 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1423
1424 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1425 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1426 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1427
1428 /* forward the mgmt frame to HDD */
1429 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1430
1431 return status;
1432}
1433#endif
1434
1435
Jeff Johnson295189b2012-06-20 16:38:30 -07001436/*--------------------------------------------------------------------------
1437
1438 \brief sme_ProcessMsg() - The main message processor for SME.
1439
1440 The function is called by a message dispatcher when to process a message
1441 targeted for SME.
1442
Srinivas Girigowdade697412013-02-14 16:31:48 -08001443 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001444 \param hHal - The handle returned by macOpen.
1445 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1446
1447 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1448
1449 Other status means SME failed to process the message to HAL.
1450 \sa
1451
1452 --------------------------------------------------------------------------*/
1453eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1454{
1455 eHalStatus status = eHAL_STATUS_FAILURE;
1456 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1457
1458 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001459 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 return status;
1461 }
1462
1463 status = sme_AcquireGlobalLock( &pMac->sme );
1464 if ( HAL_STATUS_SUCCESS( status ) )
1465 {
1466 if( SME_IS_START(pMac) )
1467 {
1468 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1469 case eWNI_PMC_ENTER_BMPS_RSP:
1470 case eWNI_PMC_EXIT_BMPS_RSP:
1471 case eWNI_PMC_EXIT_BMPS_IND:
1472 case eWNI_PMC_ENTER_IMPS_RSP:
1473 case eWNI_PMC_EXIT_IMPS_RSP:
1474 case eWNI_PMC_SMPS_STATE_IND:
1475 case eWNI_PMC_ENTER_UAPSD_RSP:
1476 case eWNI_PMC_EXIT_UAPSD_RSP:
1477 case eWNI_PMC_ENTER_WOWL_RSP:
1478 case eWNI_PMC_EXIT_WOWL_RSP:
1479 //PMC
1480 if (pMsg->bodyptr)
1481 {
1482 pmcMessageProcessor(hHal, pMsg->bodyptr);
1483 status = eHAL_STATUS_SUCCESS;
1484 vos_mem_free( pMsg->bodyptr );
1485 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001486 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001487 }
1488 break;
1489
1490 case WNI_CFG_SET_CNF:
1491 case WNI_CFG_DNLD_CNF:
1492 case WNI_CFG_GET_RSP:
1493 case WNI_CFG_ADD_GRP_ADDR_CNF:
1494 case WNI_CFG_DEL_GRP_ADDR_CNF:
1495 //CCM
1496 if (pMsg->bodyptr)
1497 {
1498 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1499 status = eHAL_STATUS_SUCCESS;
1500 vos_mem_free( pMsg->bodyptr );
1501 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001502 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001503 }
1504 break;
1505
1506 case eWNI_SME_ADDTS_RSP:
1507 case eWNI_SME_DELTS_RSP:
1508 case eWNI_SME_DELTS_IND:
1509#ifdef WLAN_FEATURE_VOWIFI_11R
1510 case eWNI_SME_FT_AGGR_QOS_RSP:
1511#endif
1512 //QoS
1513 if (pMsg->bodyptr)
1514 {
1515#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1516 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
1517 vos_mem_free( pMsg->bodyptr );
1518#endif
1519 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001520 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001521 }
1522 break;
1523#if defined WLAN_FEATURE_VOWIFI
1524 case eWNI_SME_NEIGHBOR_REPORT_IND:
1525 case eWNI_SME_BEACON_REPORT_REQ_IND:
1526#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001527 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001528#endif
1529 if ( pMsg->bodyptr )
1530 {
1531 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
1532 vos_mem_free( pMsg->bodyptr );
1533 }
1534 else
1535 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001536 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001537 }
1538 break;
1539#endif
1540
Jeff Johnsone7245742012-09-05 17:12:55 -07001541#ifdef FEATURE_OEM_DATA_SUPPORT
1542 //Handle the eWNI_SME_OEM_DATA_RSP:
1543 case eWNI_SME_OEM_DATA_RSP:
1544 if(pMsg->bodyptr)
1545 {
1546 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
1547 vos_mem_free(pMsg->bodyptr);
1548 }
1549 else
1550 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001551 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07001552 }
1553 smeProcessPendingQueue( pMac );
1554 break;
1555#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001556
1557 case eWNI_SME_ADD_STA_SELF_RSP:
1558 if(pMsg->bodyptr)
1559 {
1560 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
1561 vos_mem_free(pMsg->bodyptr);
1562 }
1563 else
1564 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001565 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001566 }
1567 break;
1568 case eWNI_SME_DEL_STA_SELF_RSP:
1569 if(pMsg->bodyptr)
1570 {
1571 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
1572 vos_mem_free(pMsg->bodyptr);
1573 }
1574 else
1575 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001576 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 }
1578 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001579 case eWNI_SME_REMAIN_ON_CHN_RSP:
1580 if(pMsg->bodyptr)
1581 {
1582 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
1583 vos_mem_free(pMsg->bodyptr);
1584 }
1585 else
1586 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001587 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001588 }
1589 break;
1590 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
1591 if(pMsg->bodyptr)
1592 {
1593 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
1594 vos_mem_free(pMsg->bodyptr);
1595 }
1596 else
1597 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001598 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 -07001599 }
1600 break;
1601 case eWNI_SME_MGMT_FRM_IND:
1602 if(pMsg->bodyptr)
1603 {
1604 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
1605 vos_mem_free(pMsg->bodyptr);
1606 }
1607 else
1608 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001609 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001610 }
1611 break;
1612 case eWNI_SME_ACTION_FRAME_SEND_CNF:
1613 if(pMsg->bodyptr)
1614 {
1615 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
1616 vos_mem_free(pMsg->bodyptr);
1617 }
1618 else
1619 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001620 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001621 }
1622 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001623 case eWNI_SME_COEX_IND:
1624 if(pMsg->bodyptr)
1625 {
1626 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
1627 vos_mem_free(pMsg->bodyptr);
1628 }
1629 else
1630 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001631 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001632 }
1633 break;
1634
1635#ifdef FEATURE_WLAN_SCAN_PNO
1636 case eWNI_SME_PREF_NETWORK_FOUND_IND:
1637 if(pMsg->bodyptr)
1638 {
1639 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
1640 vos_mem_free(pMsg->bodyptr);
1641 }
1642 else
1643 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001644 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001645 }
1646 break;
1647#endif // FEATURE_WLAN_SCAN_PNO
1648
1649 case eWNI_SME_TX_PER_HIT_IND:
1650 if (pMac->sme.pTxPerHitCallback)
1651 {
1652 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
1653 }
1654 break;
1655
1656 case eWNI_SME_CHANGE_COUNTRY_CODE:
1657 if(pMsg->bodyptr)
1658 {
1659 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
1660 vos_mem_free(pMsg->bodyptr);
1661 }
1662 else
1663 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001664 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001665 }
1666 break;
1667
1668#ifdef WLAN_FEATURE_PACKET_FILTERING
1669 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
1670 if(pMsg->bodyptr)
1671 {
1672 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
1673 vos_mem_free(pMsg->bodyptr);
1674 }
1675 else
1676 {
1677 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001678 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001679 }
1680 break;
1681#endif // WLAN_FEATURE_PACKET_FILTERING
1682 case eWNI_SME_PRE_SWITCH_CHL_IND:
1683 {
1684 status = sme_HandlePreChannelSwitchInd(pMac);
1685 break;
1686 }
1687
1688 case eWNI_SME_POST_SWITCH_CHL_IND:
1689 {
1690 status = sme_HandlePostChannelSwitchInd(pMac);
1691 break;
1692 }
1693
1694#ifdef WLAN_WAKEUP_EVENTS
1695 case eWNI_SME_WAKE_REASON_IND:
1696 if(pMsg->bodyptr)
1697 {
1698 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
1699 vos_mem_free(pMsg->bodyptr);
1700 }
1701 else
1702 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001703 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001704 }
1705 break;
1706#endif // WLAN_WAKEUP_EVENTS
1707
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001708#ifdef FEATURE_WLAN_TDLS
1709 /*
1710 * command rescived from PE, SME tdls msg processor shall be called
1711 * to process commands recieved from PE
1712 */
1713 case eWNI_SME_TDLS_SEND_MGMT_RSP:
1714 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08001715 case eWNI_SME_TDLS_DEL_STA_RSP:
1716 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001717 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001718 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001719#ifdef FEATURE_WLAN_TDLS_INTERNAL
1720 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
1721 case eWNI_SME_TDLS_DISCOVERY_START_IND:
1722 case eWNI_SME_TDLS_LINK_START_RSP:
1723 case eWNI_SME_TDLS_LINK_START_IND:
1724 case eWNI_SME_TDLS_TEARDOWN_RSP:
1725 case eWNI_SME_TDLS_TEARDOWN_IND:
1726 case eWNI_SME_ADD_TDLS_PEER_IND:
1727 case eWNI_SME_DELETE_TDLS_PEER_IND:
1728#endif
1729 {
1730 if (pMsg->bodyptr)
1731 {
1732 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
1733 vos_mem_free( pMsg->bodyptr );
1734 }
1735 else
1736 {
1737 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001738 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001739 }
1740 break;
1741 }
1742#endif
1743
Chet Lanctot186b5732013-03-18 10:26:30 -07001744#ifdef WLAN_FEATURE_11W
1745 case eWNI_SME_UNPROT_MGMT_FRM_IND:
1746 if (pMsg->bodyptr)
1747 {
1748 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
1749 vos_mem_free(pMsg->bodyptr);
1750 }
1751 else
1752 {
1753 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
1754 }
1755 break;
1756#endif
1757
Jeff Johnson295189b2012-06-20 16:38:30 -07001758 default:
1759
1760 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
1761 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
1762 {
1763 //CSR
1764 if (pMsg->bodyptr)
1765 {
1766 status = csrMsgProcessor(hHal, pMsg->bodyptr);
1767 vos_mem_free( pMsg->bodyptr );
1768 }
1769 else
1770 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001771 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001772 }
1773 }
1774 else
1775 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001776 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07001777 pMsg->type);
1778 if (pMsg->bodyptr)
1779 {
1780 vos_mem_free( pMsg->bodyptr );
1781 }
1782 }
1783 }//switch
1784 } //SME_IS_START
1785 else
1786 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001787 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001788 if (pMsg->bodyptr)
1789 {
1790 vos_mem_free( pMsg->bodyptr );
1791 }
1792 }
1793 sme_ReleaseGlobalLock( &pMac->sme );
1794 }
1795 else
1796 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001797 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07001798 if (pMsg->bodyptr)
1799 {
1800 vos_mem_free( pMsg->bodyptr );
1801 }
1802 }
1803
1804 return status;
1805}
1806
1807
1808//No need to hold the global lock here because this function can only be called
1809//after sme_Stop.
1810v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
1811{
1812 if( pMsg )
1813 {
1814 if (pMsg->bodyptr)
1815 {
1816 vos_mem_free( pMsg->bodyptr );
1817 }
1818 }
1819
1820}
1821
1822
1823/*--------------------------------------------------------------------------
1824
1825 \brief sme_Stop() - Stop all SME modules and put them at idle state
1826
1827 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
1828 return, all modules are at idle state ready to start.
1829
Srinivas Girigowdade697412013-02-14 16:31:48 -08001830 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001831 \param hHal - The handle returned by macOpen
1832
1833 \return eHAL_STATUS_SUCCESS - SME is stopped.
1834
1835 Other status means SME is failed to stop but caller should still
1836 consider SME is stopped.
1837 \sa
1838
1839 --------------------------------------------------------------------------*/
1840eHalStatus sme_Stop(tHalHandle hHal, tANI_BOOLEAN pmcFlag)
1841{
1842 eHalStatus status = eHAL_STATUS_FAILURE;
1843 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
1844 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1845
Jeff Johnson295189b2012-06-20 16:38:30 -07001846 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1847 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001848 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001849 status );
1850 fail_status = status;
1851 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001852
1853 p2pStop(hHal);
1854
1855 if(pmcFlag)
1856 {
1857 status = pmcStop(hHal);
1858 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001859 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001860 status );
1861 fail_status = status;
1862 }
1863 }
1864
1865 status = csrStop(pMac);
1866 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001867 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001868 status );
1869 fail_status = status;
1870 }
1871
1872 ccmStop(hHal);
1873
1874 purgeSmeCmdList(pMac);
1875
1876 if (!HAL_STATUS_SUCCESS( fail_status )) {
1877 status = fail_status;
1878 }
1879
1880 pMac->sme.state = SME_STATE_STOP;
1881
1882 return status;
1883}
1884
1885/*--------------------------------------------------------------------------
1886
1887 \brief sme_Close() - Release all SME modules and their resources.
1888
1889 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
1890 return, all modules are at closed state.
1891
1892 No SME APIs can be involved after smeClose except smeOpen.
1893 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001894 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001895 \param hHal - The handle returned by macOpen
1896
1897 \return eHAL_STATUS_SUCCESS - SME is successfully close.
1898
1899 Other status means SME is failed to be closed but caller still cannot
1900 call any other SME functions except smeOpen.
1901 \sa
1902
1903 --------------------------------------------------------------------------*/
1904eHalStatus sme_Close(tHalHandle hHal)
1905{
1906 eHalStatus status = eHAL_STATUS_FAILURE;
1907 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
1908 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1909
1910 status = csrClose(pMac);
1911 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001912 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001913 status );
1914 fail_status = status;
1915 }
1916
Jeff Johnson295189b2012-06-20 16:38:30 -07001917 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1918 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001919 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 status );
1921 fail_status = status;
1922 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001923
1924#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1925 status = btcClose(hHal);
1926 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001927 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001928 status );
1929 fail_status = status;
1930 }
1931
1932 status = sme_QosClose(pMac);
1933 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001934 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001935 status );
1936 fail_status = status;
1937 }
1938#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001939#ifdef FEATURE_OEM_DATA_SUPPORT
1940 status = oemData_OemDataReqClose(hHal);
1941 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001942 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07001943 status );
1944 fail_status = status;
1945 }
1946#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001947
1948 status = ccmClose(hHal);
1949 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001950 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001951 status );
1952 fail_status = status;
1953 }
1954
1955 status = pmcClose(hHal);
1956 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001957 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001958 status );
1959 fail_status = status;
1960 }
1961#if defined WLAN_FEATURE_VOWIFI
1962 status = rrmClose(hHal);
1963 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001964 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001965 status );
1966 fail_status = status;
1967 }
1968#endif
1969
1970#if defined WLAN_FEATURE_VOWIFI_11R
1971 sme_FTClose(hHal);
1972#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001973 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07001974
1975 freeSmeCmdList(pMac);
1976
1977 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
1978 {
1979 fail_status = eHAL_STATUS_FAILURE;
1980 }
1981
1982 if (!HAL_STATUS_SUCCESS( fail_status )) {
1983 status = fail_status;
1984 }
1985
1986 pMac->sme.state = SME_STATE_STOP;
1987
1988 return status;
1989}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07001990#ifdef FEATURE_WLAN_LFR
1991tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
1992{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07001993#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07001994 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
1995 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
1996 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
1997 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
1998 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
1999 return eANI_BOOLEAN_FALSE;
2000 default:
2001 return eANI_BOOLEAN_TRUE;
2002 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002003#else
2004 /*
2005 * TODO: always return TRUE for now until
2006 * we figure out why we could be stuck in
2007 * one of the roaming states forever.
2008 */
2009 return eANI_BOOLEAN_TRUE;
2010#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002011}
2012#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002013/* ---------------------------------------------------------------------------
2014 \fn sme_ScanRequest
2015 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002016 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002017 \param pScanRequestID - pointer to an object to get back the request ID
2018 \param callback - a callback function that scan calls upon finish, will not
2019 be called if csrScanRequest returns error
2020 \param pContext - a pointer passed in for the callback
2021 \return eHalStatus
2022 ---------------------------------------------------------------------------*/
2023eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2024 tANI_U32 *pScanRequestID,
2025 csrScanCompleteCallback callback, void *pContext)
2026{
2027 eHalStatus status = eHAL_STATUS_FAILURE;
2028 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2029
2030 smsLog(pMac, LOG2, FL("enter"));
2031 do
2032 {
2033 if(pMac->scan.fScanEnable)
2034 {
2035 status = sme_AcquireGlobalLock( &pMac->sme );
2036 if ( HAL_STATUS_SUCCESS( status ) )
2037 {
2038 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002039#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002040 if(csrIsScanAllowed(pMac))
2041 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002042#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002043 status = csrScanRequest( hHal, sessionId, pscanReq,
2044 pScanRequestID, callback, pContext );
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002045#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002046 }
2047 else
2048 {
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002049 smsLog(pMac, LOGE, FL("Scan denied in state %d (sub-state %d)"),
2050 pMac->roam.neighborRoamInfo.neighborRoamState,
2051 pMac->roam.curSubState[sessionId]);
2052 /*HandOff is in progress. So schedule this scan later*/
2053 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002054 }
2055#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002056 }
2057
2058 sme_ReleaseGlobalLock( &pMac->sme );
2059 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002060 else
2061 {
2062 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2063 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002064 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002065 else
2066 {
2067 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2068 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 } while( 0 );
2070
2071 return (status);
2072
2073
2074}
2075
2076/* ---------------------------------------------------------------------------
2077 \fn sme_ScanGetResult
2078 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002079 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 \param pFilter - If pFilter is NULL, all cached results are returned
2081 \param phResult - an object for the result.
2082 \return eHalStatus
2083 ---------------------------------------------------------------------------*/
2084eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2085 tScanResultHandle *phResult)
2086{
2087 eHalStatus status = eHAL_STATUS_FAILURE;
2088 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2089
2090 smsLog(pMac, LOG2, FL("enter"));
2091 status = sme_AcquireGlobalLock( &pMac->sme );
2092 if ( HAL_STATUS_SUCCESS( status ) )
2093 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002094 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 sme_ReleaseGlobalLock( &pMac->sme );
2096 }
2097 smsLog(pMac, LOG2, FL("exit status %d"), status);
2098
2099 return (status);
2100}
2101
2102
2103/* ---------------------------------------------------------------------------
2104 \fn sme_ScanFlushResult
2105 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002106 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002107 \return eHalStatus
2108 ---------------------------------------------------------------------------*/
2109eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2110{
2111 eHalStatus status = eHAL_STATUS_FAILURE;
2112 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2113
2114 status = sme_AcquireGlobalLock( &pMac->sme );
2115 if ( HAL_STATUS_SUCCESS( status ) )
2116 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002117 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002118 sme_ReleaseGlobalLock( &pMac->sme );
2119 }
2120
2121 return (status);
2122}
2123
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002124eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2125{
2126 eHalStatus status = eHAL_STATUS_FAILURE;
2127 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2128
2129 status = sme_AcquireGlobalLock( &pMac->sme );
2130 if ( HAL_STATUS_SUCCESS( status ) )
2131 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302132 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002133 sme_ReleaseGlobalLock( &pMac->sme );
2134 }
2135
2136 return (status);
2137}
Jeff Johnson295189b2012-06-20 16:38:30 -07002138
2139/* ---------------------------------------------------------------------------
2140 \fn sme_ScanResultGetFirst
2141 \brief a wrapper function to request CSR to returns the first element of
2142 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002143 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 \param hScanResult - returned from csrScanGetResult
2145 \return tCsrScanResultInfo * - NULL if no result
2146 ---------------------------------------------------------------------------*/
2147tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2148 tScanResultHandle hScanResult)
2149{
2150 eHalStatus status = eHAL_STATUS_FAILURE;
2151 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2152 tCsrScanResultInfo *pRet = NULL;
2153
2154 status = sme_AcquireGlobalLock( &pMac->sme );
2155 if ( HAL_STATUS_SUCCESS( status ) )
2156 {
2157 pRet = csrScanResultGetFirst( pMac, hScanResult );
2158 sme_ReleaseGlobalLock( &pMac->sme );
2159 }
2160
2161 return (pRet);
2162}
2163
2164
2165/* ---------------------------------------------------------------------------
2166 \fn sme_ScanResultGetNext
2167 \brief a wrapper function to request CSR to returns the next element of
2168 scan result. It can be called without calling csrScanResultGetFirst
2169 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002170 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002171 \param hScanResult - returned from csrScanGetResult
2172 \return Null if no result or reach the end
2173 ---------------------------------------------------------------------------*/
2174tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2175 tScanResultHandle hScanResult)
2176{
2177 eHalStatus status = eHAL_STATUS_FAILURE;
2178 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2179 tCsrScanResultInfo *pRet = NULL;
2180
2181 status = sme_AcquireGlobalLock( &pMac->sme );
2182 if ( HAL_STATUS_SUCCESS( status ) )
2183 {
2184 pRet = csrScanResultGetNext( pMac, hScanResult );
2185 sme_ReleaseGlobalLock( &pMac->sme );
2186 }
2187
2188 return (pRet);
2189}
2190
2191
2192/* ---------------------------------------------------------------------------
2193 \fn sme_ScanSetBGScanparams
2194 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002195 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002196 \param pScanReq - BG scan request structure
2197 \return eHalStatus
2198 ---------------------------------------------------------------------------*/
2199eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2200{
2201 eHalStatus status = eHAL_STATUS_FAILURE;
2202 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2203
2204 if( NULL != pScanReq )
2205 {
2206 status = sme_AcquireGlobalLock( &pMac->sme );
2207 if ( HAL_STATUS_SUCCESS( status ) )
2208 {
2209 status = csrScanSetBGScanparams( hHal, pScanReq );
2210 sme_ReleaseGlobalLock( &pMac->sme );
2211 }
2212 }
2213
2214 return (status);
2215}
2216
2217
2218/* ---------------------------------------------------------------------------
2219 \fn sme_ScanResultPurge
2220 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2221 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002222 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 \param hScanResult - returned from csrScanGetResult. hScanResult is
2224 considered gone by
2225 calling this function and even before this function reutrns.
2226 \return eHalStatus
2227 ---------------------------------------------------------------------------*/
2228eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2229{
2230 eHalStatus status = eHAL_STATUS_FAILURE;
2231 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2232
2233 status = sme_AcquireGlobalLock( &pMac->sme );
2234 if ( HAL_STATUS_SUCCESS( status ) )
2235 {
2236 status = csrScanResultPurge( hHal, hScanResult );
2237 sme_ReleaseGlobalLock( &pMac->sme );
2238 }
2239
2240 return (status);
2241}
2242
2243/* ---------------------------------------------------------------------------
2244 \fn sme_ScanGetPMKIDCandidateList
2245 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002246 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002247 \param pPmkidList - caller allocated buffer point to an array of
2248 tPmkidCandidateInfo
2249 \param pNumItems - pointer to a variable that has the number of
2250 tPmkidCandidateInfo allocated when retruning, this is
2251 either the number needed or number of items put into
2252 pPmkidList
2253 \return eHalStatus - when fail, it usually means the buffer allocated is not
2254 big enough and pNumItems
2255 has the number of tPmkidCandidateInfo.
2256 \Note: pNumItems is a number of tPmkidCandidateInfo,
2257 not sizeof(tPmkidCandidateInfo) * something
2258 ---------------------------------------------------------------------------*/
2259eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
2260 tPmkidCandidateInfo *pPmkidList,
2261 tANI_U32 *pNumItems )
2262{
2263 eHalStatus status = eHAL_STATUS_FAILURE;
2264 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2265
2266 status = sme_AcquireGlobalLock( &pMac->sme );
2267 if ( HAL_STATUS_SUCCESS( status ) )
2268 {
2269 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2270 sme_ReleaseGlobalLock( &pMac->sme );
2271 }
2272
2273 return (status);
2274}
2275
2276/*----------------------------------------------------------------------------
2277 \fn sme_RoamRegisterLinkQualityIndCallback
2278
2279 \brief
2280 a wrapper function to allow HDD to register a callback handler with CSR for
2281 link quality indications.
2282
2283 Only one callback may be registered at any time.
2284 In order to deregister the callback, a NULL cback may be provided.
2285
2286 Registration happens in the task context of the caller.
2287
2288 \param callback - Call back being registered
2289 \param pContext - user data
2290
2291 DEPENDENCIES: After CSR open
2292
2293 \return eHalStatus
2294-----------------------------------------------------------------------------*/
2295eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2296 csrRoamLinkQualityIndCallback callback,
2297 void *pContext)
2298{
2299 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2300}
2301
2302/* ---------------------------------------------------------------------------
2303 \fn sme_RoamRegisterCallback
2304 \brief a wrapper function to allow HDD to register a callback with CSR.
2305 Unlike scan, roam has one callback for all the roam requests
2306 \param callback - a callback function that roam calls upon when state changes
2307 \param pContext - a pointer passed in for the callback
2308 \return eHalStatus
2309 ---------------------------------------------------------------------------*/
2310eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2311 csrRoamCompleteCallback callback,
2312 void *pContext)
2313{
2314 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2315}
2316
2317eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2318{
2319 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2320 return pMac->roam.configParam.phyMode;
2321}
2322
2323/* ---------------------------------------------------------------------------
2324 \fn sme_RoamConnect
2325 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002326 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002327 \param sessionId - the sessionId returned by sme_OpenSession.
2328 \param pProfile - description of the network to which to connect
2329 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2330 from csrScanGetResult
2331 \param pRoamId - to get back the request ID
2332 \return eHalStatus
2333 ---------------------------------------------------------------------------*/
2334eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2335 tANI_U32 *pRoamId)
2336{
2337 eHalStatus status = eHAL_STATUS_FAILURE;
2338 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2339
2340 smsLog(pMac, LOG2, FL("enter"));
2341 status = sme_AcquireGlobalLock( &pMac->sme );
2342 if ( HAL_STATUS_SUCCESS( status ) )
2343 {
2344 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2345 {
2346 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2347 }
2348 else
2349 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002350 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002351 status = eHAL_STATUS_INVALID_PARAMETER;
2352 }
2353 sme_ReleaseGlobalLock( &pMac->sme );
2354 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002355 else
2356 {
2357 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2358 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002359
2360 return (status);
2361}
2362
2363/* ---------------------------------------------------------------------------
Gopichand Nakkalad86a14e2013-04-18 16:41:54 +05302364
2365 \fn sme_SetPhyMode
2366
2367 \brief Changes the PhyMode.
2368
2369 \param hHal - The handle returned by macOpen.
2370
2371 \param phyMode new phyMode which is to set
2372
2373 \return eHalStatus SUCCESS.
2374
2375 -------------------------------------------------------------------------------*/
2376eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
2377{
2378 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2379
2380 if (NULL == pMac)
2381 {
2382 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2383 "%s: invalid context", __func__);
2384 return eHAL_STATUS_FAILURE;
2385 }
2386
2387 pMac->roam.configParam.phyMode = phyMode;
2388 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
2389 pMac->roam.configParam.phyMode,
2390 pMac->roam.configParam.ProprietaryRatesEnabled);
2391
2392 return eHAL_STATUS_SUCCESS;
2393}
2394
2395/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07002396 \fn sme_RoamReassoc
2397 \brief a wrapper function to request CSR to inititiate a re-association
2398 \param pProfile - can be NULL to join the currently connected AP. In that
2399 case modProfileFields should carry the modified field(s) which could trigger
2400 reassoc
2401 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2402 that might need modification dynamically once STA is up & running and this
2403 could trigger a reassoc
2404 \param pRoamId - to get back the request ID
2405 \return eHalStatus
2406 -------------------------------------------------------------------------------*/
2407eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2408 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002409 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002410{
2411 eHalStatus status = eHAL_STATUS_FAILURE;
2412 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2413
2414 smsLog(pMac, LOG2, FL("enter"));
2415 status = sme_AcquireGlobalLock( &pMac->sme );
2416 if ( HAL_STATUS_SUCCESS( status ) )
2417 {
2418 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2419 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07002420 if((NULL == pProfile) && (fForce == 1))
2421 {
2422 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
2423 /* to force the AP initiate fresh 802.1x authentication need to clear
2424 * the PMKID cache for that set the following boolean. this is needed
2425 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
2426 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002427 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
2428 }
2429 else
2430 {
2431 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
2432 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002433 }
2434 else
2435 {
2436 status = eHAL_STATUS_INVALID_PARAMETER;
2437 }
2438 sme_ReleaseGlobalLock( &pMac->sme );
2439 }
2440
2441 return (status);
2442}
2443
2444/* ---------------------------------------------------------------------------
2445 \fn sme_RoamConnectToLastProfile
2446 \brief a wrapper function to request CSR to disconnect and reconnect with
2447 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08002448 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002449 \return eHalStatus. It returns fail if currently connected
2450 ---------------------------------------------------------------------------*/
2451eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
2452{
2453 eHalStatus status = eHAL_STATUS_FAILURE;
2454 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2455
2456 status = sme_AcquireGlobalLock( &pMac->sme );
2457 if ( HAL_STATUS_SUCCESS( status ) )
2458 {
2459 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2460 {
2461 status = csrRoamConnectToLastProfile( pMac, sessionId );
2462 }
2463 else
2464 {
2465 status = eHAL_STATUS_INVALID_PARAMETER;
2466 }
2467 sme_ReleaseGlobalLock( &pMac->sme );
2468 }
2469
2470 return (status);
2471}
2472
2473/* ---------------------------------------------------------------------------
2474 \fn sme_RoamDisconnect
2475 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08002476 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002477 \param reason -- To indicate the reason for disconnecting. Currently, only
2478 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
2479 \return eHalStatus
2480 ---------------------------------------------------------------------------*/
2481eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
2482{
2483 eHalStatus status = eHAL_STATUS_FAILURE;
2484 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2485
2486 smsLog(pMac, LOG2, FL("enter"));
2487 status = sme_AcquireGlobalLock( &pMac->sme );
2488 if ( HAL_STATUS_SUCCESS( status ) )
2489 {
2490 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2491 {
2492 status = csrRoamDisconnect( pMac, sessionId, reason );
2493 }
2494 else
2495 {
2496 status = eHAL_STATUS_INVALID_PARAMETER;
2497 }
2498 sme_ReleaseGlobalLock( &pMac->sme );
2499 }
2500
2501 return (status);
2502}
2503
Jeff Johnson295189b2012-06-20 16:38:30 -07002504/* ---------------------------------------------------------------------------
2505 \fn sme_RoamStopBss
2506 \brief To stop BSS for Soft AP. This is an asynchronous API.
2507 \param hHal - Global structure
2508 \param sessionId - sessionId of SoftAP
2509 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2510 -------------------------------------------------------------------------------*/
2511eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
2512{
2513 eHalStatus status = eHAL_STATUS_FAILURE;
2514 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2515
2516 smsLog(pMac, LOG2, FL("enter"));
2517 status = sme_AcquireGlobalLock( &pMac->sme );
2518 if ( HAL_STATUS_SUCCESS( status ) )
2519 {
2520 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2521 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05302522 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07002523 }
2524 else
2525 {
2526 status = eHAL_STATUS_INVALID_PARAMETER;
2527 }
2528 sme_ReleaseGlobalLock( &pMac->sme );
2529 }
2530
2531 return (status);
2532}
2533
2534/* ---------------------------------------------------------------------------
2535 \fn sme_RoamDisconnectSta
2536 \brief To disassociate a station. This is an asynchronous API.
2537 \param hHal - Global structure
2538 \param sessionId - sessionId of SoftAP
2539 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2540 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2541 -------------------------------------------------------------------------------*/
2542eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
2543 tANI_U8 *pPeerMacAddr)
2544{
2545 eHalStatus status = eHAL_STATUS_FAILURE;
2546 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2547
2548 if ( NULL == pMac )
2549 {
2550 VOS_ASSERT(0);
2551 return status;
2552 }
2553
2554 status = sme_AcquireGlobalLock( &pMac->sme );
2555 if ( HAL_STATUS_SUCCESS( status ) )
2556 {
2557 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2558 {
2559 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302560 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002561 }
2562 else
2563 {
2564 status = eHAL_STATUS_INVALID_PARAMETER;
2565 }
2566 sme_ReleaseGlobalLock( &pMac->sme );
2567 }
2568
2569 return (status);
2570}
2571
2572/* ---------------------------------------------------------------------------
2573 \fn sme_RoamDeauthSta
2574 \brief To disassociate a station. This is an asynchronous API.
2575 \param hHal - Global structure
2576 \param sessionId - sessionId of SoftAP
2577 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2578 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2579 -------------------------------------------------------------------------------*/
2580eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
2581 tANI_U8 *pPeerMacAddr)
2582{
2583 eHalStatus status = eHAL_STATUS_FAILURE;
2584 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2585
2586 if ( NULL == pMac )
2587 {
2588 VOS_ASSERT(0);
2589 return status;
2590 }
2591
2592 status = sme_AcquireGlobalLock( &pMac->sme );
2593 if ( HAL_STATUS_SUCCESS( status ) )
2594 {
2595 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2596 {
2597 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302598 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002599 }
2600 else
2601 {
2602 status = eHAL_STATUS_INVALID_PARAMETER;
2603 }
2604 sme_ReleaseGlobalLock( &pMac->sme );
2605 }
2606
2607 return (status);
2608}
2609
2610/* ---------------------------------------------------------------------------
2611 \fn sme_RoamTKIPCounterMeasures
2612 \brief To start or stop TKIP counter measures. This is an asynchronous API.
2613 \param sessionId - sessionId of SoftAP
2614 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2615 \return eHalStatus
2616 -------------------------------------------------------------------------------*/
2617eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
2618 tANI_BOOLEAN bEnable)
2619{
2620 eHalStatus status = eHAL_STATUS_FAILURE;
2621 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2622
2623 if ( NULL == pMac )
2624 {
2625 VOS_ASSERT(0);
2626 return status;
2627 }
2628
2629 status = sme_AcquireGlobalLock( &pMac->sme );
2630 if ( HAL_STATUS_SUCCESS( status ) )
2631 {
2632 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2633 {
2634 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
2635 }
2636 else
2637 {
2638 status = eHAL_STATUS_INVALID_PARAMETER;
2639 }
2640 sme_ReleaseGlobalLock( &pMac->sme );
2641 }
2642
2643 return (status);
2644}
2645
2646/* ---------------------------------------------------------------------------
2647 \fn sme_RoamGetAssociatedStas
2648 \brief To probe the list of associated stations from various modules of CORE stack.
2649 \This is an asynchronous API.
2650 \param sessionId - sessionId of SoftAP
2651 \param modId - Module from whom list of associtated stations is to be probed.
2652 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
2653 \param pUsrContext - Opaque HDD context
2654 \param pfnSapEventCallback - Sap event callback in HDD
2655 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
2656 \return eHalStatus
2657 -------------------------------------------------------------------------------*/
2658eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
2659 VOS_MODULE_ID modId, void *pUsrContext,
2660 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
2661{
2662 eHalStatus status = eHAL_STATUS_FAILURE;
2663 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2664
2665 if ( NULL == pMac )
2666 {
2667 VOS_ASSERT(0);
2668 return status;
2669 }
2670
2671 status = sme_AcquireGlobalLock( &pMac->sme );
2672 if ( HAL_STATUS_SUCCESS( status ) )
2673 {
2674 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2675 {
2676 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
2677 }
2678 else
2679 {
2680 status = eHAL_STATUS_INVALID_PARAMETER;
2681 }
2682 sme_ReleaseGlobalLock( &pMac->sme );
2683 }
2684
2685 return (status);
2686}
2687
2688/* ---------------------------------------------------------------------------
2689 \fn sme_RoamGetWpsSessionOverlap
2690 \brief To get the WPS PBC session overlap information.
2691 \This is an asynchronous API.
2692 \param sessionId - sessionId of SoftAP
2693 \param pUsrContext - Opaque HDD context
2694 \param pfnSapEventCallback - Sap event callback in HDD
2695 \pRemoveMac - pointer to Mac address which needs to be removed from session
2696 \return eHalStatus
2697 -------------------------------------------------------------------------------*/
2698eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
2699 void *pUsrContext, void
2700 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
2701{
2702 eHalStatus status = eHAL_STATUS_FAILURE;
2703 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2704
2705 if ( NULL == pMac )
2706 {
2707 VOS_ASSERT(0);
2708 return status;
2709 }
2710
2711 status = sme_AcquireGlobalLock( &pMac->sme );
2712 if ( HAL_STATUS_SUCCESS( status ) )
2713 {
2714 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2715 {
2716 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
2717 }
2718 else
2719 {
2720 status = eHAL_STATUS_INVALID_PARAMETER;
2721 }
2722 sme_ReleaseGlobalLock( &pMac->sme );
2723 }
2724
2725 return (status);
2726}
2727
Jeff Johnson295189b2012-06-20 16:38:30 -07002728
2729/* ---------------------------------------------------------------------------
2730 \fn sme_RoamGetConnectState
2731 \brief a wrapper function to request CSR to return the current connect state
2732 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08002733 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002734 \return eHalStatus
2735 ---------------------------------------------------------------------------*/
2736eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
2737{
2738 eHalStatus status = eHAL_STATUS_FAILURE;
2739 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2740
2741 status = sme_AcquireGlobalLock( &pMac->sme );
2742 if ( HAL_STATUS_SUCCESS( status ) )
2743 {
2744 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2745 {
2746 status = csrRoamGetConnectState( pMac, sessionId, pState );
2747 }
2748 else
2749 {
2750 status = eHAL_STATUS_INVALID_PARAMETER;
2751 }
2752 sme_ReleaseGlobalLock( &pMac->sme );
2753 }
2754
2755 return (status);
2756}
2757
2758/* ---------------------------------------------------------------------------
2759 \fn sme_RoamGetConnectProfile
2760 \brief a wrapper function to request CSR to return the current connect
2761 profile. Caller must call csrRoamFreeConnectProfile after it is done
2762 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002763 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002764 \param pProfile - pointer to a caller allocated structure
2765 tCsrRoamConnectedProfile
2766 \return eHalStatus. Failure if not connected
2767 ---------------------------------------------------------------------------*/
2768eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
2769 tCsrRoamConnectedProfile *pProfile)
2770{
2771 eHalStatus status = eHAL_STATUS_FAILURE;
2772 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2773
2774 status = sme_AcquireGlobalLock( &pMac->sme );
2775 if ( HAL_STATUS_SUCCESS( status ) )
2776 {
2777 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2778 {
2779 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
2780 }
2781 else
2782 {
2783 status = eHAL_STATUS_INVALID_PARAMETER;
2784 }
2785 sme_ReleaseGlobalLock( &pMac->sme );
2786 }
2787
2788 return (status);
2789}
2790
2791/* ---------------------------------------------------------------------------
2792 \fn sme_RoamFreeConnectProfile
2793 \brief a wrapper function to request CSR to free and reinitialize the
2794 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002795 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002796 \param pProfile - pointer to a caller allocated structure
2797 tCsrRoamConnectedProfile
2798 \return eHalStatus.
2799 ---------------------------------------------------------------------------*/
2800eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
2801 tCsrRoamConnectedProfile *pProfile)
2802{
2803 eHalStatus status = eHAL_STATUS_FAILURE;
2804 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2805
2806 status = sme_AcquireGlobalLock( &pMac->sme );
2807 if ( HAL_STATUS_SUCCESS( status ) )
2808 {
2809 status = csrRoamFreeConnectProfile( pMac, pProfile );
2810 sme_ReleaseGlobalLock( &pMac->sme );
2811 }
2812
2813 return (status);
2814}
2815
2816/* ---------------------------------------------------------------------------
2817 \fn sme_RoamSetPMKIDCache
2818 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002819 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002820 \param pPMKIDCache - caller allocated buffer point to an array of
2821 tPmkidCacheInfo
2822 \param numItems - a variable that has the number of tPmkidCacheInfo
2823 allocated when retruning, this is either the number needed
2824 or number of items put into pPMKIDCache
2825 \return eHalStatus - when fail, it usually means the buffer allocated is not
2826 big enough and pNumItems has the number of
2827 tPmkidCacheInfo.
2828 \Note: pNumItems is a number of tPmkidCacheInfo,
2829 not sizeof(tPmkidCacheInfo) * something
2830 ---------------------------------------------------------------------------*/
2831eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
2832 tANI_U32 numItems )
2833{
2834 eHalStatus status = eHAL_STATUS_FAILURE;
2835 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2836
2837 status = sme_AcquireGlobalLock( &pMac->sme );
2838 if ( HAL_STATUS_SUCCESS( status ) )
2839 {
2840 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2841 {
2842 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
2843 }
2844 else
2845 {
2846 status = eHAL_STATUS_INVALID_PARAMETER;
2847 }
2848 sme_ReleaseGlobalLock( &pMac->sme );
2849 }
2850
2851 return (status);
2852}
2853
2854/* ---------------------------------------------------------------------------
2855 \fn sme_RoamGetSecurityReqIE
2856 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
2857 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08002858 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002859 \param pLen - caller allocated memory that has the length of pBuf as input.
2860 Upon returned, *pLen has the needed or IE length in pBuf.
2861 \param pBuf - Caller allocated memory that contain the IE field, if any,
2862 upon return
2863 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
2864 \return eHalStatus - when fail, it usually means the buffer allocated is not
2865 big enough
2866 ---------------------------------------------------------------------------*/
2867eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
2868 tANI_U8 *pBuf, eCsrSecurityType secType)
2869{
2870 eHalStatus status = eHAL_STATUS_FAILURE;
2871 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2872
2873 status = sme_AcquireGlobalLock( &pMac->sme );
2874 if ( HAL_STATUS_SUCCESS( status ) )
2875 {
2876 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2877 {
2878 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
2879 }
2880 else
2881 {
2882 status = eHAL_STATUS_INVALID_PARAMETER;
2883 }
2884 sme_ReleaseGlobalLock( &pMac->sme );
2885 }
2886
2887 return (status);
2888}
2889
2890/* ---------------------------------------------------------------------------
2891 \fn sme_RoamGetSecurityRspIE
2892 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
2893 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08002894 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002895 \param pLen - caller allocated memory that has the length of pBuf as input.
2896 Upon returned, *pLen has the needed or IE length in pBuf.
2897 \param pBuf - Caller allocated memory that contain the IE field, if any,
2898 upon return
2899 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
2900 \return eHalStatus - when fail, it usually means the buffer allocated is not
2901 big enough
2902 ---------------------------------------------------------------------------*/
2903eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
2904 tANI_U8 *pBuf, eCsrSecurityType secType)
2905{
2906 eHalStatus status = eHAL_STATUS_FAILURE;
2907 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2908
2909 status = sme_AcquireGlobalLock( &pMac->sme );
2910 if ( HAL_STATUS_SUCCESS( status ) )
2911 {
2912 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2913 {
2914 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
2915 }
2916 else
2917 {
2918 status = eHAL_STATUS_INVALID_PARAMETER;
2919 }
2920 sme_ReleaseGlobalLock( &pMac->sme );
2921 }
2922
2923 return (status);
2924
2925}
2926
2927
2928/* ---------------------------------------------------------------------------
2929 \fn sme_RoamGetNumPMKIDCache
2930 \brief a wrapper function to request CSR to return number of PMKID cache
2931 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08002932 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002933 \return tANI_U32 - the number of PMKID cache entries
2934 ---------------------------------------------------------------------------*/
2935tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
2936{
2937 eHalStatus status = eHAL_STATUS_FAILURE;
2938 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2939 tANI_U32 numPmkidCache = 0;
2940
2941 status = sme_AcquireGlobalLock( &pMac->sme );
2942 if ( HAL_STATUS_SUCCESS( status ) )
2943 {
2944 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2945 {
2946 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
2947 status = eHAL_STATUS_SUCCESS;
2948 }
2949 else
2950 {
2951 status = eHAL_STATUS_INVALID_PARAMETER;
2952 }
2953 sme_ReleaseGlobalLock( &pMac->sme );
2954 }
2955
2956 return (numPmkidCache);
2957}
2958
2959/* ---------------------------------------------------------------------------
2960 \fn sme_RoamGetPMKIDCache
2961 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08002962 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002963 \param pNum - caller allocated memory that has the space of the number of
2964 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
2965 needed or actually number in tPmkidCacheInfo.
2966 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
2967 any, upon return
2968 \return eHalStatus - when fail, it usually means the buffer allocated is not
2969 big enough
2970 ---------------------------------------------------------------------------*/
2971eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
2972 tPmkidCacheInfo *pPmkidCache)
2973{
2974 eHalStatus status = eHAL_STATUS_FAILURE;
2975 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2976
2977 status = sme_AcquireGlobalLock( &pMac->sme );
2978 if ( HAL_STATUS_SUCCESS( status ) )
2979 {
2980 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2981 {
2982 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
2983 }
2984 else
2985 {
2986 status = eHAL_STATUS_INVALID_PARAMETER;
2987 }
2988 sme_ReleaseGlobalLock( &pMac->sme );
2989 }
2990
2991 return (status);
2992}
2993
2994
2995/* ---------------------------------------------------------------------------
2996 \fn sme_GetConfigParam
2997 \brief a wrapper function that HDD calls to get the global settings
2998 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002999 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003000 \param pParam - caller allocated memory
3001 \return eHalStatus
3002 ---------------------------------------------------------------------------*/
3003eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3004{
3005 eHalStatus status = eHAL_STATUS_FAILURE;
3006 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3007
3008 status = sme_AcquireGlobalLock( &pMac->sme );
3009 if ( HAL_STATUS_SUCCESS( status ) )
3010 {
3011 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3012 if (status != eHAL_STATUS_SUCCESS)
3013 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003014 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003015 sme_ReleaseGlobalLock( &pMac->sme );
3016 return status;
3017 }
3018#if defined WLAN_FEATURE_P2P_INTERNAL
3019 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3020 if (status != eHAL_STATUS_SUCCESS)
3021 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003022 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003023 sme_ReleaseGlobalLock( &pMac->sme );
3024 return status;
3025 }
3026#endif
3027 sme_ReleaseGlobalLock( &pMac->sme );
3028 }
3029
3030 return (status);
3031}
3032
3033/* ---------------------------------------------------------------------------
3034 \fn sme_CfgSetInt
3035 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003036 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003037 \param cfgId - Configuration Parameter ID (type) for STA.
3038 \param ccmValue - The information related to Configuration Parameter ID
3039 which needs to be saved in CFG
3040 \param callback - To be registered by CSR with CCM. Once the CFG done with
3041 saving the information in the database, it notifies CCM &
3042 then the callback will be invoked to notify.
3043 \param toBeSaved - To save the request for future reference
3044 \return eHalStatus
3045 ---------------------------------------------------------------------------*/
3046eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3047 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3048{
3049 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3050}
3051
3052/* ---------------------------------------------------------------------------
3053 \fn sme_CfgSetStr
3054 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003055 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003056 \param cfgId - Configuration Parameter ID (type) for STA.
3057 \param pStr - Pointer to the byte array which carries the information needs
3058 to be saved in CFG
3059 \param length - Length of the data to be saved
3060 \param callback - To be registered by CSR with CCM. Once the CFG done with
3061 saving the information in the database, it notifies CCM &
3062 then the callback will be invoked to notify.
3063 \param toBeSaved - To save the request for future reference
3064 \return eHalStatus
3065 ---------------------------------------------------------------------------*/
3066eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3067 tANI_U32 length, tCcmCfgSetCallback callback,
3068 eAniBoolean toBeSaved)
3069{
3070 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3071}
3072
3073/* ---------------------------------------------------------------------------
3074 \fn sme_GetModifyProfileFields
3075 \brief HDD or SME - QOS calls this function to get the current values of
3076 connected profile fields, changing which can cause reassoc.
3077 This function must be called after CFG is downloaded and STA is in connected
3078 state. Also, make sure to call this function to get the current profile
3079 fields before calling the reassoc. So that pModifyProfileFields will have
3080 all the latest values plus the one(s) has been updated as part of reassoc
3081 request.
3082 \param pModifyProfileFields - pointer to the connected profile fields
3083 changing which can cause reassoc
3084
3085 \return eHalStatus
3086 -------------------------------------------------------------------------------*/
3087eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3088 tCsrRoamModifyProfileFields * pModifyProfileFields)
3089{
3090 eHalStatus status = eHAL_STATUS_FAILURE;
3091 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3092
3093 status = sme_AcquireGlobalLock( &pMac->sme );
3094 if ( HAL_STATUS_SUCCESS( status ) )
3095 {
3096 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3097 {
3098 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3099 }
3100 else
3101 {
3102 status = eHAL_STATUS_INVALID_PARAMETER;
3103 }
3104 sme_ReleaseGlobalLock( &pMac->sme );
3105 }
3106
3107 return (status);
3108}
3109
3110/*--------------------------------------------------------------------------
3111 \fn sme_SetConfigPowerSave
3112 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3113 For BMPS related configuration, this function also updates the CFG
3114 and sends a message to FW to pick up the new values. Note: Calling
3115 this function only updates the configuration and does not enable
3116 the specified power save mode.
3117 \param hHal - The handle returned by macOpen.
3118 \param psMode - Power Saving mode being modified
3119 \param pConfigParams - a pointer to a caller allocated object of type
3120 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3121 \return eHalStatus
3122 --------------------------------------------------------------------------*/
3123eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3124 void *pConfigParams)
3125{
3126 eHalStatus status = eHAL_STATUS_FAILURE;
3127 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3128
3129 if (NULL == pConfigParams ) {
3130 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3131 "nothing to update");
3132 return eHAL_STATUS_FAILURE;
3133 }
3134
3135 status = sme_AcquireGlobalLock( &pMac->sme );
3136 if ( HAL_STATUS_SUCCESS( status ) )
3137 {
3138 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3139 sme_ReleaseGlobalLock( &pMac->sme );
3140 }
3141
3142 return (status);
3143}
3144
3145/*--------------------------------------------------------------------------
3146 \fn sme_GetConfigPowerSave
3147 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3148 \param hHal - The handle returned by macOpen.
3149 \param psMode - Power Saving mode
3150 \param pConfigParams - a pointer to a caller allocated object of type
3151 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3152 \return eHalStatus
3153 --------------------------------------------------------------------------*/
3154eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3155 void *pConfigParams)
3156{
3157 eHalStatus status = eHAL_STATUS_FAILURE;
3158 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3159
3160 if (NULL == pConfigParams ) {
3161 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3162 "nothing to update");
3163 return eHAL_STATUS_FAILURE;
3164 }
3165
3166 status = sme_AcquireGlobalLock( &pMac->sme );
3167 if ( HAL_STATUS_SUCCESS( status ) )
3168 {
3169 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3170 sme_ReleaseGlobalLock( &pMac->sme );
3171 }
3172
3173 return (status);
3174}
3175
3176/* ---------------------------------------------------------------------------
3177 \fn sme_SignalPowerEvent
3178 \brief Signals to PMC that a power event has occurred. Used for putting
3179 the chip into deep sleep mode.
3180 \param hHal - The handle returned by macOpen.
3181 \param event - the event that has occurred
3182 \return eHalStatus
3183 ---------------------------------------------------------------------------*/
3184eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3185{
3186 eHalStatus status = eHAL_STATUS_FAILURE;
3187 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3188
3189 status = sme_AcquireGlobalLock( &pMac->sme );
3190 if ( HAL_STATUS_SUCCESS( status ) )
3191 {
3192 status = pmcSignalPowerEvent(hHal, event);
3193 sme_ReleaseGlobalLock( &pMac->sme );
3194 }
3195
3196 return (status);
3197}
3198
3199/* ---------------------------------------------------------------------------
3200 \fn sme_EnablePowerSave
3201 \brief Enables one of the power saving modes.
3202 \param hHal - The handle returned by macOpen.
3203 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3204 while the chip is operating in Full Power, PMC will start
3205 a timer that will try to put the chip in BMPS mode after
3206 expiry.
3207 \return eHalStatus
3208 ---------------------------------------------------------------------------*/
3209eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3210{
3211 eHalStatus status = eHAL_STATUS_FAILURE;
3212 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3213
3214 status = sme_AcquireGlobalLock( &pMac->sme );
3215 if ( HAL_STATUS_SUCCESS( status ) )
3216 {
3217 status = pmcEnablePowerSave(hHal, psMode);
3218 sme_ReleaseGlobalLock( &pMac->sme );
3219 }
3220
3221 return (status);
3222}
3223
3224/* ---------------------------------------------------------------------------
3225 \fn sme_DisablePowerSave
3226 \brief Disables one of the power saving modes.
3227 \param hHal - The handle returned by macOpen.
3228 \param psMode - The power saving mode to disable. Disabling does not imply
3229 that device will be brought out of the current PS mode. This
3230 is purely a configuration API.
3231 \return eHalStatus
3232 ---------------------------------------------------------------------------*/
3233eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3234{
3235 eHalStatus status = eHAL_STATUS_FAILURE;
3236 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3237
3238 status = sme_AcquireGlobalLock( &pMac->sme );
3239 if ( HAL_STATUS_SUCCESS( status ) )
3240 {
3241 status = pmcDisablePowerSave(hHal, psMode);
3242 sme_ReleaseGlobalLock( &pMac->sme );
3243 }
3244
3245 return (status);
3246 }
3247
3248/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303249+ \fn sme_SetHostPowerSave
3250+ \brief Enables BMPS logic to be controlled by User level apps
3251+ \param hHal - The handle returned by macOpen.
3252+ \param psMode - The power saving mode to disable. Disabling does not imply
3253+ that device will be brought out of the current PS mode. This
3254+ is purely a configuration API.
3255+ \return eHalStatus
3256+ ---------------------------------------------------------------------------*/
3257eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3258{
3259 eHalStatus status = eHAL_STATUS_FAILURE;
3260 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3261
3262 pMac->pmc.isHostPsEn = psMode;
3263
3264 return (status);
3265}
3266
3267/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003268 \fn sme_StartAutoBmpsTimer
3269 \brief Starts a timer that periodically polls all the registered
3270 module for entry into Bmps mode. This timer is started only if BMPS is
3271 enabled and whenever the device is in full power.
3272 \param hHal - The handle returned by macOpen.
3273 \return eHalStatus
3274 ---------------------------------------------------------------------------*/
3275eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3276{
3277 eHalStatus status = eHAL_STATUS_FAILURE;
3278 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3279
3280 status = sme_AcquireGlobalLock( &pMac->sme );
3281 if ( HAL_STATUS_SUCCESS( status ) )
3282 {
3283 status = pmcStartAutoBmpsTimer(hHal);
3284 sme_ReleaseGlobalLock( &pMac->sme );
3285 }
3286
3287 return (status);
3288}
3289/* ---------------------------------------------------------------------------
3290 \fn sme_StopAutoBmpsTimer
3291 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3292 Stopping the timer does not cause a device state change. Only the timer
3293 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3294 \param hHal - The handle returned by macOpen.
3295 \return eHalStatus
3296 ---------------------------------------------------------------------------*/
3297eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3298{
3299 eHalStatus status = eHAL_STATUS_FAILURE;
3300 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3301
3302 status = sme_AcquireGlobalLock( &pMac->sme );
3303 if ( HAL_STATUS_SUCCESS( status ) )
3304 {
3305 status = pmcStopAutoBmpsTimer(hHal);
3306 sme_ReleaseGlobalLock( &pMac->sme );
3307 }
3308
3309 return (status);
3310}
3311/* ---------------------------------------------------------------------------
3312 \fn sme_QueryPowerState
3313 \brief Returns the current power state of the device.
3314 \param hHal - The handle returned by macOpen.
3315 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3316 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3317 \return eHalStatus
3318 ---------------------------------------------------------------------------*/
3319eHalStatus sme_QueryPowerState (
3320 tHalHandle hHal,
3321 tPmcPowerState *pPowerState,
3322 tPmcSwitchState *pSwWlanSwitchState)
3323{
3324 eHalStatus status = eHAL_STATUS_FAILURE;
3325 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3326
3327 status = sme_AcquireGlobalLock( &pMac->sme );
3328 if ( HAL_STATUS_SUCCESS( status ) )
3329 {
3330 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3331 sme_ReleaseGlobalLock( &pMac->sme );
3332 }
3333
3334 return (status);
3335}
3336
3337/* ---------------------------------------------------------------------------
3338 \fn sme_IsPowerSaveEnabled
3339 \brief Checks if the device is able to enter a particular power save mode
3340 This does not imply that the device is in a particular PS mode
3341 \param hHal - The handle returned by macOpen.
3342 \param psMode - the power saving mode
3343 \return eHalStatus
3344 ---------------------------------------------------------------------------*/
3345tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
3346{
3347 eHalStatus status = eHAL_STATUS_FAILURE;
3348 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3349 tANI_BOOLEAN result = false;
3350
3351 status = sme_AcquireGlobalLock( &pMac->sme );
3352 if ( HAL_STATUS_SUCCESS( status ) )
3353 {
3354 result = pmcIsPowerSaveEnabled(hHal, psMode);
3355 sme_ReleaseGlobalLock( &pMac->sme );
3356 return result;
3357 }
3358
3359 return false;
3360}
3361
3362/* ---------------------------------------------------------------------------
3363 \fn sme_RequestFullPower
3364 \brief Request that the device be brought to full power state. When the
3365 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
3366 is enabled. On timer expiry PMC will attempt to put the device in
3367 BMPS mode if following holds true:
3368 - BMPS mode is enabled
3369 - Polling of all modules through the Power Save Check routine passes
3370 - STA is associated to an access point
3371 \param hHal - The handle returned by macOpen.
3372 \param - callbackRoutine Callback routine invoked in case of success/failure
3373 \return eHalStatus - status
3374 eHAL_STATUS_SUCCESS - device brought to full power state
3375 eHAL_STATUS_FAILURE - device cannot be brought to full power state
3376 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
3377 ---------------------------------------------------------------------------*/
3378eHalStatus sme_RequestFullPower (
3379 tHalHandle hHal,
3380 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3381 void *callbackContext,
3382 tRequestFullPowerReason fullPowerReason)
3383{
3384 eHalStatus status = eHAL_STATUS_FAILURE;
3385 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3386
3387 status = sme_AcquireGlobalLock( &pMac->sme );
3388 if ( HAL_STATUS_SUCCESS( status ) )
3389 {
3390 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
3391 sme_ReleaseGlobalLock( &pMac->sme );
3392 }
3393
3394 return (status);
3395}
3396
3397/* ---------------------------------------------------------------------------
3398 \fn sme_RequestBmps
3399 \brief Request that the device be put in BMPS state. Request will be
3400 accepted only if BMPS mode is enabled and power save check routine
3401 passes.
3402 \param hHal - The handle returned by macOpen.
3403 \param - callbackRoutine Callback routine invoked in case of success/failure
3404 \return eHalStatus
3405 eHAL_STATUS_SUCCESS - device is in BMPS state
3406 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
3407 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
3408 ---------------------------------------------------------------------------*/
3409eHalStatus sme_RequestBmps (
3410 tHalHandle hHal,
3411 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3412 void *callbackContext)
3413{
3414 eHalStatus status = eHAL_STATUS_FAILURE;
3415 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3416
3417 status = sme_AcquireGlobalLock( &pMac->sme );
3418 if ( HAL_STATUS_SUCCESS( status ) )
3419 {
3420 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
3421 sme_ReleaseGlobalLock( &pMac->sme );
3422 }
3423
3424 return (status);
3425}
3426
3427
3428/* ---------------------------------------------------------------------------
3429 \fn sme_SetDHCPTillPowerActiveFlag
3430 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
3431 entry by PMC
3432 \param hHal - The handle returned by macOpen.
3433 ---------------------------------------------------------------------------*/
3434void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
3435{
3436 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3437
3438 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
3439 pMac->pmc.remainInPowerActiveTillDHCP = flag;
3440}
3441
3442
3443/* ---------------------------------------------------------------------------
3444 \fn sme_StartUapsd
3445 \brief Request that the device be put in UAPSD state. If the device is in
3446 Full Power it will be put in BMPS mode first and then into UAPSD
3447 mode.
3448 \param hHal - The handle returned by macOpen.
3449 \param - callbackRoutine Callback routine invoked in case of success/failure
3450 eHAL_STATUS_SUCCESS - device is in UAPSD state
3451 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
3452 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
3453 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
3454 \return eHalStatus
3455 ---------------------------------------------------------------------------*/
3456eHalStatus sme_StartUapsd (
3457 tHalHandle hHal,
3458 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3459 void *callbackContext)
3460{
3461 eHalStatus status = eHAL_STATUS_FAILURE;
3462 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3463
3464 status = sme_AcquireGlobalLock( &pMac->sme );
3465 if ( HAL_STATUS_SUCCESS( status ) )
3466 {
3467 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
3468 sme_ReleaseGlobalLock( &pMac->sme );
3469 }
3470
3471 return (status);
3472 }
3473
3474/* ---------------------------------------------------------------------------
3475 \fn sme_StopUapsd
3476 \brief Request that the device be put out of UAPSD state. Device will be
3477 put in in BMPS state after stop UAPSD completes.
3478 \param hHal - The handle returned by macOpen.
3479 \return eHalStatus
3480 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
3481 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
3482 ---------------------------------------------------------------------------*/
3483eHalStatus sme_StopUapsd (tHalHandle hHal)
3484{
3485 eHalStatus status = eHAL_STATUS_FAILURE;
3486 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3487
3488 status = sme_AcquireGlobalLock( &pMac->sme );
3489 if ( HAL_STATUS_SUCCESS( status ) )
3490 {
3491 status = pmcStopUapsd(hHal);
3492 sme_ReleaseGlobalLock( &pMac->sme );
3493 }
3494
3495 return (status);
3496}
3497
3498/* ---------------------------------------------------------------------------
3499 \fn sme_RequestStandby
3500 \brief Request that the device be put in standby. It is HDD's responsibility
3501 to bring the chip to full power and do a disassoc before calling
3502 this API.
3503 \param hHal - The handle returned by macOpen.
3504 \param - callbackRoutine Callback routine invoked in case of success/failure
3505 \return eHalStatus
3506 eHAL_STATUS_SUCCESS - device is in Standby mode
3507 eHAL_STATUS_FAILURE - device cannot be put in standby mode
3508 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
3509 ---------------------------------------------------------------------------*/
3510eHalStatus sme_RequestStandby (
3511 tHalHandle hHal,
3512 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3513 void *callbackContext)
3514{
3515 eHalStatus status = eHAL_STATUS_FAILURE;
3516 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3517
3518 smsLog( pMac, LOG1, FL("") );
3519 status = sme_AcquireGlobalLock( &pMac->sme );
3520 if ( HAL_STATUS_SUCCESS( status ) )
3521 {
3522 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
3523 sme_ReleaseGlobalLock( &pMac->sme );
3524 }
3525
3526 return (status);
3527}
3528
3529/* ---------------------------------------------------------------------------
3530 \fn sme_RegisterPowerSaveCheck
3531 \brief Register a power save check routine that is called whenever
3532 the device is about to enter one of the power save modes.
3533 \param hHal - The handle returned by macOpen.
3534 \param checkRoutine - Power save check routine to be registered
3535 \return eHalStatus
3536 eHAL_STATUS_SUCCESS - successfully registered
3537 eHAL_STATUS_FAILURE - not successfully registered
3538 ---------------------------------------------------------------------------*/
3539eHalStatus sme_RegisterPowerSaveCheck (
3540 tHalHandle hHal,
3541 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
3542{
3543 eHalStatus status = eHAL_STATUS_FAILURE;
3544 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3545
3546 status = sme_AcquireGlobalLock( &pMac->sme );
3547 if ( HAL_STATUS_SUCCESS( status ) )
3548 {
3549 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
3550 sme_ReleaseGlobalLock( &pMac->sme );
3551 }
3552
3553 return (status);
3554}
3555
3556/* ---------------------------------------------------------------------------
3557 \fn sme_DeregisterPowerSaveCheck
3558 \brief Deregister a power save check routine
3559 \param hHal - The handle returned by macOpen.
3560 \param checkRoutine - Power save check routine to be deregistered
3561 \return eHalStatus
3562 eHAL_STATUS_SUCCESS - successfully deregistered
3563 eHAL_STATUS_FAILURE - not successfully deregistered
3564 ---------------------------------------------------------------------------*/
3565eHalStatus sme_DeregisterPowerSaveCheck (
3566 tHalHandle hHal,
3567 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
3568{
3569 eHalStatus status = eHAL_STATUS_FAILURE;
3570 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3571
3572 status = sme_AcquireGlobalLock( &pMac->sme );
3573 if ( HAL_STATUS_SUCCESS( status ) )
3574 {
3575 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
3576 sme_ReleaseGlobalLock( &pMac->sme );
3577 }
3578
3579 return (status);
3580}
3581
3582/* ---------------------------------------------------------------------------
3583 \fn sme_RegisterDeviceStateUpdateInd
3584 \brief Register a callback routine that is called whenever
3585 the device enters a new device state (Full Power, BMPS, UAPSD)
3586 \param hHal - The handle returned by macOpen.
3587 \param callbackRoutine - Callback routine to be registered
3588 \param callbackContext - Cookie to be passed back during callback
3589 \return eHalStatus
3590 eHAL_STATUS_SUCCESS - successfully registered
3591 eHAL_STATUS_FAILURE - not successfully registered
3592 ---------------------------------------------------------------------------*/
3593eHalStatus sme_RegisterDeviceStateUpdateInd (
3594 tHalHandle hHal,
3595 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
3596 void *callbackContext)
3597{
3598 eHalStatus status = eHAL_STATUS_FAILURE;
3599 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3600
3601 status = sme_AcquireGlobalLock( &pMac->sme );
3602 if ( HAL_STATUS_SUCCESS( status ) )
3603 {
3604 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
3605 sme_ReleaseGlobalLock( &pMac->sme );
3606 }
3607
3608 return (status);
3609}
3610
3611/* ---------------------------------------------------------------------------
3612 \fn sme_DeregisterDeviceStateUpdateInd
3613 \brief Deregister a routine that was registered for device state changes
3614 \param hHal - The handle returned by macOpen.
3615 \param callbackRoutine - Callback routine to be deregistered
3616 \return eHalStatus
3617 eHAL_STATUS_SUCCESS - successfully deregistered
3618 eHAL_STATUS_FAILURE - not successfully deregistered
3619 ---------------------------------------------------------------------------*/
3620eHalStatus sme_DeregisterDeviceStateUpdateInd (
3621 tHalHandle hHal,
3622 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
3623{
3624 eHalStatus status = eHAL_STATUS_FAILURE;
3625 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3626
3627 status = sme_AcquireGlobalLock( &pMac->sme );
3628 if ( HAL_STATUS_SUCCESS( status ) )
3629 {
3630 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
3631 sme_ReleaseGlobalLock( &pMac->sme );
3632 }
3633
3634 return (status);
3635}
3636
3637/* ---------------------------------------------------------------------------
3638 \fn sme_WowlAddBcastPattern
3639 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
3640 do a pattern match on these patterns when Wowl is enabled during BMPS
3641 mode. Note that Firmware performs the pattern matching only on
3642 broadcast frames and while Libra is in BMPS mode.
3643 \param hHal - The handle returned by macOpen.
3644 \param pattern - Pattern to be added
3645 \return eHalStatus
3646 eHAL_STATUS_FAILURE Cannot add pattern
3647 eHAL_STATUS_SUCCESS Request accepted.
3648 ---------------------------------------------------------------------------*/
3649eHalStatus sme_WowlAddBcastPattern (
3650 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003651 tpSirWowlAddBcastPtrn pattern,
3652 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003653{
3654 eHalStatus status = eHAL_STATUS_FAILURE;
3655 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3656 status = sme_AcquireGlobalLock( &pMac->sme );
3657 if ( HAL_STATUS_SUCCESS( status ) )
3658 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003659 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003660 sme_ReleaseGlobalLock( &pMac->sme );
3661 }
3662
3663 return (status);
3664}
3665
3666/* ---------------------------------------------------------------------------
3667 \fn sme_WowlDelBcastPattern
3668 \brief Delete a pattern that was added for Pattern Byte Matching.
3669 \param hHal - The handle returned by macOpen.
3670 \param pattern - Pattern to be deleted
3671 \return eHalStatus
3672 eHAL_STATUS_FAILURE Cannot delete pattern
3673 eHAL_STATUS_SUCCESS Request accepted.
3674 ---------------------------------------------------------------------------*/
3675eHalStatus sme_WowlDelBcastPattern (
3676 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003677 tpSirWowlDelBcastPtrn pattern,
3678 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003679{
3680 eHalStatus status = eHAL_STATUS_FAILURE;
3681 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3682 status = sme_AcquireGlobalLock( &pMac->sme );
3683 if ( HAL_STATUS_SUCCESS( status ) )
3684 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003685 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003686 sme_ReleaseGlobalLock( &pMac->sme );
3687 }
3688
3689 return (status);
3690}
3691
3692/* ---------------------------------------------------------------------------
3693 \fn sme_EnterWowl
3694 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
3695 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
3696 SME will will cache the information that WOWL has been enabled and
3697 attempt to put the device in BMPS. On entry into BMPS, SME will
3698 enable the WOWL mode.
3699 Note 1: If we exit BMPS mode (someone requests full power), we
3700 will NOT resume WOWL when we go back to BMPS again. Request for full
3701 power (while in WOWL mode) means disable WOWL and go to full power.
3702 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
3703 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
3704 are required. Currently there is no requirement or use case to support
3705 UAPSD and WOWL at the same time.
3706
3707 \param hHal - The handle returned by macOpen.
3708 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
3709 Used for success/failure notification by SME
3710 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
3711 at the time of callback.
3712 \param wakeReasonIndCB - Callback routine provided by HDD.
3713 Used for Wake Reason Indication by SME
3714 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
3715 at the time of callback.
3716 \return eHalStatus
3717 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
3718 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
3719 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
3720 BMPS mode is entered.
3721 ---------------------------------------------------------------------------*/
3722eHalStatus sme_EnterWowl (
3723 tHalHandle hHal,
3724 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
3725 void *enterWowlCallbackContext,
3726#ifdef WLAN_WAKEUP_EVENTS
3727 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
3728 void *wakeIndicationCBContext,
3729#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003730 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003731{
3732 eHalStatus status = eHAL_STATUS_FAILURE;
3733 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3734 status = sme_AcquireGlobalLock( &pMac->sme );
3735 if ( HAL_STATUS_SUCCESS( status ) )
3736 {
3737 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
3738#ifdef WLAN_WAKEUP_EVENTS
3739 wakeIndicationCB, wakeIndicationCBContext,
3740#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003741 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003742 sme_ReleaseGlobalLock( &pMac->sme );
3743 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003744 return (status);
3745}
3746/* ---------------------------------------------------------------------------
3747 \fn sme_ExitWowl
3748 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
3749 SME will initiate exit from WoWLAN mode and device will be put in BMPS
3750 mode.
3751 \param hHal - The handle returned by macOpen.
3752 \return eHalStatus
3753 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
3754 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
3755 ---------------------------------------------------------------------------*/
3756eHalStatus sme_ExitWowl (tHalHandle hHal)
3757{
3758 eHalStatus status = eHAL_STATUS_FAILURE;
3759 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3760 status = sme_AcquireGlobalLock( &pMac->sme );
3761 if ( HAL_STATUS_SUCCESS( status ) )
3762 {
3763 status = pmcExitWowl (hHal);
3764 sme_ReleaseGlobalLock( &pMac->sme );
3765 }
3766
3767 return (status);
3768}
3769
3770/* ---------------------------------------------------------------------------
3771
3772 \fn sme_RoamSetKey
3773
3774 \brief To set encryption key. This function should be called only when connected
3775 This is an asynchronous API.
3776
3777 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
3778
3779 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
3780
3781 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
3782
3783 FAILURE or RESOURCES The API finished and failed.
3784
3785 -------------------------------------------------------------------------------*/
3786eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
3787{
3788 eHalStatus status = eHAL_STATUS_FAILURE;
3789 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3790 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003791 tANI_U32 i;
3792 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003793
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07003794 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
3795 {
3796 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
3797 return eHAL_STATUS_FAILURE;
3798 }
3799
Jeff Johnson295189b2012-06-20 16:38:30 -07003800 status = sme_AcquireGlobalLock( &pMac->sme );
3801 if ( HAL_STATUS_SUCCESS( status ) )
3802 {
3803 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
3804 if(pRoamId)
3805 {
3806 *pRoamId = roamId;
3807 }
3808
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07003809 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07003810
3811 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003812 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003813
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003814 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003815
3816 pSession = CSR_GET_SESSION(pMac, sessionId);
3817
Jeff Johnson32d95a32012-09-10 13:15:23 -07003818 if(!pSession)
3819 {
3820 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08003821 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003822 return eHAL_STATUS_FAILURE;
3823 }
3824
Jeff Johnson295189b2012-06-20 16:38:30 -07003825 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
3826 {
3827 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
3828 {
3829 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
3830 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
3831 {
3832 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
3833 }
3834 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
3835 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
3836 {
3837 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
3838 }
3839 }
3840 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003841
3842 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
3843 sme_ReleaseGlobalLock( &pMac->sme );
3844 }
3845
3846 return (status);
3847}
3848
3849
3850/* ---------------------------------------------------------------------------
3851
3852 \fn sme_RoamRemoveKey
3853
3854 \brief To set encryption key. This is an asynchronous API.
3855
3856 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
3857
3858 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
3859
3860 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
3861
3862 FAILURE or RESOURCES The API finished and failed.
3863
3864 -------------------------------------------------------------------------------*/
3865eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
3866 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
3867{
3868 eHalStatus status = eHAL_STATUS_FAILURE;
3869 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3870 tANI_U32 roamId;
3871
3872 status = sme_AcquireGlobalLock( &pMac->sme );
3873 if ( HAL_STATUS_SUCCESS( status ) )
3874 {
3875 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
3876 if(pRoamId)
3877 {
3878 *pRoamId = roamId;
3879 }
3880 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
3881 sme_ReleaseGlobalLock( &pMac->sme );
3882 }
3883
3884 return (status);
3885}
3886
3887/* ---------------------------------------------------------------------------
3888 \fn sme_GetRssi
3889 \brief a wrapper function that client calls to register a callback to get RSSI
3890
3891 \param callback - SME sends back the requested stats using the callback
3892 \param staId - The station ID for which the stats is requested for
3893 \param pContext - user context to be passed back along with the callback
3894 \param pVosContext - vos context
3895 \return eHalStatus
3896 ---------------------------------------------------------------------------*/
3897eHalStatus sme_GetRssi(tHalHandle hHal,
3898 tCsrRssiCallback callback,
3899 tANI_U8 staId, tCsrBssid bssId,
3900 void *pContext, void* pVosContext)
3901{
3902 eHalStatus status = eHAL_STATUS_FAILURE;
3903 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3904
3905 status = sme_AcquireGlobalLock( &pMac->sme );
3906 if ( HAL_STATUS_SUCCESS( status ) )
3907 {
3908 status = csrGetRssi( pMac, callback,
3909 staId, bssId, pContext, pVosContext);
3910 sme_ReleaseGlobalLock( &pMac->sme );
3911 }
3912 return (status);
3913}
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08003914#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
3915/* ---------------------------------------------------------------------------
3916 \fn sme_GetRoamRssi
3917 \brief a wrapper function that client calls to register a callback to get Roam RSSI
3918
3919 \param callback - SME sends back the requested stats using the callback
3920 \param staId - The station ID for which the stats is requested for
3921 \param pContext - user context to be passed back along with the callback
3922 \param pVosContext - vos context
3923 \return eHalStatus
3924 ---------------------------------------------------------------------------*/
3925eHalStatus sme_GetRoamRssi(tHalHandle hHal,
3926 tCsrRssiCallback callback,
3927 tANI_U8 staId, tCsrBssid bssId,
3928 void *pContext, void* pVosContext)
3929{
3930 eHalStatus status = eHAL_STATUS_FAILURE;
3931 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3932
3933 status = sme_AcquireGlobalLock( &pMac->sme );
3934 if ( HAL_STATUS_SUCCESS( status ) )
3935 {
3936 status = csrGetRoamRssi( pMac, callback,
3937 staId, bssId, pContext, pVosContext);
3938 sme_ReleaseGlobalLock( &pMac->sme );
3939 }
3940 return (status);
3941}
3942#endif
3943
Jeff Johnson295189b2012-06-20 16:38:30 -07003944
3945/* ---------------------------------------------------------------------------
3946 \fn sme_GetStatistics
3947 \brief a wrapper function that client calls to register a callback to get
3948 different PHY level statistics from CSR.
3949
3950 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
3951 \param statsMask - The different category/categories of stats requester is looking for
3952 \param callback - SME sends back the requested stats using the callback
3953 \param periodicity - If requester needs periodic update in millisec, 0 means
3954 it's an one time request
3955 \param cache - If requester is happy with cached stats
3956 \param staId - The station ID for which the stats is requested for
3957 \param pContext - user context to be passed back along with the callback
3958 \return eHalStatus
3959 ---------------------------------------------------------------------------*/
3960eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
3961 tANI_U32 statsMask,
3962 tCsrStatsCallback callback,
3963 tANI_U32 periodicity, tANI_BOOLEAN cache,
3964 tANI_U8 staId, void *pContext)
3965{
3966 eHalStatus status = eHAL_STATUS_FAILURE;
3967 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3968
3969 status = sme_AcquireGlobalLock( &pMac->sme );
3970 if ( HAL_STATUS_SUCCESS( status ) )
3971 {
3972 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
3973 periodicity, cache, staId, pContext);
3974 sme_ReleaseGlobalLock( &pMac->sme );
3975 }
3976
3977 return (status);
3978
3979}
3980
3981/* ---------------------------------------------------------------------------
3982
3983 \fn sme_GetCountryCode
3984
3985 \brief To return the current country code. If no country code is applied, default country code is
3986 used to fill the buffer.
3987 If 11d supported is turned off, an error is return and the last applied/default country code is used.
3988 This is a synchronous API.
3989
3990 \param pBuf - pointer to a caller allocated buffer for returned country code.
3991
3992 \param pbLen For input, this parameter indicates how big is the buffer.
3993 Upon return, this parameter has the number of bytes for country. If pBuf
3994 doesn't have enough space, this function returns
3995 fail status and this parameter contains the number that is needed.
3996
3997 \return eHalStatus SUCCESS.
3998
3999 FAILURE or RESOURCES The API finished and failed.
4000
4001 -------------------------------------------------------------------------------*/
4002eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
4003{
4004 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4005
4006 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
4007}
4008
4009
4010/* ---------------------------------------------------------------------------
4011
4012 \fn sme_SetCountryCode
4013
4014 \brief To change the current/default country code.
4015 If 11d supported is turned off, an error is return.
4016 This is a synchronous API.
4017
4018 \param pCountry - pointer to a caller allocated buffer for the country code.
4019
4020 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
4021 whether a reset is required.
4022
4023 \return eHalStatus SUCCESS.
4024
4025 FAILURE or RESOURCES The API finished and failed.
4026
4027 -------------------------------------------------------------------------------*/
4028eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
4029{
4030 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4031
4032 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4033}
4034
4035
4036/* ---------------------------------------------------------------------------
4037 \fn sme_ResetCountryCodeInformation
4038 \brief this function is to reset the country code current being used back to EEPROM default
4039 this includes channel list and power setting. This is a synchronous API.
4040 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4041 a restart is needed to apply the change
4042 \return eHalStatus
4043 -------------------------------------------------------------------------------*/
4044eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4045{
4046 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4047
4048 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4049}
4050
4051
4052/* ---------------------------------------------------------------------------
4053 \fn sme_GetSupportedCountryCode
4054 \brief this function is to get a list of the country code current being supported
4055 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4056 this has the country code list. 3 bytes for each country code. This may be NULL if
4057 caller wants to know the needed byte count.
4058 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4059 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4060 \return eHalStatus
4061 -------------------------------------------------------------------------------*/
4062eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4063{
4064 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4065
4066 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4067}
4068
4069
4070/* ---------------------------------------------------------------------------
4071 \fn sme_GetCurrentRegulatoryDomain
4072 \brief this function is to get the current regulatory domain. This is a synchronous API.
4073 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4074 SME. The function fails if 11d support is turned off.
4075 \param pDomain - Caller allocated buffer to return the current domain.
4076 \return eHalStatus SUCCESS.
4077
4078 FAILURE or RESOURCES The API finished and failed.
4079 -------------------------------------------------------------------------------*/
4080eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4081{
4082 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4083 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4084
4085 if( pDomain )
4086 {
4087 if( csrIs11dSupported( pMac ) )
4088 {
4089 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4090 status = eHAL_STATUS_SUCCESS;
4091 }
4092 else
4093 {
4094 status = eHAL_STATUS_FAILURE;
4095 }
4096 }
4097
4098 return ( status );
4099}
4100
4101
4102/* ---------------------------------------------------------------------------
4103 \fn sme_SetRegulatoryDomain
4104 \brief this function is to set the current regulatory domain.
4105 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4106 SME. This is a synchronous API.
4107 \param domainId - indicate the domain (defined in the driver) needs to set to.
4108 See v_REGDOMAIN_t for definition
4109 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4110 a restart is needed to apply the change
4111 \return eHalStatus
4112 -------------------------------------------------------------------------------*/
4113eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4114{
4115 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4116
4117 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4118}
4119
4120
4121/* ---------------------------------------------------------------------------
4122
4123 \fn sme_GetRegulatoryDomainForCountry
4124
4125 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4126
4127 \param pCountry - pointer to a caller allocated buffer for input country code.
4128
4129 \param pDomainId Upon successful return, it is the domain that country belongs to.
4130 If it is NULL, returning success means that the country code is known.
4131
4132 \return eHalStatus SUCCESS.
4133
4134 FAILURE or RESOURCES The API finished and failed.
4135
4136 -------------------------------------------------------------------------------*/
4137eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4138{
4139 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4140
4141 return ( csrGetRegulatoryDomainForCountry( pMac, pCountry, pDomainId ) );
4142}
4143
4144
4145
4146
4147/* ---------------------------------------------------------------------------
4148
4149 \fn sme_GetSupportedRegulatoryDomains
4150
4151 \brief To return a list of supported regulatory domains. This is a synchronous API.
4152
4153 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4154
4155 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4156 Upon return, this parameter has the number for supported domains. If pDomains
4157 doesn't have enough space for all the supported domains, this function returns
4158 fail status and this parameter contains the number that is needed.
4159
4160 \return eHalStatus SUCCESS.
4161
4162 FAILURE or RESOURCES The API finished and failed.
4163
4164 -------------------------------------------------------------------------------*/
4165eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4166{
4167 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4168
4169 //We support all domains for now
4170 if( pNumDomains )
4171 {
4172 if( NUM_REG_DOMAINS <= *pNumDomains )
4173 {
4174 status = eHAL_STATUS_SUCCESS;
4175 }
4176 *pNumDomains = NUM_REG_DOMAINS;
4177 }
4178 if( HAL_STATUS_SUCCESS( status ) )
4179 {
4180 if( pDomains )
4181 {
4182 pDomains[0] = REGDOMAIN_FCC;
4183 pDomains[1] = REGDOMAIN_ETSI;
4184 pDomains[2] = REGDOMAIN_JAPAN;
4185 pDomains[3] = REGDOMAIN_WORLD;
4186 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
4187 pDomains[5] = REGDOMAIN_APAC;
4188 pDomains[6] = REGDOMAIN_KOREA;
4189 pDomains[7] = REGDOMAIN_HI_5GHZ;
4190 pDomains[8] = REGDOMAIN_NO_5GHZ;
4191 }
4192 else
4193 {
4194 status = eHAL_STATUS_INVALID_PARAMETER;
4195 }
4196 }
4197
4198 return ( status );
4199}
4200
4201
4202//some support functions
4203tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
4204{
4205 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4206
4207 return ( csrIs11dSupported( pMac ) );
4208}
4209
4210
4211tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
4212{
4213 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4214
4215 return ( csrIs11hSupported( pMac ) );
4216}
4217
4218
4219tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
4220{
4221 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4222
4223 return ( csrIsWmmSupported( pMac ) );
4224}
4225
4226//Upper layer to get the list of the base channels to scan for passively 11d info from csr
4227eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
4228{
4229 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4230
4231 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
4232}
4233
4234/* ---------------------------------------------------------------------------
4235
4236 \fn sme_ChangeCountryCode
4237
4238 \brief Change Country code from upperlayer during WLAN driver operation.
4239 This is a synchronous API.
4240
4241 \param hHal - The handle returned by macOpen.
4242
4243 \param pCountry New Country Code String
4244
4245 \return eHalStatus SUCCESS.
4246
4247 FAILURE or RESOURCES The API finished and failed.
4248
4249 -------------------------------------------------------------------------------*/
4250eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
4251 tSmeChangeCountryCallback callback,
4252 tANI_U8 *pCountry,
4253 void *pContext,
4254 void* pVosContext )
4255{
4256 eHalStatus status = eHAL_STATUS_FAILURE;
4257 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4258 vos_msg_t msg;
4259 tAniChangeCountryCodeReq *pMsg;
4260
4261 status = sme_AcquireGlobalLock( &pMac->sme );
4262 if ( HAL_STATUS_SUCCESS( status ) )
4263 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004264 smsLog(pMac, LOG1, FL(" called"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004265 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniChangeCountryCodeReq));
4266 if ( !HAL_STATUS_SUCCESS(status) )
4267 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004268 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004269 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07004270 return status;
4271 }
4272
4273 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
4274 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
4275 palCopyMemory(pMac->hHdd, pMsg->countryCode, pCountry, 3);
4276 pMsg->changeCCCallback = callback;
4277 pMsg->pDevContext = pContext;
4278 pMsg->pVosContext = pVosContext;
4279
4280 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
4281 msg.bodyptr = pMsg;
4282 msg.reserved = 0;
4283
4284 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
4285 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004286 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Jeff Johnson295189b2012-06-20 16:38:30 -07004287 palFreeMemory(pMac->hHdd, (void *)pMsg);
4288 status = eHAL_STATUS_FAILURE;
4289 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004290 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004291 sme_ReleaseGlobalLock( &pMac->sme );
4292 }
4293
4294 return (status);
4295}
4296
4297/* ---------------------------------------------------------------------------
4298 \fn sme_BtcSignalBtEvent
4299 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
4300 BT event type and the current operating mode of Libra (full power,
4301 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
4302 would be employed.
4303 \param hHal - The handle returned by macOpen.
4304 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
4305 Caller owns the memory and is responsible for freeing it.
4306 \return VOS_STATUS
4307 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
4308 if BTC execution mode is set to BTC_WLAN_ONLY
4309 or BTC_PTA_ONLY.
4310 VOS_STATUS_SUCCESS BT Event passed to HAL
4311 ---------------------------------------------------------------------------*/
4312VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
4313{
4314 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4315#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4316 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4317
4318 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4319 {
4320 status = btcSignalBTEvent (hHal, pBtEvent);
4321 sme_ReleaseGlobalLock( &pMac->sme );
4322 }
4323#endif
4324 return (status);
4325}
4326
4327/* ---------------------------------------------------------------------------
4328 \fn sme_BtcSetConfig
4329 \brief API to change the current Bluetooth Coexistence (BTC) configuration
4330 This function should be invoked only after CFG download has completed.
4331 Calling it after sme_HDDReadyInd is recommended.
4332 \param hHal - The handle returned by macOpen.
4333 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
4334 Caller owns the memory and is responsible for freeing it.
4335 \return VOS_STATUS
4336 VOS_STATUS_E_FAILURE Config not passed to HAL.
4337 VOS_STATUS_SUCCESS Config passed to HAL
4338 ---------------------------------------------------------------------------*/
4339VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4340{
4341 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4342#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4343 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4344 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4345 {
4346 status = btcSetConfig (hHal, pSmeBtcConfig);
4347 sme_ReleaseGlobalLock( &pMac->sme );
4348 }
4349#endif
4350 return (status);
4351}
4352
4353/* ---------------------------------------------------------------------------
4354 \fn sme_BtcGetConfig
4355 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
4356 \param hHal - The handle returned by macOpen.
4357 \param pSmeBtcConfig - Pointer to a caller allocated object of type
4358 tSmeBtcConfig. Caller owns the memory and is responsible
4359 for freeing it.
4360 \return VOS_STATUS
4361 VOS_STATUS_E_FAILURE - failure
4362 VOS_STATUS_SUCCESS success
4363 ---------------------------------------------------------------------------*/
4364VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4365{
4366 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4367#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4368 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4369
4370 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4371 {
4372 status = btcGetConfig (hHal, pSmeBtcConfig);
4373 sme_ReleaseGlobalLock( &pMac->sme );
4374 }
4375#endif
4376 return (status);
4377}
4378/* ---------------------------------------------------------------------------
4379 \fn sme_SetCfgPrivacy
4380 \brief API to set configure privacy parameters
4381 \param hHal - The handle returned by macOpen.
4382 \param pProfile - Pointer CSR Roam profile.
4383 \param fPrivacy - This parameter indicates status of privacy
4384
4385 \return void
4386 ---------------------------------------------------------------------------*/
4387void sme_SetCfgPrivacy( tHalHandle hHal,
4388 tCsrRoamProfile *pProfile,
4389 tANI_BOOLEAN fPrivacy
4390 )
4391{
4392 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4393 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4394 {
4395 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
4396 sme_ReleaseGlobalLock( &pMac->sme );
4397 }
4398}
4399
4400#if defined WLAN_FEATURE_VOWIFI
4401/* ---------------------------------------------------------------------------
4402 \fn sme_NeighborReportRequest
4403 \brief API to request neighbor report.
4404 \param hHal - The handle returned by macOpen.
4405 \param pRrmNeighborReq - Pointer to a caller allocated object of type
4406 tRrmNeighborReq. Caller owns the memory and is responsible
4407 for freeing it.
4408 \return VOS_STATUS
4409 VOS_STATUS_E_FAILURE - failure
4410 VOS_STATUS_SUCCESS success
4411 ---------------------------------------------------------------------------*/
4412VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
4413 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
4414{
4415 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4416 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4417
4418 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4419 {
4420 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
4421 sme_ReleaseGlobalLock( &pMac->sme );
4422 }
4423
4424 return (status);
4425}
4426#endif
4427
4428//The following are debug APIs to support direct read/write register/memory
4429//They are placed in SME because HW cannot be access when in LOW_POWER state
4430//AND not connected. The knowledge and synchronization is done in SME
4431
4432//sme_DbgReadRegister
4433//Caller needs to validate the input values
4434VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
4435{
4436 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4437 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004438 tPmcPowerState PowerState;
4439 tANI_U32 sessionId = 0;
4440
4441 /* 1) To make Quarky work in FTM mode **************************************/
4442
4443 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4444 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004445 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004446 {
4447 return VOS_STATUS_SUCCESS;
4448 }
4449 return VOS_STATUS_E_FAILURE;
4450 }
4451
4452 /* 2) NON FTM mode driver *************************************************/
4453
4454 /* Acquire SME global lock */
4455 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4456 {
4457 return VOS_STATUS_E_FAILURE;
4458 }
4459
4460 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4461 {
4462 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4463 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4464 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004465 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004466 {
4467 status = VOS_STATUS_SUCCESS;
4468 }
4469 else
4470 {
4471 status = VOS_STATUS_E_FAILURE;
4472 }
4473 }
4474 else
4475 {
4476 status = VOS_STATUS_E_FAILURE;
4477 }
4478 }
4479
4480 /* This is a hack for Qualky/pttWniSocket
4481 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
4482 if ( VOS_STATUS_SUCCESS != status )
4483 {
4484 *pRegValue = 0xDEADBEEF;
4485 status = VOS_STATUS_SUCCESS;
4486 }
4487
4488 /* Release SME global lock */
4489 sme_ReleaseGlobalLock(&pMac->sme);
4490
4491 return (status);
4492}
4493
4494
4495//sme_DbgWriteRegister
4496//Caller needs to validate the input values
4497VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
4498{
4499 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4500 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004501 tPmcPowerState PowerState;
4502 tANI_U32 sessionId = 0;
4503
4504 /* 1) To make Quarky work in FTM mode **************************************/
4505
4506 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4507 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004508 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004509 {
4510 return VOS_STATUS_SUCCESS;
4511 }
4512 return VOS_STATUS_E_FAILURE;
4513 }
4514
4515 /* 2) NON FTM mode driver *************************************************/
4516
4517 /* Acquire SME global lock */
4518 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4519 {
4520 return VOS_STATUS_E_FAILURE;
4521 }
4522
4523 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4524 {
4525 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4526 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4527 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004528 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004529 {
4530 status = VOS_STATUS_SUCCESS;
4531 }
4532 else
4533 {
4534 status = VOS_STATUS_E_FAILURE;
4535 }
4536 }
4537 else
4538 {
4539 status = VOS_STATUS_E_FAILURE;
4540 }
4541 }
4542
4543 /* Release SME global lock */
4544 sme_ReleaseGlobalLock(&pMac->sme);
4545
4546 return (status);
4547}
4548
4549
4550
4551//sme_DbgReadMemory
4552//Caller needs to validate the input values
4553//pBuf caller allocated buffer has the length of nLen
4554VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
4555{
4556 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4557 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07004558 tPmcPowerState PowerState;
4559 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004560 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
4561 tANI_U32 arg1 = memAddr;
4562 tANI_U32 arg2 = nLen/4;
4563 tANI_U32 arg3 = 4;
4564 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004565 /* 1) To make Quarky work in FTM mode **************************************/
4566
4567 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4568 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004569 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07004570 {
4571 return VOS_STATUS_SUCCESS;
4572 }
4573 return VOS_STATUS_E_FAILURE;
4574 }
4575
4576 /* 2) NON FTM mode driver *************************************************/
4577
4578 /* Acquire SME global lock */
4579 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4580 {
4581 return VOS_STATUS_E_FAILURE;
4582 }
4583
4584 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4585 {
4586 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4587 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4588 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004589 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07004590 {
4591 status = VOS_STATUS_SUCCESS;
4592 }
4593 else
4594 {
4595 status = VOS_STATUS_E_FAILURE;
4596 }
4597 }
4598 else
4599 {
4600 status = VOS_STATUS_E_FAILURE;
4601 }
4602 }
4603
4604 /* This is a hack for Qualky/pttWniSocket
4605 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
4606 if (VOS_STATUS_SUCCESS != status)
4607 {
4608 vos_mem_set(pBuf, nLen, 0xCD);
4609 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004610 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004611 }
4612
4613 /* Release SME lock */
4614 sme_ReleaseGlobalLock(&pMac->sme);
4615
4616 return (status);
4617}
4618
4619
4620//sme_DbgWriteMemory
4621//Caller needs to validate the input values
4622VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
4623{
4624 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4625 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004626 tPmcPowerState PowerState;
4627 tANI_U32 sessionId = 0;
4628
4629 /* 1) To make Quarky work in FTM mode **************************************/
4630
4631 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4632 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004633 {
4634 return VOS_STATUS_SUCCESS;
4635 }
4636 return VOS_STATUS_E_FAILURE;
4637 }
4638
4639 /* 2) NON FTM mode driver *************************************************/
4640
4641 /* Acquire SME global lock */
4642 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4643 {
4644 return VOS_STATUS_E_FAILURE;
4645 }
4646
4647 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4648 {
4649 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4650 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4651 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004652 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07004653 {
4654 status = VOS_STATUS_SUCCESS;
4655 }
4656 else
4657 {
4658 status = VOS_STATUS_E_FAILURE;
4659 }
4660 }
4661 else
4662 {
4663 status = VOS_STATUS_E_FAILURE;
4664 }
4665 }
4666
4667 /* Release Global lock */
4668 sme_ReleaseGlobalLock(&pMac->sme);
4669
4670 return (status);
4671}
4672
4673
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004674void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07004675{
4676#ifdef WLAN_DEBUG
4677 // Verify against current log level
4678 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
4679 return;
4680 else
4681 {
4682 va_list marker;
4683
4684 va_start( marker, pString ); /* Initialize variable arguments. */
4685
4686 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
4687
4688 va_end( marker ); /* Reset variable arguments. */
4689 }
4690#endif
4691}
Jeff Johnson295189b2012-06-20 16:38:30 -07004692
Jeff Johnson295189b2012-06-20 16:38:30 -07004693/* ---------------------------------------------------------------------------
4694 \fn sme_GetWcnssWlanCompiledVersion
4695 \brief This API returns the version of the WCNSS WLAN API with
4696 which the HOST driver was built
4697 \param hHal - The handle returned by macOpen.
4698 \param pVersion - Points to the Version structure to be filled
4699 \return VOS_STATUS
4700 VOS_STATUS_E_INVAL - failure
4701 VOS_STATUS_SUCCESS success
4702 ---------------------------------------------------------------------------*/
4703VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
4704 tSirVersionType *pVersion)
4705{
4706 VOS_STATUS status = VOS_STATUS_SUCCESS;
4707 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4708 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4709
4710 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4711 {
4712 if( pVersion != NULL )
4713 {
4714 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
4715 }
4716 else
4717 {
4718 status = VOS_STATUS_E_INVAL;
4719 }
4720 sme_ReleaseGlobalLock( &pMac->sme );
4721 }
4722
4723 return (status);
4724}
4725
4726
4727/* ---------------------------------------------------------------------------
4728 \fn sme_GetWcnssWlanReportedVersion
4729 \brief This API returns the version of the WCNSS WLAN API with
4730 which the WCNSS driver reports it was built
4731 \param hHal - The handle returned by macOpen.
4732 \param pVersion - Points to the Version structure to be filled
4733 \return VOS_STATUS
4734 VOS_STATUS_E_INVAL - failure
4735 VOS_STATUS_SUCCESS success
4736 ---------------------------------------------------------------------------*/
4737VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
4738 tSirVersionType *pVersion)
4739{
4740 VOS_STATUS status = VOS_STATUS_SUCCESS;
4741 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4742 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4743
4744 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4745 {
4746 if( pVersion != NULL )
4747 {
4748 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
4749 }
4750 else
4751 {
4752 status = VOS_STATUS_E_INVAL;
4753 }
4754 sme_ReleaseGlobalLock( &pMac->sme );
4755 }
4756
4757 return (status);
4758}
4759
4760
4761/* ---------------------------------------------------------------------------
4762 \fn sme_GetWcnssSoftwareVersion
4763 \brief This API returns the version string of the WCNSS driver
4764 \param hHal - The handle returned by macOpen.
4765 \param pVersion - Points to the Version string buffer to be filled
4766 \param versionBufferSize - THe size of the Version string buffer
4767 \return VOS_STATUS
4768 VOS_STATUS_E_INVAL - failure
4769 VOS_STATUS_SUCCESS success
4770 ---------------------------------------------------------------------------*/
4771VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
4772 tANI_U8 *pVersion,
4773 tANI_U32 versionBufferSize)
4774{
4775 VOS_STATUS status = VOS_STATUS_SUCCESS;
4776 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4777 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4778
4779 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4780 {
4781 if( pVersion != NULL )
4782 {
4783 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
4784 versionBufferSize);
4785 }
4786 else
4787 {
4788 status = VOS_STATUS_E_INVAL;
4789 }
4790 sme_ReleaseGlobalLock( &pMac->sme );
4791 }
4792
4793 return (status);
4794}
4795
4796
4797/* ---------------------------------------------------------------------------
4798 \fn sme_GetWcnssHardwareVersion
4799 \brief This API returns the version string of the WCNSS hardware
4800 \param hHal - The handle returned by macOpen.
4801 \param pVersion - Points to the Version string buffer to be filled
4802 \param versionBufferSize - THe size of the Version string buffer
4803 \return VOS_STATUS
4804 VOS_STATUS_E_INVAL - failure
4805 VOS_STATUS_SUCCESS success
4806 ---------------------------------------------------------------------------*/
4807VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
4808 tANI_U8 *pVersion,
4809 tANI_U32 versionBufferSize)
4810{
4811 VOS_STATUS status = VOS_STATUS_SUCCESS;
4812 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4813 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4814
4815 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4816 {
4817 if( pVersion != NULL )
4818 {
4819 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
4820 versionBufferSize);
4821 }
4822 else
4823 {
4824 status = VOS_STATUS_E_INVAL;
4825 }
4826 sme_ReleaseGlobalLock( &pMac->sme );
4827 }
4828
4829 return (status);
4830}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08004831
Jeff Johnson295189b2012-06-20 16:38:30 -07004832
4833#ifdef FEATURE_WLAN_WAPI
4834/* ---------------------------------------------------------------------------
4835 \fn sme_RoamSetBKIDCache
4836 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
4837 candidate list.
4838 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4839 it is opened (by calling halOpen).
4840 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
4841 \param numItems - a variable that has the number of tBkidCacheInfo allocated
4842 when retruning, this is the number of items put into pBKIDCache
4843 \return eHalStatus - when fail, it usually means the buffer allocated is not
4844 big enough and pNumItems has the number of tBkidCacheInfo.
4845 ---------------------------------------------------------------------------*/
4846eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
4847 tANI_U32 numItems )
4848{
4849 eHalStatus status = eHAL_STATUS_FAILURE;
4850 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4851
4852 status = sme_AcquireGlobalLock( &pMac->sme );
4853 if ( HAL_STATUS_SUCCESS( status ) )
4854 {
4855 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
4856 sme_ReleaseGlobalLock( &pMac->sme );
4857 }
4858
4859 return (status);
4860}
4861
4862/* ---------------------------------------------------------------------------
4863 \fn sme_RoamGetBKIDCache
4864 \brief The SME API exposed to HDD to allow HDD to request SME to return its
4865 BKID cache.
4866 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4867 it is opened (by calling halOpen).
4868 \param pNum - caller allocated memory that has the space of the number of
4869 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
4870 in SME cache.
4871 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
4872 upon return
4873 \return eHalStatus - when fail, it usually means the buffer allocated is not
4874 big enough.
4875 ---------------------------------------------------------------------------*/
4876eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
4877 tBkidCacheInfo *pBkidCache)
4878{
4879 eHalStatus status = eHAL_STATUS_FAILURE;
4880 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4881
4882 status = sme_AcquireGlobalLock( &pMac->sme );
4883 if ( HAL_STATUS_SUCCESS( status ) )
4884 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004885 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004886 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
4887 sme_ReleaseGlobalLock( &pMac->sme );
4888 }
4889
4890 return (status);
4891}
4892
4893/* ---------------------------------------------------------------------------
4894 \fn sme_RoamGetNumBKIDCache
4895 \brief The SME API exposed to HDD to allow HDD to request SME to return the
4896 number of BKID cache entries.
4897 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4898 it is opened (by calling halOpen).
4899 \return tANI_U32 - the number of BKID cache entries.
4900 ---------------------------------------------------------------------------*/
4901tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
4902{
4903 eHalStatus status = eHAL_STATUS_FAILURE;
4904 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4905 tANI_U32 numBkidCache = 0;
4906
4907 status = sme_AcquireGlobalLock( &pMac->sme );
4908 if ( HAL_STATUS_SUCCESS( status ) )
4909 {
4910 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
4911 sme_ReleaseGlobalLock( &pMac->sme );
4912 }
4913
4914 return (numBkidCache);
4915}
4916
4917/* ---------------------------------------------------------------------------
4918 \fn sme_ScanGetBKIDCandidateList
4919 \brief a wrapper function to return the BKID candidate list
4920 \param pBkidList - caller allocated buffer point to an array of
4921 tBkidCandidateInfo
4922 \param pNumItems - pointer to a variable that has the number of
4923 tBkidCandidateInfo allocated when retruning, this is
4924 either the number needed or number of items put into
4925 pPmkidList
4926 \return eHalStatus - when fail, it usually means the buffer allocated is not
4927 big enough and pNumItems
4928 has the number of tBkidCandidateInfo.
4929 \Note: pNumItems is a number of tBkidCandidateInfo,
4930 not sizeof(tBkidCandidateInfo) * something
4931 ---------------------------------------------------------------------------*/
4932eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
4933 tBkidCandidateInfo *pBkidList,
4934 tANI_U32 *pNumItems )
4935{
4936 eHalStatus status = eHAL_STATUS_FAILURE;
4937 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4938
4939 status = sme_AcquireGlobalLock( &pMac->sme );
4940 if ( HAL_STATUS_SUCCESS( status ) )
4941 {
4942 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
4943 sme_ReleaseGlobalLock( &pMac->sme );
4944 }
4945
4946 return (status);
4947}
4948#endif /* FEATURE_WLAN_WAPI */
4949
Jeff Johnsone7245742012-09-05 17:12:55 -07004950#ifdef FEATURE_OEM_DATA_SUPPORT
4951
4952/*****************************************************************************
4953 OEM DATA related modifications and function additions
4954 *****************************************************************************/
4955
4956/* ---------------------------------------------------------------------------
4957 \fn sme_getOemDataRsp
4958 \brief a wrapper function to obtain the OEM DATA RSP
4959 \param pOemDataRsp - A pointer to the response object
4960 \param pContext - a pointer passed in for the callback
4961 \return eHalStatus
4962 ---------------------------------------------------------------------------*/
4963eHalStatus sme_getOemDataRsp(tHalHandle hHal,
4964 tOemDataRsp **pOemDataRsp)
4965{
4966 eHalStatus status = eHAL_STATUS_SUCCESS;
4967 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
4968
4969 do
4970 {
4971 //acquire the lock for the sme object
4972 status = sme_AcquireGlobalLock(&pMac->sme);
4973
4974 if(!HAL_STATUS_SUCCESS(status))
4975 {
4976 break;
4977 }
4978
4979 if(pMac->oemData.pOemDataRsp != NULL)
4980 {
4981 *pOemDataRsp = pMac->oemData.pOemDataRsp;
4982 }
4983 else
4984 {
4985 status = eHAL_STATUS_FAILURE;
4986 }
4987
4988 //release the lock for the sme object
4989 sme_ReleaseGlobalLock( &pMac->sme );
4990
4991 } while(0);
4992
4993 return status;
4994}
4995
4996/* ---------------------------------------------------------------------------
4997 \fn sme_OemDataReq
4998 \brief a wrapper function for OEM DATA REQ
4999 \param sessionId - session id to be used.
5000 \param pOemDataReqId - pointer to an object to get back the request ID
5001 \param callback - a callback function that is called upon finish
5002 \param pContext - a pointer passed in for the callback
5003 \return eHalStatus
5004 ---------------------------------------------------------------------------*/
5005eHalStatus sme_OemDataReq(tHalHandle hHal,
5006 tANI_U8 sessionId,
5007 tOemDataReqConfig *pOemDataReqConfig,
5008 tANI_U32 *pOemDataReqID,
5009 oemData_OemDataReqCompleteCallback callback,
5010 void *pContext)
5011{
5012 eHalStatus status = eHAL_STATUS_SUCCESS;
5013 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5014
5015 do
5016 {
5017 //acquire the lock for the sme object
5018 status = sme_AcquireGlobalLock(&pMac->sme);
5019 if(HAL_STATUS_SUCCESS(status))
5020 {
5021 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
5022
5023 if(pOemDataReqID)
5024 {
5025 *pOemDataReqID = lOemDataReqId;
5026 }
5027 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005028 {
5029 sme_ReleaseGlobalLock( &pMac->sme );
5030 return eHAL_STATUS_FAILURE;
5031 }
Jeff Johnsone7245742012-09-05 17:12:55 -07005032
5033 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
5034
5035 //release the lock for the sme object
5036 sme_ReleaseGlobalLock( &pMac->sme );
5037 }
5038 } while(0);
5039
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005040 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07005041
5042 return(status);
5043}
5044
5045#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07005046
5047/*--------------------------------------------------------------------------
5048
5049 \brief sme_OpenSession() - Open a session for scan/roam operation.
5050
5051 This is a synchronous API.
5052
5053
5054 \param hHal - The handle returned by macOpen.
5055 \param callback - A pointer to the function caller specifies for roam/connect status indication
5056 \param pContext - The context passed with callback
5057 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
5058 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
5059
5060 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
5061
5062 Other status means SME is failed to open the session.
5063 eHAL_STATUS_RESOURCES - no more session available.
5064 \sa
5065
5066 --------------------------------------------------------------------------*/
5067eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback, void *pContext,
5068 tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId)
5069{
5070 eHalStatus status;
5071 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5072
5073 if( NULL == pbSessionId )
5074 {
5075 status = eHAL_STATUS_INVALID_PARAMETER;
5076 }
5077 else
5078 {
5079 status = sme_AcquireGlobalLock( &pMac->sme );
5080 if ( HAL_STATUS_SUCCESS( status ) )
5081 {
5082 status = csrRoamOpenSession( pMac, callback, pContext, pSelfMacAddr, pbSessionId );
5083
5084 sme_ReleaseGlobalLock( &pMac->sme );
5085 }
5086 }
5087
5088 return ( status );
5089}
5090
5091
5092/*--------------------------------------------------------------------------
5093
5094 \brief sme_CloseSession() - Open a session for scan/roam operation.
5095
5096 This is a synchronous API.
5097
5098
5099 \param hHal - The handle returned by macOpen.
5100
5101 \param sessionId - A previous opened session's ID.
5102
5103 \return eHAL_STATUS_SUCCESS - session is closed.
5104
5105 Other status means SME is failed to open the session.
5106 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
5107 \sa
5108
5109 --------------------------------------------------------------------------*/
5110eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
5111 csrRoamSessionCloseCallback callback, void *pContext)
5112{
5113 eHalStatus status;
5114 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5115
5116 status = sme_AcquireGlobalLock( &pMac->sme );
5117 if ( HAL_STATUS_SUCCESS( status ) )
5118 {
5119 status = csrRoamCloseSession( pMac, sessionId, FALSE,
5120 callback, pContext );
5121
5122 sme_ReleaseGlobalLock( &pMac->sme );
5123 }
5124
5125 return ( status );
5126}
5127
Jeff Johnson295189b2012-06-20 16:38:30 -07005128/* ---------------------------------------------------------------------------
5129
5130 \fn sme_RoamUpdateAPWPSIE
5131
5132 \brief To update AP's WPS IE. This function should be called after SME AP session is created
5133 This is an asynchronous API.
5134
5135 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
5136
5137 \return eHalStatus – SUCCESS –
5138
5139 FAILURE or RESOURCES – The API finished and failed.
5140
5141 -------------------------------------------------------------------------------*/
5142eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
5143{
5144
5145 eHalStatus status = eHAL_STATUS_FAILURE;
5146 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5147
5148 status = sme_AcquireGlobalLock( &pMac->sme );
5149 if ( HAL_STATUS_SUCCESS( status ) )
5150 {
5151
5152 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
5153
5154 sme_ReleaseGlobalLock( &pMac->sme );
5155 }
5156
5157 return (status);
5158}
5159/* ---------------------------------------------------------------------------
5160
5161 \fn sme_RoamUpdateAPWPARSNIEs
5162
5163 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
5164 This is an asynchronous API.
5165
5166 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
5167
5168 \return eHalStatus – SUCCESS –
5169
5170 FAILURE or RESOURCES – The API finished and failed.
5171
5172 -------------------------------------------------------------------------------*/
5173eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
5174{
5175
5176 eHalStatus status = eHAL_STATUS_FAILURE;
5177 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5178
5179 status = sme_AcquireGlobalLock( &pMac->sme );
5180 if ( HAL_STATUS_SUCCESS( status ) )
5181 {
5182
5183 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
5184
5185 sme_ReleaseGlobalLock( &pMac->sme );
5186 }
5187
5188 return (status);
5189}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005190/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005191
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005192 \fn sme_ChangeMCCBeaconInterval
5193
5194 \brief To update P2P-GO beaconInterval. This function should be called after
5195 disassociating all the station is done
5196 This is an asynchronous API.
5197
5198 \param
5199
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005200 \return eHalStatus SUCCESS
5201 FAILURE or RESOURCES
5202 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005203
5204 -------------------------------------------------------------------------------*/
5205eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
5206{
5207 eHalStatus status = eHAL_STATUS_FAILURE;
5208 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5209
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005210 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005211 status = sme_AcquireGlobalLock( &pMac->sme );
5212 if ( HAL_STATUS_SUCCESS( status ) )
5213 {
5214 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
5215 sme_ReleaseGlobalLock( &pMac->sme );
5216 }
5217 return (status);
5218}
Jeff Johnson295189b2012-06-20 16:38:30 -07005219
5220/*-------------------------------------------------------------------------------*
5221
5222 \fn sme_sendBTAmpEvent
5223
5224 \brief to receive the coex priorty request from BT-AMP PAL
5225 and send the BT_AMP link state to HAL
5226
5227 \param btAmpEvent - btAmpEvent
5228
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005229 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07005230
5231 FAILURE: API failed
5232
5233-------------------------------------------------------------------------------*/
5234
5235eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
5236{
5237 vos_msg_t msg;
5238 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
5239 eHalStatus status = eHAL_STATUS_FAILURE;
5240
5241 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tpSmeBtAmpEvent));
5242 if (NULL == ptrSmeBtAmpEvent)
5243 {
5244 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005245 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005246 return status;
5247 }
5248
5249 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
5250 msg.type = WDA_SIGNAL_BTAMP_EVENT;
5251 msg.reserved = 0;
5252 msg.bodyptr = ptrSmeBtAmpEvent;
5253
5254 //status = halFW_SendBTAmpEventMesg(pMac, event);
5255
5256 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
5257 {
5258 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005259 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005260 vos_mem_free(ptrSmeBtAmpEvent);
5261 return status;
5262 }
5263
5264 return eHAL_STATUS_SUCCESS;
5265
5266}
5267
5268/* ---------------------------------------------------------------------------
5269 \fn sme_SetHostOffload
5270 \brief API to set the host offload feature.
5271 \param hHal - The handle returned by macOpen.
5272 \param pRequest - Pointer to the offload request.
5273 \return eHalStatus
5274 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005275eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
5276 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005277{
5278 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07005279 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005280
5281 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5282 {
5283#ifdef WLAN_NS_OFFLOAD
5284 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
5285 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005286 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005287 }
5288 else
5289#endif //WLAN_NS_OFFLOAD
5290 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005291 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005292 }
5293 sme_ReleaseGlobalLock( &pMac->sme );
5294 }
5295
5296 return (status);
5297}
5298
5299#ifdef WLAN_FEATURE_GTK_OFFLOAD
5300/* ---------------------------------------------------------------------------
5301 \fn sme_SetGTKOffload
5302 \brief API to set GTK offload information.
5303 \param hHal - The handle returned by macOpen.
5304 \param pRequest - Pointer to the GTK offload request.
5305 \return eHalStatus
5306 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005307eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
5308 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005309{
5310 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5311 eHalStatus status;
5312
5313 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5314 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005315 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005316 sme_ReleaseGlobalLock( &pMac->sme );
5317 }
5318
5319 return (status);
5320}
5321
5322/* ---------------------------------------------------------------------------
5323 \fn sme_GetGTKOffload
5324 \brief API to get GTK offload information.
5325 \param hHal - The handle returned by macOpen.
5326 \param pRequest - Pointer to the GTK offload response.
5327 \return eHalStatus
5328 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005329eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
5330 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07005331{
5332 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5333 eHalStatus status;
5334
5335 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5336 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005337 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005338 sme_ReleaseGlobalLock( &pMac->sme );
5339 }
5340
5341 return (status);
5342}
5343#endif // WLAN_FEATURE_GTK_OFFLOAD
5344
5345/* ---------------------------------------------------------------------------
5346 \fn sme_SetKeepAlive
5347 \brief API to set the Keep Alive feature.
5348 \param hHal - The handle returned by macOpen.
5349 \param pRequest - Pointer to the Keep Alive request.
5350 \return eHalStatus
5351 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005352eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
5353 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005354{
5355 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5356 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07005357 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5358 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005359 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005360 sme_ReleaseGlobalLock( &pMac->sme );
5361 }
5362
5363 return (status);
5364}
5365
5366#ifdef FEATURE_WLAN_SCAN_PNO
5367/* ---------------------------------------------------------------------------
5368 \fn sme_SetPreferredNetworkList
5369 \brief API to set the Preferred Network List Offload feature.
5370 \param hHal - The handle returned by macOpen.
5371 \param pRequest - Pointer to the offload request.
5372 \return eHalStatus
5373 ---------------------------------------------------------------------------*/
5374eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
5375{
5376 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5377 eHalStatus status;
5378
5379 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5380 {
5381 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
5382 sme_ReleaseGlobalLock( &pMac->sme );
5383 }
5384
5385 return (status);
5386}
5387
5388eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
5389{
5390 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5391 eHalStatus status;
5392
5393 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5394 {
5395 pmcSetRssiFilter(hHal, rssiThreshold);
5396 sme_ReleaseGlobalLock( &pMac->sme );
5397 }
5398
5399 return (status);
5400}
5401
5402#endif // FEATURE_WLAN_SCAN_PNO
5403
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005404eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07005405{
5406 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5407 eHalStatus status;
5408
5409 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5410 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005411 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07005412 sme_ReleaseGlobalLock( &pMac->sme );
5413 }
5414
5415 return (status);
5416}
5417
5418/* ---------------------------------------------------------------------------
5419 \fn sme_AbortMacScan
5420 \brief API to cancel MAC scan.
5421 \param hHal - The handle returned by macOpen.
5422 \return VOS_STATUS
5423 VOS_STATUS_E_FAILURE - failure
5424 VOS_STATUS_SUCCESS success
5425 ---------------------------------------------------------------------------*/
5426eHalStatus sme_AbortMacScan(tHalHandle hHal)
5427{
5428 eHalStatus status;
5429 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5430
5431 status = sme_AcquireGlobalLock( &pMac->sme );
5432 if ( HAL_STATUS_SUCCESS( status ) )
5433 {
5434 status = csrScanAbortMacScan(pMac);
5435
5436 sme_ReleaseGlobalLock( &pMac->sme );
5437 }
5438
5439 return ( status );
5440}
5441
5442/* ----------------------------------------------------------------------------
5443 \fn sme_GetOperationChannel
5444 \brief API to get current channel on which STA is parked
5445 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005446 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07005447 \returns eHAL_STATUS_SUCCESS
5448 eHAL_STATUS_FAILURE
5449-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005450eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005451{
Jeff Johnson295189b2012-06-20 16:38:30 -07005452 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5453 tCsrRoamSession *pSession;
5454
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005455 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005456 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005457 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005458
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005459 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
5460 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005461 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005462 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
5463 {
5464 *pChannel =pSession->connectedProfile.operationChannel;
5465 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005466 }
5467 }
5468 return eHAL_STATUS_FAILURE;
5469}// sme_GetOperationChannel ends here
5470
Jeff Johnson295189b2012-06-20 16:38:30 -07005471/* ---------------------------------------------------------------------------
5472
5473 \fn sme_RegisterMgtFrame
5474
5475 \brief To register managment frame of specified type and subtype.
5476 \param frameType - type of the frame that needs to be passed to HDD.
5477 \param matchData - data which needs to be matched before passing frame
5478 to HDD.
5479 \param matchDataLen - Length of matched data.
5480 \return eHalStatus
5481 -------------------------------------------------------------------------------*/
5482eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5483 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5484{
5485 eHalStatus status = eHAL_STATUS_SUCCESS;
5486 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5487
5488 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5489 {
5490 tSirRegisterMgmtFrame *pMsg;
5491 tANI_U16 len;
5492 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005493
5494 if(!pSession)
5495 {
5496 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005497 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005498 return eHAL_STATUS_FAILURE;
5499 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005500
5501 if( !pSession->sessionActive )
5502 {
5503 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005504 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005505 sme_ReleaseGlobalLock( &pMac->sme );
5506 return eHAL_STATUS_FAILURE;
5507 }
5508
5509 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5510
5511 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5512 if(HAL_STATUS_SUCCESS(status))
5513 {
5514 palZeroMemory(pMac->hHdd, pMsg, len);
5515 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5516 pMsg->length = len;
5517 pMsg->sessionId = sessionId;
5518 pMsg->registerFrame = VOS_TRUE;
5519 pMsg->frameType = frameType;
5520 pMsg->matchLen = matchLen;
5521 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5522 status = palSendMBMessage(pMac->hHdd, pMsg);
5523 }
5524 sme_ReleaseGlobalLock( &pMac->sme );
5525 }
5526 return status;
5527}
5528
5529/* ---------------------------------------------------------------------------
5530
5531 \fn sme_DeregisterMgtFrame
5532
5533 \brief To De-register managment frame of specified type and subtype.
5534 \param frameType - type of the frame that needs to be passed to HDD.
5535 \param matchData - data which needs to be matched before passing frame
5536 to HDD.
5537 \param matchDataLen - Length of matched data.
5538 \return eHalStatus
5539 -------------------------------------------------------------------------------*/
5540eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5541 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5542{
5543 eHalStatus status = eHAL_STATUS_SUCCESS;
5544 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5545
5546 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5547 {
5548 tSirRegisterMgmtFrame *pMsg;
5549 tANI_U16 len;
5550 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005551
5552 if(!pSession)
5553 {
5554 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005555 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005556 return eHAL_STATUS_FAILURE;
5557 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005558
5559 if( !pSession->sessionActive )
5560 {
5561 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005562 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005563 sme_ReleaseGlobalLock( &pMac->sme );
5564 return eHAL_STATUS_FAILURE;
5565 }
5566
5567 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5568
5569 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5570 if(HAL_STATUS_SUCCESS(status))
5571 {
5572 palZeroMemory(pMac->hHdd, pMsg, len);
5573 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5574 pMsg->length = len;
5575 pMsg->registerFrame = VOS_FALSE;
5576 pMsg->frameType = frameType;
5577 pMsg->matchLen = matchLen;
5578 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5579 status = palSendMBMessage(pMac->hHdd, pMsg);
5580 }
5581 sme_ReleaseGlobalLock( &pMac->sme );
5582 }
5583 return status;
5584}
5585
5586/* ---------------------------------------------------------------------------
5587 \fn sme_RemainOnChannel
5588 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
5589 \param hHal - The handle returned by macOpen.
5590 \param pRequest - channel
5591 \param duration - duration in ms
5592 \param callback - HDD registered callback to process reaminOnChannelRsp
5593 \param context - HDD Callback param
5594 \return eHalStatus
5595 ---------------------------------------------------------------------------*/
5596
5597eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
5598 tANI_U8 channel, tANI_U32 duration,
5599 remainOnChanCallback callback,
5600 void *pContext)
5601{
5602 eHalStatus status = eHAL_STATUS_SUCCESS;
5603 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5604
5605 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5606 {
5607 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext
5608#ifdef WLAN_FEATURE_P2P_INTERNAL
5609 , eP2PRemainOnChnReasonUnknown
5610#endif
5611 );
5612 sme_ReleaseGlobalLock( &pMac->sme );
5613 }
5614 return(status);
5615}
5616
5617/* ---------------------------------------------------------------------------
5618 \fn sme_ReportProbeReq
5619 \brief API to enable/disable forwarding of probeReq to apps in p2p.
5620 \param hHal - The handle returned by macOpen.
5621 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
5622 \return eHalStatus
5623 ---------------------------------------------------------------------------*/
5624
5625#ifndef WLAN_FEATURE_CONCURRENT_P2P
5626eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
5627{
5628 eHalStatus status = eHAL_STATUS_SUCCESS;
5629 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5630
5631 do
5632 {
5633 //acquire the lock for the sme object
5634 status = sme_AcquireGlobalLock(&pMac->sme);
5635 if(HAL_STATUS_SUCCESS(status))
5636 {
5637 /* call set in context */
5638 pMac->p2pContext.probeReqForwarding = flag;
5639 //release the lock for the sme object
5640 sme_ReleaseGlobalLock( &pMac->sme );
5641 }
5642 } while(0);
5643
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005644 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005645
5646 return(status);
5647}
5648
5649/* ---------------------------------------------------------------------------
5650 \fn sme_updateP2pIe
5651 \brief API to set the P2p Ie in p2p context
5652 \param hHal - The handle returned by macOpen.
5653 \param p2pIe - Ptr to p2pIe from HDD.
5654 \param p2pIeLength: length of p2pIe
5655 \return eHalStatus
5656 ---------------------------------------------------------------------------*/
5657
5658eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
5659{
5660 eHalStatus status = eHAL_STATUS_SUCCESS;
5661 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5662
5663 //acquire the lock for the sme object
5664 status = sme_AcquireGlobalLock(&pMac->sme);
5665 if(HAL_STATUS_SUCCESS(status))
5666 {
5667 if(NULL != pMac->p2pContext.probeRspIe){
5668 vos_mem_free(pMac->p2pContext.probeRspIe);
5669 pMac->p2pContext.probeRspIeLength = 0;
5670 }
5671
5672 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
5673 if (NULL == pMac->p2pContext.probeRspIe)
5674 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005675 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005676 pMac->p2pContext.probeRspIeLength = 0;
5677 status = eHAL_STATUS_FAILURE;
5678 }
5679 else
5680 {
5681 pMac->p2pContext.probeRspIeLength = p2pIeLength;
5682
5683 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
5684 pMac->p2pContext.probeRspIe,
5685 pMac->p2pContext.probeRspIeLength );
5686 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
5687 p2pIeLength);
5688 }
5689
5690 //release the lock for the sme object
5691 sme_ReleaseGlobalLock( &pMac->sme );
5692 }
5693
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005694 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005695
5696 return(status);
5697}
5698#endif
5699
5700/* ---------------------------------------------------------------------------
5701 \fn sme_sendAction
5702 \brief API to send action frame from supplicant.
5703 \param hHal - The handle returned by macOpen.
5704 \return eHalStatus
5705 ---------------------------------------------------------------------------*/
5706
5707eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07005708 const tANI_U8 *pBuf, tANI_U32 len,
5709 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07005710{
5711 eHalStatus status = eHAL_STATUS_SUCCESS;
5712 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5713
5714 //acquire the lock for the sme object
5715 status = sme_AcquireGlobalLock(&pMac->sme);
5716 if(HAL_STATUS_SUCCESS(status))
5717 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005718 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07005719 //release the lock for the sme object
5720 sme_ReleaseGlobalLock( &pMac->sme );
5721 }
5722
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005723 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005724
5725 return(status);
5726}
5727
5728eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
5729{
5730 eHalStatus status = eHAL_STATUS_SUCCESS;
5731 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5732
5733 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5734 {
5735 status = p2pCancelRemainOnChannel (hHal, sessionId);
5736 sme_ReleaseGlobalLock( &pMac->sme );
5737 }
5738 return(status);
5739}
5740
5741//Power Save Related
5742eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
5743{
5744 eHalStatus status = eHAL_STATUS_SUCCESS;
5745 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5746
5747 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5748 {
5749 status = p2pSetPs (hHal, data);
5750 sme_ReleaseGlobalLock( &pMac->sme );
5751 }
5752 return(status);
5753}
5754
Jeff Johnson295189b2012-06-20 16:38:30 -07005755
5756/* ---------------------------------------------------------------------------
5757
5758 \fn sme_ConfigureRxpFilter
5759
5760 \brief
5761 SME will pass this request to lower mac to set/reset the filter on RXP for
5762 multicast & broadcast traffic.
5763
5764 \param
5765
5766 hHal - The handle returned by macOpen.
5767
5768 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
5769 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
5770 on this param. In future we can use this as a mask to set various types of
5771 filters as suggested below:
5772 FILTER_ALL_MULTICAST:
5773 FILTER_ALL_BROADCAST:
5774 FILTER_ALL_MULTICAST_BROADCAST:
5775
5776
5777 \return eHalStatus
5778
5779
5780--------------------------------------------------------------------------- */
5781eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
5782 tpSirWlanSetRxpFilters wlanRxpFilterParam)
5783{
5784 eHalStatus status = eHAL_STATUS_SUCCESS;
5785 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5786 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5787 vos_msg_t vosMessage;
5788
5789 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5790 {
5791 /* serialize the req through MC thread */
5792 vosMessage.bodyptr = wlanRxpFilterParam;
5793 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
5794 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5795 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5796 {
5797 status = eHAL_STATUS_FAILURE;
5798 }
5799 sme_ReleaseGlobalLock( &pMac->sme );
5800 }
5801 return(status);
5802}
5803
Jeff Johnson295189b2012-06-20 16:38:30 -07005804/* ---------------------------------------------------------------------------
5805
5806 \fn sme_ConfigureSuspendInd
5807
5808 \brief
5809 SME will pass this request to lower mac to Indicate that the wlan needs to
5810 be suspended
5811
5812 \param
5813
5814 hHal - The handle returned by macOpen.
5815
5816 wlanSuspendParam- Depicts the wlan suspend params
5817
5818
5819 \return eHalStatus
5820
5821
5822--------------------------------------------------------------------------- */
5823eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
5824 tpSirWlanSuspendParam wlanSuspendParam)
5825{
5826 eHalStatus status = eHAL_STATUS_SUCCESS;
5827 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5828 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5829 vos_msg_t vosMessage;
5830
5831 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5832 {
5833 /* serialize the req through MC thread */
5834 vosMessage.bodyptr = wlanSuspendParam;
5835 vosMessage.type = WDA_WLAN_SUSPEND_IND;
5836 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5837 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5838 {
5839 status = eHAL_STATUS_FAILURE;
5840 }
5841 sme_ReleaseGlobalLock( &pMac->sme );
5842 }
5843 return(status);
5844}
5845
5846/* ---------------------------------------------------------------------------
5847
5848 \fn sme_ConfigureResumeReq
5849
5850 \brief
5851 SME will pass this request to lower mac to Indicate that the wlan needs to
5852 be Resumed
5853
5854 \param
5855
5856 hHal - The handle returned by macOpen.
5857
5858 wlanResumeParam- Depicts the wlan resume params
5859
5860
5861 \return eHalStatus
5862
5863
5864--------------------------------------------------------------------------- */
5865eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
5866 tpSirWlanResumeParam wlanResumeParam)
5867{
5868 eHalStatus status = eHAL_STATUS_SUCCESS;
5869 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5870 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5871 vos_msg_t vosMessage;
5872
5873 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5874 {
5875 /* serialize the req through MC thread */
5876 vosMessage.bodyptr = wlanResumeParam;
5877 vosMessage.type = WDA_WLAN_RESUME_REQ;
5878 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5879 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5880 {
5881 status = eHAL_STATUS_FAILURE;
5882 }
5883 sme_ReleaseGlobalLock( &pMac->sme );
5884 }
5885 return(status);
5886}
5887
Jeff Johnson295189b2012-06-20 16:38:30 -07005888/* ---------------------------------------------------------------------------
5889
5890 \fn sme_GetInfraSessionId
5891
5892 \brief To get the session ID for infra session, if connected
5893 This is a synchronous API.
5894
5895 \param hHal - The handle returned by macOpen.
5896
5897 \return sessionid, -1 if infra session is not connected
5898
5899 -------------------------------------------------------------------------------*/
5900tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
5901{
5902 eHalStatus status = eHAL_STATUS_FAILURE;
5903 tANI_S8 sessionid = -1;
5904 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5905
5906 status = sme_AcquireGlobalLock( &pMac->sme );
5907 if ( HAL_STATUS_SUCCESS( status ) )
5908 {
5909
5910 sessionid = csrGetInfraSessionId( pMac);
5911
5912 sme_ReleaseGlobalLock( &pMac->sme );
5913 }
5914
5915 return (sessionid);
5916}
5917
5918/* ---------------------------------------------------------------------------
5919
5920 \fn sme_GetInfraOperationChannel
5921
5922 \brief To get the operating channel for infra session, if connected
5923 This is a synchronous API.
5924
5925 \param hHal - The handle returned by macOpen.
5926 \param sessionId - the sessionId returned by sme_OpenSession.
5927
5928 \return operating channel, 0 if infra session is not connected
5929
5930 -------------------------------------------------------------------------------*/
5931tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
5932{
5933 eHalStatus status = eHAL_STATUS_FAILURE;
5934 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5935 tANI_U8 channel = 0;
5936 status = sme_AcquireGlobalLock( &pMac->sme );
5937 if ( HAL_STATUS_SUCCESS( status ) )
5938 {
5939
5940 channel = csrGetInfraOperationChannel( pMac, sessionId);
5941
5942 sme_ReleaseGlobalLock( &pMac->sme );
5943 }
5944
5945 return (channel);
5946}
5947
5948//This routine will return poerating channel on which other BSS is operating to be used for concurrency mode.
5949//If other BSS is not up or not connected it will return 0
5950tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
5951{
5952 eHalStatus status = eHAL_STATUS_FAILURE;
5953 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5954 tANI_U8 channel = 0;
5955 status = sme_AcquireGlobalLock( &pMac->sme );
5956 if ( HAL_STATUS_SUCCESS( status ) )
5957 {
5958
5959 channel = csrGetConcurrentOperationChannel( pMac );
5960 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005961 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07005962 sme_ReleaseGlobalLock( &pMac->sme );
5963 }
5964
5965 return (channel);
5966}
5967
5968#ifdef FEATURE_WLAN_SCAN_PNO
5969/******************************************************************************
5970*
5971* Name: sme_PreferredNetworkFoundInd
5972*
5973* Description:
5974* Invoke Preferred Network Found Indication
5975*
5976* Parameters:
5977* hHal - HAL handle for device
5978* pMsg - found network description
5979*
5980* Returns: eHalStatus
5981*
5982******************************************************************************/
5983eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
5984{
5985 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5986 eHalStatus status = eHAL_STATUS_SUCCESS;
5987 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
5988
5989 if (NULL == pMsg)
5990 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005991 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005992 status = eHAL_STATUS_FAILURE;
5993 }
5994 else
5995 {
5996 if (pPrefNetworkFoundInd->ssId.length > 0)
5997 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005998 smsLog(pMac, LOG1, "Preferred Network Found Indication in %s(), SSID=%s",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005999 __func__, pPrefNetworkFoundInd->ssId.ssId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006000
6001
6002 /* Call Preferred Netowrk Found Indication callback routine. */
6003 if (pMac->pmc.prefNetwFoundCB != NULL)
6004 {
6005 pMac->pmc.prefNetwFoundCB(pMac->pmc.preferredNetworkFoundIndCallbackContext, pPrefNetworkFoundInd);
6006 }
6007
6008 }
6009 else
6010 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006011 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006012 status = eHAL_STATUS_FAILURE;
6013 }
6014 }
6015
6016
6017 return(status);
6018}
6019
6020#endif // FEATURE_WLAN_SCAN_PNO
6021
6022
6023eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
6024{
6025 eHalStatus status = eHAL_STATUS_FAILURE;
6026 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6027
6028 status = sme_AcquireGlobalLock( &pMac->sme );
6029 if ( HAL_STATUS_SUCCESS( status ) )
6030 {
6031 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
6032 sme_ReleaseGlobalLock( &pMac->sme );
6033 }
6034
6035 return (status);
6036}
6037
6038
6039/* ---------------------------------------------------------------------------
6040
6041 \fn sme_SetTxPerTracking
6042
6043 \brief Set Tx PER tracking configuration parameters
6044
6045 \param hHal - The handle returned by macOpen.
6046 \param pTxPerTrackingConf - Tx PER configuration parameters
6047
6048 \return eHalStatus
6049
6050 -------------------------------------------------------------------------------*/
6051eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
6052 void (*pCallbackfn) (void *pCallbackContext),
6053 void *pCallbackContext,
6054 tpSirTxPerTrackingParam pTxPerTrackingParam)
6055{
6056 vos_msg_t msg;
6057 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
6058 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6059
6060 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6061 {
6062 pMac->sme.pTxPerHitCallback = pCallbackfn;
6063 pMac->sme.pTxPerHitCbContext = pCallbackContext;
6064 sme_ReleaseGlobalLock( &pMac->sme );
6065 }
6066
6067 // free this memory in failure case or WDA request callback function
6068 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
6069 if (NULL == pTxPerTrackingParamReq)
6070 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006071 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 -07006072 return eHAL_STATUS_FAILURE;
6073 }
6074
6075 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam, sizeof(tSirTxPerTrackingParam));
6076 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
6077 msg.reserved = 0;
6078 msg.bodyptr = pTxPerTrackingParamReq;
6079
6080 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6081 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006082 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 -07006083 vos_mem_free(pTxPerTrackingParamReq);
6084 return eHAL_STATUS_FAILURE;
6085 }
6086
6087 return eHAL_STATUS_SUCCESS;
6088}
6089
6090/* ---------------------------------------------------------------------------
6091
6092 \fn sme_HandleChangeCountryCode
6093
6094 \brief Change Country code, Reg Domain and channel list
6095
6096 \details Country Code Priority
6097 0 = 11D > Configured Country > NV
6098 1 = Configured Country > 11D > NV
6099 If Supplicant country code is priority than 11d is disabled.
6100 If 11D is enabled, we update the country code after every scan.
6101 Hence when Supplicant country code is priority, we don't need 11D info.
6102 Country code from Supplicant is set as current courtry code.
6103 User can send reset command XX (instead of country code) to reset the
6104 country code to default values which is read from NV.
6105 In case of reset, 11D is enabled and default NV code is Set as current country code
6106 If 11D is priority,
6107 Than Supplicant country code code is set to default code. But 11D code is set as current country code
6108
6109 \param pMac - The handle returned by macOpen.
6110 \param pMsgBuf - MSG Buffer
6111
6112 \return eHalStatus
6113
6114 -------------------------------------------------------------------------------*/
6115eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
6116{
6117 eHalStatus status = eHAL_STATUS_SUCCESS;
6118 tAniChangeCountryCodeReq *pMsg;
6119 v_REGDOMAIN_t domainIdIoctl;
6120 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6121 static uNvTables nvTables;
6122 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
6123
6124
6125 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
6126 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
6127 {
6128 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6129
6130 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
6131
6132 /* read the country code from NV and use it */
6133 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
6134 {
6135 palCopyMemory( pMac->hHdd, pMsg->countryCode , nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN );
6136 }
6137 else
6138 {
6139 status = eHAL_STATUS_FAILURE;
6140 return status;
6141 }
6142 }
6143 else
6144 {
6145 /* if Supplicant country code has priority, disable 11d */
6146 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
6147 {
6148 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
6149 }
6150 }
6151
6152 /* WEXT set country code means
6153 * 11D should be supported?
6154 * 11D Channel should be enforced?
6155 * 11D Country code should be matched?
6156 * 11D Reg Domian should be matched?
6157 * Country string changed */
6158 if(pMac->roam.configParam.Is11dSupportEnabled &&
6159 pMac->roam.configParam.fEnforce11dChannels &&
6160 pMac->roam.configParam.fEnforceCountryCodeMatch &&
6161 pMac->roam.configParam.fEnforceDefaultDomain &&
6162 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
6163 {
6164 /* All 11D related options are already enabled
6165 * Country string is not changed
6166 * Do not need do anything for country code change request */
6167 return eHAL_STATUS_SUCCESS;
6168 }
6169
6170 /* Set Current Country code and Current Regulatory domain */
6171 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
6172 if(eHAL_STATUS_SUCCESS != status)
6173 {
6174 /* Supplicant country code failed. So give 11D priority */
6175 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6176 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
6177 return status;
6178 }
6179
6180 /* purge current scan results
6181 if i don't do this than I still get old ap's (of different country code) as available (even if they are powered off).
6182 Looks like a bug in current scan sequence.
6183 */
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07006184 csrScanFlushResult(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07006185
6186 /* overwrite the defualt country code */
6187 palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
6188
6189 /* Get Domain ID from country code */
6190 status = csrGetRegulatoryDomainForCountry( pMac, pMac->scan.countryCodeCurrent,(v_REGDOMAIN_t *) &domainIdIoctl );
6191 if ( status != eHAL_STATUS_SUCCESS )
6192 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006193 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006194 return status;
6195 }
6196
6197 status = WDA_SetRegDomain(pMac, domainIdIoctl);
6198
6199 if ( status != eHAL_STATUS_SUCCESS )
6200 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006201 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006202 return status;
6203 }
6204
6205 /* set to default domain ID */
6206 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
6207
6208 /* get the channels based on new cc */
6209 status = csrInitGetChannels( pMac );
6210
6211 if ( status != eHAL_STATUS_SUCCESS )
6212 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006213 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07006214 return status;
6215 }
6216
6217 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08006218 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Jeff Johnson295189b2012-06-20 16:38:30 -07006219 if( pMsg->changeCCCallback )
6220 {
6221 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
6222 }
6223
6224 return eHAL_STATUS_SUCCESS;
6225}
6226
6227#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08006228eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07006229{
6230 tpSirRcvFltMcAddrList pRequestBuf;
6231 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006232 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07006233 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006234
6235 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05306236 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006237 pMulticastAddrs->ulMulticastAddrCnt,
6238 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07006239
6240 /*
6241 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08006242 */
6243 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
6244 csrIsConnStateInfra(pMac, sessionId))
6245 {
6246 pSession = CSR_GET_SESSION( pMac, sessionId );
6247 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006248
6249 if(pSession == NULL )
6250 {
6251 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006252 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006253 return eHAL_STATUS_FAILURE;
6254 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006255
Jeff Johnson295189b2012-06-20 16:38:30 -07006256 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
6257 if (NULL == pRequestBuf)
6258 {
6259 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006260 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006261 return eHAL_STATUS_FAILED_ALLOC;
6262 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006263
6264 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
6265 {
6266 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
6267 "indication as we are not connected", __func__);
6268 vos_mem_free(pRequestBuf);
6269 return eHAL_STATUS_FAILURE;
6270 }
6271
Jeff Johnson295189b2012-06-20 16:38:30 -07006272 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
6273
Jeff Johnsone7245742012-09-05 17:12:55 -07006274 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6275 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
6276 sizeof(tSirMacAddr));
6277
Jeff Johnson295189b2012-06-20 16:38:30 -07006278 msg.type = WDA_8023_MULTICAST_LIST_REQ;
6279 msg.reserved = 0;
6280 msg.bodyptr = pRequestBuf;
6281 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6282 {
6283 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006284 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006285 vos_mem_free(pRequestBuf);
6286 return eHAL_STATUS_FAILURE;
6287 }
6288
6289 return eHAL_STATUS_SUCCESS;
6290}
6291
Jeff Johnsone7245742012-09-05 17:12:55 -07006292eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
6293 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006294{
6295 tpSirRcvPktFilterCfgType pRequestBuf;
6296 v_SINT_t allocSize;
6297 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006298 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6299 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006300 v_U8_t idx=0;
6301
6302 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006303 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006304 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
6305
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07006306 allocSize = sizeof(tSirRcvPktFilterCfgType);
6307
Jeff Johnson295189b2012-06-20 16:38:30 -07006308 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006309
6310 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006311 {
6312 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006313 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006314 return eHAL_STATUS_FAILED_ALLOC;
6315 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006316
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006317 if( NULL == pSession )
6318 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006319 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006320 vos_mem_free(pRequestBuf);
6321 return eHAL_STATUS_FAILURE;
6322 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006323
6324 vos_mem_copy( pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6325 vos_mem_copy( pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006326 sizeof(tSirMacAddr));
6327
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006328 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
6329
Jeff Johnson295189b2012-06-20 16:38:30 -07006330 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
6331 msg.reserved = 0;
6332 msg.bodyptr = pRequestBuf;
6333
6334 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6335 "FT %d FID %d ",
6336 pRequestBuf->filterType, pRequestBuf->filterId);
6337
6338 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6339 "params %d CT %d",
6340 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
6341
6342 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
6343 {
6344
6345 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006346 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07006347 pRequestBuf->paramsData[idx].protocolLayer,
6348 pRequestBuf->paramsData[idx].cmpFlag);
6349
6350 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006351 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006352 pRequestBuf->paramsData[idx].dataOffset,
6353 pRequestBuf->paramsData[idx].dataLength);
6354
6355 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006356 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006357 pRequestBuf->paramsData[idx].compareData[0],
6358 pRequestBuf->paramsData[idx].compareData[1],
6359 pRequestBuf->paramsData[idx].compareData[2],
6360 pRequestBuf->paramsData[idx].compareData[3],
6361 pRequestBuf->paramsData[idx].compareData[4],
6362 pRequestBuf->paramsData[idx].compareData[5]);
6363
6364 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006365 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006366 pRequestBuf->paramsData[idx].dataMask[0],
6367 pRequestBuf->paramsData[idx].dataMask[1],
6368 pRequestBuf->paramsData[idx].dataMask[2],
6369 pRequestBuf->paramsData[idx].dataMask[3],
6370 pRequestBuf->paramsData[idx].dataMask[4],
6371 pRequestBuf->paramsData[idx].dataMask[5]);
6372
6373 }
6374
6375 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6376 {
6377 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006378 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006379 vos_mem_free(pRequestBuf);
6380 return eHAL_STATUS_FAILURE;
6381 }
6382
6383 return eHAL_STATUS_SUCCESS;
6384}
6385
6386eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
6387 FilterMatchCountCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006388 void *callbackContext,
6389 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006390{
6391 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6392 eHalStatus status;
6393
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006394 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006395
6396 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
6397 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006398 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006399 sme_ReleaseGlobalLock( &pMac->sme );
6400 }
6401
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006402 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006403
6404 return (status);
6405}
6406
Jeff Johnsone7245742012-09-05 17:12:55 -07006407eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
6408 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006409{
6410 tpSirRcvFltPktClearParam pRequestBuf;
6411 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006412 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6413 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006414
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006415 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006416 pRcvFltPktClearParam->filterId);
6417
6418 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006419 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006420 {
6421 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6422 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006423 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006424 return eHAL_STATUS_FAILED_ALLOC;
6425 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006426 if( NULL == pSession )
6427 {
6428 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006429 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006430 vos_mem_free(pRequestBuf);
6431 return eHAL_STATUS_FAILURE;
6432 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006433
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006434 vos_mem_copy( pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6435 vos_mem_copy( pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006436 sizeof(tSirMacAddr));
6437
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006438 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
6439
Jeff Johnson295189b2012-06-20 16:38:30 -07006440 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
6441 msg.reserved = 0;
6442 msg.bodyptr = pRequestBuf;
6443 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6444 {
6445 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006446 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006447 vos_mem_free(pRequestBuf);
6448 return eHAL_STATUS_FAILURE;
6449 }
6450
6451 return eHAL_STATUS_SUCCESS;
6452}
6453#endif // WLAN_FEATURE_PACKET_FILTERING
6454
6455/* ---------------------------------------------------------------------------
6456 \fn sme_PreChannelSwitchIndFullPowerCB
6457 \brief call back function for the PMC full power request because of pre
6458 channel switch.
6459 \param callbackContext
6460 \param status
6461 ---------------------------------------------------------------------------*/
6462void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
6463 eHalStatus status)
6464{
6465 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
6466 tSirMbMsg *pMsg;
6467 tANI_U16 msgLen;
6468
6469 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
6470 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
6471 if(HAL_STATUS_SUCCESS(status))
6472 {
6473 palZeroMemory(pMac->hHdd, (void *)pMsg, msgLen);
6474 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
6475 pMsg->msgLen = pal_cpu_to_be16(msgLen);
6476 status = palSendMBMessage(pMac->hHdd, pMsg);
6477 }
6478
6479 return;
6480}
6481
6482/* ---------------------------------------------------------------------------
6483 \fn sme_HandlePreChannelSwitchInd
6484 \brief Processes the indcation from PE for pre-channel switch.
6485 \param hHal
6486 \- The handle returned by macOpen. return eHalStatus
6487 ---------------------------------------------------------------------------*/
6488eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
6489{
6490 eHalStatus status = eHAL_STATUS_FAILURE;
6491 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6492 status = sme_AcquireGlobalLock( &pMac->sme );
6493 if ( HAL_STATUS_SUCCESS( status ) )
6494 {
6495 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
6496 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
6497 sme_ReleaseGlobalLock( &pMac->sme );
6498 }
6499
6500 return (status);
6501}
6502
6503/* ---------------------------------------------------------------------------
6504 \fn sme_HandlePostChannelSwitchInd
6505 \brief Processes the indcation from PE for post-channel switch.
6506 \param hHal
6507 \- The handle returned by macOpen. return eHalStatus
6508 ---------------------------------------------------------------------------*/
6509eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
6510{
6511 eHalStatus status = eHAL_STATUS_FAILURE;
6512 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6513
6514 status = sme_AcquireGlobalLock( &pMac->sme );
6515 if ( HAL_STATUS_SUCCESS( status ) )
6516 {
6517 status = pmcRequestBmps(hHal, NULL, NULL);
6518 sme_ReleaseGlobalLock( &pMac->sme );
6519 }
6520
6521 return (status);
6522}
6523
6524/* ---------------------------------------------------------------------------
6525
6526 \fn sme_IsChannelValid
6527
6528 \brief To check if the channel is valid for currently established domain
6529 This is a synchronous API.
6530
6531 \param hHal - The handle returned by macOpen.
6532 \param channel - channel to verify
6533
6534 \return TRUE/FALSE, TRUE if channel is valid
6535
6536 -------------------------------------------------------------------------------*/
6537tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
6538{
6539 eHalStatus status = eHAL_STATUS_FAILURE;
6540 tANI_BOOLEAN valid = FALSE;
6541 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6542
6543 status = sme_AcquireGlobalLock( &pMac->sme );
6544 if ( HAL_STATUS_SUCCESS( status ) )
6545 {
6546
6547 valid = csrRoamIsChannelValid( pMac, channel);
6548
6549 sme_ReleaseGlobalLock( &pMac->sme );
6550 }
6551
6552 return (valid);
6553}
6554
6555/* ---------------------------------------------------------------------------
6556 \fn sme_SetFreqBand
6557 \brief Used to set frequency band.
6558 \param hHal
6559 \eBand band value to be configured
6560 \- return eHalStatus
6561 -------------------------------------------------------------------------*/
6562eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
6563{
6564 eHalStatus status = eHAL_STATUS_FAILURE;
6565 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6566
6567 status = sme_AcquireGlobalLock( &pMac->sme );
6568 if ( HAL_STATUS_SUCCESS( status ) )
6569 {
6570 status = csrSetBand(hHal, eBand);
6571 sme_ReleaseGlobalLock( &pMac->sme );
6572 }
6573 return status;
6574}
6575
6576/* ---------------------------------------------------------------------------
6577 \fn sme_GetFreqBand
6578 \brief Used to get the current band settings.
6579 \param hHal
6580 \pBand pointer to hold band value
6581 \- return eHalStatus
6582 -------------------------------------------------------------------------*/
6583eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
6584{
6585 eHalStatus status = eHAL_STATUS_FAILURE;
6586 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6587
6588 status = sme_AcquireGlobalLock( &pMac->sme );
6589 if ( HAL_STATUS_SUCCESS( status ) )
6590 {
6591 *pBand = csrGetCurrentBand( hHal );
6592 sme_ReleaseGlobalLock( &pMac->sme );
6593 }
6594 return status;
6595}
6596
6597#ifdef WLAN_WAKEUP_EVENTS
6598/******************************************************************************
6599 \fn sme_WakeReasonIndCallback
6600
6601 \brief
6602 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
6603
6604 \param hHal - HAL handle for device
6605 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
6606
6607 \return eHalStatus
6608******************************************************************************/
6609eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
6610{
6611 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6612 eHalStatus status = eHAL_STATUS_SUCCESS;
6613 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
6614
6615 if (NULL == pMsg)
6616 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006617 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006618 status = eHAL_STATUS_FAILURE;
6619 }
6620 else
6621 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006622 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07006623
6624 /* Call Wake Reason Indication callback routine. */
6625 if (pMac->pmc.wakeReasonIndCB != NULL)
6626 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
6627
6628 pMac->pmc.wakeReasonIndCB = NULL;
6629 pMac->pmc.wakeReasonIndCBContext = NULL;
6630
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006631 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07006632 }
6633
6634 return(status);
6635}
6636#endif // WLAN_WAKEUP_EVENTS
6637
6638
6639/* ---------------------------------------------------------------------------
6640
6641 \fn sme_SetMaxTxPower
6642
6643 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
6644 not persist over reboots.
6645
6646 \param hHal
6647 \param pBssid BSSID to set the power cap for
6648 \param pBssid pSelfMacAddress self MAC Address
6649 \param pBssid power to set in dB
6650 \- return eHalStatus
6651
6652 -------------------------------------------------------------------------------*/
6653eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
6654 tSirMacAddr pSelfMacAddress, v_S7_t dB)
6655{
6656 vos_msg_t msg;
6657 tpMaxTxPowerParams pMaxTxParams = NULL;
6658
6659 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
6660 if (NULL == pMaxTxParams)
6661 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006662 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 -07006663 return eHAL_STATUS_FAILURE;
6664 }
6665
6666 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
6667 vos_mem_copy(pMaxTxParams->selfStaMacAddr , pSelfMacAddress,
6668 SIR_MAC_ADDR_LENGTH);
6669 pMaxTxParams->power = dB;
6670
6671 msg.type = WDA_SET_MAX_TX_POWER_REQ;
6672 msg.reserved = 0;
6673 msg.bodyptr = pMaxTxParams;
6674
6675 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6676 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006677 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 -07006678 vos_mem_free(pMaxTxParams);
6679 return eHAL_STATUS_FAILURE;
6680 }
6681
6682 return eHAL_STATUS_SUCCESS;
6683}
6684
Jeff Johnson295189b2012-06-20 16:38:30 -07006685/* ---------------------------------------------------------------------------
6686
schang86c22c42013-03-13 18:41:24 -07006687 \fn sme_SetTxPower
6688
6689 \brief Set Transmit Power dynamically. Note: this setting will
6690 not persist over reboots.
6691
6692 \param hHal
6693 \param sessionId Target Session ID
6694 \param mW power to set in mW
6695 \- return eHalStatus
6696
6697 -------------------------------------------------------------------------------*/
6698eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
6699{
6700
6701 eHalStatus status = eHAL_STATUS_FAILURE;
6702 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6703
6704 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
6705 status = sme_AcquireGlobalLock(&pMac->sme);
6706 if (HAL_STATUS_SUCCESS(status))
6707 {
6708 status = csrSetTxPower(pMac, sessionId, mW);
6709 sme_ReleaseGlobalLock(&pMac->sme);
6710 }
6711 return status;
6712}
6713
6714/* ---------------------------------------------------------------------------
6715
Jeff Johnson295189b2012-06-20 16:38:30 -07006716 \fn sme_HideSSID
6717
6718 \brief hide/show SSID dynamically. Note: this setting will
6719 not persist over reboots.
6720
6721 \param hHal
6722 \param sessionId
6723 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
6724 \- return eHalStatus
6725
6726 -------------------------------------------------------------------------------*/
6727eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
6728{
6729 eHalStatus status = eHAL_STATUS_SUCCESS;
6730 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6731 tANI_U16 len;
6732
6733 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6734 {
6735 tpSirUpdateParams pMsg;
6736 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006737
6738 if(!pSession)
6739 {
6740 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006741 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006742 return eHAL_STATUS_FAILURE;
6743 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006744
6745 if( !pSession->sessionActive )
6746 VOS_ASSERT(0);
6747
6748 /* Create the message and send to lim */
6749 len = sizeof(tSirUpdateParams);
6750 status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len );
6751 if(HAL_STATUS_SUCCESS(status))
6752 {
6753 palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirUpdateParams) );
6754 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
6755 pMsg->length = len;
6756 /* Data starts from here */
6757 pMsg->sessionId = sessionId;
6758 pMsg->ssidHidden = ssidHidden;
6759 status = palSendMBMessage(pMac->hHdd, pMsg);
6760 }
6761 sme_ReleaseGlobalLock( &pMac->sme );
6762 }
6763 return status;
6764}
Jeff Johnson295189b2012-06-20 16:38:30 -07006765
6766/* ---------------------------------------------------------------------------
6767
6768 \fn sme_SetTmLevel
6769 \brief Set Thermal Mitigation Level to RIVA
6770 \param hHal - The handle returned by macOpen.
6771 \param newTMLevel - new Thermal Mitigation Level
6772 \param tmMode - Thermal Mitigation handle mode, default 0
6773 \return eHalStatus
6774 ---------------------------------------------------------------------------*/
6775eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
6776{
6777 eHalStatus status = eHAL_STATUS_SUCCESS;
6778 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6779 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6780 vos_msg_t vosMessage;
6781 tAniSetTmLevelReq *setTmLevelReq = NULL;
6782
6783 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6784 {
6785 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
6786 if(NULL == setTmLevelReq)
6787 {
6788 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006789 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006790 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07006791 return eHAL_STATUS_FAILURE;
6792 }
6793
6794 setTmLevelReq->tmMode = tmMode;
6795 setTmLevelReq->newTmLevel = newTMLevel;
6796
6797 /* serialize the req through MC thread */
6798 vosMessage.bodyptr = setTmLevelReq;
6799 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
6800 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6801 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6802 {
6803 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006804 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006805 vos_mem_free(setTmLevelReq);
6806 status = eHAL_STATUS_FAILURE;
6807 }
6808 sme_ReleaseGlobalLock( &pMac->sme );
6809 }
6810 return(status);
6811}
6812
6813/*---------------------------------------------------------------------------
6814
6815 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
6816 Host and FW.
6817
6818 \param hHal - HAL handle for device
6819
6820 \return NONE
6821
6822---------------------------------------------------------------------------*/
6823void sme_featureCapsExchange( tHalHandle hHal)
6824{
6825 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6826 WDA_featureCapsExchange(vosContext);
6827}
Jeff Johnsond13512a2012-07-17 11:42:19 -07006828
Yathish9f22e662012-12-10 14:21:35 -08006829/*---------------------------------------------------------------------------
6830
6831 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
6832 in Host.
6833
6834 \param hHal - HAL handle for device
6835
6836 \return NONE
6837
6838---------------------------------------------------------------------------*/
6839void sme_disableFeatureCapablity(tANI_U8 feature_index)
6840{
6841 WDA_disableCapablityFeature(feature_index);
6842}
6843
6844
Jeff Johnsond13512a2012-07-17 11:42:19 -07006845
6846/* ---------------------------------------------------------------------------
6847
6848 \fn sme_GetDefaultCountryCode
6849
6850 \brief Get the default country code from NV
6851
6852 \param hHal
6853 \param pCountry
6854 \- return eHalStatus
6855
6856 -------------------------------------------------------------------------------*/
6857eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
6858{
6859 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6860 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
6861}
6862
6863/* ---------------------------------------------------------------------------
6864
6865 \fn sme_GetCurrentCountryCode
6866
6867 \brief Get the current country code
6868
6869 \param hHal
6870 \param pCountry
6871 \- return eHalStatus
6872
6873 -------------------------------------------------------------------------------*/
6874eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
6875{
6876 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6877 return csrGetCurrentCountryCode(pMac, pCountry);
6878}
6879
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006880/* ---------------------------------------------------------------------------
6881 \fn sme_transportDebug
6882 \brief Dynamically monitoring Transport channels
6883 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07006884 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08006885 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006886 \param toggleStallDetect Enable stall detect feature
6887 This feature will take effect to data performance
6888 Not integrate till fully verification
6889 \- return NONE
6890 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07006891void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006892{
schang6295e542013-03-12 15:31:23 -07006893 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6894
6895 if (NULL == pMac)
6896 {
6897 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6898 "%s: invalid context", __func__);
6899 return;
6900 }
6901 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07006902}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006903
Kiran4a17ebe2013-01-31 10:43:43 -08006904/* ---------------------------------------------------------------------------
6905 \fn sme_ResetPowerValuesFor5G
6906 \brief Reset the power values for 5G band with NV power values.
6907 \param hHal - HAL handle for device
6908 \- return NONE
6909 -------------------------------------------------------------------------*/
6910void sme_ResetPowerValuesFor5G (tHalHandle hHal)
6911{
6912 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
6913 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
6914 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
6915}
6916
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006917#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
6918/* ---------------------------------------------------------------------------
6919 \fn sme_UpdateRoamPrefer5GHz
6920 \brief enable/disable Roam prefer 5G runtime option
6921 This function is called through dynamic setConfig callback function
6922 to configure the Roam prefer 5G runtime option
6923 \param hHal - HAL handle for device
6924 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
6925 \- return Success or failure
6926 -------------------------------------------------------------------------*/
6927
6928eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
6929{
6930 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08006931 eHalStatus status = eHAL_STATUS_SUCCESS;
6932
6933 status = sme_AcquireGlobalLock( &pMac->sme );
6934 if ( HAL_STATUS_SUCCESS( status ) )
6935 {
6936 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6937 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
6938 pMac->roam.configParam.nRoamPrefer5GHz,
6939 nRoamPrefer5GHz);
6940 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
6941 sme_ReleaseGlobalLock( &pMac->sme );
6942 }
6943
6944 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006945}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08006946
6947/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07006948 \fn sme_setRoamIntraBand
6949 \brief enable/disable Intra band roaming
6950 This function is called through dynamic setConfig callback function
6951 to configure the intra band roaming
6952 \param hHal - HAL handle for device
6953 \param nRoamIntraBand Enable/Disable Intra band roaming
6954 \- return Success or failure
6955 -------------------------------------------------------------------------*/
6956eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
6957{
6958 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6959 eHalStatus status = eHAL_STATUS_SUCCESS;
6960
6961 status = sme_AcquireGlobalLock( &pMac->sme );
6962 if ( HAL_STATUS_SUCCESS( status ) )
6963 {
6964 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6965 "%s: gRoamIntraBand is changed from %d to %d", __func__,
6966 pMac->roam.configParam.nRoamIntraBand,
6967 nRoamIntraBand);
6968 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
6969 sme_ReleaseGlobalLock( &pMac->sme );
6970 }
6971
6972 return status ;
6973}
6974
6975/* ---------------------------------------------------------------------------
6976 \fn sme_getRoamIntraBand
6977 \brief get Intra band roaming
6978 \param hHal - HAL handle for device
6979 \- return Success or failure
6980 -------------------------------------------------------------------------*/
6981v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
6982{
6983 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6984 return pMac->roam.configParam.nRoamIntraBand;
6985}
6986
6987
6988/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08006989 \fn sme_UpdateImmediateRoamRssiDiff
6990 \brief Update nImmediateRoamRssiDiff
6991 This function is called through dynamic setConfig callback function
6992 to configure nImmediateRoamRssiDiff
6993 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
6994 \param hHal - HAL handle for device
6995 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
6996 candidate and current AP.
6997 \- return Success or failure
6998 -------------------------------------------------------------------------*/
6999
7000eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
7001{
7002 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08007003 eHalStatus status = eHAL_STATUS_SUCCESS;
7004
7005 status = sme_AcquireGlobalLock( &pMac->sme );
7006 if ( HAL_STATUS_SUCCESS( status ) )
7007 {
7008 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7009 "LFR runtime successfully set immediate roam rssi diff to %d - old value is %d - roam state is %d",
7010 nImmediateRoamRssiDiff,
7011 pMac->roam.configParam.nImmediateRoamRssiDiff,
7012 pMac->roam.neighborRoamInfo.neighborRoamState);
7013 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
7014 sme_ReleaseGlobalLock( &pMac->sme );
7015 }
7016
7017 return status ;
7018}
7019
7020/* ---------------------------------------------------------------------------
7021 \fn sme_UpdateRoamRssiDiff
7022 \brief Update RoamRssiDiff
7023 This function is called through dynamic setConfig callback function
7024 to configure RoamRssiDiff
7025 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
7026 \param hHal - HAL handle for device
7027 \param RoamRssiDiff - minimum rssi difference between potential
7028 candidate and current AP.
7029 \- return Success or failure
7030 -------------------------------------------------------------------------*/
7031
7032eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
7033{
7034 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7035 eHalStatus status = eHAL_STATUS_SUCCESS;
7036
7037 status = sme_AcquireGlobalLock( &pMac->sme );
7038 if ( HAL_STATUS_SUCCESS( status ) )
7039 {
7040 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7041 "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %d",
7042 RoamRssiDiff,
7043 pMac->roam.configParam.RoamRssiDiff,
7044 pMac->roam.neighborRoamInfo.neighborRoamState);
7045 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
7046 sme_ReleaseGlobalLock( &pMac->sme );
7047 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007048#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7049 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7050 {
7051 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
7052 }
7053#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007054 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08007055}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007056
7057/*--------------------------------------------------------------------------
7058 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
7059 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7060 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007061 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007062 \param hHal - The handle returned by macOpen.
7063 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
7064 Other status means SME is failed to update isFastTransitionEnabled.
7065 \sa
7066 --------------------------------------------------------------------------*/
7067eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
7068 v_BOOL_t isFastTransitionEnabled)
7069{
7070 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08007071 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007072
Srinivas Girigowdade697412013-02-14 16:31:48 -08007073 status = sme_AcquireGlobalLock( &pMac->sme );
7074 if ( HAL_STATUS_SUCCESS( status ) )
7075 {
7076 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7077 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
7078 pMac->roam.configParam.isFastTransitionEnabled,
7079 isFastTransitionEnabled);
7080 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
7081 sme_ReleaseGlobalLock( &pMac->sme );
7082 }
7083
7084 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007085}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007086
7087/* ---------------------------------------------------------------------------
7088 \fn sme_UpdateWESMode
7089 \brief Update WES Mode
7090 This function is called through dynamic setConfig callback function
7091 to configure isWESModeEnabled
7092 \param hHal - HAL handle for device
7093 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
7094 Other status means SME is failed to update isWESModeEnabled.
7095 -------------------------------------------------------------------------*/
7096
7097eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
7098{
7099 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7100 eHalStatus status = eHAL_STATUS_SUCCESS;
7101
7102 status = sme_AcquireGlobalLock( &pMac->sme );
7103 if ( HAL_STATUS_SUCCESS( status ) )
7104 {
7105 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7106 "LFR runtime successfully set WES Mode to %d - old value is %d - roam state is %d",
7107 isWESModeEnabled,
7108 pMac->roam.configParam.isWESModeEnabled,
7109 pMac->roam.neighborRoamInfo.neighborRoamState);
7110 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
7111 sme_ReleaseGlobalLock( &pMac->sme );
7112 }
7113
7114 return status ;
7115}
7116
7117/* ---------------------------------------------------------------------------
7118 \fn sme_SetRoamScanControl
7119 \brief Set roam scan control
7120 This function is called to set roam scan control
7121 if roam scan control is set to 0, roaming scan cache is cleared
7122 any value other than 0 is treated as invalid value
7123 \param hHal - HAL handle for device
7124 \return eHAL_STATUS_SUCCESS - SME update config successfully.
7125 Other status means SME failure to update
7126 -------------------------------------------------------------------------*/
7127eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
7128{
7129 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7130 eHalStatus status = eHAL_STATUS_SUCCESS;
7131
7132 status = sme_AcquireGlobalLock( &pMac->sme );
7133 if ( HAL_STATUS_SUCCESS( status ) )
7134 {
7135 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7136 "LFR runtime successfully set roam scan control to %d - old value is %d - roam state is %d",
7137 roamScanControl,
7138 pMac->roam.configParam.nRoamScanControl,
7139 pMac->roam.neighborRoamInfo.neighborRoamState);
7140 pMac->roam.configParam.nRoamScanControl = roamScanControl;
7141 if ( 0 == roamScanControl)
7142 {
7143 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7144 "LFR runtime successfully cleared roam scan cache");
7145 csrFlushBgScanRoamChannelList(pMac);
7146#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7147 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7148 {
7149 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
7150 }
7151#endif
7152 }
7153 sme_ReleaseGlobalLock( &pMac->sme );
7154 }
7155 return status ;
7156}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007157#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */
7158
7159#ifdef FEATURE_WLAN_LFR
7160/*--------------------------------------------------------------------------
7161 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
7162 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7163 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007164 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007165 \param hHal - The handle returned by macOpen.
7166 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
7167 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
7168 \sa
7169 --------------------------------------------------------------------------*/
7170eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007171 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007172{
7173 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7174
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007175 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
7176 {
7177 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7178 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
7179 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
7180 isFastRoamIniFeatureEnabled);
7181 return eHAL_STATUS_SUCCESS;
7182 }
7183
Srinivas Girigowdade697412013-02-14 16:31:48 -08007184 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7185 "%s: FastRoamEnabled is changed from %d to %d", __func__,
7186 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
7187 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007188 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007189 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007190
7191 if(TRUE == isFastRoamIniFeatureEnabled)
7192 {
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007193 sme_UpdateConfigFwRssiMonitoring(hHal, TRUE);
7194 }
7195 else
7196 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08007197 /* CCX also depend on FW Monitoring.
7198 Hence Disabling LFR should check for CCX enable before disabling FW Monitoring */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007199#ifdef FEATURE_WLAN_CCX
7200 if(FALSE == pMac->roam.configParam.isCcxIniFeatureEnabled)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007201#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007202 {
7203 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Srinivas Girigowdade697412013-02-14 16:31:48 -08007204 "%s: Turn off FW Monitoring", __func__);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007205 sme_UpdateConfigFwRssiMonitoring(hHal, FALSE);
7206 }
7207 }
7208
7209 return eHAL_STATUS_SUCCESS;
7210}
7211#endif /* FEATURE_WLAN_LFR */
7212
7213#ifdef FEATURE_WLAN_CCX
7214/*--------------------------------------------------------------------------
7215 \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime
7216 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7217 isCcxIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007218 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007219 \param hHal - The handle returned by macOpen.
7220 \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully.
7221 Other status means SME is failed to update isCcxIniFeatureEnabled.
7222 \sa
7223 --------------------------------------------------------------------------*/
7224
7225eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007226 const v_BOOL_t isCcxIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007227{
7228 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7229
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007230 if (pMac->roam.configParam.isCcxIniFeatureEnabled == isCcxIniFeatureEnabled)
7231 {
7232 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7233 "%s: CCX Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
7234 pMac->roam.configParam.isCcxIniFeatureEnabled,
7235 isCcxIniFeatureEnabled);
7236 return eHAL_STATUS_SUCCESS;
7237 }
7238
Srinivas Girigowdade697412013-02-14 16:31:48 -08007239 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7240 "%s: CcxEnabled is changed from %d to %d", __func__,
7241 pMac->roam.configParam.isCcxIniFeatureEnabled,
7242 isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007243 pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007244 csrNeighborRoamUpdateCcxModeEnabled(pMac, isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007245
7246 if(TRUE == isCcxIniFeatureEnabled)
7247 {
7248 sme_UpdateFastTransitionEnabled(hHal, TRUE);
7249 sme_UpdateConfigFwRssiMonitoring(hHal, TRUE);
7250 }
7251 else
7252 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08007253 /* LFR also depend on FW Monitoring.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007254 Hence Disabling CCX should check for LFR enable before disabling FW Monitoring and Fast Transition */
7255#ifdef FEATURE_WLAN_LFR
7256 if(FALSE == pMac->roam.configParam.isFastRoamIniFeatureEnabled)
7257#endif
7258 {
7259 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7260 "%s: Turn off FW Monitoring/Fast Transition", __func__);
7261 sme_UpdateFastTransitionEnabled(hHal, FALSE);
7262 sme_UpdateConfigFwRssiMonitoring(hHal, FALSE);
7263 }
7264 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007265#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7266 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7267 {
7268 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CCX_INI_CFG_CHANGED);
7269 }
7270#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007271 return eHAL_STATUS_SUCCESS;
7272}
7273#endif /* FEATURE_WLAN_CCX */
7274
7275/*--------------------------------------------------------------------------
7276 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
7277 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7278 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007279 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007280 \param hHal - The handle returned by macOpen.
7281 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
7282 Other status means SME is failed to update fEnableFwRssiMonitoring.
7283 \sa
7284 --------------------------------------------------------------------------*/
7285
7286eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
7287 v_BOOL_t fEnableFwRssiMonitoring)
7288{
7289 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
7290
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007291 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
7292 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
7293 {
7294 halStatus = eHAL_STATUS_FAILURE;
7295 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007296 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007297 }
7298
7299 return (halStatus);
7300}
7301
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007302#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08007303/*--------------------------------------------------------------------------
7304 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
7305 This is a synchronous call
7306 \param hHal - The handle returned by macOpen.
7307 \return eHAL_STATUS_SUCCESS - SME update config successful.
7308 Other status means SME is failed to update
7309 \sa
7310 --------------------------------------------------------------------------*/
7311eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
7312 v_U8_t neighborLookupRssiThreshold)
7313{
7314 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7315 eHalStatus status = eHAL_STATUS_SUCCESS;
7316
7317 status = sme_AcquireGlobalLock( &pMac->sme );
7318 if ( HAL_STATUS_SUCCESS( status ) )
7319 {
7320 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
7321 if (HAL_STATUS_SUCCESS(status))
7322 {
7323 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7324 "LFR runtime successfully set Lookup threshold to %d - old value is %d - roam state is %d",
7325 neighborLookupRssiThreshold,
7326 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
7327 pMac->roam.neighborRoamInfo.neighborRoamState);
7328 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
7329 neighborLookupRssiThreshold;
7330 }
7331 sme_ReleaseGlobalLock( &pMac->sme );
7332 }
7333
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007334#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7335 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7336 {
7337 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_LOOKUP_THRESH_CHANGED);
7338 }
7339#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007340 return status;
7341}
7342
7343/*--------------------------------------------------------------------------
7344 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
7345 This is a synchronous call
7346 \param hHal - The handle returned by macOpen.
7347 \return eHAL_STATUS_SUCCESS - SME update config successful.
7348 Other status means SME is failed to update
7349 \sa
7350 --------------------------------------------------------------------------*/
7351eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
7352 v_U8_t neighborReassocRssiThreshold)
7353{
7354 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7355 eHalStatus status = eHAL_STATUS_SUCCESS;
7356
7357 status = sme_AcquireGlobalLock( &pMac->sme );
7358 if ( HAL_STATUS_SUCCESS( status ) )
7359 {
7360 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7361 "LFR runtime successfully set Reassoc threshold to %d - old value is %d - roam state is %d",
7362 neighborReassocRssiThreshold,
7363 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
7364 pMac->roam.neighborRoamInfo.neighborRoamState);
7365 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
7366 neighborReassocRssiThreshold;
7367 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
7368 neighborReassocRssiThreshold;
7369 sme_ReleaseGlobalLock( &pMac->sme );
7370 }
7371
7372 return status ;
7373}
7374
7375
7376/*--------------------------------------------------------------------------
7377 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
7378 This is a synchronous call
7379 \param hHal - The handle returned by macOpen.
7380 \return eHAL_STATUS_SUCCESS - SME update config successful.
7381 Other status means SME is failed to update
7382 \sa
7383 --------------------------------------------------------------------------*/
7384v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
7385{
7386 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7387 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
7388}
7389
7390/*--------------------------------------------------------------------------
7391 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
7392 This is a synchronous call
7393 \param hHal - The handle returned by macOpen.
7394 \return eHAL_STATUS_SUCCESS - SME update config successful.
7395 Other status means SME is failed to update
7396 \sa
7397 --------------------------------------------------------------------------*/
7398eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
7399 v_U16_t neighborScanResultsRefreshPeriod)
7400{
7401 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7402 eHalStatus status = eHAL_STATUS_SUCCESS;
7403
7404 status = sme_AcquireGlobalLock( &pMac->sme );
7405 if ( HAL_STATUS_SUCCESS( status ) )
7406 {
7407 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7408 "LFR runtime successfully set roam scan refresh period to %d - old value is %d - roam state is %d",
7409 neighborScanResultsRefreshPeriod,
7410 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
7411 pMac->roam.neighborRoamInfo.neighborRoamState);
7412 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
7413 neighborScanResultsRefreshPeriod;
7414 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
7415 neighborScanResultsRefreshPeriod;
7416
7417 sme_ReleaseGlobalLock( &pMac->sme );
7418 }
7419
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007420#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7421 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7422 {
7423 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7424 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
7425 }
7426#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007427 return status ;
7428}
7429
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007430#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7431/*--------------------------------------------------------------------------
7432 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
7433 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7434 gRoamScanOffloadEnabled.
7435 This is a synchronous call
7436 \param hHal - The handle returned by macOpen.
7437 \return eHAL_STATUS_SUCCESS - SME update config successfully.
7438 Other status means SME is failed to update.
7439 \sa
7440 --------------------------------------------------------------------------*/
7441
7442eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
7443 v_BOOL_t nRoamScanOffloadEnabled)
7444{
7445 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7446 eHalStatus status = eHAL_STATUS_SUCCESS;
7447
7448 status = sme_AcquireGlobalLock( &pMac->sme );
7449 if ( HAL_STATUS_SUCCESS( status ) )
7450 {
7451 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7452 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
7453 pMac->roam.configParam.isRoamOffloadScanEnabled,
7454 nRoamScanOffloadEnabled);
7455 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
7456 sme_ReleaseGlobalLock( &pMac->sme );
7457 }
7458
7459 return status ;
7460}
7461#endif
7462
Srinivas Girigowdade697412013-02-14 16:31:48 -08007463/*--------------------------------------------------------------------------
7464 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
7465 This is a synchronous call
7466 \param hHal - The handle returned by macOpen.
7467 \return v_U16_t - Neighbor scan results refresh period value
7468 \sa
7469 --------------------------------------------------------------------------*/
7470v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
7471{
7472 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7473 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
7474}
7475
7476/*--------------------------------------------------------------------------
7477 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
7478 This is a synchronuous call
7479 \param hHal - The handle returned by macOpen.
7480 \return eHAL_STATUS_SUCCESS - SME update config successful.
7481 Other status means SME is failed to update
7482 \sa
7483 --------------------------------------------------------------------------*/
7484v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
7485{
7486 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7487 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
7488}
7489
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007490/* ---------------------------------------------------------------------------
7491 \fn sme_UpdateEmptyScanRefreshPeriod
7492 \brief Update nEmptyScanRefreshPeriod
7493 This function is called through dynamic setConfig callback function
7494 to configure nEmptyScanRefreshPeriod
7495 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
7496 \param hHal - HAL handle for device
7497 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
7498 \- return Success or failure
7499 -------------------------------------------------------------------------*/
7500
7501eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
7502{
7503 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7504 eHalStatus status = eHAL_STATUS_SUCCESS;
7505
7506 status = sme_AcquireGlobalLock( &pMac->sme );
7507 if ( HAL_STATUS_SUCCESS( status ) )
7508 {
7509 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7510 "LFR runtime successfully set roam scan period to %d - old value is %d - roam state is %d",
7511 nEmptyScanRefreshPeriod,
7512 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
7513 pMac->roam.neighborRoamInfo.neighborRoamState);
7514 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
7515 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
7516 sme_ReleaseGlobalLock( &pMac->sme );
7517 }
7518
7519 return status ;
7520}
7521
7522/* ---------------------------------------------------------------------------
7523 \fn sme_setNeighborScanMinChanTime
7524 \brief Update nNeighborScanMinChanTime
7525 This function is called through dynamic setConfig callback function
7526 to configure gNeighborScanChannelMinTime
7527 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
7528 \param hHal - HAL handle for device
7529 \param nNeighborScanMinChanTime - Channel minimum dwell time
7530 \- return Success or failure
7531 -------------------------------------------------------------------------*/
7532eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
7533{
7534 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7535 eHalStatus status = eHAL_STATUS_SUCCESS;
7536
7537 status = sme_AcquireGlobalLock( &pMac->sme );
7538 if ( HAL_STATUS_SUCCESS( status ) )
7539 {
7540 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7541 "LFR runtime successfully set channel min dwell time to %d - old value is %d - roam state is %d",
7542 nNeighborScanMinChanTime,
7543 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
7544 pMac->roam.neighborRoamInfo.neighborRoamState);
7545 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
7546 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
7547 sme_ReleaseGlobalLock( &pMac->sme );
7548 }
7549
7550 return status ;
7551}
7552
7553/* ---------------------------------------------------------------------------
7554 \fn sme_setNeighborScanMaxChanTime
7555 \brief Update nNeighborScanMaxChanTime
7556 This function is called through dynamic setConfig callback function
7557 to configure gNeighborScanChannelMaxTime
7558 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
7559 \param hHal - HAL handle for device
7560 \param nNeighborScanMinChanTime - Channel maximum dwell time
7561 \- return Success or failure
7562 -------------------------------------------------------------------------*/
7563eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
7564{
7565 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7566 eHalStatus status = eHAL_STATUS_SUCCESS;
7567
7568 status = sme_AcquireGlobalLock( &pMac->sme );
7569 if ( HAL_STATUS_SUCCESS( status ) )
7570 {
7571 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7572 "LFR runtime successfully set channel max dwell time to %d - old value is %d - roam state is %d",
7573 nNeighborScanMaxChanTime,
7574 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
7575 pMac->roam.neighborRoamInfo.neighborRoamState);
7576 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
7577 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
7578 sme_ReleaseGlobalLock( &pMac->sme );
7579 }
7580
7581 return status ;
7582}
7583
7584/* ---------------------------------------------------------------------------
7585 \fn sme_getNeighborScanMinChanTime
7586 \brief get neighbor scan min channel time
7587 \param hHal - The handle returned by macOpen.
7588 \return v_U16_t - channel min time value
7589 -------------------------------------------------------------------------*/
7590v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
7591{
7592 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7593 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
7594}
7595
7596/* ---------------------------------------------------------------------------
7597 \fn sme_getNeighborScanMaxChanTime
7598 \brief get neighbor scan max channel time
7599 \param hHal - The handle returned by macOpen.
7600 \return v_U16_t - channel max time value
7601 -------------------------------------------------------------------------*/
7602v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
7603{
7604 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7605 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
7606}
7607
7608/* ---------------------------------------------------------------------------
7609 \fn sme_setNeighborScanPeriod
7610 \brief Update nNeighborScanPeriod
7611 This function is called through dynamic setConfig callback function
7612 to configure nNeighborScanPeriod
7613 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 60]
7614 \param hHal - HAL handle for device
7615 \param nNeighborScanPeriod - neighbor scan period
7616 \- return Success or failure
7617 -------------------------------------------------------------------------*/
7618eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
7619{
7620 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7621 eHalStatus status = eHAL_STATUS_SUCCESS;
7622
7623 status = sme_AcquireGlobalLock( &pMac->sme );
7624 if ( HAL_STATUS_SUCCESS( status ) )
7625 {
7626 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7627 "LFR runtime successfully set neighbor scan period to %d - old value is %d - roam state is %d",
7628 nNeighborScanPeriod,
7629 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
7630 pMac->roam.neighborRoamInfo.neighborRoamState);
7631 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
7632 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
7633 sme_ReleaseGlobalLock( &pMac->sme );
7634 }
7635
7636 return status ;
7637}
7638
7639/* ---------------------------------------------------------------------------
7640 \fn sme_getNeighborScanPeriod
7641 \brief get neighbor scan period
7642 \param hHal - The handle returned by macOpen.
7643 \return v_U16_t - neighbor scan period
7644 -------------------------------------------------------------------------*/
7645v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
7646{
7647 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7648 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
7649}
7650
7651#endif
7652
Srinivas Girigowdade697412013-02-14 16:31:48 -08007653#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007654
Srinivas Girigowdade697412013-02-14 16:31:48 -08007655/*--------------------------------------------------------------------------
7656 \brief sme_getRoamRssiDiff() - get Roam rssi diff
7657 This is a synchronous call
7658 \param hHal - The handle returned by macOpen.
7659 \return v_U16_t - Rssi diff value
7660 \sa
7661 --------------------------------------------------------------------------*/
7662v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
7663{
7664 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7665 return pMac->roam.configParam.RoamRssiDiff;
7666}
7667
7668/*--------------------------------------------------------------------------
7669 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
7670 This is a synchronous call
7671 \param hHal - The handle returned by macOpen.
7672 \return eHAL_STATUS_SUCCESS - SME update config successful.
7673 Other status means SME is failed to update
7674 \sa
7675 --------------------------------------------------------------------------*/
7676eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
7677 tANI_U8 numChannels)
7678{
7679 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7680 eHalStatus status = eHAL_STATUS_SUCCESS;
7681 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007682 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08007683 tANI_U8 newChannelList[128] = {0};
7684 tANI_U8 i = 0, j = 0;
7685
7686 status = sme_AcquireGlobalLock( &pMac->sme );
7687 if ( HAL_STATUS_SUCCESS( status ) )
7688 {
7689 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
7690 {
7691 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
7692 {
7693 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
7694 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
7695 }
7696 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007697 csrFlushBgScanRoamChannelList(pMac);
7698 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Srinivas Girigowdade697412013-02-14 16:31:48 -08007699 status = csrUpdateBgScanConfigIniChannelList(pMac, csrGetCurrentBand(hHal));
7700
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007701 if ( HAL_STATUS_SUCCESS( status ))
Srinivas Girigowdade697412013-02-14 16:31:48 -08007702 {
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007703 sme_SetRoamScanControl(hHal, 1);
7704 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08007705 {
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007706 j = 0;
7707 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
7708 {
7709 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
7710 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
7711 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007712 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007713
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007714 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7715 "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d",
7716 newChannelList, oldChannelList,
7717 pMac->roam.neighborRoamInfo.neighborRoamState);
7718 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007719 sme_ReleaseGlobalLock( &pMac->sme );
7720 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007721#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7722 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7723 {
7724 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
7725 }
7726#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007727
7728 return status ;
7729}
7730
7731/*--------------------------------------------------------------------------
7732 \brief sme_ChangeCountryValidChannelListByRevision() - Change Korea valid channel list
7733 based on country revision number
7734 This is a synchronous call
7735 \param hHal - The handle returned by macOpen.
7736 \return eHAL_STATUS_SUCCESS - SME update config successful.
7737 Other status means SME is failed to update
7738 \sa
7739 --------------------------------------------------------------------------*/
7740eHalStatus sme_ChangeCountryValidChannelListByRevision(tHalHandle hHal,
7741 tANI_U8 Revision)
7742{
7743 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7744 eHalStatus status = eHAL_STATUS_SUCCESS;
7745
7746 status = sme_AcquireGlobalLock( &pMac->sme );
7747 if ( HAL_STATUS_SUCCESS( status ) )
7748 {
7749 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7750 "LFR runtime successfully set country/revision to %s/%d - old value is %s/%d - roam state is %d",
7751 "KR", Revision, "KR",
7752 pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.revision,
7753 pMac->roam.neighborRoamInfo.neighborRoamState);
7754 csr_SetRevision(pMac, Revision);
7755 csrInitCountryValidChannelList(pMac, Revision);
7756 sme_ReleaseGlobalLock( &pMac->sme );
7757 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007758#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7759 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7760 {
7761 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_VALID_CHANNEL_LIST_CHANGED);
7762 }
7763#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007764
7765 return status ;
7766}
7767
7768
7769/*--------------------------------------------------------------------------
7770 \brief csrUpdateBgScanConfigIniChannelList() - Update bgscan roam cache
7771 This is a synchronous call
7772 \param hHal - The handle returned by macOpen.
7773 \return eHAL_STATUS_SUCCESS - SME update config successful.
7774 Other status means SME is failed to update
7775 \sa
7776 --------------------------------------------------------------------------*/
7777eHalStatus sme_UpdateBgScanConfigIniChannelList(tHalHandle hHal,
7778 eCsrBand eBand)
7779{
7780 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7781 return csrUpdateBgScanConfigIniChannelList(pMac, eBand);
7782}
7783
7784/*--------------------------------------------------------------------------
7785 \brief sme_getRoamScanChannelList() - get roam scan channel list
7786 This is a synchronous call
7787 \param hHal - The handle returned by macOpen.
7788 \return eHAL_STATUS_SUCCESS - SME update config successful.
7789 Other status means SME is failed to update
7790 \sa
7791 --------------------------------------------------------------------------*/
7792eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
7793 tANI_U8 *pNumChannels)
7794{
7795 int i = 0;
7796 tANI_U8 *pOutPtr = pChannelList;
7797 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7798 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7799 eHalStatus status = eHAL_STATUS_SUCCESS;
7800
7801 status = sme_AcquireGlobalLock( &pMac->sme );
7802 if ( HAL_STATUS_SUCCESS( status ) )
7803 {
7804 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
7805 {
7806 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
7807 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007808 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08007809 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007810 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08007811 }
7812
7813 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
7814 for (i = 0; i < (*pNumChannels); i++)
7815 {
7816 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
7817 }
7818 pOutPtr[i] = '\0';
7819 sme_ReleaseGlobalLock( &pMac->sme );
7820 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007821 return status ;
7822}
7823
7824/*--------------------------------------------------------------------------
7825 \brief sme_GetCountryRevision() - get Country revision index
7826 This is a synchronous call
7827 \param hHal - The handle returned by macOpen.
7828 \return eHAL_STATUS_SUCCESS - SME update config successful.
7829 Other status means SME is failed to update
7830 \sa
7831 --------------------------------------------------------------------------*/
7832eHalStatus sme_GetCountryRevision(tHalHandle hHal, tANI_U8 *pRevision)
7833{
7834 /* this is valid for Country KR only now */
7835 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7836 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7837 eHalStatus status = eHAL_STATUS_SUCCESS;
7838
7839 *pRevision = pNeighborRoamInfo->cfgParams.countryChannelInfo.revision;
7840
7841 return status;
7842}
7843
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007844/*--------------------------------------------------------------------------
7845 \brief sme_getIsCcxFeatureEnabled() - get CCX feature enabled or not
7846 This is a synchronuous call
7847 \param hHal - The handle returned by macOpen.
7848 \return TRUE (1) - if the CCX feature is enabled
7849 FALSE (0) - if feature is disabled (compile or runtime)
7850 \sa
7851 --------------------------------------------------------------------------*/
7852tANI_BOOLEAN sme_getIsCcxFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08007853{
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007854#ifdef FEATURE_WLAN_CCX
Srinivas Girigowdade697412013-02-14 16:31:48 -08007855 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007856 return pMac->roam.configParam.isCcxIniFeatureEnabled;
7857#else
7858 return eANI_BOOLEAN_FALSE;
7859#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007860}
7861
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007862/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007863 \brief sme_GetWESMode() - get WES Mode
7864 This is a synchronous call
7865 \param hHal - The handle returned by macOpen
7866 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
7867 \sa
7868 --------------------------------------------------------------------------*/
7869v_BOOL_t sme_GetWESMode(tHalHandle hHal)
7870{
7871 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7872 return pMac->roam.configParam.isWESModeEnabled;
7873}
7874
7875/*--------------------------------------------------------------------------
7876 \brief sme_GetRoamScanControl() - get scan control
7877 This is a synchronous call
7878 \param hHal - The handle returned by macOpen.
7879 \return v_BOOL_t - Enabled(1)/Disabled(0)
7880 \sa
7881 --------------------------------------------------------------------------*/
7882v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
7883{
7884 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7885 return pMac->roam.configParam.nRoamScanControl;
7886}
7887#endif
7888
7889/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007890 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
7891 This is a synchronuous call
7892 \param hHal - The handle returned by macOpen.
7893 \return TRUE (1) - if the feature is enabled
7894 FALSE (0) - if feature is disabled (compile or runtime)
7895 \sa
7896 --------------------------------------------------------------------------*/
7897tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
7898{
7899#ifdef FEATURE_WLAN_LFR
7900 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7901 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
7902#else
7903 return eANI_BOOLEAN_FALSE;
7904#endif
7905}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007906
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007907/*--------------------------------------------------------------------------
7908 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
7909 This is a synchronuous call
7910 \param hHal - The handle returned by macOpen.
7911 \return TRUE (1) - if the feature is enabled
7912 FALSE (0) - if feature is disabled (compile or runtime)
7913 \sa
7914 --------------------------------------------------------------------------*/
7915tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
7916{
7917#ifdef WLAN_FEATURE_VOWIFI_11R
7918 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7919 return pMac->roam.configParam.isFastTransitionEnabled;
7920#else
7921 return eANI_BOOLEAN_FALSE;
7922#endif
7923}
7924
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007925
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007926/* ---------------------------------------------------------------------------
7927 \fn sme_IsFeatureSupportedByFW
7928 \brief Check if an feature is enabled by FW
7929
7930 \param feattEnumValue - Enumeration value from placeHolderInCapBitmap
7931 \- return 1/0 (TRUE/FALSE)
7932 -------------------------------------------------------------------------*/
7933tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
7934{
7935 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
7936}
7937#ifdef FEATURE_WLAN_TDLS
7938/* ---------------------------------------------------------------------------
7939 \fn sme_SendTdlsMgmtFrame
7940 \brief API to send TDLS management frames.
7941
7942 \param peerMac - peer's Mac Adress.
7943 \param frame_type - Type of TDLS mgmt frame to be sent.
7944 \param dialog - dialog token used in the frame.
7945 \param status - status to be incuded in the frame.
7946 \param buf - additional IEs to be included
7947 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08007948 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007949 \- return VOS_STATUS_SUCCES
7950 -------------------------------------------------------------------------*/
7951VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Hoonki Leea34dd892013-02-05 22:56:02 -08007952 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 -08007953{
7954 eHalStatus status = eHAL_STATUS_SUCCESS;
7955 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
7956 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7957
7958 status = sme_AcquireGlobalLock( &pMac->sme );
7959 if ( HAL_STATUS_SUCCESS( status ) )
7960 {
7961 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
7962 sendTdlsReq.frameType = frame_type;
7963 sendTdlsReq.buf = buf;
7964 sendTdlsReq.len = len;
7965 sendTdlsReq.dialog = dialog;
7966 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08007967 sendTdlsReq.responder = responder;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08007968
7969 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
7970
7971 sme_ReleaseGlobalLock( &pMac->sme );
7972 }
7973
7974 return status ;
7975
7976}
7977/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08007978 \fn sme_ChangeTdlsPeerSta
7979 \brief API to Update TDLS peer sta parameters.
7980
7981 \param peerMac - peer's Mac Adress.
7982 \param staParams - Peer Station Parameters
7983 \- return VOS_STATUS_SUCCES
7984 -------------------------------------------------------------------------*/
7985VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
7986 tCsrStaParams *pstaParams)
7987{
7988 eHalStatus status = eHAL_STATUS_SUCCESS;
7989 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7990
7991 status = sme_AcquireGlobalLock( &pMac->sme );
7992 if ( HAL_STATUS_SUCCESS( status ) )
7993 {
7994 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
7995
7996 sme_ReleaseGlobalLock( &pMac->sme );
7997 }
7998
7999 return status ;
8000
8001}
8002
8003/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008004 \fn sme_AddTdlsPeerSta
8005 \brief API to Add TDLS peer sta entry.
8006
8007 \param peerMac - peer's Mac Adress.
8008 \- return VOS_STATUS_SUCCES
8009 -------------------------------------------------------------------------*/
8010VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8011{
8012 eHalStatus status = eHAL_STATUS_SUCCESS;
8013 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8014
8015 status = sme_AcquireGlobalLock( &pMac->sme );
8016 if ( HAL_STATUS_SUCCESS( status ) )
8017 {
8018 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
8019
8020 sme_ReleaseGlobalLock( &pMac->sme );
8021 }
8022
8023 return status ;
8024
8025}
8026/* ---------------------------------------------------------------------------
8027 \fn sme_DeleteTdlsPeerSta
8028 \brief API to Delete TDLS peer sta entry.
8029
8030 \param peerMac - peer's Mac Adress.
8031 \- return VOS_STATUS_SUCCES
8032 -------------------------------------------------------------------------*/
8033VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8034{
8035 eHalStatus status = eHAL_STATUS_SUCCESS;
8036 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8037
8038 status = sme_AcquireGlobalLock( &pMac->sme );
8039 if ( HAL_STATUS_SUCCESS( status ) )
8040 {
8041 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
8042
8043 sme_ReleaseGlobalLock( &pMac->sme );
8044 }
8045
8046 return status ;
8047
8048}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07008049/* ---------------------------------------------------------------------------
8050 \fn sme_IsPmcBmps
8051 \API to Check if PMC state is BMPS.
8052
8053 \- return v_BOOL_t
8054 -------------------------------------------------------------------------*/
8055v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
8056{
8057 return (BMPS == pmcGetPmcState(hHal));
8058}
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07008059/* ---------------------------------------------------------------------------
8060 \fn sme_SetTdlsPowerSaveProhibited
8061 \API to set/reset the isTdlsPowerSaveProhibited.
8062
8063 \- return void
8064 -------------------------------------------------------------------------*/
8065void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
8066{
8067 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8068
8069 pMac->isTdlsPowerSaveProhibited = val;
8070 return;
8071}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008072#endif
8073#ifdef FEATURE_WLAN_TDLS_INTERNAL
8074/*
8075 * SME API to start TDLS discovery Procedure
8076 */
8077VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8078{
8079 VOS_STATUS status = VOS_STATUS_SUCCESS;
8080 tCsrTdlsDisRequest disReq = {{0}} ;
8081 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8082 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
8083
8084 return status ;
8085
8086}
8087
8088/*
8089 * Process TDLS discovery results
8090 */
8091v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
8092 tSmeTdlsDisResult *disResult, v_U8_t listType)
8093{
8094 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
8095 tSirTdlsPeerInfo *peerInfo = NULL ;
8096 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8097 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
8098 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
8099 tListElem *pEntry = NULL ;
8100 v_U8_t peerCnt = 0 ;
8101
8102 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008103 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008104 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
8105 while(pEntry)
8106 {
8107 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
8108 tdlsPeerStaLink) ;
8109 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
8110
8111 switch(listType)
8112 {
8113 case TDLS_SETUP_LIST:
8114 {
8115 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
8116 {
8117 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
8118 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
8119 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
8120 peerCnt++ ;
8121 }
8122 break ;
8123 }
8124 case TDLS_DIS_LIST:
8125 {
8126 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
8127 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
8128 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
8129 peerCnt++ ;
8130 break ;
8131 }
8132 default:
8133 {
8134 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008135 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008136 break ;
8137 }
8138 }
8139
8140 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
8141 }
8142
8143 return peerCnt ;
8144
8145}
8146
8147/*
8148 * SME API to start TDLS link setup Procedure.
8149 */
8150VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8151{
8152 VOS_STATUS status = VOS_STATUS_SUCCESS;
8153 tCsrTdlsSetupRequest setupReq = {{0}} ;
8154 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8155 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
8156 return status ;
8157
8158}
8159
8160/*
8161 * SME API to start TDLS link Teardown Procedure.
8162 */
8163VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8164{
8165 VOS_STATUS status = VOS_STATUS_SUCCESS;
8166 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
8167 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8168 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
8169 return status ;
8170
8171}
8172
8173#endif /* FEATURE_WLAN_TDLS */
8174
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -07008175eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
8176{
8177 eHalStatus status = eHAL_STATUS_FAILURE;
8178 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8179
8180 smsLog(pMac, LOG2, FL("enter"));
8181 status = sme_AcquireGlobalLock( &pMac->sme );
8182 if ( HAL_STATUS_SUCCESS( status ) )
8183 {
8184 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
8185 sme_ReleaseGlobalLock( &pMac->sme );
8186 }
8187 smsLog(pMac, LOG2, FL("exit status %d"), status);
8188
8189 return (status);
8190}
8191
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -07008192/*
8193 * SME API to enable/disable WLAN driver initiated SSR
8194 */
8195void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
8196{
8197 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8198 eHalStatus status = eHAL_STATUS_SUCCESS;
8199
8200 status = sme_AcquireGlobalLock(&pMac->sme);
8201 if (HAL_STATUS_SUCCESS(status))
8202 {
8203 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8204 "SSR level is changed %d", enableSSR);
8205 /* not serializing this messsage, as this is only going
8206 * to set a variable in WDA/WDI
8207 */
8208 WDA_SetEnableSSR(enableSSR);
8209 sme_ReleaseGlobalLock(&pMac->sme);
8210 }
8211 return;
8212}