blob: 4ecbe9de4938608bc12ddd33ec8d0f9e628d91c2 [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:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530792 case eSmeCommandTdlsLinkEstablish:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800793#ifdef FEATURE_WLAN_TDLS_INTERNAL
794 case eSmeCommandTdlsDiscovery:
795 case eSmeCommandTdlsLinkSetup:
796 case eSmeCommandTdlsLinkTear:
797 case eSmeCommandTdlsEnterUapsd:
798 case eSmeCommandTdlsExitUapsd:
799#endif
800 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -0800801 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800802 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800803
804 csrLLUnlock( &pMac->sme.smeCmdActiveList );
805 status = csrTdlsProcessCmd( pMac, pCommand );
806 }
807 break ;
808#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700809
810 default:
811 //something is wrong
812 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800813 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700814 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
815 csrLLUnlock( &pMac->sme.smeCmdActiveList );
816 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
817 smeReleaseCommand( pMac, pCommand );
818 status = eHAL_STATUS_FAILURE;
819 break;
820 }
821 if(!HAL_STATUS_SUCCESS(status))
822 {
823 fContinue = eANI_BOOLEAN_TRUE;
824 }
825 }//if(pEntry)
826 else
827 {
828 //This is odd. Some one else pull off the command.
829 csrLLUnlock( &pMac->sme.smeCmdActiveList );
830 }
831 }
832 else
833 {
834 csrLLUnlock( &pMac->sme.smeCmdActiveList );
835 }
836 }
837 else
838 {
839 //No command waiting
840 csrLLUnlock( &pMac->sme.smeCmdActiveList );
841 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
842 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
843 {
844 tANI_U32 nTime = 0;
845
846 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
847 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
848 {
849 csrScanStartIdleScanTimer(pMac, nTime);
850 }
851 }
852 }
853 }
854 else {
855 csrLLUnlock( &pMac->sme.smeCmdActiveList );
856 }
857
858 return ( fContinue );
859}
860
861void smeProcessPendingQueue( tpAniSirGlobal pMac )
862{
863 while( smeProcessCommand( pMac ) );
864}
865
866
867tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
868{
869 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
870 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
871}
872
873
874
875//Global APIs
876
877/*--------------------------------------------------------------------------
878
879 \brief sme_Open() - Initialze all SME modules and put them at idle state
880
881 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
882 successfully return, all modules are at idle state ready to start.
883
884 smeOpen must be called before any other SME APIs can be involved.
885 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -0800886 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 \param hHal - The handle returned by macOpen.
888
889 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
890
891 Other status means SME is failed to be initialized
892 \sa
893
894 --------------------------------------------------------------------------*/
895eHalStatus sme_Open(tHalHandle hHal)
896{
897 eHalStatus status = eHAL_STATUS_FAILURE;
898 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
899
900 do {
901 pMac->sme.state = SME_STATE_STOP;
902 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
903 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800904 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -0700905 status = eHAL_STATUS_FAILURE;
906 break;
907 }
908
909 status = ccmOpen(hHal);
910 if ( ! HAL_STATUS_SUCCESS( status ) ) {
911 smsLog( pMac, LOGE,
912 "ccmOpen failed during initialization with status=%d", status );
913 break;
914 }
915
916 status = csrOpen(pMac);
917 if ( ! HAL_STATUS_SUCCESS( status ) ) {
918 smsLog( pMac, LOGE,
919 "csrOpen failed during initialization with status=%d", status );
920 break;
921 }
922
923 status = pmcOpen(hHal);
924 if ( ! HAL_STATUS_SUCCESS( status ) ) {
925 smsLog( pMac, LOGE,
926 "pmcOpen failed during initialization with status=%d", status );
927 break;
928 }
929
Gopichand Nakkala34d1b062013-03-19 15:28:33 -0700930#ifdef FEATURE_WLAN_TDLS
931 pMac->isTdlsPowerSaveProhibited = 0;
932#endif
933
Jeff Johnson295189b2012-06-20 16:38:30 -0700934#ifndef WLAN_MDM_CODE_REDUCTION_OPT
935 status = sme_QosOpen(pMac);
936 if ( ! HAL_STATUS_SUCCESS( status ) ) {
937 smsLog( pMac, LOGE,
938 "Qos open failed during initialization with status=%d", status );
939 break;
940 }
941
942 status = btcOpen(pMac);
943 if ( ! HAL_STATUS_SUCCESS( status ) ) {
944 smsLog( pMac, LOGE,
945 "btcOpen open failed during initialization with status=%d", status );
946 break;
947 }
948#endif
Jeff Johnsone7245742012-09-05 17:12:55 -0700949#ifdef FEATURE_OEM_DATA_SUPPORT
950 status = oemData_OemDataReqOpen(pMac);
951 if ( ! HAL_STATUS_SUCCESS( status ) ) {
952 smsLog(pMac, LOGE,
953 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
954 break;
955 }
956#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700957
958 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
959 break;
960
Jeff Johnson295189b2012-06-20 16:38:30 -0700961 {
962 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
963 if ( NULL == pvosGCtx ){
964 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
965 status = eHAL_STATUS_FAILURE;
966 break;
967 }
968
969 status = WLANSAP_Open( pvosGCtx );
970 if ( ! HAL_STATUS_SUCCESS( status ) ) {
971 smsLog( pMac, LOGE,
972 "WLANSAP_Open open failed during initialization with status=%d", status );
973 break;
974 }
975 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700976#if defined WLAN_FEATURE_VOWIFI
977 status = rrmOpen(pMac);
978 if ( ! HAL_STATUS_SUCCESS( status ) ) {
979 smsLog( pMac, LOGE,
980 "rrmOpen open failed during initialization with status=%d", status );
981 break;
982 }
983#endif
984
985#if defined WLAN_FEATURE_VOWIFI_11R
986 sme_FTOpen(pMac);
987#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700988 sme_p2pOpen(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700989
990 }while (0);
991
992 return status;
993}
994
Jeff Johnson295189b2012-06-20 16:38:30 -0700995/*--------------------------------------------------------------------------
996
997 \brief sme_set11dinfo() - Set the 11d information about valid channels
998 and there power using information from nvRAM
999 This function is called only for AP.
1000
Srinivas Girigowdade697412013-02-14 16:31:48 -08001001 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001002
1003 \param hHal - The handle returned by macOpen.
1004 \Param pSmeConfigParams - a pointer to a caller allocated object of
1005 typedef struct _smeConfigParams.
1006
1007 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1008
1009 Other status means SME is failed to update the config parameters.
1010 \sa
1011--------------------------------------------------------------------------*/
1012
1013eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1014{
1015 eHalStatus status = eHAL_STATUS_FAILURE;
1016 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1017
1018 if (NULL == pSmeConfigParams ) {
1019 smsLog( pMac, LOGE,
1020 "Empty config param structure for SME, nothing to update");
1021 return status;
1022 }
1023
1024 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1025 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001026 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001027 status );
1028 }
1029 return status;
1030}
1031
1032/*--------------------------------------------------------------------------
1033
1034 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1035
Srinivas Girigowdade697412013-02-14 16:31:48 -08001036 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001037
1038 \param hHal - The handle returned by HostapdAdapter.
1039 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1040
1041 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1042
1043 Other status means, failed to get the current regulatory domain.
1044 \sa
1045--------------------------------------------------------------------------*/
1046
1047eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1048{
1049 eHalStatus status = eHAL_STATUS_FAILURE;
1050 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1051
1052 if (NULL == domainIdSoftAp ) {
1053 smsLog( pMac, LOGE, "Uninitialized domain Id");
1054 return status;
1055 }
1056
1057 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1058 status = eHAL_STATUS_SUCCESS;
1059
1060 return status;
1061}
1062
1063
1064eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1065{
1066 eHalStatus status = eHAL_STATUS_FAILURE;
1067 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1068
1069 if (NULL == apCntryCode ) {
1070 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1071 return status;
1072 }
1073
1074 status = csrSetRegInfo(hHal, apCntryCode );
1075 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001076 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001077 status );
1078 }
1079 return status;
1080}
1081
Jeff Johnson295189b2012-06-20 16:38:30 -07001082#ifdef FEATURE_WLAN_SCAN_PNO
1083/*--------------------------------------------------------------------------
1084
1085 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
1086
1087 It is used at driver start up to inform RIVA of the default channel
1088 configuration.
1089
Srinivas Girigowdade697412013-02-14 16:31:48 -08001090 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001091
1092 \param hHal - The handle returned by macOpen.
1093
1094 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1095
1096 Other status means SME is failed to update the channel config.
1097 \sa
1098
1099 --------------------------------------------------------------------------*/
1100eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1101{
1102 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1103
1104 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
1105 &pMac->scan.base20MHzChannels, FALSE);
1106 return eHAL_STATUS_SUCCESS;
1107}
1108#endif // FEATURE_WLAN_SCAN_PNLO
1109
1110/*--------------------------------------------------------------------------
1111
1112 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1113
1114 The function updates some configuration for modules in SME, CCM, CSR, etc
1115 during SMEs close open sequence.
1116
1117 Modules inside SME apply the new configuration at the next transaction.
1118
Srinivas Girigowdade697412013-02-14 16:31:48 -08001119 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001120
1121 \param hHal - The handle returned by macOpen.
1122 \Param pSmeConfigParams - a pointer to a caller allocated object of
1123 typedef struct _smeConfigParams.
1124
1125 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1126
1127 Other status means SME is failed to update the config parameters.
1128 \sa
1129
1130 --------------------------------------------------------------------------*/
1131eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1132{
1133 eHalStatus status = eHAL_STATUS_FAILURE;
1134 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1135
1136 if (NULL == pSmeConfigParams ) {
1137 smsLog( pMac, LOGE,
1138 "Empty config param structure for SME, nothing to update");
1139 return status;
1140 }
1141
1142 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1143
1144 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001145 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001146 status );
1147 }
1148#if defined WLAN_FEATURE_P2P_INTERNAL
1149 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1150
1151 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001152 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001153 status );
1154 }
1155#endif
1156#if defined WLAN_FEATURE_VOWIFI
1157 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1158
1159 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001160 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001161 status );
1162 }
1163#endif
1164 //For SOC, CFG is set before start
1165 //We don't want to apply global CFG in connect state because that may cause some side affect
1166 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001167 csrIsAllSessionDisconnected( pMac) )
1168 {
1169 csrSetGlobalCfgs(pMac);
1170 }
1171
1172 return status;
1173}
1174
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301175#ifdef WLAN_FEATURE_GTK_OFFLOAD
1176void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1177 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1178{
1179 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1180
1181 if (NULL == pMac)
1182 {
1183 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1184 "%s: pMac is null", __func__);
1185 return ;
1186 }
1187 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1188 {
1189 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1190 "%s: HDD callback is null", __func__);
1191 return ;
1192 }
1193 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1194 pGtkOffloadGetInfoRsp);
1195}
1196#endif
1197
Jeff Johnson295189b2012-06-20 16:38:30 -07001198/* ---------------------------------------------------------------------------
1199 \fn sme_ChangeConfigParams
1200 \brief The SME API exposed for HDD to provide config params to SME during
1201 SMEs stop -> start sequence.
1202
1203 If HDD changed the domain that will cause a reset. This function will
1204 provide the new set of 11d information for the new domain. Currrently this
1205 API provides info regarding 11d only at reset but we can extend this for
1206 other params (PMC, QoS) which needs to be initialized again at reset.
1207
Srinivas Girigowdade697412013-02-14 16:31:48 -08001208 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001209
1210 \param hHal - The handle returned by macOpen.
1211
1212 \Param
1213 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1214 currently provides 11d related information like Country code,
1215 Regulatory domain, valid channel list, Tx power per channel, a
1216 list with active/passive scan allowed per valid channel.
1217
1218 \return eHalStatus
1219 ---------------------------------------------------------------------------*/
1220eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1221 tCsrUpdateConfigParam *pUpdateConfigParam)
1222{
1223 eHalStatus status = eHAL_STATUS_FAILURE;
1224 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1225
1226 if (NULL == pUpdateConfigParam ) {
1227 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001228 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001229 return status;
1230 }
1231
1232 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1233
1234 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001235 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001236 status );
1237 }
1238
1239 return status;
1240
1241}
1242
1243/*--------------------------------------------------------------------------
1244
1245 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1246 that the NIC is ready tio run.
1247
1248 The function is called by HDD at the end of initialization stage so PE/HAL can
1249 enable the NIC to running state.
1250
Srinivas Girigowdade697412013-02-14 16:31:48 -08001251 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001252 \param hHal - The handle returned by macOpen.
1253
1254 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1255 successfully.
1256
1257 Other status means SME failed to send the message to PE.
1258 \sa
1259
1260 --------------------------------------------------------------------------*/
1261eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1262{
1263 tSirSmeReadyReq Msg;
1264 eHalStatus status = eHAL_STATUS_FAILURE;
1265 tPmcPowerState powerState;
1266 tPmcSwitchState hwWlanSwitchState;
1267 tPmcSwitchState swWlanSwitchState;
1268 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1269
1270 do
1271 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001272
1273 Msg.messageType = eWNI_SME_SYS_READY_IND;
1274 Msg.length = sizeof( tSirSmeReadyReq );
1275
1276 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1277 {
1278 status = eHAL_STATUS_SUCCESS;
1279 }
1280 else
1281 {
1282 smsLog( pMac, LOGE,
1283 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1284 break;
1285 }
1286
1287 status = pmcQueryPowerState( hHal, &powerState,
1288 &hwWlanSwitchState, &swWlanSwitchState );
1289 if ( ! HAL_STATUS_SUCCESS( status ) )
1290 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001291 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001292 status );
1293 break;
1294 }
1295
1296 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1297 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1298 {
1299 status = csrReady(pMac);
1300 if ( ! HAL_STATUS_SUCCESS( status ) )
1301 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001302 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001303 break;
1304 }
1305 status = pmcReady(hHal);
1306 if ( ! HAL_STATUS_SUCCESS( status ) )
1307 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001308 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001309 break;
1310 }
1311#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1312 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1313 {
1314 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001315 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001316 break;
1317 }
1318#endif
1319
1320#if defined WLAN_FEATURE_VOWIFI
1321 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1322 {
1323 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001324 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001325 break;
1326 }
1327#endif
1328 }
1329 pMac->sme.state = SME_STATE_READY;
1330 } while( 0 );
1331
1332 return status;
1333}
1334
1335/*--------------------------------------------------------------------------
1336
1337 \brief sme_Start() - Put all SME modules at ready state.
1338
1339 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1340 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001341 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001342 \param hHal - The handle returned by macOpen.
1343
1344 \return eHAL_STATUS_SUCCESS - SME is ready.
1345
1346 Other status means SME is failed to start
1347 \sa
1348
1349 --------------------------------------------------------------------------*/
1350eHalStatus sme_Start(tHalHandle hHal)
1351{
1352 eHalStatus status = eHAL_STATUS_FAILURE;
1353 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1354
1355 do
1356 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001357 status = csrStart(pMac);
1358 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001359 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001360 status );
1361 break;
1362 }
1363
1364 status = pmcStart(hHal);
1365 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001366 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001367 status );
1368 break;
1369 }
1370
Jeff Johnson295189b2012-06-20 16:38:30 -07001371 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1372 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001373 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001374 status );
1375 break;
1376 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001377 pMac->sme.state = SME_STATE_START;
1378 }while (0);
1379
1380 return status;
1381}
1382
1383
1384#ifdef WLAN_FEATURE_PACKET_FILTERING
1385/******************************************************************************
1386*
1387* Name: sme_PCFilterMatchCountResponseHandler
1388*
1389* Description:
1390* Invoke Packet Coalescing Filter Match Count callback routine
1391*
1392* Parameters:
1393* hHal - HAL handle for device
1394* pMsg - Pointer to tRcvFltPktMatchRsp structure
1395*
1396* Returns: eHalStatus
1397*
1398******************************************************************************/
1399eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1400{
1401 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1402 eHalStatus status = eHAL_STATUS_SUCCESS;
1403 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1404
1405 if (NULL == pMsg)
1406 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001407 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001408 status = eHAL_STATUS_FAILURE;
1409 }
1410 else
1411 {
1412 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001413 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001414
1415 /* Call Packet Coalescing Filter Match Count callback routine. */
1416 if (pMac->pmc.FilterMatchCountCB != NULL)
1417 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1418 pRcvFltPktMatchRsp);
1419
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001420 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001421 pRcvFltPktMatchRsp->status);
1422
1423 pMac->pmc.FilterMatchCountCB = NULL;
1424 pMac->pmc.FilterMatchCountCBContext = NULL;
1425 }
1426
1427 return(status);
1428}
1429#endif // WLAN_FEATURE_PACKET_FILTERING
1430
1431
Chet Lanctot186b5732013-03-18 10:26:30 -07001432#ifdef WLAN_FEATURE_11W
1433/*------------------------------------------------------------------
1434 *
1435 * Handle the unprotected management frame indication from LIM and
1436 * forward it to HDD.
1437 *
1438 *------------------------------------------------------------------*/
1439
1440eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1441 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1442{
1443 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1444 eHalStatus status = eHAL_STATUS_SUCCESS;
1445 tCsrRoamInfo pRoamInfo = {0};
1446 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1447
1448 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1449 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1450 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1451
1452 /* forward the mgmt frame to HDD */
1453 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1454
1455 return status;
1456}
1457#endif
1458
1459
Jeff Johnson295189b2012-06-20 16:38:30 -07001460/*--------------------------------------------------------------------------
1461
1462 \brief sme_ProcessMsg() - The main message processor for SME.
1463
1464 The function is called by a message dispatcher when to process a message
1465 targeted for SME.
1466
Srinivas Girigowdade697412013-02-14 16:31:48 -08001467 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001468 \param hHal - The handle returned by macOpen.
1469 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1470
1471 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1472
1473 Other status means SME failed to process the message to HAL.
1474 \sa
1475
1476 --------------------------------------------------------------------------*/
1477eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1478{
1479 eHalStatus status = eHAL_STATUS_FAILURE;
1480 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1481
1482 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001483 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001484 return status;
1485 }
1486
1487 status = sme_AcquireGlobalLock( &pMac->sme );
1488 if ( HAL_STATUS_SUCCESS( status ) )
1489 {
1490 if( SME_IS_START(pMac) )
1491 {
1492 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1493 case eWNI_PMC_ENTER_BMPS_RSP:
1494 case eWNI_PMC_EXIT_BMPS_RSP:
1495 case eWNI_PMC_EXIT_BMPS_IND:
1496 case eWNI_PMC_ENTER_IMPS_RSP:
1497 case eWNI_PMC_EXIT_IMPS_RSP:
1498 case eWNI_PMC_SMPS_STATE_IND:
1499 case eWNI_PMC_ENTER_UAPSD_RSP:
1500 case eWNI_PMC_EXIT_UAPSD_RSP:
1501 case eWNI_PMC_ENTER_WOWL_RSP:
1502 case eWNI_PMC_EXIT_WOWL_RSP:
1503 //PMC
1504 if (pMsg->bodyptr)
1505 {
1506 pmcMessageProcessor(hHal, pMsg->bodyptr);
1507 status = eHAL_STATUS_SUCCESS;
1508 vos_mem_free( pMsg->bodyptr );
1509 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001510 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001511 }
1512 break;
1513
1514 case WNI_CFG_SET_CNF:
1515 case WNI_CFG_DNLD_CNF:
1516 case WNI_CFG_GET_RSP:
1517 case WNI_CFG_ADD_GRP_ADDR_CNF:
1518 case WNI_CFG_DEL_GRP_ADDR_CNF:
1519 //CCM
1520 if (pMsg->bodyptr)
1521 {
1522 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1523 status = eHAL_STATUS_SUCCESS;
1524 vos_mem_free( pMsg->bodyptr );
1525 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001526 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001527 }
1528 break;
1529
1530 case eWNI_SME_ADDTS_RSP:
1531 case eWNI_SME_DELTS_RSP:
1532 case eWNI_SME_DELTS_IND:
1533#ifdef WLAN_FEATURE_VOWIFI_11R
1534 case eWNI_SME_FT_AGGR_QOS_RSP:
1535#endif
1536 //QoS
1537 if (pMsg->bodyptr)
1538 {
1539#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1540 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
1541 vos_mem_free( pMsg->bodyptr );
1542#endif
1543 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001544 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001545 }
1546 break;
1547#if defined WLAN_FEATURE_VOWIFI
1548 case eWNI_SME_NEIGHBOR_REPORT_IND:
1549 case eWNI_SME_BEACON_REPORT_REQ_IND:
1550#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001551 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001552#endif
1553 if ( pMsg->bodyptr )
1554 {
1555 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
1556 vos_mem_free( pMsg->bodyptr );
1557 }
1558 else
1559 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001560 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001561 }
1562 break;
1563#endif
1564
Jeff Johnsone7245742012-09-05 17:12:55 -07001565#ifdef FEATURE_OEM_DATA_SUPPORT
1566 //Handle the eWNI_SME_OEM_DATA_RSP:
1567 case eWNI_SME_OEM_DATA_RSP:
1568 if(pMsg->bodyptr)
1569 {
1570 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
1571 vos_mem_free(pMsg->bodyptr);
1572 }
1573 else
1574 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001575 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07001576 }
1577 smeProcessPendingQueue( pMac );
1578 break;
1579#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001580
1581 case eWNI_SME_ADD_STA_SELF_RSP:
1582 if(pMsg->bodyptr)
1583 {
1584 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
1585 vos_mem_free(pMsg->bodyptr);
1586 }
1587 else
1588 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001589 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001590 }
1591 break;
1592 case eWNI_SME_DEL_STA_SELF_RSP:
1593 if(pMsg->bodyptr)
1594 {
1595 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
1596 vos_mem_free(pMsg->bodyptr);
1597 }
1598 else
1599 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001600 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001601 }
1602 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001603 case eWNI_SME_REMAIN_ON_CHN_RSP:
1604 if(pMsg->bodyptr)
1605 {
1606 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
1607 vos_mem_free(pMsg->bodyptr);
1608 }
1609 else
1610 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001611 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001612 }
1613 break;
1614 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
1615 if(pMsg->bodyptr)
1616 {
1617 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
1618 vos_mem_free(pMsg->bodyptr);
1619 }
1620 else
1621 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001622 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 -07001623 }
1624 break;
1625 case eWNI_SME_MGMT_FRM_IND:
1626 if(pMsg->bodyptr)
1627 {
1628 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
1629 vos_mem_free(pMsg->bodyptr);
1630 }
1631 else
1632 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001633 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001634 }
1635 break;
1636 case eWNI_SME_ACTION_FRAME_SEND_CNF:
1637 if(pMsg->bodyptr)
1638 {
1639 status = sme_sendActionCnf(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_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001645 }
1646 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001647 case eWNI_SME_COEX_IND:
1648 if(pMsg->bodyptr)
1649 {
1650 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
1651 vos_mem_free(pMsg->bodyptr);
1652 }
1653 else
1654 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001655 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001656 }
1657 break;
1658
1659#ifdef FEATURE_WLAN_SCAN_PNO
1660 case eWNI_SME_PREF_NETWORK_FOUND_IND:
1661 if(pMsg->bodyptr)
1662 {
1663 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
1664 vos_mem_free(pMsg->bodyptr);
1665 }
1666 else
1667 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001668 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001669 }
1670 break;
1671#endif // FEATURE_WLAN_SCAN_PNO
1672
1673 case eWNI_SME_TX_PER_HIT_IND:
1674 if (pMac->sme.pTxPerHitCallback)
1675 {
1676 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
1677 }
1678 break;
1679
1680 case eWNI_SME_CHANGE_COUNTRY_CODE:
1681 if(pMsg->bodyptr)
1682 {
1683 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
1684 vos_mem_free(pMsg->bodyptr);
1685 }
1686 else
1687 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001688 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001689 }
1690 break;
1691
1692#ifdef WLAN_FEATURE_PACKET_FILTERING
1693 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
1694 if(pMsg->bodyptr)
1695 {
1696 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
1697 vos_mem_free(pMsg->bodyptr);
1698 }
1699 else
1700 {
1701 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001702 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001703 }
1704 break;
1705#endif // WLAN_FEATURE_PACKET_FILTERING
1706 case eWNI_SME_PRE_SWITCH_CHL_IND:
1707 {
1708 status = sme_HandlePreChannelSwitchInd(pMac);
1709 break;
1710 }
1711
1712 case eWNI_SME_POST_SWITCH_CHL_IND:
1713 {
1714 status = sme_HandlePostChannelSwitchInd(pMac);
1715 break;
1716 }
1717
1718#ifdef WLAN_WAKEUP_EVENTS
1719 case eWNI_SME_WAKE_REASON_IND:
1720 if(pMsg->bodyptr)
1721 {
1722 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
1723 vos_mem_free(pMsg->bodyptr);
1724 }
1725 else
1726 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001727 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001728 }
1729 break;
1730#endif // WLAN_WAKEUP_EVENTS
1731
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001732#ifdef FEATURE_WLAN_TDLS
1733 /*
1734 * command rescived from PE, SME tdls msg processor shall be called
1735 * to process commands recieved from PE
1736 */
1737 case eWNI_SME_TDLS_SEND_MGMT_RSP:
1738 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08001739 case eWNI_SME_TDLS_DEL_STA_RSP:
1740 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001741 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001742 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301743 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Gopichand Nakkala78a6c812013-05-13 16:39:49 +05301744#ifdef FEATURE_WLAN_TDLS_OXYGEN_DISAPPEAR_AP
1745 case eWNI_SME_TDLS_AP_DISAPPEAR_IND:
1746#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001747#ifdef FEATURE_WLAN_TDLS_INTERNAL
1748 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
1749 case eWNI_SME_TDLS_DISCOVERY_START_IND:
1750 case eWNI_SME_TDLS_LINK_START_RSP:
1751 case eWNI_SME_TDLS_LINK_START_IND:
1752 case eWNI_SME_TDLS_TEARDOWN_RSP:
1753 case eWNI_SME_TDLS_TEARDOWN_IND:
1754 case eWNI_SME_ADD_TDLS_PEER_IND:
1755 case eWNI_SME_DELETE_TDLS_PEER_IND:
1756#endif
1757 {
1758 if (pMsg->bodyptr)
1759 {
1760 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
1761 vos_mem_free( pMsg->bodyptr );
1762 }
1763 else
1764 {
1765 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001766 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001767 }
1768 break;
1769 }
1770#endif
1771
Chet Lanctot186b5732013-03-18 10:26:30 -07001772#ifdef WLAN_FEATURE_11W
1773 case eWNI_SME_UNPROT_MGMT_FRM_IND:
1774 if (pMsg->bodyptr)
1775 {
1776 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
1777 vos_mem_free(pMsg->bodyptr);
1778 }
1779 else
1780 {
1781 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
1782 }
1783 break;
1784#endif
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07001785#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1786 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
1787 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
1788 break;
1789#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07001790
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301791#ifdef WLAN_FEATURE_GTK_OFFLOAD
1792 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
1793 if (pMsg->bodyptr)
1794 {
1795 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
1796 vos_mem_free(pMsg->bodyptr);
1797 }
1798 else
1799 {
1800 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
1801 }
1802 break ;
1803#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001804 default:
1805
1806 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
1807 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
1808 {
1809 //CSR
1810 if (pMsg->bodyptr)
1811 {
1812 status = csrMsgProcessor(hHal, pMsg->bodyptr);
1813 vos_mem_free( pMsg->bodyptr );
1814 }
1815 else
1816 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001817 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001818 }
1819 }
1820 else
1821 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001822 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07001823 pMsg->type);
1824 if (pMsg->bodyptr)
1825 {
1826 vos_mem_free( pMsg->bodyptr );
1827 }
1828 }
1829 }//switch
1830 } //SME_IS_START
1831 else
1832 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001833 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001834 if (pMsg->bodyptr)
1835 {
1836 vos_mem_free( pMsg->bodyptr );
1837 }
1838 }
1839 sme_ReleaseGlobalLock( &pMac->sme );
1840 }
1841 else
1842 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001843 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07001844 if (pMsg->bodyptr)
1845 {
1846 vos_mem_free( pMsg->bodyptr );
1847 }
1848 }
1849
1850 return status;
1851}
1852
1853
1854//No need to hold the global lock here because this function can only be called
1855//after sme_Stop.
1856v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
1857{
1858 if( pMsg )
1859 {
1860 if (pMsg->bodyptr)
1861 {
1862 vos_mem_free( pMsg->bodyptr );
1863 }
1864 }
1865
1866}
1867
1868
1869/*--------------------------------------------------------------------------
1870
1871 \brief sme_Stop() - Stop all SME modules and put them at idle state
1872
1873 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
1874 return, all modules are at idle state ready to start.
1875
Srinivas Girigowdade697412013-02-14 16:31:48 -08001876 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001877 \param hHal - The handle returned by macOpen
1878
1879 \return eHAL_STATUS_SUCCESS - SME is stopped.
1880
1881 Other status means SME is failed to stop but caller should still
1882 consider SME is stopped.
1883 \sa
1884
1885 --------------------------------------------------------------------------*/
1886eHalStatus sme_Stop(tHalHandle hHal, tANI_BOOLEAN pmcFlag)
1887{
1888 eHalStatus status = eHAL_STATUS_FAILURE;
1889 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
1890 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1891
Jeff Johnson295189b2012-06-20 16:38:30 -07001892 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1893 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001894 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001895 status );
1896 fail_status = status;
1897 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001898
1899 p2pStop(hHal);
1900
1901 if(pmcFlag)
1902 {
1903 status = pmcStop(hHal);
1904 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001905 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001906 status );
1907 fail_status = status;
1908 }
1909 }
1910
1911 status = csrStop(pMac);
1912 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001913 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001914 status );
1915 fail_status = status;
1916 }
1917
1918 ccmStop(hHal);
1919
1920 purgeSmeCmdList(pMac);
1921
1922 if (!HAL_STATUS_SUCCESS( fail_status )) {
1923 status = fail_status;
1924 }
1925
1926 pMac->sme.state = SME_STATE_STOP;
1927
1928 return status;
1929}
1930
1931/*--------------------------------------------------------------------------
1932
1933 \brief sme_Close() - Release all SME modules and their resources.
1934
1935 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
1936 return, all modules are at closed state.
1937
1938 No SME APIs can be involved after smeClose except smeOpen.
1939 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001940 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001941 \param hHal - The handle returned by macOpen
1942
1943 \return eHAL_STATUS_SUCCESS - SME is successfully close.
1944
1945 Other status means SME is failed to be closed but caller still cannot
1946 call any other SME functions except smeOpen.
1947 \sa
1948
1949 --------------------------------------------------------------------------*/
1950eHalStatus sme_Close(tHalHandle hHal)
1951{
1952 eHalStatus status = eHAL_STATUS_FAILURE;
1953 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
1954 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1955
1956 status = csrClose(pMac);
1957 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001958 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001959 status );
1960 fail_status = status;
1961 }
1962
Jeff Johnson295189b2012-06-20 16:38:30 -07001963 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1964 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001965 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001966 status );
1967 fail_status = status;
1968 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001969
1970#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1971 status = btcClose(hHal);
1972 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001973 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001974 status );
1975 fail_status = status;
1976 }
1977
1978 status = sme_QosClose(pMac);
1979 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001980 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001981 status );
1982 fail_status = status;
1983 }
1984#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001985#ifdef FEATURE_OEM_DATA_SUPPORT
1986 status = oemData_OemDataReqClose(hHal);
1987 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001988 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07001989 status );
1990 fail_status = status;
1991 }
1992#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001993
1994 status = ccmClose(hHal);
1995 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001996 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001997 status );
1998 fail_status = status;
1999 }
2000
2001 status = pmcClose(hHal);
2002 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002003 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002004 status );
2005 fail_status = status;
2006 }
2007#if defined WLAN_FEATURE_VOWIFI
2008 status = rrmClose(hHal);
2009 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002010 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002011 status );
2012 fail_status = status;
2013 }
2014#endif
2015
2016#if defined WLAN_FEATURE_VOWIFI_11R
2017 sme_FTClose(hHal);
2018#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002020
2021 freeSmeCmdList(pMac);
2022
2023 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2024 {
2025 fail_status = eHAL_STATUS_FAILURE;
2026 }
2027
2028 if (!HAL_STATUS_SUCCESS( fail_status )) {
2029 status = fail_status;
2030 }
2031
2032 pMac->sme.state = SME_STATE_STOP;
2033
2034 return status;
2035}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002036#ifdef FEATURE_WLAN_LFR
2037tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2038{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002039#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002040 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2041 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2042 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2043 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2044 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2045 return eANI_BOOLEAN_FALSE;
2046 default:
2047 return eANI_BOOLEAN_TRUE;
2048 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002049#else
2050 /*
2051 * TODO: always return TRUE for now until
2052 * we figure out why we could be stuck in
2053 * one of the roaming states forever.
2054 */
2055 return eANI_BOOLEAN_TRUE;
2056#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002057}
2058#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002059/* ---------------------------------------------------------------------------
2060 \fn sme_ScanRequest
2061 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002062 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002063 \param pScanRequestID - pointer to an object to get back the request ID
2064 \param callback - a callback function that scan calls upon finish, will not
2065 be called if csrScanRequest returns error
2066 \param pContext - a pointer passed in for the callback
2067 \return eHalStatus
2068 ---------------------------------------------------------------------------*/
2069eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2070 tANI_U32 *pScanRequestID,
2071 csrScanCompleteCallback callback, void *pContext)
2072{
2073 eHalStatus status = eHAL_STATUS_FAILURE;
2074 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2075
2076 smsLog(pMac, LOG2, FL("enter"));
2077 do
2078 {
2079 if(pMac->scan.fScanEnable)
2080 {
2081 status = sme_AcquireGlobalLock( &pMac->sme );
2082 if ( HAL_STATUS_SUCCESS( status ) )
2083 {
2084 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002085#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002086 if(csrIsScanAllowed(pMac))
2087 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002088#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002089 status = csrScanRequest( hHal, sessionId, pscanReq,
2090 pScanRequestID, callback, pContext );
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002091#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002092 }
2093 else
2094 {
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002095 smsLog(pMac, LOGE, FL("Scan denied in state %d (sub-state %d)"),
2096 pMac->roam.neighborRoamInfo.neighborRoamState,
2097 pMac->roam.curSubState[sessionId]);
2098 /*HandOff is in progress. So schedule this scan later*/
2099 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002100 }
2101#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002102 }
2103
2104 sme_ReleaseGlobalLock( &pMac->sme );
2105 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002106 else
2107 {
2108 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2109 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002110 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002111 else
2112 {
2113 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2114 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002115 } while( 0 );
2116
2117 return (status);
2118
2119
2120}
2121
2122/* ---------------------------------------------------------------------------
2123 \fn sme_ScanGetResult
2124 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002125 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002126 \param pFilter - If pFilter is NULL, all cached results are returned
2127 \param phResult - an object for the result.
2128 \return eHalStatus
2129 ---------------------------------------------------------------------------*/
2130eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2131 tScanResultHandle *phResult)
2132{
2133 eHalStatus status = eHAL_STATUS_FAILURE;
2134 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2135
2136 smsLog(pMac, LOG2, FL("enter"));
2137 status = sme_AcquireGlobalLock( &pMac->sme );
2138 if ( HAL_STATUS_SUCCESS( status ) )
2139 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002140 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002141 sme_ReleaseGlobalLock( &pMac->sme );
2142 }
2143 smsLog(pMac, LOG2, FL("exit status %d"), status);
2144
2145 return (status);
2146}
2147
2148
2149/* ---------------------------------------------------------------------------
2150 \fn sme_ScanFlushResult
2151 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002152 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002153 \return eHalStatus
2154 ---------------------------------------------------------------------------*/
2155eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2156{
2157 eHalStatus status = eHAL_STATUS_FAILURE;
2158 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2159
2160 status = sme_AcquireGlobalLock( &pMac->sme );
2161 if ( HAL_STATUS_SUCCESS( status ) )
2162 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002163 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002164 sme_ReleaseGlobalLock( &pMac->sme );
2165 }
2166
2167 return (status);
2168}
2169
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002170eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2171{
2172 eHalStatus status = eHAL_STATUS_FAILURE;
2173 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2174
2175 status = sme_AcquireGlobalLock( &pMac->sme );
2176 if ( HAL_STATUS_SUCCESS( status ) )
2177 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302178 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002179 sme_ReleaseGlobalLock( &pMac->sme );
2180 }
2181
2182 return (status);
2183}
Jeff Johnson295189b2012-06-20 16:38:30 -07002184
2185/* ---------------------------------------------------------------------------
2186 \fn sme_ScanResultGetFirst
2187 \brief a wrapper function to request CSR to returns the first element of
2188 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002189 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002190 \param hScanResult - returned from csrScanGetResult
2191 \return tCsrScanResultInfo * - NULL if no result
2192 ---------------------------------------------------------------------------*/
2193tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2194 tScanResultHandle hScanResult)
2195{
2196 eHalStatus status = eHAL_STATUS_FAILURE;
2197 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2198 tCsrScanResultInfo *pRet = NULL;
2199
2200 status = sme_AcquireGlobalLock( &pMac->sme );
2201 if ( HAL_STATUS_SUCCESS( status ) )
2202 {
2203 pRet = csrScanResultGetFirst( pMac, hScanResult );
2204 sme_ReleaseGlobalLock( &pMac->sme );
2205 }
2206
2207 return (pRet);
2208}
2209
2210
2211/* ---------------------------------------------------------------------------
2212 \fn sme_ScanResultGetNext
2213 \brief a wrapper function to request CSR to returns the next element of
2214 scan result. It can be called without calling csrScanResultGetFirst
2215 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002216 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002217 \param hScanResult - returned from csrScanGetResult
2218 \return Null if no result or reach the end
2219 ---------------------------------------------------------------------------*/
2220tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2221 tScanResultHandle hScanResult)
2222{
2223 eHalStatus status = eHAL_STATUS_FAILURE;
2224 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2225 tCsrScanResultInfo *pRet = NULL;
2226
2227 status = sme_AcquireGlobalLock( &pMac->sme );
2228 if ( HAL_STATUS_SUCCESS( status ) )
2229 {
2230 pRet = csrScanResultGetNext( pMac, hScanResult );
2231 sme_ReleaseGlobalLock( &pMac->sme );
2232 }
2233
2234 return (pRet);
2235}
2236
2237
2238/* ---------------------------------------------------------------------------
2239 \fn sme_ScanSetBGScanparams
2240 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002241 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002242 \param pScanReq - BG scan request structure
2243 \return eHalStatus
2244 ---------------------------------------------------------------------------*/
2245eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2246{
2247 eHalStatus status = eHAL_STATUS_FAILURE;
2248 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2249
2250 if( NULL != pScanReq )
2251 {
2252 status = sme_AcquireGlobalLock( &pMac->sme );
2253 if ( HAL_STATUS_SUCCESS( status ) )
2254 {
2255 status = csrScanSetBGScanparams( hHal, pScanReq );
2256 sme_ReleaseGlobalLock( &pMac->sme );
2257 }
2258 }
2259
2260 return (status);
2261}
2262
2263
2264/* ---------------------------------------------------------------------------
2265 \fn sme_ScanResultPurge
2266 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2267 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002268 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 \param hScanResult - returned from csrScanGetResult. hScanResult is
2270 considered gone by
2271 calling this function and even before this function reutrns.
2272 \return eHalStatus
2273 ---------------------------------------------------------------------------*/
2274eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2275{
2276 eHalStatus status = eHAL_STATUS_FAILURE;
2277 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2278
2279 status = sme_AcquireGlobalLock( &pMac->sme );
2280 if ( HAL_STATUS_SUCCESS( status ) )
2281 {
2282 status = csrScanResultPurge( hHal, hScanResult );
2283 sme_ReleaseGlobalLock( &pMac->sme );
2284 }
2285
2286 return (status);
2287}
2288
2289/* ---------------------------------------------------------------------------
2290 \fn sme_ScanGetPMKIDCandidateList
2291 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002292 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002293 \param pPmkidList - caller allocated buffer point to an array of
2294 tPmkidCandidateInfo
2295 \param pNumItems - pointer to a variable that has the number of
2296 tPmkidCandidateInfo allocated when retruning, this is
2297 either the number needed or number of items put into
2298 pPmkidList
2299 \return eHalStatus - when fail, it usually means the buffer allocated is not
2300 big enough and pNumItems
2301 has the number of tPmkidCandidateInfo.
2302 \Note: pNumItems is a number of tPmkidCandidateInfo,
2303 not sizeof(tPmkidCandidateInfo) * something
2304 ---------------------------------------------------------------------------*/
2305eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
2306 tPmkidCandidateInfo *pPmkidList,
2307 tANI_U32 *pNumItems )
2308{
2309 eHalStatus status = eHAL_STATUS_FAILURE;
2310 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2311
2312 status = sme_AcquireGlobalLock( &pMac->sme );
2313 if ( HAL_STATUS_SUCCESS( status ) )
2314 {
2315 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2316 sme_ReleaseGlobalLock( &pMac->sme );
2317 }
2318
2319 return (status);
2320}
2321
2322/*----------------------------------------------------------------------------
2323 \fn sme_RoamRegisterLinkQualityIndCallback
2324
2325 \brief
2326 a wrapper function to allow HDD to register a callback handler with CSR for
2327 link quality indications.
2328
2329 Only one callback may be registered at any time.
2330 In order to deregister the callback, a NULL cback may be provided.
2331
2332 Registration happens in the task context of the caller.
2333
2334 \param callback - Call back being registered
2335 \param pContext - user data
2336
2337 DEPENDENCIES: After CSR open
2338
2339 \return eHalStatus
2340-----------------------------------------------------------------------------*/
2341eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2342 csrRoamLinkQualityIndCallback callback,
2343 void *pContext)
2344{
2345 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2346}
2347
2348/* ---------------------------------------------------------------------------
2349 \fn sme_RoamRegisterCallback
2350 \brief a wrapper function to allow HDD to register a callback with CSR.
2351 Unlike scan, roam has one callback for all the roam requests
2352 \param callback - a callback function that roam calls upon when state changes
2353 \param pContext - a pointer passed in for the callback
2354 \return eHalStatus
2355 ---------------------------------------------------------------------------*/
2356eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2357 csrRoamCompleteCallback callback,
2358 void *pContext)
2359{
2360 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2361}
2362
2363eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2364{
2365 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2366 return pMac->roam.configParam.phyMode;
2367}
2368
2369/* ---------------------------------------------------------------------------
2370 \fn sme_RoamConnect
2371 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002372 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002373 \param sessionId - the sessionId returned by sme_OpenSession.
2374 \param pProfile - description of the network to which to connect
2375 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2376 from csrScanGetResult
2377 \param pRoamId - to get back the request ID
2378 \return eHalStatus
2379 ---------------------------------------------------------------------------*/
2380eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2381 tANI_U32 *pRoamId)
2382{
2383 eHalStatus status = eHAL_STATUS_FAILURE;
2384 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2385
2386 smsLog(pMac, LOG2, FL("enter"));
2387 status = sme_AcquireGlobalLock( &pMac->sme );
2388 if ( HAL_STATUS_SUCCESS( status ) )
2389 {
2390 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2391 {
2392 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2393 }
2394 else
2395 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002396 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002397 status = eHAL_STATUS_INVALID_PARAMETER;
2398 }
2399 sme_ReleaseGlobalLock( &pMac->sme );
2400 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002401 else
2402 {
2403 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2404 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002405
2406 return (status);
2407}
2408
2409/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05302410
2411 \fn sme_SetPhyMode
2412
2413 \brief Changes the PhyMode.
2414
2415 \param hHal - The handle returned by macOpen.
2416
2417 \param phyMode new phyMode which is to set
2418
2419 \return eHalStatus SUCCESS.
2420
2421 -------------------------------------------------------------------------------*/
2422eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
2423{
2424 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2425
2426 if (NULL == pMac)
2427 {
2428 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2429 "%s: invalid context", __func__);
2430 return eHAL_STATUS_FAILURE;
2431 }
2432
2433 pMac->roam.configParam.phyMode = phyMode;
2434 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
2435 pMac->roam.configParam.phyMode,
2436 pMac->roam.configParam.ProprietaryRatesEnabled);
2437
2438 return eHAL_STATUS_SUCCESS;
2439}
2440
2441/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07002442 \fn sme_RoamReassoc
2443 \brief a wrapper function to request CSR to inititiate a re-association
2444 \param pProfile - can be NULL to join the currently connected AP. In that
2445 case modProfileFields should carry the modified field(s) which could trigger
2446 reassoc
2447 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2448 that might need modification dynamically once STA is up & running and this
2449 could trigger a reassoc
2450 \param pRoamId - to get back the request ID
2451 \return eHalStatus
2452 -------------------------------------------------------------------------------*/
2453eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2454 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002455 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002456{
2457 eHalStatus status = eHAL_STATUS_FAILURE;
2458 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2459
2460 smsLog(pMac, LOG2, FL("enter"));
2461 status = sme_AcquireGlobalLock( &pMac->sme );
2462 if ( HAL_STATUS_SUCCESS( status ) )
2463 {
2464 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2465 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07002466 if((NULL == pProfile) && (fForce == 1))
2467 {
2468 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
2469 /* to force the AP initiate fresh 802.1x authentication need to clear
2470 * the PMKID cache for that set the following boolean. this is needed
2471 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
2472 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002473 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
2474 }
2475 else
2476 {
2477 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
2478 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002479 }
2480 else
2481 {
2482 status = eHAL_STATUS_INVALID_PARAMETER;
2483 }
2484 sme_ReleaseGlobalLock( &pMac->sme );
2485 }
2486
2487 return (status);
2488}
2489
2490/* ---------------------------------------------------------------------------
2491 \fn sme_RoamConnectToLastProfile
2492 \brief a wrapper function to request CSR to disconnect and reconnect with
2493 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08002494 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002495 \return eHalStatus. It returns fail if currently connected
2496 ---------------------------------------------------------------------------*/
2497eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
2498{
2499 eHalStatus status = eHAL_STATUS_FAILURE;
2500 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2501
2502 status = sme_AcquireGlobalLock( &pMac->sme );
2503 if ( HAL_STATUS_SUCCESS( status ) )
2504 {
2505 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2506 {
2507 status = csrRoamConnectToLastProfile( pMac, sessionId );
2508 }
2509 else
2510 {
2511 status = eHAL_STATUS_INVALID_PARAMETER;
2512 }
2513 sme_ReleaseGlobalLock( &pMac->sme );
2514 }
2515
2516 return (status);
2517}
2518
2519/* ---------------------------------------------------------------------------
2520 \fn sme_RoamDisconnect
2521 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08002522 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002523 \param reason -- To indicate the reason for disconnecting. Currently, only
2524 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
2525 \return eHalStatus
2526 ---------------------------------------------------------------------------*/
2527eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
2528{
2529 eHalStatus status = eHAL_STATUS_FAILURE;
2530 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2531
2532 smsLog(pMac, LOG2, FL("enter"));
2533 status = sme_AcquireGlobalLock( &pMac->sme );
2534 if ( HAL_STATUS_SUCCESS( status ) )
2535 {
2536 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2537 {
2538 status = csrRoamDisconnect( pMac, sessionId, reason );
2539 }
2540 else
2541 {
2542 status = eHAL_STATUS_INVALID_PARAMETER;
2543 }
2544 sme_ReleaseGlobalLock( &pMac->sme );
2545 }
2546
2547 return (status);
2548}
2549
Jeff Johnson295189b2012-06-20 16:38:30 -07002550/* ---------------------------------------------------------------------------
2551 \fn sme_RoamStopBss
2552 \brief To stop BSS for Soft AP. This is an asynchronous API.
2553 \param hHal - Global structure
2554 \param sessionId - sessionId of SoftAP
2555 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2556 -------------------------------------------------------------------------------*/
2557eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
2558{
2559 eHalStatus status = eHAL_STATUS_FAILURE;
2560 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2561
2562 smsLog(pMac, LOG2, FL("enter"));
2563 status = sme_AcquireGlobalLock( &pMac->sme );
2564 if ( HAL_STATUS_SUCCESS( status ) )
2565 {
2566 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2567 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05302568 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07002569 }
2570 else
2571 {
2572 status = eHAL_STATUS_INVALID_PARAMETER;
2573 }
2574 sme_ReleaseGlobalLock( &pMac->sme );
2575 }
2576
2577 return (status);
2578}
2579
2580/* ---------------------------------------------------------------------------
2581 \fn sme_RoamDisconnectSta
2582 \brief To disassociate a station. This is an asynchronous API.
2583 \param hHal - Global structure
2584 \param sessionId - sessionId of SoftAP
2585 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2586 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2587 -------------------------------------------------------------------------------*/
2588eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
2589 tANI_U8 *pPeerMacAddr)
2590{
2591 eHalStatus status = eHAL_STATUS_FAILURE;
2592 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2593
2594 if ( NULL == pMac )
2595 {
2596 VOS_ASSERT(0);
2597 return status;
2598 }
2599
2600 status = sme_AcquireGlobalLock( &pMac->sme );
2601 if ( HAL_STATUS_SUCCESS( status ) )
2602 {
2603 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2604 {
2605 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302606 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002607 }
2608 else
2609 {
2610 status = eHAL_STATUS_INVALID_PARAMETER;
2611 }
2612 sme_ReleaseGlobalLock( &pMac->sme );
2613 }
2614
2615 return (status);
2616}
2617
2618/* ---------------------------------------------------------------------------
2619 \fn sme_RoamDeauthSta
2620 \brief To disassociate a station. This is an asynchronous API.
2621 \param hHal - Global structure
2622 \param sessionId - sessionId of SoftAP
2623 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2624 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2625 -------------------------------------------------------------------------------*/
2626eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
2627 tANI_U8 *pPeerMacAddr)
2628{
2629 eHalStatus status = eHAL_STATUS_FAILURE;
2630 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2631
2632 if ( NULL == pMac )
2633 {
2634 VOS_ASSERT(0);
2635 return status;
2636 }
2637
2638 status = sme_AcquireGlobalLock( &pMac->sme );
2639 if ( HAL_STATUS_SUCCESS( status ) )
2640 {
2641 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2642 {
2643 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302644 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002645 }
2646 else
2647 {
2648 status = eHAL_STATUS_INVALID_PARAMETER;
2649 }
2650 sme_ReleaseGlobalLock( &pMac->sme );
2651 }
2652
2653 return (status);
2654}
2655
2656/* ---------------------------------------------------------------------------
2657 \fn sme_RoamTKIPCounterMeasures
2658 \brief To start or stop TKIP counter measures. This is an asynchronous API.
2659 \param sessionId - sessionId of SoftAP
2660 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2661 \return eHalStatus
2662 -------------------------------------------------------------------------------*/
2663eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
2664 tANI_BOOLEAN bEnable)
2665{
2666 eHalStatus status = eHAL_STATUS_FAILURE;
2667 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2668
2669 if ( NULL == pMac )
2670 {
2671 VOS_ASSERT(0);
2672 return status;
2673 }
2674
2675 status = sme_AcquireGlobalLock( &pMac->sme );
2676 if ( HAL_STATUS_SUCCESS( status ) )
2677 {
2678 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2679 {
2680 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
2681 }
2682 else
2683 {
2684 status = eHAL_STATUS_INVALID_PARAMETER;
2685 }
2686 sme_ReleaseGlobalLock( &pMac->sme );
2687 }
2688
2689 return (status);
2690}
2691
2692/* ---------------------------------------------------------------------------
2693 \fn sme_RoamGetAssociatedStas
2694 \brief To probe the list of associated stations from various modules of CORE stack.
2695 \This is an asynchronous API.
2696 \param sessionId - sessionId of SoftAP
2697 \param modId - Module from whom list of associtated stations is to be probed.
2698 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
2699 \param pUsrContext - Opaque HDD context
2700 \param pfnSapEventCallback - Sap event callback in HDD
2701 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
2702 \return eHalStatus
2703 -------------------------------------------------------------------------------*/
2704eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
2705 VOS_MODULE_ID modId, void *pUsrContext,
2706 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
2707{
2708 eHalStatus status = eHAL_STATUS_FAILURE;
2709 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2710
2711 if ( NULL == pMac )
2712 {
2713 VOS_ASSERT(0);
2714 return status;
2715 }
2716
2717 status = sme_AcquireGlobalLock( &pMac->sme );
2718 if ( HAL_STATUS_SUCCESS( status ) )
2719 {
2720 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2721 {
2722 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
2723 }
2724 else
2725 {
2726 status = eHAL_STATUS_INVALID_PARAMETER;
2727 }
2728 sme_ReleaseGlobalLock( &pMac->sme );
2729 }
2730
2731 return (status);
2732}
2733
2734/* ---------------------------------------------------------------------------
2735 \fn sme_RoamGetWpsSessionOverlap
2736 \brief To get the WPS PBC session overlap information.
2737 \This is an asynchronous API.
2738 \param sessionId - sessionId of SoftAP
2739 \param pUsrContext - Opaque HDD context
2740 \param pfnSapEventCallback - Sap event callback in HDD
2741 \pRemoveMac - pointer to Mac address which needs to be removed from session
2742 \return eHalStatus
2743 -------------------------------------------------------------------------------*/
2744eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
2745 void *pUsrContext, void
2746 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
2747{
2748 eHalStatus status = eHAL_STATUS_FAILURE;
2749 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2750
2751 if ( NULL == pMac )
2752 {
2753 VOS_ASSERT(0);
2754 return status;
2755 }
2756
2757 status = sme_AcquireGlobalLock( &pMac->sme );
2758 if ( HAL_STATUS_SUCCESS( status ) )
2759 {
2760 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2761 {
2762 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
2763 }
2764 else
2765 {
2766 status = eHAL_STATUS_INVALID_PARAMETER;
2767 }
2768 sme_ReleaseGlobalLock( &pMac->sme );
2769 }
2770
2771 return (status);
2772}
2773
Jeff Johnson295189b2012-06-20 16:38:30 -07002774
2775/* ---------------------------------------------------------------------------
2776 \fn sme_RoamGetConnectState
2777 \brief a wrapper function to request CSR to return the current connect state
2778 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08002779 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002780 \return eHalStatus
2781 ---------------------------------------------------------------------------*/
2782eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
2783{
2784 eHalStatus status = eHAL_STATUS_FAILURE;
2785 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2786
2787 status = sme_AcquireGlobalLock( &pMac->sme );
2788 if ( HAL_STATUS_SUCCESS( status ) )
2789 {
2790 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2791 {
2792 status = csrRoamGetConnectState( pMac, sessionId, pState );
2793 }
2794 else
2795 {
2796 status = eHAL_STATUS_INVALID_PARAMETER;
2797 }
2798 sme_ReleaseGlobalLock( &pMac->sme );
2799 }
2800
2801 return (status);
2802}
2803
2804/* ---------------------------------------------------------------------------
2805 \fn sme_RoamGetConnectProfile
2806 \brief a wrapper function to request CSR to return the current connect
2807 profile. Caller must call csrRoamFreeConnectProfile after it is done
2808 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002809 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002810 \param pProfile - pointer to a caller allocated structure
2811 tCsrRoamConnectedProfile
2812 \return eHalStatus. Failure if not connected
2813 ---------------------------------------------------------------------------*/
2814eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
2815 tCsrRoamConnectedProfile *pProfile)
2816{
2817 eHalStatus status = eHAL_STATUS_FAILURE;
2818 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2819
2820 status = sme_AcquireGlobalLock( &pMac->sme );
2821 if ( HAL_STATUS_SUCCESS( status ) )
2822 {
2823 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2824 {
2825 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
2826 }
2827 else
2828 {
2829 status = eHAL_STATUS_INVALID_PARAMETER;
2830 }
2831 sme_ReleaseGlobalLock( &pMac->sme );
2832 }
2833
2834 return (status);
2835}
2836
2837/* ---------------------------------------------------------------------------
2838 \fn sme_RoamFreeConnectProfile
2839 \brief a wrapper function to request CSR to free and reinitialize the
2840 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002841 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002842 \param pProfile - pointer to a caller allocated structure
2843 tCsrRoamConnectedProfile
2844 \return eHalStatus.
2845 ---------------------------------------------------------------------------*/
2846eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
2847 tCsrRoamConnectedProfile *pProfile)
2848{
2849 eHalStatus status = eHAL_STATUS_FAILURE;
2850 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2851
2852 status = sme_AcquireGlobalLock( &pMac->sme );
2853 if ( HAL_STATUS_SUCCESS( status ) )
2854 {
2855 status = csrRoamFreeConnectProfile( pMac, pProfile );
2856 sme_ReleaseGlobalLock( &pMac->sme );
2857 }
2858
2859 return (status);
2860}
2861
2862/* ---------------------------------------------------------------------------
2863 \fn sme_RoamSetPMKIDCache
2864 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002865 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002866 \param pPMKIDCache - caller allocated buffer point to an array of
2867 tPmkidCacheInfo
2868 \param numItems - a variable that has the number of tPmkidCacheInfo
2869 allocated when retruning, this is either the number needed
2870 or number of items put into pPMKIDCache
2871 \return eHalStatus - when fail, it usually means the buffer allocated is not
2872 big enough and pNumItems has the number of
2873 tPmkidCacheInfo.
2874 \Note: pNumItems is a number of tPmkidCacheInfo,
2875 not sizeof(tPmkidCacheInfo) * something
2876 ---------------------------------------------------------------------------*/
2877eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
2878 tANI_U32 numItems )
2879{
2880 eHalStatus status = eHAL_STATUS_FAILURE;
2881 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2882
2883 status = sme_AcquireGlobalLock( &pMac->sme );
2884 if ( HAL_STATUS_SUCCESS( status ) )
2885 {
2886 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2887 {
2888 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
2889 }
2890 else
2891 {
2892 status = eHAL_STATUS_INVALID_PARAMETER;
2893 }
2894 sme_ReleaseGlobalLock( &pMac->sme );
2895 }
2896
2897 return (status);
2898}
2899
2900/* ---------------------------------------------------------------------------
2901 \fn sme_RoamGetSecurityReqIE
2902 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
2903 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08002904 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002905 \param pLen - caller allocated memory that has the length of pBuf as input.
2906 Upon returned, *pLen has the needed or IE length in pBuf.
2907 \param pBuf - Caller allocated memory that contain the IE field, if any,
2908 upon return
2909 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
2910 \return eHalStatus - when fail, it usually means the buffer allocated is not
2911 big enough
2912 ---------------------------------------------------------------------------*/
2913eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
2914 tANI_U8 *pBuf, eCsrSecurityType secType)
2915{
2916 eHalStatus status = eHAL_STATUS_FAILURE;
2917 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2918
2919 status = sme_AcquireGlobalLock( &pMac->sme );
2920 if ( HAL_STATUS_SUCCESS( status ) )
2921 {
2922 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2923 {
2924 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
2925 }
2926 else
2927 {
2928 status = eHAL_STATUS_INVALID_PARAMETER;
2929 }
2930 sme_ReleaseGlobalLock( &pMac->sme );
2931 }
2932
2933 return (status);
2934}
2935
2936/* ---------------------------------------------------------------------------
2937 \fn sme_RoamGetSecurityRspIE
2938 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
2939 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08002940 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002941 \param pLen - caller allocated memory that has the length of pBuf as input.
2942 Upon returned, *pLen has the needed or IE length in pBuf.
2943 \param pBuf - Caller allocated memory that contain the IE field, if any,
2944 upon return
2945 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
2946 \return eHalStatus - when fail, it usually means the buffer allocated is not
2947 big enough
2948 ---------------------------------------------------------------------------*/
2949eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
2950 tANI_U8 *pBuf, eCsrSecurityType secType)
2951{
2952 eHalStatus status = eHAL_STATUS_FAILURE;
2953 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2954
2955 status = sme_AcquireGlobalLock( &pMac->sme );
2956 if ( HAL_STATUS_SUCCESS( status ) )
2957 {
2958 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2959 {
2960 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
2961 }
2962 else
2963 {
2964 status = eHAL_STATUS_INVALID_PARAMETER;
2965 }
2966 sme_ReleaseGlobalLock( &pMac->sme );
2967 }
2968
2969 return (status);
2970
2971}
2972
2973
2974/* ---------------------------------------------------------------------------
2975 \fn sme_RoamGetNumPMKIDCache
2976 \brief a wrapper function to request CSR to return number of PMKID cache
2977 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08002978 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002979 \return tANI_U32 - the number of PMKID cache entries
2980 ---------------------------------------------------------------------------*/
2981tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
2982{
2983 eHalStatus status = eHAL_STATUS_FAILURE;
2984 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2985 tANI_U32 numPmkidCache = 0;
2986
2987 status = sme_AcquireGlobalLock( &pMac->sme );
2988 if ( HAL_STATUS_SUCCESS( status ) )
2989 {
2990 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2991 {
2992 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
2993 status = eHAL_STATUS_SUCCESS;
2994 }
2995 else
2996 {
2997 status = eHAL_STATUS_INVALID_PARAMETER;
2998 }
2999 sme_ReleaseGlobalLock( &pMac->sme );
3000 }
3001
3002 return (numPmkidCache);
3003}
3004
3005/* ---------------------------------------------------------------------------
3006 \fn sme_RoamGetPMKIDCache
3007 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003008 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003009 \param pNum - caller allocated memory that has the space of the number of
3010 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3011 needed or actually number in tPmkidCacheInfo.
3012 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3013 any, upon return
3014 \return eHalStatus - when fail, it usually means the buffer allocated is not
3015 big enough
3016 ---------------------------------------------------------------------------*/
3017eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3018 tPmkidCacheInfo *pPmkidCache)
3019{
3020 eHalStatus status = eHAL_STATUS_FAILURE;
3021 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3022
3023 status = sme_AcquireGlobalLock( &pMac->sme );
3024 if ( HAL_STATUS_SUCCESS( status ) )
3025 {
3026 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3027 {
3028 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3029 }
3030 else
3031 {
3032 status = eHAL_STATUS_INVALID_PARAMETER;
3033 }
3034 sme_ReleaseGlobalLock( &pMac->sme );
3035 }
3036
3037 return (status);
3038}
3039
3040
3041/* ---------------------------------------------------------------------------
3042 \fn sme_GetConfigParam
3043 \brief a wrapper function that HDD calls to get the global settings
3044 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003045 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003046 \param pParam - caller allocated memory
3047 \return eHalStatus
3048 ---------------------------------------------------------------------------*/
3049eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3050{
3051 eHalStatus status = eHAL_STATUS_FAILURE;
3052 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3053
3054 status = sme_AcquireGlobalLock( &pMac->sme );
3055 if ( HAL_STATUS_SUCCESS( status ) )
3056 {
3057 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3058 if (status != eHAL_STATUS_SUCCESS)
3059 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003060 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003061 sme_ReleaseGlobalLock( &pMac->sme );
3062 return status;
3063 }
3064#if defined WLAN_FEATURE_P2P_INTERNAL
3065 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3066 if (status != eHAL_STATUS_SUCCESS)
3067 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003068 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003069 sme_ReleaseGlobalLock( &pMac->sme );
3070 return status;
3071 }
3072#endif
3073 sme_ReleaseGlobalLock( &pMac->sme );
3074 }
3075
3076 return (status);
3077}
3078
3079/* ---------------------------------------------------------------------------
3080 \fn sme_CfgSetInt
3081 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003082 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003083 \param cfgId - Configuration Parameter ID (type) for STA.
3084 \param ccmValue - The information related to Configuration Parameter ID
3085 which needs to be saved in CFG
3086 \param callback - To be registered by CSR with CCM. Once the CFG done with
3087 saving the information in the database, it notifies CCM &
3088 then the callback will be invoked to notify.
3089 \param toBeSaved - To save the request for future reference
3090 \return eHalStatus
3091 ---------------------------------------------------------------------------*/
3092eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3093 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3094{
3095 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3096}
3097
3098/* ---------------------------------------------------------------------------
3099 \fn sme_CfgSetStr
3100 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003101 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003102 \param cfgId - Configuration Parameter ID (type) for STA.
3103 \param pStr - Pointer to the byte array which carries the information needs
3104 to be saved in CFG
3105 \param length - Length of the data to be saved
3106 \param callback - To be registered by CSR with CCM. Once the CFG done with
3107 saving the information in the database, it notifies CCM &
3108 then the callback will be invoked to notify.
3109 \param toBeSaved - To save the request for future reference
3110 \return eHalStatus
3111 ---------------------------------------------------------------------------*/
3112eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3113 tANI_U32 length, tCcmCfgSetCallback callback,
3114 eAniBoolean toBeSaved)
3115{
3116 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3117}
3118
3119/* ---------------------------------------------------------------------------
3120 \fn sme_GetModifyProfileFields
3121 \brief HDD or SME - QOS calls this function to get the current values of
3122 connected profile fields, changing which can cause reassoc.
3123 This function must be called after CFG is downloaded and STA is in connected
3124 state. Also, make sure to call this function to get the current profile
3125 fields before calling the reassoc. So that pModifyProfileFields will have
3126 all the latest values plus the one(s) has been updated as part of reassoc
3127 request.
3128 \param pModifyProfileFields - pointer to the connected profile fields
3129 changing which can cause reassoc
3130
3131 \return eHalStatus
3132 -------------------------------------------------------------------------------*/
3133eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3134 tCsrRoamModifyProfileFields * pModifyProfileFields)
3135{
3136 eHalStatus status = eHAL_STATUS_FAILURE;
3137 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3138
3139 status = sme_AcquireGlobalLock( &pMac->sme );
3140 if ( HAL_STATUS_SUCCESS( status ) )
3141 {
3142 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3143 {
3144 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3145 }
3146 else
3147 {
3148 status = eHAL_STATUS_INVALID_PARAMETER;
3149 }
3150 sme_ReleaseGlobalLock( &pMac->sme );
3151 }
3152
3153 return (status);
3154}
3155
3156/*--------------------------------------------------------------------------
3157 \fn sme_SetConfigPowerSave
3158 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3159 For BMPS related configuration, this function also updates the CFG
3160 and sends a message to FW to pick up the new values. Note: Calling
3161 this function only updates the configuration and does not enable
3162 the specified power save mode.
3163 \param hHal - The handle returned by macOpen.
3164 \param psMode - Power Saving mode being modified
3165 \param pConfigParams - a pointer to a caller allocated object of type
3166 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3167 \return eHalStatus
3168 --------------------------------------------------------------------------*/
3169eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3170 void *pConfigParams)
3171{
3172 eHalStatus status = eHAL_STATUS_FAILURE;
3173 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3174
3175 if (NULL == pConfigParams ) {
3176 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3177 "nothing to update");
3178 return eHAL_STATUS_FAILURE;
3179 }
3180
3181 status = sme_AcquireGlobalLock( &pMac->sme );
3182 if ( HAL_STATUS_SUCCESS( status ) )
3183 {
3184 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3185 sme_ReleaseGlobalLock( &pMac->sme );
3186 }
3187
3188 return (status);
3189}
3190
3191/*--------------------------------------------------------------------------
3192 \fn sme_GetConfigPowerSave
3193 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3194 \param hHal - The handle returned by macOpen.
3195 \param psMode - Power Saving mode
3196 \param pConfigParams - a pointer to a caller allocated object of type
3197 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3198 \return eHalStatus
3199 --------------------------------------------------------------------------*/
3200eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3201 void *pConfigParams)
3202{
3203 eHalStatus status = eHAL_STATUS_FAILURE;
3204 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3205
3206 if (NULL == pConfigParams ) {
3207 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3208 "nothing to update");
3209 return eHAL_STATUS_FAILURE;
3210 }
3211
3212 status = sme_AcquireGlobalLock( &pMac->sme );
3213 if ( HAL_STATUS_SUCCESS( status ) )
3214 {
3215 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3216 sme_ReleaseGlobalLock( &pMac->sme );
3217 }
3218
3219 return (status);
3220}
3221
3222/* ---------------------------------------------------------------------------
3223 \fn sme_SignalPowerEvent
3224 \brief Signals to PMC that a power event has occurred. Used for putting
3225 the chip into deep sleep mode.
3226 \param hHal - The handle returned by macOpen.
3227 \param event - the event that has occurred
3228 \return eHalStatus
3229 ---------------------------------------------------------------------------*/
3230eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3231{
3232 eHalStatus status = eHAL_STATUS_FAILURE;
3233 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3234
3235 status = sme_AcquireGlobalLock( &pMac->sme );
3236 if ( HAL_STATUS_SUCCESS( status ) )
3237 {
3238 status = pmcSignalPowerEvent(hHal, event);
3239 sme_ReleaseGlobalLock( &pMac->sme );
3240 }
3241
3242 return (status);
3243}
3244
3245/* ---------------------------------------------------------------------------
3246 \fn sme_EnablePowerSave
3247 \brief Enables one of the power saving modes.
3248 \param hHal - The handle returned by macOpen.
3249 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3250 while the chip is operating in Full Power, PMC will start
3251 a timer that will try to put the chip in BMPS mode after
3252 expiry.
3253 \return eHalStatus
3254 ---------------------------------------------------------------------------*/
3255eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3256{
3257 eHalStatus status = eHAL_STATUS_FAILURE;
3258 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3259
3260 status = sme_AcquireGlobalLock( &pMac->sme );
3261 if ( HAL_STATUS_SUCCESS( status ) )
3262 {
3263 status = pmcEnablePowerSave(hHal, psMode);
3264 sme_ReleaseGlobalLock( &pMac->sme );
3265 }
3266
3267 return (status);
3268}
3269
3270/* ---------------------------------------------------------------------------
3271 \fn sme_DisablePowerSave
3272 \brief Disables one of the power saving modes.
3273 \param hHal - The handle returned by macOpen.
3274 \param psMode - The power saving mode to disable. Disabling does not imply
3275 that device will be brought out of the current PS mode. This
3276 is purely a configuration API.
3277 \return eHalStatus
3278 ---------------------------------------------------------------------------*/
3279eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3280{
3281 eHalStatus status = eHAL_STATUS_FAILURE;
3282 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3283
3284 status = sme_AcquireGlobalLock( &pMac->sme );
3285 if ( HAL_STATUS_SUCCESS( status ) )
3286 {
3287 status = pmcDisablePowerSave(hHal, psMode);
3288 sme_ReleaseGlobalLock( &pMac->sme );
3289 }
3290
3291 return (status);
3292 }
3293
3294/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303295+ \fn sme_SetHostPowerSave
3296+ \brief Enables BMPS logic to be controlled by User level apps
3297+ \param hHal - The handle returned by macOpen.
3298+ \param psMode - The power saving mode to disable. Disabling does not imply
3299+ that device will be brought out of the current PS mode. This
3300+ is purely a configuration API.
3301+ \return eHalStatus
3302+ ---------------------------------------------------------------------------*/
3303eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3304{
3305 eHalStatus status = eHAL_STATUS_FAILURE;
3306 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3307
3308 pMac->pmc.isHostPsEn = psMode;
3309
3310 return (status);
3311}
3312
3313/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003314 \fn sme_StartAutoBmpsTimer
3315 \brief Starts a timer that periodically polls all the registered
3316 module for entry into Bmps mode. This timer is started only if BMPS is
3317 enabled and whenever the device is in full power.
3318 \param hHal - The handle returned by macOpen.
3319 \return eHalStatus
3320 ---------------------------------------------------------------------------*/
3321eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3322{
3323 eHalStatus status = eHAL_STATUS_FAILURE;
3324 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3325
3326 status = sme_AcquireGlobalLock( &pMac->sme );
3327 if ( HAL_STATUS_SUCCESS( status ) )
3328 {
3329 status = pmcStartAutoBmpsTimer(hHal);
3330 sme_ReleaseGlobalLock( &pMac->sme );
3331 }
3332
3333 return (status);
3334}
3335/* ---------------------------------------------------------------------------
3336 \fn sme_StopAutoBmpsTimer
3337 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3338 Stopping the timer does not cause a device state change. Only the timer
3339 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3340 \param hHal - The handle returned by macOpen.
3341 \return eHalStatus
3342 ---------------------------------------------------------------------------*/
3343eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3344{
3345 eHalStatus status = eHAL_STATUS_FAILURE;
3346 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3347
3348 status = sme_AcquireGlobalLock( &pMac->sme );
3349 if ( HAL_STATUS_SUCCESS( status ) )
3350 {
3351 status = pmcStopAutoBmpsTimer(hHal);
3352 sme_ReleaseGlobalLock( &pMac->sme );
3353 }
3354
3355 return (status);
3356}
3357/* ---------------------------------------------------------------------------
3358 \fn sme_QueryPowerState
3359 \brief Returns the current power state of the device.
3360 \param hHal - The handle returned by macOpen.
3361 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3362 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3363 \return eHalStatus
3364 ---------------------------------------------------------------------------*/
3365eHalStatus sme_QueryPowerState (
3366 tHalHandle hHal,
3367 tPmcPowerState *pPowerState,
3368 tPmcSwitchState *pSwWlanSwitchState)
3369{
3370 eHalStatus status = eHAL_STATUS_FAILURE;
3371 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3372
3373 status = sme_AcquireGlobalLock( &pMac->sme );
3374 if ( HAL_STATUS_SUCCESS( status ) )
3375 {
3376 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3377 sme_ReleaseGlobalLock( &pMac->sme );
3378 }
3379
3380 return (status);
3381}
3382
3383/* ---------------------------------------------------------------------------
3384 \fn sme_IsPowerSaveEnabled
3385 \brief Checks if the device is able to enter a particular power save mode
3386 This does not imply that the device is in a particular PS mode
3387 \param hHal - The handle returned by macOpen.
3388 \param psMode - the power saving mode
3389 \return eHalStatus
3390 ---------------------------------------------------------------------------*/
3391tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
3392{
3393 eHalStatus status = eHAL_STATUS_FAILURE;
3394 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3395 tANI_BOOLEAN result = false;
3396
3397 status = sme_AcquireGlobalLock( &pMac->sme );
3398 if ( HAL_STATUS_SUCCESS( status ) )
3399 {
3400 result = pmcIsPowerSaveEnabled(hHal, psMode);
3401 sme_ReleaseGlobalLock( &pMac->sme );
3402 return result;
3403 }
3404
3405 return false;
3406}
3407
3408/* ---------------------------------------------------------------------------
3409 \fn sme_RequestFullPower
3410 \brief Request that the device be brought to full power state. When the
3411 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
3412 is enabled. On timer expiry PMC will attempt to put the device in
3413 BMPS mode if following holds true:
3414 - BMPS mode is enabled
3415 - Polling of all modules through the Power Save Check routine passes
3416 - STA is associated to an access point
3417 \param hHal - The handle returned by macOpen.
3418 \param - callbackRoutine Callback routine invoked in case of success/failure
3419 \return eHalStatus - status
3420 eHAL_STATUS_SUCCESS - device brought to full power state
3421 eHAL_STATUS_FAILURE - device cannot be brought to full power state
3422 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
3423 ---------------------------------------------------------------------------*/
3424eHalStatus sme_RequestFullPower (
3425 tHalHandle hHal,
3426 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3427 void *callbackContext,
3428 tRequestFullPowerReason fullPowerReason)
3429{
3430 eHalStatus status = eHAL_STATUS_FAILURE;
3431 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3432
3433 status = sme_AcquireGlobalLock( &pMac->sme );
3434 if ( HAL_STATUS_SUCCESS( status ) )
3435 {
3436 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
3437 sme_ReleaseGlobalLock( &pMac->sme );
3438 }
3439
3440 return (status);
3441}
3442
3443/* ---------------------------------------------------------------------------
3444 \fn sme_RequestBmps
3445 \brief Request that the device be put in BMPS state. Request will be
3446 accepted only if BMPS mode is enabled and power save check routine
3447 passes.
3448 \param hHal - The handle returned by macOpen.
3449 \param - callbackRoutine Callback routine invoked in case of success/failure
3450 \return eHalStatus
3451 eHAL_STATUS_SUCCESS - device is in BMPS state
3452 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
3453 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
3454 ---------------------------------------------------------------------------*/
3455eHalStatus sme_RequestBmps (
3456 tHalHandle hHal,
3457 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3458 void *callbackContext)
3459{
3460 eHalStatus status = eHAL_STATUS_FAILURE;
3461 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3462
3463 status = sme_AcquireGlobalLock( &pMac->sme );
3464 if ( HAL_STATUS_SUCCESS( status ) )
3465 {
3466 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
3467 sme_ReleaseGlobalLock( &pMac->sme );
3468 }
3469
3470 return (status);
3471}
3472
3473
3474/* ---------------------------------------------------------------------------
3475 \fn sme_SetDHCPTillPowerActiveFlag
3476 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
3477 entry by PMC
3478 \param hHal - The handle returned by macOpen.
3479 ---------------------------------------------------------------------------*/
3480void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
3481{
3482 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3483
3484 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
3485 pMac->pmc.remainInPowerActiveTillDHCP = flag;
3486}
3487
3488
3489/* ---------------------------------------------------------------------------
3490 \fn sme_StartUapsd
3491 \brief Request that the device be put in UAPSD state. If the device is in
3492 Full Power it will be put in BMPS mode first and then into UAPSD
3493 mode.
3494 \param hHal - The handle returned by macOpen.
3495 \param - callbackRoutine Callback routine invoked in case of success/failure
3496 eHAL_STATUS_SUCCESS - device is in UAPSD state
3497 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
3498 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
3499 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
3500 \return eHalStatus
3501 ---------------------------------------------------------------------------*/
3502eHalStatus sme_StartUapsd (
3503 tHalHandle hHal,
3504 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3505 void *callbackContext)
3506{
3507 eHalStatus status = eHAL_STATUS_FAILURE;
3508 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3509
3510 status = sme_AcquireGlobalLock( &pMac->sme );
3511 if ( HAL_STATUS_SUCCESS( status ) )
3512 {
3513 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
3514 sme_ReleaseGlobalLock( &pMac->sme );
3515 }
3516
3517 return (status);
3518 }
3519
3520/* ---------------------------------------------------------------------------
3521 \fn sme_StopUapsd
3522 \brief Request that the device be put out of UAPSD state. Device will be
3523 put in in BMPS state after stop UAPSD completes.
3524 \param hHal - The handle returned by macOpen.
3525 \return eHalStatus
3526 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
3527 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
3528 ---------------------------------------------------------------------------*/
3529eHalStatus sme_StopUapsd (tHalHandle hHal)
3530{
3531 eHalStatus status = eHAL_STATUS_FAILURE;
3532 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3533
3534 status = sme_AcquireGlobalLock( &pMac->sme );
3535 if ( HAL_STATUS_SUCCESS( status ) )
3536 {
3537 status = pmcStopUapsd(hHal);
3538 sme_ReleaseGlobalLock( &pMac->sme );
3539 }
3540
3541 return (status);
3542}
3543
3544/* ---------------------------------------------------------------------------
3545 \fn sme_RequestStandby
3546 \brief Request that the device be put in standby. It is HDD's responsibility
3547 to bring the chip to full power and do a disassoc before calling
3548 this API.
3549 \param hHal - The handle returned by macOpen.
3550 \param - callbackRoutine Callback routine invoked in case of success/failure
3551 \return eHalStatus
3552 eHAL_STATUS_SUCCESS - device is in Standby mode
3553 eHAL_STATUS_FAILURE - device cannot be put in standby mode
3554 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
3555 ---------------------------------------------------------------------------*/
3556eHalStatus sme_RequestStandby (
3557 tHalHandle hHal,
3558 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3559 void *callbackContext)
3560{
3561 eHalStatus status = eHAL_STATUS_FAILURE;
3562 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3563
3564 smsLog( pMac, LOG1, FL("") );
3565 status = sme_AcquireGlobalLock( &pMac->sme );
3566 if ( HAL_STATUS_SUCCESS( status ) )
3567 {
3568 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
3569 sme_ReleaseGlobalLock( &pMac->sme );
3570 }
3571
3572 return (status);
3573}
3574
3575/* ---------------------------------------------------------------------------
3576 \fn sme_RegisterPowerSaveCheck
3577 \brief Register a power save check routine that is called whenever
3578 the device is about to enter one of the power save modes.
3579 \param hHal - The handle returned by macOpen.
3580 \param checkRoutine - Power save check routine to be registered
3581 \return eHalStatus
3582 eHAL_STATUS_SUCCESS - successfully registered
3583 eHAL_STATUS_FAILURE - not successfully registered
3584 ---------------------------------------------------------------------------*/
3585eHalStatus sme_RegisterPowerSaveCheck (
3586 tHalHandle hHal,
3587 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
3588{
3589 eHalStatus status = eHAL_STATUS_FAILURE;
3590 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3591
3592 status = sme_AcquireGlobalLock( &pMac->sme );
3593 if ( HAL_STATUS_SUCCESS( status ) )
3594 {
3595 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
3596 sme_ReleaseGlobalLock( &pMac->sme );
3597 }
3598
3599 return (status);
3600}
3601
3602/* ---------------------------------------------------------------------------
3603 \fn sme_DeregisterPowerSaveCheck
3604 \brief Deregister a power save check routine
3605 \param hHal - The handle returned by macOpen.
3606 \param checkRoutine - Power save check routine to be deregistered
3607 \return eHalStatus
3608 eHAL_STATUS_SUCCESS - successfully deregistered
3609 eHAL_STATUS_FAILURE - not successfully deregistered
3610 ---------------------------------------------------------------------------*/
3611eHalStatus sme_DeregisterPowerSaveCheck (
3612 tHalHandle hHal,
3613 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
3614{
3615 eHalStatus status = eHAL_STATUS_FAILURE;
3616 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3617
3618 status = sme_AcquireGlobalLock( &pMac->sme );
3619 if ( HAL_STATUS_SUCCESS( status ) )
3620 {
3621 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
3622 sme_ReleaseGlobalLock( &pMac->sme );
3623 }
3624
3625 return (status);
3626}
3627
3628/* ---------------------------------------------------------------------------
3629 \fn sme_RegisterDeviceStateUpdateInd
3630 \brief Register a callback routine that is called whenever
3631 the device enters a new device state (Full Power, BMPS, UAPSD)
3632 \param hHal - The handle returned by macOpen.
3633 \param callbackRoutine - Callback routine to be registered
3634 \param callbackContext - Cookie to be passed back during callback
3635 \return eHalStatus
3636 eHAL_STATUS_SUCCESS - successfully registered
3637 eHAL_STATUS_FAILURE - not successfully registered
3638 ---------------------------------------------------------------------------*/
3639eHalStatus sme_RegisterDeviceStateUpdateInd (
3640 tHalHandle hHal,
3641 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
3642 void *callbackContext)
3643{
3644 eHalStatus status = eHAL_STATUS_FAILURE;
3645 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3646
3647 status = sme_AcquireGlobalLock( &pMac->sme );
3648 if ( HAL_STATUS_SUCCESS( status ) )
3649 {
3650 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
3651 sme_ReleaseGlobalLock( &pMac->sme );
3652 }
3653
3654 return (status);
3655}
3656
3657/* ---------------------------------------------------------------------------
3658 \fn sme_DeregisterDeviceStateUpdateInd
3659 \brief Deregister a routine that was registered for device state changes
3660 \param hHal - The handle returned by macOpen.
3661 \param callbackRoutine - Callback routine to be deregistered
3662 \return eHalStatus
3663 eHAL_STATUS_SUCCESS - successfully deregistered
3664 eHAL_STATUS_FAILURE - not successfully deregistered
3665 ---------------------------------------------------------------------------*/
3666eHalStatus sme_DeregisterDeviceStateUpdateInd (
3667 tHalHandle hHal,
3668 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
3669{
3670 eHalStatus status = eHAL_STATUS_FAILURE;
3671 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3672
3673 status = sme_AcquireGlobalLock( &pMac->sme );
3674 if ( HAL_STATUS_SUCCESS( status ) )
3675 {
3676 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
3677 sme_ReleaseGlobalLock( &pMac->sme );
3678 }
3679
3680 return (status);
3681}
3682
3683/* ---------------------------------------------------------------------------
3684 \fn sme_WowlAddBcastPattern
3685 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
3686 do a pattern match on these patterns when Wowl is enabled during BMPS
3687 mode. Note that Firmware performs the pattern matching only on
3688 broadcast frames and while Libra is in BMPS mode.
3689 \param hHal - The handle returned by macOpen.
3690 \param pattern - Pattern to be added
3691 \return eHalStatus
3692 eHAL_STATUS_FAILURE Cannot add pattern
3693 eHAL_STATUS_SUCCESS Request accepted.
3694 ---------------------------------------------------------------------------*/
3695eHalStatus sme_WowlAddBcastPattern (
3696 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003697 tpSirWowlAddBcastPtrn pattern,
3698 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003699{
3700 eHalStatus status = eHAL_STATUS_FAILURE;
3701 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3702 status = sme_AcquireGlobalLock( &pMac->sme );
3703 if ( HAL_STATUS_SUCCESS( status ) )
3704 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003705 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003706 sme_ReleaseGlobalLock( &pMac->sme );
3707 }
3708
3709 return (status);
3710}
3711
3712/* ---------------------------------------------------------------------------
3713 \fn sme_WowlDelBcastPattern
3714 \brief Delete a pattern that was added for Pattern Byte Matching.
3715 \param hHal - The handle returned by macOpen.
3716 \param pattern - Pattern to be deleted
3717 \return eHalStatus
3718 eHAL_STATUS_FAILURE Cannot delete pattern
3719 eHAL_STATUS_SUCCESS Request accepted.
3720 ---------------------------------------------------------------------------*/
3721eHalStatus sme_WowlDelBcastPattern (
3722 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003723 tpSirWowlDelBcastPtrn pattern,
3724 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003725{
3726 eHalStatus status = eHAL_STATUS_FAILURE;
3727 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3728 status = sme_AcquireGlobalLock( &pMac->sme );
3729 if ( HAL_STATUS_SUCCESS( status ) )
3730 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003731 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003732 sme_ReleaseGlobalLock( &pMac->sme );
3733 }
3734
3735 return (status);
3736}
3737
3738/* ---------------------------------------------------------------------------
3739 \fn sme_EnterWowl
3740 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
3741 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
3742 SME will will cache the information that WOWL has been enabled and
3743 attempt to put the device in BMPS. On entry into BMPS, SME will
3744 enable the WOWL mode.
3745 Note 1: If we exit BMPS mode (someone requests full power), we
3746 will NOT resume WOWL when we go back to BMPS again. Request for full
3747 power (while in WOWL mode) means disable WOWL and go to full power.
3748 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
3749 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
3750 are required. Currently there is no requirement or use case to support
3751 UAPSD and WOWL at the same time.
3752
3753 \param hHal - The handle returned by macOpen.
3754 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
3755 Used for success/failure notification by SME
3756 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
3757 at the time of callback.
3758 \param wakeReasonIndCB - Callback routine provided by HDD.
3759 Used for Wake Reason Indication by SME
3760 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
3761 at the time of callback.
3762 \return eHalStatus
3763 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
3764 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
3765 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
3766 BMPS mode is entered.
3767 ---------------------------------------------------------------------------*/
3768eHalStatus sme_EnterWowl (
3769 tHalHandle hHal,
3770 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
3771 void *enterWowlCallbackContext,
3772#ifdef WLAN_WAKEUP_EVENTS
3773 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
3774 void *wakeIndicationCBContext,
3775#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003776 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003777{
3778 eHalStatus status = eHAL_STATUS_FAILURE;
3779 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3780 status = sme_AcquireGlobalLock( &pMac->sme );
3781 if ( HAL_STATUS_SUCCESS( status ) )
3782 {
3783 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
3784#ifdef WLAN_WAKEUP_EVENTS
3785 wakeIndicationCB, wakeIndicationCBContext,
3786#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003787 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003788 sme_ReleaseGlobalLock( &pMac->sme );
3789 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003790 return (status);
3791}
3792/* ---------------------------------------------------------------------------
3793 \fn sme_ExitWowl
3794 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
3795 SME will initiate exit from WoWLAN mode and device will be put in BMPS
3796 mode.
3797 \param hHal - The handle returned by macOpen.
3798 \return eHalStatus
3799 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
3800 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
3801 ---------------------------------------------------------------------------*/
3802eHalStatus sme_ExitWowl (tHalHandle hHal)
3803{
3804 eHalStatus status = eHAL_STATUS_FAILURE;
3805 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3806 status = sme_AcquireGlobalLock( &pMac->sme );
3807 if ( HAL_STATUS_SUCCESS( status ) )
3808 {
3809 status = pmcExitWowl (hHal);
3810 sme_ReleaseGlobalLock( &pMac->sme );
3811 }
3812
3813 return (status);
3814}
3815
3816/* ---------------------------------------------------------------------------
3817
3818 \fn sme_RoamSetKey
3819
3820 \brief To set encryption key. This function should be called only when connected
3821 This is an asynchronous API.
3822
3823 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
3824
3825 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
3826
3827 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
3828
3829 FAILURE or RESOURCES The API finished and failed.
3830
3831 -------------------------------------------------------------------------------*/
3832eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
3833{
3834 eHalStatus status = eHAL_STATUS_FAILURE;
3835 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3836 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003837 tANI_U32 i;
3838 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003839
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07003840 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
3841 {
3842 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
3843 return eHAL_STATUS_FAILURE;
3844 }
3845
Jeff Johnson295189b2012-06-20 16:38:30 -07003846 status = sme_AcquireGlobalLock( &pMac->sme );
3847 if ( HAL_STATUS_SUCCESS( status ) )
3848 {
3849 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
3850 if(pRoamId)
3851 {
3852 *pRoamId = roamId;
3853 }
3854
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07003855 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07003856
3857 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003858 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003859
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003860 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003861
3862 pSession = CSR_GET_SESSION(pMac, sessionId);
3863
Jeff Johnson32d95a32012-09-10 13:15:23 -07003864 if(!pSession)
3865 {
3866 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08003867 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07003868 return eHAL_STATUS_FAILURE;
3869 }
3870
Jeff Johnson295189b2012-06-20 16:38:30 -07003871 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
3872 {
3873 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
3874 {
3875 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
3876 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
3877 {
3878 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
3879 }
3880 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
3881 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
3882 {
3883 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
3884 }
3885 }
3886 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003887
3888 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
3889 sme_ReleaseGlobalLock( &pMac->sme );
3890 }
3891
3892 return (status);
3893}
3894
3895
3896/* ---------------------------------------------------------------------------
3897
3898 \fn sme_RoamRemoveKey
3899
3900 \brief To set encryption key. This is an asynchronous API.
3901
3902 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
3903
3904 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
3905
3906 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
3907
3908 FAILURE or RESOURCES The API finished and failed.
3909
3910 -------------------------------------------------------------------------------*/
3911eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
3912 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
3913{
3914 eHalStatus status = eHAL_STATUS_FAILURE;
3915 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3916 tANI_U32 roamId;
3917
3918 status = sme_AcquireGlobalLock( &pMac->sme );
3919 if ( HAL_STATUS_SUCCESS( status ) )
3920 {
3921 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
3922 if(pRoamId)
3923 {
3924 *pRoamId = roamId;
3925 }
3926 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
3927 sme_ReleaseGlobalLock( &pMac->sme );
3928 }
3929
3930 return (status);
3931}
3932
3933/* ---------------------------------------------------------------------------
3934 \fn sme_GetRssi
3935 \brief a wrapper function that client calls to register a callback to get RSSI
3936
3937 \param callback - SME sends back the requested stats using the callback
3938 \param staId - The station ID for which the stats is requested for
3939 \param pContext - user context to be passed back along with the callback
3940 \param pVosContext - vos context
3941 \return eHalStatus
3942 ---------------------------------------------------------------------------*/
3943eHalStatus sme_GetRssi(tHalHandle hHal,
3944 tCsrRssiCallback callback,
3945 tANI_U8 staId, tCsrBssid bssId,
3946 void *pContext, void* pVosContext)
3947{
3948 eHalStatus status = eHAL_STATUS_FAILURE;
3949 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3950
3951 status = sme_AcquireGlobalLock( &pMac->sme );
3952 if ( HAL_STATUS_SUCCESS( status ) )
3953 {
3954 status = csrGetRssi( pMac, callback,
3955 staId, bssId, pContext, pVosContext);
3956 sme_ReleaseGlobalLock( &pMac->sme );
3957 }
3958 return (status);
3959}
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08003960#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
3961/* ---------------------------------------------------------------------------
3962 \fn sme_GetRoamRssi
3963 \brief a wrapper function that client calls to register a callback to get Roam RSSI
3964
3965 \param callback - SME sends back the requested stats using the callback
3966 \param staId - The station ID for which the stats is requested for
3967 \param pContext - user context to be passed back along with the callback
3968 \param pVosContext - vos context
3969 \return eHalStatus
3970 ---------------------------------------------------------------------------*/
3971eHalStatus sme_GetRoamRssi(tHalHandle hHal,
3972 tCsrRssiCallback callback,
3973 tANI_U8 staId, tCsrBssid bssId,
3974 void *pContext, void* pVosContext)
3975{
3976 eHalStatus status = eHAL_STATUS_FAILURE;
3977 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3978
3979 status = sme_AcquireGlobalLock( &pMac->sme );
3980 if ( HAL_STATUS_SUCCESS( status ) )
3981 {
3982 status = csrGetRoamRssi( pMac, callback,
3983 staId, bssId, pContext, pVosContext);
3984 sme_ReleaseGlobalLock( &pMac->sme );
3985 }
3986 return (status);
3987}
3988#endif
3989
Jeff Johnson295189b2012-06-20 16:38:30 -07003990
3991/* ---------------------------------------------------------------------------
3992 \fn sme_GetStatistics
3993 \brief a wrapper function that client calls to register a callback to get
3994 different PHY level statistics from CSR.
3995
3996 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
3997 \param statsMask - The different category/categories of stats requester is looking for
3998 \param callback - SME sends back the requested stats using the callback
3999 \param periodicity - If requester needs periodic update in millisec, 0 means
4000 it's an one time request
4001 \param cache - If requester is happy with cached stats
4002 \param staId - The station ID for which the stats is requested for
4003 \param pContext - user context to be passed back along with the callback
4004 \return eHalStatus
4005 ---------------------------------------------------------------------------*/
4006eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
4007 tANI_U32 statsMask,
4008 tCsrStatsCallback callback,
4009 tANI_U32 periodicity, tANI_BOOLEAN cache,
4010 tANI_U8 staId, void *pContext)
4011{
4012 eHalStatus status = eHAL_STATUS_FAILURE;
4013 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4014
4015 status = sme_AcquireGlobalLock( &pMac->sme );
4016 if ( HAL_STATUS_SUCCESS( status ) )
4017 {
4018 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
4019 periodicity, cache, staId, pContext);
4020 sme_ReleaseGlobalLock( &pMac->sme );
4021 }
4022
4023 return (status);
4024
4025}
4026
4027/* ---------------------------------------------------------------------------
4028
4029 \fn sme_GetCountryCode
4030
4031 \brief To return the current country code. If no country code is applied, default country code is
4032 used to fill the buffer.
4033 If 11d supported is turned off, an error is return and the last applied/default country code is used.
4034 This is a synchronous API.
4035
4036 \param pBuf - pointer to a caller allocated buffer for returned country code.
4037
4038 \param pbLen For input, this parameter indicates how big is the buffer.
4039 Upon return, this parameter has the number of bytes for country. If pBuf
4040 doesn't have enough space, this function returns
4041 fail status and this parameter contains the number that is needed.
4042
4043 \return eHalStatus SUCCESS.
4044
4045 FAILURE or RESOURCES The API finished and failed.
4046
4047 -------------------------------------------------------------------------------*/
4048eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
4049{
4050 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4051
4052 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
4053}
4054
4055
4056/* ---------------------------------------------------------------------------
4057
4058 \fn sme_SetCountryCode
4059
4060 \brief To change the current/default country code.
4061 If 11d supported is turned off, an error is return.
4062 This is a synchronous API.
4063
4064 \param pCountry - pointer to a caller allocated buffer for the country code.
4065
4066 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
4067 whether a reset is required.
4068
4069 \return eHalStatus SUCCESS.
4070
4071 FAILURE or RESOURCES The API finished and failed.
4072
4073 -------------------------------------------------------------------------------*/
4074eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
4075{
4076 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4077
4078 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4079}
4080
4081
4082/* ---------------------------------------------------------------------------
4083 \fn sme_ResetCountryCodeInformation
4084 \brief this function is to reset the country code current being used back to EEPROM default
4085 this includes channel list and power setting. This is a synchronous API.
4086 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4087 a restart is needed to apply the change
4088 \return eHalStatus
4089 -------------------------------------------------------------------------------*/
4090eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4091{
4092 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4093
4094 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4095}
4096
4097
4098/* ---------------------------------------------------------------------------
4099 \fn sme_GetSupportedCountryCode
4100 \brief this function is to get a list of the country code current being supported
4101 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4102 this has the country code list. 3 bytes for each country code. This may be NULL if
4103 caller wants to know the needed byte count.
4104 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4105 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4106 \return eHalStatus
4107 -------------------------------------------------------------------------------*/
4108eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4109{
4110 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4111
4112 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4113}
4114
4115
4116/* ---------------------------------------------------------------------------
4117 \fn sme_GetCurrentRegulatoryDomain
4118 \brief this function is to get the current regulatory domain. This is a synchronous API.
4119 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4120 SME. The function fails if 11d support is turned off.
4121 \param pDomain - Caller allocated buffer to return the current domain.
4122 \return eHalStatus SUCCESS.
4123
4124 FAILURE or RESOURCES The API finished and failed.
4125 -------------------------------------------------------------------------------*/
4126eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4127{
4128 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4129 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4130
4131 if( pDomain )
4132 {
4133 if( csrIs11dSupported( pMac ) )
4134 {
4135 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4136 status = eHAL_STATUS_SUCCESS;
4137 }
4138 else
4139 {
4140 status = eHAL_STATUS_FAILURE;
4141 }
4142 }
4143
4144 return ( status );
4145}
4146
4147
4148/* ---------------------------------------------------------------------------
4149 \fn sme_SetRegulatoryDomain
4150 \brief this function is to set the current regulatory domain.
4151 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4152 SME. This is a synchronous API.
4153 \param domainId - indicate the domain (defined in the driver) needs to set to.
4154 See v_REGDOMAIN_t for definition
4155 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4156 a restart is needed to apply the change
4157 \return eHalStatus
4158 -------------------------------------------------------------------------------*/
4159eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4160{
4161 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4162
4163 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4164}
4165
4166
4167/* ---------------------------------------------------------------------------
4168
4169 \fn sme_GetRegulatoryDomainForCountry
4170
4171 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4172
4173 \param pCountry - pointer to a caller allocated buffer for input country code.
4174
4175 \param pDomainId Upon successful return, it is the domain that country belongs to.
4176 If it is NULL, returning success means that the country code is known.
4177
4178 \return eHalStatus SUCCESS.
4179
4180 FAILURE or RESOURCES The API finished and failed.
4181
4182 -------------------------------------------------------------------------------*/
4183eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4184{
4185 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4186
4187 return ( csrGetRegulatoryDomainForCountry( pMac, pCountry, pDomainId ) );
4188}
4189
4190
4191
4192
4193/* ---------------------------------------------------------------------------
4194
4195 \fn sme_GetSupportedRegulatoryDomains
4196
4197 \brief To return a list of supported regulatory domains. This is a synchronous API.
4198
4199 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4200
4201 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4202 Upon return, this parameter has the number for supported domains. If pDomains
4203 doesn't have enough space for all the supported domains, this function returns
4204 fail status and this parameter contains the number that is needed.
4205
4206 \return eHalStatus SUCCESS.
4207
4208 FAILURE or RESOURCES The API finished and failed.
4209
4210 -------------------------------------------------------------------------------*/
4211eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4212{
4213 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4214
4215 //We support all domains for now
4216 if( pNumDomains )
4217 {
4218 if( NUM_REG_DOMAINS <= *pNumDomains )
4219 {
4220 status = eHAL_STATUS_SUCCESS;
4221 }
4222 *pNumDomains = NUM_REG_DOMAINS;
4223 }
4224 if( HAL_STATUS_SUCCESS( status ) )
4225 {
4226 if( pDomains )
4227 {
4228 pDomains[0] = REGDOMAIN_FCC;
4229 pDomains[1] = REGDOMAIN_ETSI;
4230 pDomains[2] = REGDOMAIN_JAPAN;
4231 pDomains[3] = REGDOMAIN_WORLD;
4232 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
4233 pDomains[5] = REGDOMAIN_APAC;
4234 pDomains[6] = REGDOMAIN_KOREA;
4235 pDomains[7] = REGDOMAIN_HI_5GHZ;
4236 pDomains[8] = REGDOMAIN_NO_5GHZ;
4237 }
4238 else
4239 {
4240 status = eHAL_STATUS_INVALID_PARAMETER;
4241 }
4242 }
4243
4244 return ( status );
4245}
4246
4247
4248//some support functions
4249tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
4250{
4251 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4252
4253 return ( csrIs11dSupported( pMac ) );
4254}
4255
4256
4257tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
4258{
4259 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4260
4261 return ( csrIs11hSupported( pMac ) );
4262}
4263
4264
4265tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
4266{
4267 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4268
4269 return ( csrIsWmmSupported( pMac ) );
4270}
4271
4272//Upper layer to get the list of the base channels to scan for passively 11d info from csr
4273eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
4274{
4275 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4276
4277 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
4278}
4279
4280/* ---------------------------------------------------------------------------
4281
4282 \fn sme_ChangeCountryCode
4283
4284 \brief Change Country code from upperlayer during WLAN driver operation.
4285 This is a synchronous API.
4286
4287 \param hHal - The handle returned by macOpen.
4288
4289 \param pCountry New Country Code String
4290
4291 \return eHalStatus SUCCESS.
4292
4293 FAILURE or RESOURCES The API finished and failed.
4294
4295 -------------------------------------------------------------------------------*/
4296eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
4297 tSmeChangeCountryCallback callback,
4298 tANI_U8 *pCountry,
4299 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304300 void* pVosContext,
4301 tAniBool countryFromUserSpace )
Jeff Johnson295189b2012-06-20 16:38:30 -07004302{
4303 eHalStatus status = eHAL_STATUS_FAILURE;
4304 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4305 vos_msg_t msg;
4306 tAniChangeCountryCodeReq *pMsg;
4307
4308 status = sme_AcquireGlobalLock( &pMac->sme );
4309 if ( HAL_STATUS_SUCCESS( status ) )
4310 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004311 smsLog(pMac, LOG1, FL(" called"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004312 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniChangeCountryCodeReq));
4313 if ( !HAL_STATUS_SUCCESS(status) )
4314 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004315 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004316 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07004317 return status;
4318 }
4319
4320 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
4321 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
4322 palCopyMemory(pMac->hHdd, pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304323 pMsg->countryFromUserSpace = countryFromUserSpace;
Jeff Johnson295189b2012-06-20 16:38:30 -07004324 pMsg->changeCCCallback = callback;
4325 pMsg->pDevContext = pContext;
4326 pMsg->pVosContext = pVosContext;
4327
4328 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
4329 msg.bodyptr = pMsg;
4330 msg.reserved = 0;
4331
4332 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
4333 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004334 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Jeff Johnson295189b2012-06-20 16:38:30 -07004335 palFreeMemory(pMac->hHdd, (void *)pMsg);
4336 status = eHAL_STATUS_FAILURE;
4337 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004338 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004339 sme_ReleaseGlobalLock( &pMac->sme );
4340 }
4341
4342 return (status);
4343}
4344
4345/* ---------------------------------------------------------------------------
4346 \fn sme_BtcSignalBtEvent
4347 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
4348 BT event type and the current operating mode of Libra (full power,
4349 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
4350 would be employed.
4351 \param hHal - The handle returned by macOpen.
4352 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
4353 Caller owns the memory and is responsible for freeing it.
4354 \return VOS_STATUS
4355 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
4356 if BTC execution mode is set to BTC_WLAN_ONLY
4357 or BTC_PTA_ONLY.
4358 VOS_STATUS_SUCCESS BT Event passed to HAL
4359 ---------------------------------------------------------------------------*/
4360VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
4361{
4362 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4363#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4364 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4365
4366 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4367 {
4368 status = btcSignalBTEvent (hHal, pBtEvent);
4369 sme_ReleaseGlobalLock( &pMac->sme );
4370 }
4371#endif
4372 return (status);
4373}
4374
4375/* ---------------------------------------------------------------------------
4376 \fn sme_BtcSetConfig
4377 \brief API to change the current Bluetooth Coexistence (BTC) configuration
4378 This function should be invoked only after CFG download has completed.
4379 Calling it after sme_HDDReadyInd is recommended.
4380 \param hHal - The handle returned by macOpen.
4381 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
4382 Caller owns the memory and is responsible for freeing it.
4383 \return VOS_STATUS
4384 VOS_STATUS_E_FAILURE Config not passed to HAL.
4385 VOS_STATUS_SUCCESS Config passed to HAL
4386 ---------------------------------------------------------------------------*/
4387VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4388{
4389 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4390#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4391 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4392 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4393 {
4394 status = btcSetConfig (hHal, pSmeBtcConfig);
4395 sme_ReleaseGlobalLock( &pMac->sme );
4396 }
4397#endif
4398 return (status);
4399}
4400
4401/* ---------------------------------------------------------------------------
4402 \fn sme_BtcGetConfig
4403 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
4404 \param hHal - The handle returned by macOpen.
4405 \param pSmeBtcConfig - Pointer to a caller allocated object of type
4406 tSmeBtcConfig. 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_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4413{
4414 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4415#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4416 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4417
4418 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4419 {
4420 status = btcGetConfig (hHal, pSmeBtcConfig);
4421 sme_ReleaseGlobalLock( &pMac->sme );
4422 }
4423#endif
4424 return (status);
4425}
4426/* ---------------------------------------------------------------------------
4427 \fn sme_SetCfgPrivacy
4428 \brief API to set configure privacy parameters
4429 \param hHal - The handle returned by macOpen.
4430 \param pProfile - Pointer CSR Roam profile.
4431 \param fPrivacy - This parameter indicates status of privacy
4432
4433 \return void
4434 ---------------------------------------------------------------------------*/
4435void sme_SetCfgPrivacy( tHalHandle hHal,
4436 tCsrRoamProfile *pProfile,
4437 tANI_BOOLEAN fPrivacy
4438 )
4439{
4440 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4441 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4442 {
4443 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
4444 sme_ReleaseGlobalLock( &pMac->sme );
4445 }
4446}
4447
4448#if defined WLAN_FEATURE_VOWIFI
4449/* ---------------------------------------------------------------------------
4450 \fn sme_NeighborReportRequest
4451 \brief API to request neighbor report.
4452 \param hHal - The handle returned by macOpen.
4453 \param pRrmNeighborReq - Pointer to a caller allocated object of type
4454 tRrmNeighborReq. Caller owns the memory and is responsible
4455 for freeing it.
4456 \return VOS_STATUS
4457 VOS_STATUS_E_FAILURE - failure
4458 VOS_STATUS_SUCCESS success
4459 ---------------------------------------------------------------------------*/
4460VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
4461 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
4462{
4463 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4464 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4465
4466 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4467 {
4468 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
4469 sme_ReleaseGlobalLock( &pMac->sme );
4470 }
4471
4472 return (status);
4473}
4474#endif
4475
4476//The following are debug APIs to support direct read/write register/memory
4477//They are placed in SME because HW cannot be access when in LOW_POWER state
4478//AND not connected. The knowledge and synchronization is done in SME
4479
4480//sme_DbgReadRegister
4481//Caller needs to validate the input values
4482VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
4483{
4484 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4485 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004486 tPmcPowerState PowerState;
4487 tANI_U32 sessionId = 0;
4488
4489 /* 1) To make Quarky work in FTM mode **************************************/
4490
4491 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4492 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004493 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004494 {
4495 return VOS_STATUS_SUCCESS;
4496 }
4497 return VOS_STATUS_E_FAILURE;
4498 }
4499
4500 /* 2) NON FTM mode driver *************************************************/
4501
4502 /* Acquire SME global lock */
4503 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4504 {
4505 return VOS_STATUS_E_FAILURE;
4506 }
4507
4508 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4509 {
4510 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4511 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4512 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004513 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004514 {
4515 status = VOS_STATUS_SUCCESS;
4516 }
4517 else
4518 {
4519 status = VOS_STATUS_E_FAILURE;
4520 }
4521 }
4522 else
4523 {
4524 status = VOS_STATUS_E_FAILURE;
4525 }
4526 }
4527
4528 /* This is a hack for Qualky/pttWniSocket
4529 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
4530 if ( VOS_STATUS_SUCCESS != status )
4531 {
4532 *pRegValue = 0xDEADBEEF;
4533 status = VOS_STATUS_SUCCESS;
4534 }
4535
4536 /* Release SME global lock */
4537 sme_ReleaseGlobalLock(&pMac->sme);
4538
4539 return (status);
4540}
4541
4542
4543//sme_DbgWriteRegister
4544//Caller needs to validate the input values
4545VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
4546{
4547 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4548 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004549 tPmcPowerState PowerState;
4550 tANI_U32 sessionId = 0;
4551
4552 /* 1) To make Quarky work in FTM mode **************************************/
4553
4554 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4555 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004556 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004557 {
4558 return VOS_STATUS_SUCCESS;
4559 }
4560 return VOS_STATUS_E_FAILURE;
4561 }
4562
4563 /* 2) NON FTM mode driver *************************************************/
4564
4565 /* Acquire SME global lock */
4566 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4567 {
4568 return VOS_STATUS_E_FAILURE;
4569 }
4570
4571 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4572 {
4573 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4574 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4575 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004576 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004577 {
4578 status = VOS_STATUS_SUCCESS;
4579 }
4580 else
4581 {
4582 status = VOS_STATUS_E_FAILURE;
4583 }
4584 }
4585 else
4586 {
4587 status = VOS_STATUS_E_FAILURE;
4588 }
4589 }
4590
4591 /* Release SME global lock */
4592 sme_ReleaseGlobalLock(&pMac->sme);
4593
4594 return (status);
4595}
4596
4597
4598
4599//sme_DbgReadMemory
4600//Caller needs to validate the input values
4601//pBuf caller allocated buffer has the length of nLen
4602VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
4603{
4604 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4605 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07004606 tPmcPowerState PowerState;
4607 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004608 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
4609 tANI_U32 arg1 = memAddr;
4610 tANI_U32 arg2 = nLen/4;
4611 tANI_U32 arg3 = 4;
4612 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004613 /* 1) To make Quarky work in FTM mode **************************************/
4614
4615 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4616 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004617 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07004618 {
4619 return VOS_STATUS_SUCCESS;
4620 }
4621 return VOS_STATUS_E_FAILURE;
4622 }
4623
4624 /* 2) NON FTM mode driver *************************************************/
4625
4626 /* Acquire SME global lock */
4627 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4628 {
4629 return VOS_STATUS_E_FAILURE;
4630 }
4631
4632 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4633 {
4634 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4635 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4636 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004637 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07004638 {
4639 status = VOS_STATUS_SUCCESS;
4640 }
4641 else
4642 {
4643 status = VOS_STATUS_E_FAILURE;
4644 }
4645 }
4646 else
4647 {
4648 status = VOS_STATUS_E_FAILURE;
4649 }
4650 }
4651
4652 /* This is a hack for Qualky/pttWniSocket
4653 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
4654 if (VOS_STATUS_SUCCESS != status)
4655 {
4656 vos_mem_set(pBuf, nLen, 0xCD);
4657 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004658 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004659 }
4660
4661 /* Release SME lock */
4662 sme_ReleaseGlobalLock(&pMac->sme);
4663
4664 return (status);
4665}
4666
4667
4668//sme_DbgWriteMemory
4669//Caller needs to validate the input values
4670VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
4671{
4672 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4673 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004674 tPmcPowerState PowerState;
4675 tANI_U32 sessionId = 0;
4676
4677 /* 1) To make Quarky work in FTM mode **************************************/
4678
4679 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4680 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004681 {
4682 return VOS_STATUS_SUCCESS;
4683 }
4684 return VOS_STATUS_E_FAILURE;
4685 }
4686
4687 /* 2) NON FTM mode driver *************************************************/
4688
4689 /* Acquire SME global lock */
4690 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4691 {
4692 return VOS_STATUS_E_FAILURE;
4693 }
4694
4695 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4696 {
4697 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4698 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4699 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004700 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07004701 {
4702 status = VOS_STATUS_SUCCESS;
4703 }
4704 else
4705 {
4706 status = VOS_STATUS_E_FAILURE;
4707 }
4708 }
4709 else
4710 {
4711 status = VOS_STATUS_E_FAILURE;
4712 }
4713 }
4714
4715 /* Release Global lock */
4716 sme_ReleaseGlobalLock(&pMac->sme);
4717
4718 return (status);
4719}
4720
4721
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004722void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07004723{
4724#ifdef WLAN_DEBUG
4725 // Verify against current log level
4726 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
4727 return;
4728 else
4729 {
4730 va_list marker;
4731
4732 va_start( marker, pString ); /* Initialize variable arguments. */
4733
4734 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
4735
4736 va_end( marker ); /* Reset variable arguments. */
4737 }
4738#endif
4739}
Jeff Johnson295189b2012-06-20 16:38:30 -07004740
Jeff Johnson295189b2012-06-20 16:38:30 -07004741/* ---------------------------------------------------------------------------
4742 \fn sme_GetWcnssWlanCompiledVersion
4743 \brief This API returns the version of the WCNSS WLAN API with
4744 which the HOST driver was built
4745 \param hHal - The handle returned by macOpen.
4746 \param pVersion - Points to the Version structure to be filled
4747 \return VOS_STATUS
4748 VOS_STATUS_E_INVAL - failure
4749 VOS_STATUS_SUCCESS success
4750 ---------------------------------------------------------------------------*/
4751VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
4752 tSirVersionType *pVersion)
4753{
4754 VOS_STATUS status = VOS_STATUS_SUCCESS;
4755 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4756 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4757
4758 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4759 {
4760 if( pVersion != NULL )
4761 {
4762 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
4763 }
4764 else
4765 {
4766 status = VOS_STATUS_E_INVAL;
4767 }
4768 sme_ReleaseGlobalLock( &pMac->sme );
4769 }
4770
4771 return (status);
4772}
4773
4774
4775/* ---------------------------------------------------------------------------
4776 \fn sme_GetWcnssWlanReportedVersion
4777 \brief This API returns the version of the WCNSS WLAN API with
4778 which the WCNSS driver reports it was built
4779 \param hHal - The handle returned by macOpen.
4780 \param pVersion - Points to the Version structure to be filled
4781 \return VOS_STATUS
4782 VOS_STATUS_E_INVAL - failure
4783 VOS_STATUS_SUCCESS success
4784 ---------------------------------------------------------------------------*/
4785VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
4786 tSirVersionType *pVersion)
4787{
4788 VOS_STATUS status = VOS_STATUS_SUCCESS;
4789 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4790 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4791
4792 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4793 {
4794 if( pVersion != NULL )
4795 {
4796 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
4797 }
4798 else
4799 {
4800 status = VOS_STATUS_E_INVAL;
4801 }
4802 sme_ReleaseGlobalLock( &pMac->sme );
4803 }
4804
4805 return (status);
4806}
4807
4808
4809/* ---------------------------------------------------------------------------
4810 \fn sme_GetWcnssSoftwareVersion
4811 \brief This API returns the version string of the WCNSS driver
4812 \param hHal - The handle returned by macOpen.
4813 \param pVersion - Points to the Version string buffer to be filled
4814 \param versionBufferSize - THe size of the Version string buffer
4815 \return VOS_STATUS
4816 VOS_STATUS_E_INVAL - failure
4817 VOS_STATUS_SUCCESS success
4818 ---------------------------------------------------------------------------*/
4819VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
4820 tANI_U8 *pVersion,
4821 tANI_U32 versionBufferSize)
4822{
4823 VOS_STATUS status = VOS_STATUS_SUCCESS;
4824 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4825 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4826
4827 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4828 {
4829 if( pVersion != NULL )
4830 {
4831 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
4832 versionBufferSize);
4833 }
4834 else
4835 {
4836 status = VOS_STATUS_E_INVAL;
4837 }
4838 sme_ReleaseGlobalLock( &pMac->sme );
4839 }
4840
4841 return (status);
4842}
4843
4844
4845/* ---------------------------------------------------------------------------
4846 \fn sme_GetWcnssHardwareVersion
4847 \brief This API returns the version string of the WCNSS hardware
4848 \param hHal - The handle returned by macOpen.
4849 \param pVersion - Points to the Version string buffer to be filled
4850 \param versionBufferSize - THe size of the Version string buffer
4851 \return VOS_STATUS
4852 VOS_STATUS_E_INVAL - failure
4853 VOS_STATUS_SUCCESS success
4854 ---------------------------------------------------------------------------*/
4855VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
4856 tANI_U8 *pVersion,
4857 tANI_U32 versionBufferSize)
4858{
4859 VOS_STATUS status = VOS_STATUS_SUCCESS;
4860 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4861 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
4862
4863 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4864 {
4865 if( pVersion != NULL )
4866 {
4867 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
4868 versionBufferSize);
4869 }
4870 else
4871 {
4872 status = VOS_STATUS_E_INVAL;
4873 }
4874 sme_ReleaseGlobalLock( &pMac->sme );
4875 }
4876
4877 return (status);
4878}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08004879
Jeff Johnson295189b2012-06-20 16:38:30 -07004880
4881#ifdef FEATURE_WLAN_WAPI
4882/* ---------------------------------------------------------------------------
4883 \fn sme_RoamSetBKIDCache
4884 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
4885 candidate list.
4886 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4887 it is opened (by calling halOpen).
4888 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
4889 \param numItems - a variable that has the number of tBkidCacheInfo allocated
4890 when retruning, this is the number of items put into pBKIDCache
4891 \return eHalStatus - when fail, it usually means the buffer allocated is not
4892 big enough and pNumItems has the number of tBkidCacheInfo.
4893 ---------------------------------------------------------------------------*/
4894eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
4895 tANI_U32 numItems )
4896{
4897 eHalStatus status = eHAL_STATUS_FAILURE;
4898 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4899
4900 status = sme_AcquireGlobalLock( &pMac->sme );
4901 if ( HAL_STATUS_SUCCESS( status ) )
4902 {
4903 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
4904 sme_ReleaseGlobalLock( &pMac->sme );
4905 }
4906
4907 return (status);
4908}
4909
4910/* ---------------------------------------------------------------------------
4911 \fn sme_RoamGetBKIDCache
4912 \brief The SME API exposed to HDD to allow HDD to request SME to return its
4913 BKID cache.
4914 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4915 it is opened (by calling halOpen).
4916 \param pNum - caller allocated memory that has the space of the number of
4917 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
4918 in SME cache.
4919 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
4920 upon return
4921 \return eHalStatus - when fail, it usually means the buffer allocated is not
4922 big enough.
4923 ---------------------------------------------------------------------------*/
4924eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
4925 tBkidCacheInfo *pBkidCache)
4926{
4927 eHalStatus status = eHAL_STATUS_FAILURE;
4928 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4929
4930 status = sme_AcquireGlobalLock( &pMac->sme );
4931 if ( HAL_STATUS_SUCCESS( status ) )
4932 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004933 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004934 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
4935 sme_ReleaseGlobalLock( &pMac->sme );
4936 }
4937
4938 return (status);
4939}
4940
4941/* ---------------------------------------------------------------------------
4942 \fn sme_RoamGetNumBKIDCache
4943 \brief The SME API exposed to HDD to allow HDD to request SME to return the
4944 number of BKID cache entries.
4945 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
4946 it is opened (by calling halOpen).
4947 \return tANI_U32 - the number of BKID cache entries.
4948 ---------------------------------------------------------------------------*/
4949tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
4950{
4951 eHalStatus status = eHAL_STATUS_FAILURE;
4952 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4953 tANI_U32 numBkidCache = 0;
4954
4955 status = sme_AcquireGlobalLock( &pMac->sme );
4956 if ( HAL_STATUS_SUCCESS( status ) )
4957 {
4958 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
4959 sme_ReleaseGlobalLock( &pMac->sme );
4960 }
4961
4962 return (numBkidCache);
4963}
4964
4965/* ---------------------------------------------------------------------------
4966 \fn sme_ScanGetBKIDCandidateList
4967 \brief a wrapper function to return the BKID candidate list
4968 \param pBkidList - caller allocated buffer point to an array of
4969 tBkidCandidateInfo
4970 \param pNumItems - pointer to a variable that has the number of
4971 tBkidCandidateInfo allocated when retruning, this is
4972 either the number needed or number of items put into
4973 pPmkidList
4974 \return eHalStatus - when fail, it usually means the buffer allocated is not
4975 big enough and pNumItems
4976 has the number of tBkidCandidateInfo.
4977 \Note: pNumItems is a number of tBkidCandidateInfo,
4978 not sizeof(tBkidCandidateInfo) * something
4979 ---------------------------------------------------------------------------*/
4980eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
4981 tBkidCandidateInfo *pBkidList,
4982 tANI_U32 *pNumItems )
4983{
4984 eHalStatus status = eHAL_STATUS_FAILURE;
4985 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4986
4987 status = sme_AcquireGlobalLock( &pMac->sme );
4988 if ( HAL_STATUS_SUCCESS( status ) )
4989 {
4990 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
4991 sme_ReleaseGlobalLock( &pMac->sme );
4992 }
4993
4994 return (status);
4995}
4996#endif /* FEATURE_WLAN_WAPI */
4997
Jeff Johnsone7245742012-09-05 17:12:55 -07004998#ifdef FEATURE_OEM_DATA_SUPPORT
4999
5000/*****************************************************************************
5001 OEM DATA related modifications and function additions
5002 *****************************************************************************/
5003
5004/* ---------------------------------------------------------------------------
5005 \fn sme_getOemDataRsp
5006 \brief a wrapper function to obtain the OEM DATA RSP
5007 \param pOemDataRsp - A pointer to the response object
5008 \param pContext - a pointer passed in for the callback
5009 \return eHalStatus
5010 ---------------------------------------------------------------------------*/
5011eHalStatus sme_getOemDataRsp(tHalHandle hHal,
5012 tOemDataRsp **pOemDataRsp)
5013{
5014 eHalStatus status = eHAL_STATUS_SUCCESS;
5015 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5016
5017 do
5018 {
5019 //acquire the lock for the sme object
5020 status = sme_AcquireGlobalLock(&pMac->sme);
5021
5022 if(!HAL_STATUS_SUCCESS(status))
5023 {
5024 break;
5025 }
5026
5027 if(pMac->oemData.pOemDataRsp != NULL)
5028 {
5029 *pOemDataRsp = pMac->oemData.pOemDataRsp;
5030 }
5031 else
5032 {
5033 status = eHAL_STATUS_FAILURE;
5034 }
5035
5036 //release the lock for the sme object
5037 sme_ReleaseGlobalLock( &pMac->sme );
5038
5039 } while(0);
5040
5041 return status;
5042}
5043
5044/* ---------------------------------------------------------------------------
5045 \fn sme_OemDataReq
5046 \brief a wrapper function for OEM DATA REQ
5047 \param sessionId - session id to be used.
5048 \param pOemDataReqId - pointer to an object to get back the request ID
5049 \param callback - a callback function that is called upon finish
5050 \param pContext - a pointer passed in for the callback
5051 \return eHalStatus
5052 ---------------------------------------------------------------------------*/
5053eHalStatus sme_OemDataReq(tHalHandle hHal,
5054 tANI_U8 sessionId,
5055 tOemDataReqConfig *pOemDataReqConfig,
5056 tANI_U32 *pOemDataReqID,
5057 oemData_OemDataReqCompleteCallback callback,
5058 void *pContext)
5059{
5060 eHalStatus status = eHAL_STATUS_SUCCESS;
5061 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5062
5063 do
5064 {
5065 //acquire the lock for the sme object
5066 status = sme_AcquireGlobalLock(&pMac->sme);
5067 if(HAL_STATUS_SUCCESS(status))
5068 {
5069 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
5070
5071 if(pOemDataReqID)
5072 {
5073 *pOemDataReqID = lOemDataReqId;
5074 }
5075 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005076 {
5077 sme_ReleaseGlobalLock( &pMac->sme );
5078 return eHAL_STATUS_FAILURE;
5079 }
Jeff Johnsone7245742012-09-05 17:12:55 -07005080
5081 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
5082
5083 //release the lock for the sme object
5084 sme_ReleaseGlobalLock( &pMac->sme );
5085 }
5086 } while(0);
5087
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005088 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07005089
5090 return(status);
5091}
5092
5093#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07005094
5095/*--------------------------------------------------------------------------
5096
5097 \brief sme_OpenSession() - Open a session for scan/roam operation.
5098
5099 This is a synchronous API.
5100
5101
5102 \param hHal - The handle returned by macOpen.
5103 \param callback - A pointer to the function caller specifies for roam/connect status indication
5104 \param pContext - The context passed with callback
5105 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
5106 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
5107
5108 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
5109
5110 Other status means SME is failed to open the session.
5111 eHAL_STATUS_RESOURCES - no more session available.
5112 \sa
5113
5114 --------------------------------------------------------------------------*/
5115eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback, void *pContext,
5116 tANI_U8 *pSelfMacAddr, tANI_U8 *pbSessionId)
5117{
5118 eHalStatus status;
5119 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5120
5121 if( NULL == pbSessionId )
5122 {
5123 status = eHAL_STATUS_INVALID_PARAMETER;
5124 }
5125 else
5126 {
5127 status = sme_AcquireGlobalLock( &pMac->sme );
5128 if ( HAL_STATUS_SUCCESS( status ) )
5129 {
5130 status = csrRoamOpenSession( pMac, callback, pContext, pSelfMacAddr, pbSessionId );
5131
5132 sme_ReleaseGlobalLock( &pMac->sme );
5133 }
5134 }
5135
5136 return ( status );
5137}
5138
5139
5140/*--------------------------------------------------------------------------
5141
5142 \brief sme_CloseSession() - Open a session for scan/roam operation.
5143
5144 This is a synchronous API.
5145
5146
5147 \param hHal - The handle returned by macOpen.
5148
5149 \param sessionId - A previous opened session's ID.
5150
5151 \return eHAL_STATUS_SUCCESS - session is closed.
5152
5153 Other status means SME is failed to open the session.
5154 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
5155 \sa
5156
5157 --------------------------------------------------------------------------*/
5158eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
5159 csrRoamSessionCloseCallback callback, void *pContext)
5160{
5161 eHalStatus status;
5162 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5163
5164 status = sme_AcquireGlobalLock( &pMac->sme );
5165 if ( HAL_STATUS_SUCCESS( status ) )
5166 {
5167 status = csrRoamCloseSession( pMac, sessionId, FALSE,
5168 callback, pContext );
5169
5170 sme_ReleaseGlobalLock( &pMac->sme );
5171 }
5172
5173 return ( status );
5174}
5175
Jeff Johnson295189b2012-06-20 16:38:30 -07005176/* ---------------------------------------------------------------------------
5177
5178 \fn sme_RoamUpdateAPWPSIE
5179
5180 \brief To update AP's WPS IE. This function should be called after SME AP session is created
5181 This is an asynchronous API.
5182
5183 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
5184
5185 \return eHalStatus – SUCCESS –
5186
5187 FAILURE or RESOURCES – The API finished and failed.
5188
5189 -------------------------------------------------------------------------------*/
5190eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
5191{
5192
5193 eHalStatus status = eHAL_STATUS_FAILURE;
5194 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5195
5196 status = sme_AcquireGlobalLock( &pMac->sme );
5197 if ( HAL_STATUS_SUCCESS( status ) )
5198 {
5199
5200 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
5201
5202 sme_ReleaseGlobalLock( &pMac->sme );
5203 }
5204
5205 return (status);
5206}
5207/* ---------------------------------------------------------------------------
5208
5209 \fn sme_RoamUpdateAPWPARSNIEs
5210
5211 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
5212 This is an asynchronous API.
5213
5214 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
5215
5216 \return eHalStatus – SUCCESS –
5217
5218 FAILURE or RESOURCES – The API finished and failed.
5219
5220 -------------------------------------------------------------------------------*/
5221eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
5222{
5223
5224 eHalStatus status = eHAL_STATUS_FAILURE;
5225 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5226
5227 status = sme_AcquireGlobalLock( &pMac->sme );
5228 if ( HAL_STATUS_SUCCESS( status ) )
5229 {
5230
5231 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
5232
5233 sme_ReleaseGlobalLock( &pMac->sme );
5234 }
5235
5236 return (status);
5237}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005238/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005239
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005240 \fn sme_ChangeMCCBeaconInterval
5241
5242 \brief To update P2P-GO beaconInterval. This function should be called after
5243 disassociating all the station is done
5244 This is an asynchronous API.
5245
5246 \param
5247
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005248 \return eHalStatus SUCCESS
5249 FAILURE or RESOURCES
5250 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005251
5252 -------------------------------------------------------------------------------*/
5253eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
5254{
5255 eHalStatus status = eHAL_STATUS_FAILURE;
5256 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5257
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005258 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005259 status = sme_AcquireGlobalLock( &pMac->sme );
5260 if ( HAL_STATUS_SUCCESS( status ) )
5261 {
5262 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
5263 sme_ReleaseGlobalLock( &pMac->sme );
5264 }
5265 return (status);
5266}
Jeff Johnson295189b2012-06-20 16:38:30 -07005267
5268/*-------------------------------------------------------------------------------*
5269
5270 \fn sme_sendBTAmpEvent
5271
5272 \brief to receive the coex priorty request from BT-AMP PAL
5273 and send the BT_AMP link state to HAL
5274
5275 \param btAmpEvent - btAmpEvent
5276
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005277 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07005278
5279 FAILURE: API failed
5280
5281-------------------------------------------------------------------------------*/
5282
5283eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
5284{
5285 vos_msg_t msg;
5286 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
5287 eHalStatus status = eHAL_STATUS_FAILURE;
5288
5289 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tpSmeBtAmpEvent));
5290 if (NULL == ptrSmeBtAmpEvent)
5291 {
5292 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005293 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005294 return status;
5295 }
5296
5297 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
5298 msg.type = WDA_SIGNAL_BTAMP_EVENT;
5299 msg.reserved = 0;
5300 msg.bodyptr = ptrSmeBtAmpEvent;
5301
5302 //status = halFW_SendBTAmpEventMesg(pMac, event);
5303
5304 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
5305 {
5306 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005307 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005308 vos_mem_free(ptrSmeBtAmpEvent);
5309 return status;
5310 }
5311
5312 return eHAL_STATUS_SUCCESS;
5313
5314}
5315
5316/* ---------------------------------------------------------------------------
5317 \fn sme_SetHostOffload
5318 \brief API to set the host offload feature.
5319 \param hHal - The handle returned by macOpen.
5320 \param pRequest - Pointer to the offload request.
5321 \return eHalStatus
5322 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005323eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
5324 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005325{
5326 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07005327 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005328
5329 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5330 {
5331#ifdef WLAN_NS_OFFLOAD
5332 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
5333 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005334 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005335 }
5336 else
5337#endif //WLAN_NS_OFFLOAD
5338 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005339 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005340 }
5341 sme_ReleaseGlobalLock( &pMac->sme );
5342 }
5343
5344 return (status);
5345}
5346
5347#ifdef WLAN_FEATURE_GTK_OFFLOAD
5348/* ---------------------------------------------------------------------------
5349 \fn sme_SetGTKOffload
5350 \brief API to set GTK offload information.
5351 \param hHal - The handle returned by macOpen.
5352 \param pRequest - Pointer to the GTK offload request.
5353 \return eHalStatus
5354 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005355eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
5356 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005357{
5358 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5359 eHalStatus status;
5360
5361 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5362 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005363 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005364 sme_ReleaseGlobalLock( &pMac->sme );
5365 }
5366
5367 return (status);
5368}
5369
5370/* ---------------------------------------------------------------------------
5371 \fn sme_GetGTKOffload
5372 \brief API to get GTK offload information.
5373 \param hHal - The handle returned by macOpen.
5374 \param pRequest - Pointer to the GTK offload response.
5375 \return eHalStatus
5376 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005377eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
5378 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07005379{
5380 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5381 eHalStatus status;
5382
5383 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5384 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005385 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005386 sme_ReleaseGlobalLock( &pMac->sme );
5387 }
5388
5389 return (status);
5390}
5391#endif // WLAN_FEATURE_GTK_OFFLOAD
5392
5393/* ---------------------------------------------------------------------------
5394 \fn sme_SetKeepAlive
5395 \brief API to set the Keep Alive feature.
5396 \param hHal - The handle returned by macOpen.
5397 \param pRequest - Pointer to the Keep Alive request.
5398 \return eHalStatus
5399 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005400eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
5401 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005402{
5403 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5404 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07005405 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5406 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005407 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005408 sme_ReleaseGlobalLock( &pMac->sme );
5409 }
5410
5411 return (status);
5412}
5413
5414#ifdef FEATURE_WLAN_SCAN_PNO
5415/* ---------------------------------------------------------------------------
5416 \fn sme_SetPreferredNetworkList
5417 \brief API to set the Preferred Network List Offload feature.
5418 \param hHal - The handle returned by macOpen.
5419 \param pRequest - Pointer to the offload request.
5420 \return eHalStatus
5421 ---------------------------------------------------------------------------*/
5422eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
5423{
5424 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5425 eHalStatus status;
5426
5427 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5428 {
5429 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
5430 sme_ReleaseGlobalLock( &pMac->sme );
5431 }
5432
5433 return (status);
5434}
5435
5436eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
5437{
5438 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5439 eHalStatus status;
5440
5441 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5442 {
5443 pmcSetRssiFilter(hHal, rssiThreshold);
5444 sme_ReleaseGlobalLock( &pMac->sme );
5445 }
5446
5447 return (status);
5448}
5449
5450#endif // FEATURE_WLAN_SCAN_PNO
5451
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005452eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07005453{
5454 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5455 eHalStatus status;
5456
5457 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5458 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005459 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07005460 sme_ReleaseGlobalLock( &pMac->sme );
5461 }
5462
5463 return (status);
5464}
5465
5466/* ---------------------------------------------------------------------------
5467 \fn sme_AbortMacScan
5468 \brief API to cancel MAC scan.
5469 \param hHal - The handle returned by macOpen.
5470 \return VOS_STATUS
5471 VOS_STATUS_E_FAILURE - failure
5472 VOS_STATUS_SUCCESS success
5473 ---------------------------------------------------------------------------*/
5474eHalStatus sme_AbortMacScan(tHalHandle hHal)
5475{
5476 eHalStatus status;
5477 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5478
5479 status = sme_AcquireGlobalLock( &pMac->sme );
5480 if ( HAL_STATUS_SUCCESS( status ) )
5481 {
5482 status = csrScanAbortMacScan(pMac);
5483
5484 sme_ReleaseGlobalLock( &pMac->sme );
5485 }
5486
5487 return ( status );
5488}
5489
5490/* ----------------------------------------------------------------------------
5491 \fn sme_GetOperationChannel
5492 \brief API to get current channel on which STA is parked
5493 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005494 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07005495 \returns eHAL_STATUS_SUCCESS
5496 eHAL_STATUS_FAILURE
5497-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005498eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005499{
Jeff Johnson295189b2012-06-20 16:38:30 -07005500 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5501 tCsrRoamSession *pSession;
5502
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005503 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005504 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005505 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005506
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005507 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
5508 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005509 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005510 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
5511 {
5512 *pChannel =pSession->connectedProfile.operationChannel;
5513 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005514 }
5515 }
5516 return eHAL_STATUS_FAILURE;
5517}// sme_GetOperationChannel ends here
5518
Jeff Johnson295189b2012-06-20 16:38:30 -07005519/* ---------------------------------------------------------------------------
5520
5521 \fn sme_RegisterMgtFrame
5522
5523 \brief To register managment frame of specified type and subtype.
5524 \param frameType - type of the frame that needs to be passed to HDD.
5525 \param matchData - data which needs to be matched before passing frame
5526 to HDD.
5527 \param matchDataLen - Length of matched data.
5528 \return eHalStatus
5529 -------------------------------------------------------------------------------*/
5530eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5531 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5532{
5533 eHalStatus status = eHAL_STATUS_SUCCESS;
5534 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5535
5536 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5537 {
5538 tSirRegisterMgmtFrame *pMsg;
5539 tANI_U16 len;
5540 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005541
5542 if(!pSession)
5543 {
5544 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005545 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005546 return eHAL_STATUS_FAILURE;
5547 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005548
5549 if( !pSession->sessionActive )
5550 {
5551 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005552 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005553 sme_ReleaseGlobalLock( &pMac->sme );
5554 return eHAL_STATUS_FAILURE;
5555 }
5556
5557 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5558
5559 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5560 if(HAL_STATUS_SUCCESS(status))
5561 {
5562 palZeroMemory(pMac->hHdd, pMsg, len);
5563 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5564 pMsg->length = len;
5565 pMsg->sessionId = sessionId;
5566 pMsg->registerFrame = VOS_TRUE;
5567 pMsg->frameType = frameType;
5568 pMsg->matchLen = matchLen;
5569 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5570 status = palSendMBMessage(pMac->hHdd, pMsg);
5571 }
5572 sme_ReleaseGlobalLock( &pMac->sme );
5573 }
5574 return status;
5575}
5576
5577/* ---------------------------------------------------------------------------
5578
5579 \fn sme_DeregisterMgtFrame
5580
5581 \brief To De-register managment frame of specified type and subtype.
5582 \param frameType - type of the frame that needs to be passed to HDD.
5583 \param matchData - data which needs to be matched before passing frame
5584 to HDD.
5585 \param matchDataLen - Length of matched data.
5586 \return eHalStatus
5587 -------------------------------------------------------------------------------*/
5588eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5589 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5590{
5591 eHalStatus status = eHAL_STATUS_SUCCESS;
5592 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5593
5594 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5595 {
5596 tSirRegisterMgmtFrame *pMsg;
5597 tANI_U16 len;
5598 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005599
5600 if(!pSession)
5601 {
5602 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005603 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005604 return eHAL_STATUS_FAILURE;
5605 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005606
5607 if( !pSession->sessionActive )
5608 {
5609 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005610 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005611 sme_ReleaseGlobalLock( &pMac->sme );
5612 return eHAL_STATUS_FAILURE;
5613 }
5614
5615 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5616
5617 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5618 if(HAL_STATUS_SUCCESS(status))
5619 {
5620 palZeroMemory(pMac->hHdd, pMsg, len);
5621 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5622 pMsg->length = len;
5623 pMsg->registerFrame = VOS_FALSE;
5624 pMsg->frameType = frameType;
5625 pMsg->matchLen = matchLen;
5626 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5627 status = palSendMBMessage(pMac->hHdd, pMsg);
5628 }
5629 sme_ReleaseGlobalLock( &pMac->sme );
5630 }
5631 return status;
5632}
5633
5634/* ---------------------------------------------------------------------------
5635 \fn sme_RemainOnChannel
5636 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
5637 \param hHal - The handle returned by macOpen.
5638 \param pRequest - channel
5639 \param duration - duration in ms
5640 \param callback - HDD registered callback to process reaminOnChannelRsp
5641 \param context - HDD Callback param
5642 \return eHalStatus
5643 ---------------------------------------------------------------------------*/
5644
5645eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
5646 tANI_U8 channel, tANI_U32 duration,
5647 remainOnChanCallback callback,
5648 void *pContext)
5649{
5650 eHalStatus status = eHAL_STATUS_SUCCESS;
5651 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5652
5653 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5654 {
5655 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext
5656#ifdef WLAN_FEATURE_P2P_INTERNAL
5657 , eP2PRemainOnChnReasonUnknown
5658#endif
5659 );
5660 sme_ReleaseGlobalLock( &pMac->sme );
5661 }
5662 return(status);
5663}
5664
5665/* ---------------------------------------------------------------------------
5666 \fn sme_ReportProbeReq
5667 \brief API to enable/disable forwarding of probeReq to apps in p2p.
5668 \param hHal - The handle returned by macOpen.
5669 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
5670 \return eHalStatus
5671 ---------------------------------------------------------------------------*/
5672
5673#ifndef WLAN_FEATURE_CONCURRENT_P2P
5674eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
5675{
5676 eHalStatus status = eHAL_STATUS_SUCCESS;
5677 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5678
5679 do
5680 {
5681 //acquire the lock for the sme object
5682 status = sme_AcquireGlobalLock(&pMac->sme);
5683 if(HAL_STATUS_SUCCESS(status))
5684 {
5685 /* call set in context */
5686 pMac->p2pContext.probeReqForwarding = flag;
5687 //release the lock for the sme object
5688 sme_ReleaseGlobalLock( &pMac->sme );
5689 }
5690 } while(0);
5691
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005692 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005693
5694 return(status);
5695}
5696
5697/* ---------------------------------------------------------------------------
5698 \fn sme_updateP2pIe
5699 \brief API to set the P2p Ie in p2p context
5700 \param hHal - The handle returned by macOpen.
5701 \param p2pIe - Ptr to p2pIe from HDD.
5702 \param p2pIeLength: length of p2pIe
5703 \return eHalStatus
5704 ---------------------------------------------------------------------------*/
5705
5706eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
5707{
5708 eHalStatus status = eHAL_STATUS_SUCCESS;
5709 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5710
5711 //acquire the lock for the sme object
5712 status = sme_AcquireGlobalLock(&pMac->sme);
5713 if(HAL_STATUS_SUCCESS(status))
5714 {
5715 if(NULL != pMac->p2pContext.probeRspIe){
5716 vos_mem_free(pMac->p2pContext.probeRspIe);
5717 pMac->p2pContext.probeRspIeLength = 0;
5718 }
5719
5720 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
5721 if (NULL == pMac->p2pContext.probeRspIe)
5722 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005723 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005724 pMac->p2pContext.probeRspIeLength = 0;
5725 status = eHAL_STATUS_FAILURE;
5726 }
5727 else
5728 {
5729 pMac->p2pContext.probeRspIeLength = p2pIeLength;
5730
5731 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
5732 pMac->p2pContext.probeRspIe,
5733 pMac->p2pContext.probeRspIeLength );
5734 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
5735 p2pIeLength);
5736 }
5737
5738 //release the lock for the sme object
5739 sme_ReleaseGlobalLock( &pMac->sme );
5740 }
5741
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005742 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005743
5744 return(status);
5745}
5746#endif
5747
5748/* ---------------------------------------------------------------------------
5749 \fn sme_sendAction
5750 \brief API to send action frame from supplicant.
5751 \param hHal - The handle returned by macOpen.
5752 \return eHalStatus
5753 ---------------------------------------------------------------------------*/
5754
5755eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07005756 const tANI_U8 *pBuf, tANI_U32 len,
5757 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07005758{
5759 eHalStatus status = eHAL_STATUS_SUCCESS;
5760 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5761
5762 //acquire the lock for the sme object
5763 status = sme_AcquireGlobalLock(&pMac->sme);
5764 if(HAL_STATUS_SUCCESS(status))
5765 {
Jeff Johnsone7245742012-09-05 17:12:55 -07005766 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07005767 //release the lock for the sme object
5768 sme_ReleaseGlobalLock( &pMac->sme );
5769 }
5770
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005771 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005772
5773 return(status);
5774}
5775
5776eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
5777{
5778 eHalStatus status = eHAL_STATUS_SUCCESS;
5779 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5780
5781 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5782 {
5783 status = p2pCancelRemainOnChannel (hHal, sessionId);
5784 sme_ReleaseGlobalLock( &pMac->sme );
5785 }
5786 return(status);
5787}
5788
5789//Power Save Related
5790eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
5791{
5792 eHalStatus status = eHAL_STATUS_SUCCESS;
5793 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5794
5795 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5796 {
5797 status = p2pSetPs (hHal, data);
5798 sme_ReleaseGlobalLock( &pMac->sme );
5799 }
5800 return(status);
5801}
5802
Jeff Johnson295189b2012-06-20 16:38:30 -07005803
5804/* ---------------------------------------------------------------------------
5805
5806 \fn sme_ConfigureRxpFilter
5807
5808 \brief
5809 SME will pass this request to lower mac to set/reset the filter on RXP for
5810 multicast & broadcast traffic.
5811
5812 \param
5813
5814 hHal - The handle returned by macOpen.
5815
5816 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
5817 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
5818 on this param. In future we can use this as a mask to set various types of
5819 filters as suggested below:
5820 FILTER_ALL_MULTICAST:
5821 FILTER_ALL_BROADCAST:
5822 FILTER_ALL_MULTICAST_BROADCAST:
5823
5824
5825 \return eHalStatus
5826
5827
5828--------------------------------------------------------------------------- */
5829eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
5830 tpSirWlanSetRxpFilters wlanRxpFilterParam)
5831{
5832 eHalStatus status = eHAL_STATUS_SUCCESS;
5833 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5834 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5835 vos_msg_t vosMessage;
5836
5837 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5838 {
5839 /* serialize the req through MC thread */
5840 vosMessage.bodyptr = wlanRxpFilterParam;
5841 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
5842 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5843 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5844 {
5845 status = eHAL_STATUS_FAILURE;
5846 }
5847 sme_ReleaseGlobalLock( &pMac->sme );
5848 }
5849 return(status);
5850}
5851
Jeff Johnson295189b2012-06-20 16:38:30 -07005852/* ---------------------------------------------------------------------------
5853
5854 \fn sme_ConfigureSuspendInd
5855
5856 \brief
5857 SME will pass this request to lower mac to Indicate that the wlan needs to
5858 be suspended
5859
5860 \param
5861
5862 hHal - The handle returned by macOpen.
5863
5864 wlanSuspendParam- Depicts the wlan suspend params
5865
5866
5867 \return eHalStatus
5868
5869
5870--------------------------------------------------------------------------- */
5871eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
5872 tpSirWlanSuspendParam wlanSuspendParam)
5873{
5874 eHalStatus status = eHAL_STATUS_SUCCESS;
5875 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5876 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5877 vos_msg_t vosMessage;
5878
5879 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5880 {
5881 /* serialize the req through MC thread */
5882 vosMessage.bodyptr = wlanSuspendParam;
5883 vosMessage.type = WDA_WLAN_SUSPEND_IND;
5884 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5885 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5886 {
5887 status = eHAL_STATUS_FAILURE;
5888 }
5889 sme_ReleaseGlobalLock( &pMac->sme );
5890 }
5891 return(status);
5892}
5893
5894/* ---------------------------------------------------------------------------
5895
5896 \fn sme_ConfigureResumeReq
5897
5898 \brief
5899 SME will pass this request to lower mac to Indicate that the wlan needs to
5900 be Resumed
5901
5902 \param
5903
5904 hHal - The handle returned by macOpen.
5905
5906 wlanResumeParam- Depicts the wlan resume params
5907
5908
5909 \return eHalStatus
5910
5911
5912--------------------------------------------------------------------------- */
5913eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
5914 tpSirWlanResumeParam wlanResumeParam)
5915{
5916 eHalStatus status = eHAL_STATUS_SUCCESS;
5917 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
5918 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5919 vos_msg_t vosMessage;
5920
5921 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5922 {
5923 /* serialize the req through MC thread */
5924 vosMessage.bodyptr = wlanResumeParam;
5925 vosMessage.type = WDA_WLAN_RESUME_REQ;
5926 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5927 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5928 {
5929 status = eHAL_STATUS_FAILURE;
5930 }
5931 sme_ReleaseGlobalLock( &pMac->sme );
5932 }
5933 return(status);
5934}
5935
Jeff Johnson295189b2012-06-20 16:38:30 -07005936/* ---------------------------------------------------------------------------
5937
5938 \fn sme_GetInfraSessionId
5939
5940 \brief To get the session ID for infra session, if connected
5941 This is a synchronous API.
5942
5943 \param hHal - The handle returned by macOpen.
5944
5945 \return sessionid, -1 if infra session is not connected
5946
5947 -------------------------------------------------------------------------------*/
5948tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
5949{
5950 eHalStatus status = eHAL_STATUS_FAILURE;
5951 tANI_S8 sessionid = -1;
5952 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5953
5954 status = sme_AcquireGlobalLock( &pMac->sme );
5955 if ( HAL_STATUS_SUCCESS( status ) )
5956 {
5957
5958 sessionid = csrGetInfraSessionId( pMac);
5959
5960 sme_ReleaseGlobalLock( &pMac->sme );
5961 }
5962
5963 return (sessionid);
5964}
5965
5966/* ---------------------------------------------------------------------------
5967
5968 \fn sme_GetInfraOperationChannel
5969
5970 \brief To get the operating channel for infra session, if connected
5971 This is a synchronous API.
5972
5973 \param hHal - The handle returned by macOpen.
5974 \param sessionId - the sessionId returned by sme_OpenSession.
5975
5976 \return operating channel, 0 if infra session is not connected
5977
5978 -------------------------------------------------------------------------------*/
5979tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
5980{
5981 eHalStatus status = eHAL_STATUS_FAILURE;
5982 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5983 tANI_U8 channel = 0;
5984 status = sme_AcquireGlobalLock( &pMac->sme );
5985 if ( HAL_STATUS_SUCCESS( status ) )
5986 {
5987
5988 channel = csrGetInfraOperationChannel( pMac, sessionId);
5989
5990 sme_ReleaseGlobalLock( &pMac->sme );
5991 }
5992
5993 return (channel);
5994}
5995
5996//This routine will return poerating channel on which other BSS is operating to be used for concurrency mode.
5997//If other BSS is not up or not connected it will return 0
5998tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
5999{
6000 eHalStatus status = eHAL_STATUS_FAILURE;
6001 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6002 tANI_U8 channel = 0;
6003 status = sme_AcquireGlobalLock( &pMac->sme );
6004 if ( HAL_STATUS_SUCCESS( status ) )
6005 {
6006
6007 channel = csrGetConcurrentOperationChannel( pMac );
6008 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006009 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07006010 sme_ReleaseGlobalLock( &pMac->sme );
6011 }
6012
6013 return (channel);
6014}
6015
6016#ifdef FEATURE_WLAN_SCAN_PNO
6017/******************************************************************************
6018*
6019* Name: sme_PreferredNetworkFoundInd
6020*
6021* Description:
6022* Invoke Preferred Network Found Indication
6023*
6024* Parameters:
6025* hHal - HAL handle for device
6026* pMsg - found network description
6027*
6028* Returns: eHalStatus
6029*
6030******************************************************************************/
6031eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
6032{
6033 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6034 eHalStatus status = eHAL_STATUS_SUCCESS;
6035 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07006036 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
6037 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006038
6039 if (NULL == pMsg)
6040 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006041 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006042 status = eHAL_STATUS_FAILURE;
6043 }
6044 else
6045 {
6046 if (pPrefNetworkFoundInd->ssId.length > 0)
6047 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07006048 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
6049 pPrefNetworkFoundInd->ssId.length);
6050 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
6051 dumpSsId[ssIdLength] = 0;
6052 smsLog(pMac, LOG2, "%s:SSID=%s frame length %d",
6053 __func__, dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07006054
Srikant Kuppa066904f2013-05-07 13:56:02 -07006055 //Save the frame to scan result
6056 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
6057 {
6058 //we may have a frame
6059 status = csrScanSavePreferredNetworkFound(pMac,
6060 pPrefNetworkFoundInd);
6061 if (!HAL_STATUS_SUCCESS(status))
6062 {
6063 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
6064 }
6065 }
6066 else
6067 {
6068 smsLog(pMac, LOGE, FL(" not enough data length %d needed %d"),
6069 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07006070 }
6071
Srikant Kuppa066904f2013-05-07 13:56:02 -07006072 /* Call Preferred Netowrk Found Indication callback routine. */
6073 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
6074 {
6075 pMac->pmc.prefNetwFoundCB(
6076 pMac->pmc.preferredNetworkFoundIndCallbackContext,
6077 pPrefNetworkFoundInd);
6078 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006079 }
6080 else
6081 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006082 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006083 status = eHAL_STATUS_FAILURE;
6084 }
6085 }
6086
6087
6088 return(status);
6089}
6090
6091#endif // FEATURE_WLAN_SCAN_PNO
6092
6093
6094eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
6095{
6096 eHalStatus status = eHAL_STATUS_FAILURE;
6097 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6098
6099 status = sme_AcquireGlobalLock( &pMac->sme );
6100 if ( HAL_STATUS_SUCCESS( status ) )
6101 {
6102 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
6103 sme_ReleaseGlobalLock( &pMac->sme );
6104 }
6105
6106 return (status);
6107}
6108
6109
6110/* ---------------------------------------------------------------------------
6111
6112 \fn sme_SetTxPerTracking
6113
6114 \brief Set Tx PER tracking configuration parameters
6115
6116 \param hHal - The handle returned by macOpen.
6117 \param pTxPerTrackingConf - Tx PER configuration parameters
6118
6119 \return eHalStatus
6120
6121 -------------------------------------------------------------------------------*/
6122eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
6123 void (*pCallbackfn) (void *pCallbackContext),
6124 void *pCallbackContext,
6125 tpSirTxPerTrackingParam pTxPerTrackingParam)
6126{
6127 vos_msg_t msg;
6128 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
6129 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6130
6131 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6132 {
6133 pMac->sme.pTxPerHitCallback = pCallbackfn;
6134 pMac->sme.pTxPerHitCbContext = pCallbackContext;
6135 sme_ReleaseGlobalLock( &pMac->sme );
6136 }
6137
6138 // free this memory in failure case or WDA request callback function
6139 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
6140 if (NULL == pTxPerTrackingParamReq)
6141 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006142 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 -07006143 return eHAL_STATUS_FAILURE;
6144 }
6145
6146 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam, sizeof(tSirTxPerTrackingParam));
6147 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
6148 msg.reserved = 0;
6149 msg.bodyptr = pTxPerTrackingParamReq;
6150
6151 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6152 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006153 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 -07006154 vos_mem_free(pTxPerTrackingParamReq);
6155 return eHAL_STATUS_FAILURE;
6156 }
6157
6158 return eHAL_STATUS_SUCCESS;
6159}
6160
6161/* ---------------------------------------------------------------------------
6162
6163 \fn sme_HandleChangeCountryCode
6164
6165 \brief Change Country code, Reg Domain and channel list
6166
6167 \details Country Code Priority
6168 0 = 11D > Configured Country > NV
6169 1 = Configured Country > 11D > NV
6170 If Supplicant country code is priority than 11d is disabled.
6171 If 11D is enabled, we update the country code after every scan.
6172 Hence when Supplicant country code is priority, we don't need 11D info.
6173 Country code from Supplicant is set as current courtry code.
6174 User can send reset command XX (instead of country code) to reset the
6175 country code to default values which is read from NV.
6176 In case of reset, 11D is enabled and default NV code is Set as current country code
6177 If 11D is priority,
6178 Than Supplicant country code code is set to default code. But 11D code is set as current country code
6179
6180 \param pMac - The handle returned by macOpen.
6181 \param pMsgBuf - MSG Buffer
6182
6183 \return eHalStatus
6184
6185 -------------------------------------------------------------------------------*/
6186eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
6187{
6188 eHalStatus status = eHAL_STATUS_SUCCESS;
6189 tAniChangeCountryCodeReq *pMsg;
6190 v_REGDOMAIN_t domainIdIoctl;
6191 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6192 static uNvTables nvTables;
6193 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
6194
6195
6196 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
6197 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
6198 {
6199 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6200
6201 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
6202
6203 /* read the country code from NV and use it */
6204 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
6205 {
6206 palCopyMemory( pMac->hHdd, pMsg->countryCode , nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN );
6207 }
6208 else
6209 {
6210 status = eHAL_STATUS_FAILURE;
6211 return status;
6212 }
6213 }
6214 else
6215 {
6216 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05306217 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
6218 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07006219 {
6220 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
6221 }
6222 }
6223
6224 /* WEXT set country code means
6225 * 11D should be supported?
6226 * 11D Channel should be enforced?
6227 * 11D Country code should be matched?
6228 * 11D Reg Domian should be matched?
6229 * Country string changed */
6230 if(pMac->roam.configParam.Is11dSupportEnabled &&
6231 pMac->roam.configParam.fEnforce11dChannels &&
6232 pMac->roam.configParam.fEnforceCountryCodeMatch &&
6233 pMac->roam.configParam.fEnforceDefaultDomain &&
6234 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
6235 {
6236 /* All 11D related options are already enabled
6237 * Country string is not changed
6238 * Do not need do anything for country code change request */
6239 return eHAL_STATUS_SUCCESS;
6240 }
6241
6242 /* Set Current Country code and Current Regulatory domain */
6243 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
6244 if(eHAL_STATUS_SUCCESS != status)
6245 {
6246 /* Supplicant country code failed. So give 11D priority */
6247 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6248 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
6249 return status;
6250 }
6251
Jeff Johnson295189b2012-06-20 16:38:30 -07006252 /* overwrite the defualt country code */
6253 palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
6254
6255 /* Get Domain ID from country code */
6256 status = csrGetRegulatoryDomainForCountry( pMac, pMac->scan.countryCodeCurrent,(v_REGDOMAIN_t *) &domainIdIoctl );
6257 if ( status != eHAL_STATUS_SUCCESS )
6258 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006259 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006260 return status;
6261 }
6262
6263 status = WDA_SetRegDomain(pMac, domainIdIoctl);
6264
6265 if ( status != eHAL_STATUS_SUCCESS )
6266 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006267 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006268 return status;
6269 }
6270
6271 /* set to default domain ID */
6272 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
6273
6274 /* get the channels based on new cc */
6275 status = csrInitGetChannels( pMac );
6276
6277 if ( status != eHAL_STATUS_SUCCESS )
6278 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006279 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07006280 return status;
6281 }
6282
6283 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08006284 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Jeff Johnson295189b2012-06-20 16:38:30 -07006285 if( pMsg->changeCCCallback )
6286 {
6287 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
6288 }
6289
6290 return eHAL_STATUS_SUCCESS;
6291}
6292
6293#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08006294eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07006295{
6296 tpSirRcvFltMcAddrList pRequestBuf;
6297 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006298 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07006299 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006300
6301 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05306302 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006303 pMulticastAddrs->ulMulticastAddrCnt,
6304 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07006305
6306 /*
6307 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08006308 */
6309 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
6310 csrIsConnStateInfra(pMac, sessionId))
6311 {
6312 pSession = CSR_GET_SESSION( pMac, sessionId );
6313 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006314
6315 if(pSession == NULL )
6316 {
6317 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006318 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006319 return eHAL_STATUS_FAILURE;
6320 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006321
Jeff Johnson295189b2012-06-20 16:38:30 -07006322 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
6323 if (NULL == pRequestBuf)
6324 {
6325 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006326 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006327 return eHAL_STATUS_FAILED_ALLOC;
6328 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006329
6330 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
6331 {
6332 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
6333 "indication as we are not connected", __func__);
6334 vos_mem_free(pRequestBuf);
6335 return eHAL_STATUS_FAILURE;
6336 }
6337
Jeff Johnson295189b2012-06-20 16:38:30 -07006338 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
6339
Jeff Johnsone7245742012-09-05 17:12:55 -07006340 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6341 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
6342 sizeof(tSirMacAddr));
6343
Jeff Johnson295189b2012-06-20 16:38:30 -07006344 msg.type = WDA_8023_MULTICAST_LIST_REQ;
6345 msg.reserved = 0;
6346 msg.bodyptr = pRequestBuf;
6347 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6348 {
6349 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006350 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006351 vos_mem_free(pRequestBuf);
6352 return eHAL_STATUS_FAILURE;
6353 }
6354
6355 return eHAL_STATUS_SUCCESS;
6356}
6357
Jeff Johnsone7245742012-09-05 17:12:55 -07006358eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
6359 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006360{
6361 tpSirRcvPktFilterCfgType pRequestBuf;
6362 v_SINT_t allocSize;
6363 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006364 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6365 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006366 v_U8_t idx=0;
6367
6368 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006369 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006370 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
6371
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07006372 allocSize = sizeof(tSirRcvPktFilterCfgType);
6373
Jeff Johnson295189b2012-06-20 16:38:30 -07006374 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006375
6376 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006377 {
6378 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006379 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006380 return eHAL_STATUS_FAILED_ALLOC;
6381 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006382
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006383 if( NULL == pSession )
6384 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006385 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006386 vos_mem_free(pRequestBuf);
6387 return eHAL_STATUS_FAILURE;
6388 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006389
6390 vos_mem_copy( pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6391 vos_mem_copy( pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006392 sizeof(tSirMacAddr));
6393
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006394 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
6395
Jeff Johnson295189b2012-06-20 16:38:30 -07006396 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
6397 msg.reserved = 0;
6398 msg.bodyptr = pRequestBuf;
6399
6400 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6401 "FT %d FID %d ",
6402 pRequestBuf->filterType, pRequestBuf->filterId);
6403
6404 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6405 "params %d CT %d",
6406 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
6407
6408 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
6409 {
6410
6411 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006412 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07006413 pRequestBuf->paramsData[idx].protocolLayer,
6414 pRequestBuf->paramsData[idx].cmpFlag);
6415
6416 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006417 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006418 pRequestBuf->paramsData[idx].dataOffset,
6419 pRequestBuf->paramsData[idx].dataLength);
6420
6421 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006422 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006423 pRequestBuf->paramsData[idx].compareData[0],
6424 pRequestBuf->paramsData[idx].compareData[1],
6425 pRequestBuf->paramsData[idx].compareData[2],
6426 pRequestBuf->paramsData[idx].compareData[3],
6427 pRequestBuf->paramsData[idx].compareData[4],
6428 pRequestBuf->paramsData[idx].compareData[5]);
6429
6430 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006431 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006432 pRequestBuf->paramsData[idx].dataMask[0],
6433 pRequestBuf->paramsData[idx].dataMask[1],
6434 pRequestBuf->paramsData[idx].dataMask[2],
6435 pRequestBuf->paramsData[idx].dataMask[3],
6436 pRequestBuf->paramsData[idx].dataMask[4],
6437 pRequestBuf->paramsData[idx].dataMask[5]);
6438
6439 }
6440
6441 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6442 {
6443 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006444 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006445 vos_mem_free(pRequestBuf);
6446 return eHAL_STATUS_FAILURE;
6447 }
6448
6449 return eHAL_STATUS_SUCCESS;
6450}
6451
6452eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
6453 FilterMatchCountCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006454 void *callbackContext,
6455 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006456{
6457 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6458 eHalStatus status;
6459
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006460 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006461
6462 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
6463 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006464 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006465 sme_ReleaseGlobalLock( &pMac->sme );
6466 }
6467
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006468 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006469
6470 return (status);
6471}
6472
Jeff Johnsone7245742012-09-05 17:12:55 -07006473eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
6474 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006475{
6476 tpSirRcvFltPktClearParam pRequestBuf;
6477 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006478 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6479 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006480
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006481 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006482 pRcvFltPktClearParam->filterId);
6483
6484 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006485 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006486 {
6487 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6488 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006489 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006490 return eHAL_STATUS_FAILED_ALLOC;
6491 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006492 if( NULL == pSession )
6493 {
6494 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006495 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006496 vos_mem_free(pRequestBuf);
6497 return eHAL_STATUS_FAILURE;
6498 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006499
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006500 vos_mem_copy( pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6501 vos_mem_copy( pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006502 sizeof(tSirMacAddr));
6503
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006504 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
6505
Jeff Johnson295189b2012-06-20 16:38:30 -07006506 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
6507 msg.reserved = 0;
6508 msg.bodyptr = pRequestBuf;
6509 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6510 {
6511 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006512 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006513 vos_mem_free(pRequestBuf);
6514 return eHAL_STATUS_FAILURE;
6515 }
6516
6517 return eHAL_STATUS_SUCCESS;
6518}
6519#endif // WLAN_FEATURE_PACKET_FILTERING
6520
6521/* ---------------------------------------------------------------------------
6522 \fn sme_PreChannelSwitchIndFullPowerCB
6523 \brief call back function for the PMC full power request because of pre
6524 channel switch.
6525 \param callbackContext
6526 \param status
6527 ---------------------------------------------------------------------------*/
6528void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
6529 eHalStatus status)
6530{
6531 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
6532 tSirMbMsg *pMsg;
6533 tANI_U16 msgLen;
6534
6535 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
6536 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
6537 if(HAL_STATUS_SUCCESS(status))
6538 {
6539 palZeroMemory(pMac->hHdd, (void *)pMsg, msgLen);
6540 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
6541 pMsg->msgLen = pal_cpu_to_be16(msgLen);
6542 status = palSendMBMessage(pMac->hHdd, pMsg);
6543 }
6544
6545 return;
6546}
6547
6548/* ---------------------------------------------------------------------------
6549 \fn sme_HandlePreChannelSwitchInd
6550 \brief Processes the indcation from PE for pre-channel switch.
6551 \param hHal
6552 \- The handle returned by macOpen. return eHalStatus
6553 ---------------------------------------------------------------------------*/
6554eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
6555{
6556 eHalStatus status = eHAL_STATUS_FAILURE;
6557 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6558 status = sme_AcquireGlobalLock( &pMac->sme );
6559 if ( HAL_STATUS_SUCCESS( status ) )
6560 {
6561 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
6562 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
6563 sme_ReleaseGlobalLock( &pMac->sme );
6564 }
6565
6566 return (status);
6567}
6568
6569/* ---------------------------------------------------------------------------
6570 \fn sme_HandlePostChannelSwitchInd
6571 \brief Processes the indcation from PE for post-channel switch.
6572 \param hHal
6573 \- The handle returned by macOpen. return eHalStatus
6574 ---------------------------------------------------------------------------*/
6575eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
6576{
6577 eHalStatus status = eHAL_STATUS_FAILURE;
6578 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6579
6580 status = sme_AcquireGlobalLock( &pMac->sme );
6581 if ( HAL_STATUS_SUCCESS( status ) )
6582 {
6583 status = pmcRequestBmps(hHal, NULL, NULL);
6584 sme_ReleaseGlobalLock( &pMac->sme );
6585 }
6586
6587 return (status);
6588}
6589
6590/* ---------------------------------------------------------------------------
6591
6592 \fn sme_IsChannelValid
6593
6594 \brief To check if the channel is valid for currently established domain
6595 This is a synchronous API.
6596
6597 \param hHal - The handle returned by macOpen.
6598 \param channel - channel to verify
6599
6600 \return TRUE/FALSE, TRUE if channel is valid
6601
6602 -------------------------------------------------------------------------------*/
6603tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
6604{
6605 eHalStatus status = eHAL_STATUS_FAILURE;
6606 tANI_BOOLEAN valid = FALSE;
6607 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6608
6609 status = sme_AcquireGlobalLock( &pMac->sme );
6610 if ( HAL_STATUS_SUCCESS( status ) )
6611 {
6612
6613 valid = csrRoamIsChannelValid( pMac, channel);
6614
6615 sme_ReleaseGlobalLock( &pMac->sme );
6616 }
6617
6618 return (valid);
6619}
6620
6621/* ---------------------------------------------------------------------------
6622 \fn sme_SetFreqBand
6623 \brief Used to set frequency band.
6624 \param hHal
6625 \eBand band value to be configured
6626 \- return eHalStatus
6627 -------------------------------------------------------------------------*/
6628eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
6629{
6630 eHalStatus status = eHAL_STATUS_FAILURE;
6631 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6632
6633 status = sme_AcquireGlobalLock( &pMac->sme );
6634 if ( HAL_STATUS_SUCCESS( status ) )
6635 {
6636 status = csrSetBand(hHal, eBand);
6637 sme_ReleaseGlobalLock( &pMac->sme );
6638 }
6639 return status;
6640}
6641
6642/* ---------------------------------------------------------------------------
6643 \fn sme_GetFreqBand
6644 \brief Used to get the current band settings.
6645 \param hHal
6646 \pBand pointer to hold band value
6647 \- return eHalStatus
6648 -------------------------------------------------------------------------*/
6649eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
6650{
6651 eHalStatus status = eHAL_STATUS_FAILURE;
6652 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6653
6654 status = sme_AcquireGlobalLock( &pMac->sme );
6655 if ( HAL_STATUS_SUCCESS( status ) )
6656 {
6657 *pBand = csrGetCurrentBand( hHal );
6658 sme_ReleaseGlobalLock( &pMac->sme );
6659 }
6660 return status;
6661}
6662
6663#ifdef WLAN_WAKEUP_EVENTS
6664/******************************************************************************
6665 \fn sme_WakeReasonIndCallback
6666
6667 \brief
6668 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
6669
6670 \param hHal - HAL handle for device
6671 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
6672
6673 \return eHalStatus
6674******************************************************************************/
6675eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
6676{
6677 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6678 eHalStatus status = eHAL_STATUS_SUCCESS;
6679 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
6680
6681 if (NULL == pMsg)
6682 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006683 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006684 status = eHAL_STATUS_FAILURE;
6685 }
6686 else
6687 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006688 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07006689
6690 /* Call Wake Reason Indication callback routine. */
6691 if (pMac->pmc.wakeReasonIndCB != NULL)
6692 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
6693
6694 pMac->pmc.wakeReasonIndCB = NULL;
6695 pMac->pmc.wakeReasonIndCBContext = NULL;
6696
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006697 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07006698 }
6699
6700 return(status);
6701}
6702#endif // WLAN_WAKEUP_EVENTS
6703
6704
6705/* ---------------------------------------------------------------------------
6706
6707 \fn sme_SetMaxTxPower
6708
6709 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
6710 not persist over reboots.
6711
6712 \param hHal
6713 \param pBssid BSSID to set the power cap for
6714 \param pBssid pSelfMacAddress self MAC Address
6715 \param pBssid power to set in dB
6716 \- return eHalStatus
6717
6718 -------------------------------------------------------------------------------*/
6719eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
6720 tSirMacAddr pSelfMacAddress, v_S7_t dB)
6721{
6722 vos_msg_t msg;
6723 tpMaxTxPowerParams pMaxTxParams = NULL;
6724
6725 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
6726 if (NULL == pMaxTxParams)
6727 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006728 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 -07006729 return eHAL_STATUS_FAILURE;
6730 }
6731
6732 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
6733 vos_mem_copy(pMaxTxParams->selfStaMacAddr , pSelfMacAddress,
6734 SIR_MAC_ADDR_LENGTH);
6735 pMaxTxParams->power = dB;
6736
6737 msg.type = WDA_SET_MAX_TX_POWER_REQ;
6738 msg.reserved = 0;
6739 msg.bodyptr = pMaxTxParams;
6740
6741 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6742 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006743 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 -07006744 vos_mem_free(pMaxTxParams);
6745 return eHAL_STATUS_FAILURE;
6746 }
6747
6748 return eHAL_STATUS_SUCCESS;
6749}
6750
Jeff Johnson295189b2012-06-20 16:38:30 -07006751/* ---------------------------------------------------------------------------
6752
schang86c22c42013-03-13 18:41:24 -07006753 \fn sme_SetTxPower
6754
6755 \brief Set Transmit Power dynamically. Note: this setting will
6756 not persist over reboots.
6757
6758 \param hHal
6759 \param sessionId Target Session ID
6760 \param mW power to set in mW
6761 \- return eHalStatus
6762
6763 -------------------------------------------------------------------------------*/
6764eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
6765{
6766
6767 eHalStatus status = eHAL_STATUS_FAILURE;
6768 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6769
6770 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
6771 status = sme_AcquireGlobalLock(&pMac->sme);
6772 if (HAL_STATUS_SUCCESS(status))
6773 {
6774 status = csrSetTxPower(pMac, sessionId, mW);
6775 sme_ReleaseGlobalLock(&pMac->sme);
6776 }
6777 return status;
6778}
6779
6780/* ---------------------------------------------------------------------------
6781
Jeff Johnson295189b2012-06-20 16:38:30 -07006782 \fn sme_HideSSID
6783
6784 \brief hide/show SSID dynamically. Note: this setting will
6785 not persist over reboots.
6786
6787 \param hHal
6788 \param sessionId
6789 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
6790 \- return eHalStatus
6791
6792 -------------------------------------------------------------------------------*/
6793eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
6794{
6795 eHalStatus status = eHAL_STATUS_SUCCESS;
6796 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6797 tANI_U16 len;
6798
6799 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6800 {
6801 tpSirUpdateParams pMsg;
6802 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006803
6804 if(!pSession)
6805 {
6806 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006807 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006808 return eHAL_STATUS_FAILURE;
6809 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006810
6811 if( !pSession->sessionActive )
6812 VOS_ASSERT(0);
6813
6814 /* Create the message and send to lim */
6815 len = sizeof(tSirUpdateParams);
6816 status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len );
6817 if(HAL_STATUS_SUCCESS(status))
6818 {
6819 palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirUpdateParams) );
6820 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
6821 pMsg->length = len;
6822 /* Data starts from here */
6823 pMsg->sessionId = sessionId;
6824 pMsg->ssidHidden = ssidHidden;
6825 status = palSendMBMessage(pMac->hHdd, pMsg);
6826 }
6827 sme_ReleaseGlobalLock( &pMac->sme );
6828 }
6829 return status;
6830}
Jeff Johnson295189b2012-06-20 16:38:30 -07006831
6832/* ---------------------------------------------------------------------------
6833
6834 \fn sme_SetTmLevel
6835 \brief Set Thermal Mitigation Level to RIVA
6836 \param hHal - The handle returned by macOpen.
6837 \param newTMLevel - new Thermal Mitigation Level
6838 \param tmMode - Thermal Mitigation handle mode, default 0
6839 \return eHalStatus
6840 ---------------------------------------------------------------------------*/
6841eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
6842{
6843 eHalStatus status = eHAL_STATUS_SUCCESS;
6844 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6845 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6846 vos_msg_t vosMessage;
6847 tAniSetTmLevelReq *setTmLevelReq = NULL;
6848
6849 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6850 {
6851 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
6852 if(NULL == setTmLevelReq)
6853 {
6854 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006855 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006856 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07006857 return eHAL_STATUS_FAILURE;
6858 }
6859
6860 setTmLevelReq->tmMode = tmMode;
6861 setTmLevelReq->newTmLevel = newTMLevel;
6862
6863 /* serialize the req through MC thread */
6864 vosMessage.bodyptr = setTmLevelReq;
6865 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
6866 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6867 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6868 {
6869 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006870 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006871 vos_mem_free(setTmLevelReq);
6872 status = eHAL_STATUS_FAILURE;
6873 }
6874 sme_ReleaseGlobalLock( &pMac->sme );
6875 }
6876 return(status);
6877}
6878
6879/*---------------------------------------------------------------------------
6880
6881 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
6882 Host and FW.
6883
6884 \param hHal - HAL handle for device
6885
6886 \return NONE
6887
6888---------------------------------------------------------------------------*/
6889void sme_featureCapsExchange( tHalHandle hHal)
6890{
6891 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6892 WDA_featureCapsExchange(vosContext);
6893}
Jeff Johnsond13512a2012-07-17 11:42:19 -07006894
Yathish9f22e662012-12-10 14:21:35 -08006895/*---------------------------------------------------------------------------
6896
6897 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
6898 in Host.
6899
6900 \param hHal - HAL handle for device
6901
6902 \return NONE
6903
6904---------------------------------------------------------------------------*/
6905void sme_disableFeatureCapablity(tANI_U8 feature_index)
6906{
6907 WDA_disableCapablityFeature(feature_index);
6908}
6909
6910
Jeff Johnsond13512a2012-07-17 11:42:19 -07006911
6912/* ---------------------------------------------------------------------------
6913
6914 \fn sme_GetDefaultCountryCode
6915
6916 \brief Get the default country code from NV
6917
6918 \param hHal
6919 \param pCountry
6920 \- return eHalStatus
6921
6922 -------------------------------------------------------------------------------*/
6923eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
6924{
6925 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6926 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
6927}
6928
6929/* ---------------------------------------------------------------------------
6930
6931 \fn sme_GetCurrentCountryCode
6932
6933 \brief Get the current country code
6934
6935 \param hHal
6936 \param pCountry
6937 \- return eHalStatus
6938
6939 -------------------------------------------------------------------------------*/
6940eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
6941{
6942 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6943 return csrGetCurrentCountryCode(pMac, pCountry);
6944}
6945
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006946/* ---------------------------------------------------------------------------
6947 \fn sme_transportDebug
6948 \brief Dynamically monitoring Transport channels
6949 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07006950 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08006951 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006952 \param toggleStallDetect Enable stall detect feature
6953 This feature will take effect to data performance
6954 Not integrate till fully verification
6955 \- return NONE
6956 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07006957void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07006958{
schang6295e542013-03-12 15:31:23 -07006959 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6960
6961 if (NULL == pMac)
6962 {
6963 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6964 "%s: invalid context", __func__);
6965 return;
6966 }
6967 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07006968}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006969
Kiran4a17ebe2013-01-31 10:43:43 -08006970/* ---------------------------------------------------------------------------
6971 \fn sme_ResetPowerValuesFor5G
6972 \brief Reset the power values for 5G band with NV power values.
6973 \param hHal - HAL handle for device
6974 \- return NONE
6975 -------------------------------------------------------------------------*/
6976void sme_ResetPowerValuesFor5G (tHalHandle hHal)
6977{
6978 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
6979 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
6980 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
6981}
6982
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08006983#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
6984/* ---------------------------------------------------------------------------
6985 \fn sme_UpdateRoamPrefer5GHz
6986 \brief enable/disable Roam prefer 5G runtime option
6987 This function is called through dynamic setConfig callback function
6988 to configure the Roam prefer 5G runtime option
6989 \param hHal - HAL handle for device
6990 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
6991 \- return Success or failure
6992 -------------------------------------------------------------------------*/
6993
6994eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
6995{
6996 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08006997 eHalStatus status = eHAL_STATUS_SUCCESS;
6998
6999 status = sme_AcquireGlobalLock( &pMac->sme );
7000 if ( HAL_STATUS_SUCCESS( status ) )
7001 {
7002 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7003 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
7004 pMac->roam.configParam.nRoamPrefer5GHz,
7005 nRoamPrefer5GHz);
7006 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
7007 sme_ReleaseGlobalLock( &pMac->sme );
7008 }
7009
7010 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007011}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08007012
7013/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007014 \fn sme_setRoamIntraBand
7015 \brief enable/disable Intra band roaming
7016 This function is called through dynamic setConfig callback function
7017 to configure the intra band roaming
7018 \param hHal - HAL handle for device
7019 \param nRoamIntraBand Enable/Disable Intra band roaming
7020 \- return Success or failure
7021 -------------------------------------------------------------------------*/
7022eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
7023{
7024 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7025 eHalStatus status = eHAL_STATUS_SUCCESS;
7026
7027 status = sme_AcquireGlobalLock( &pMac->sme );
7028 if ( HAL_STATUS_SUCCESS( status ) )
7029 {
7030 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7031 "%s: gRoamIntraBand is changed from %d to %d", __func__,
7032 pMac->roam.configParam.nRoamIntraBand,
7033 nRoamIntraBand);
7034 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
7035 sme_ReleaseGlobalLock( &pMac->sme );
7036 }
7037
7038 return status ;
7039}
7040
7041/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007042 \fn sme_UpdateRoamScanNProbes
7043 \brief function to update roam scan N probes
7044 This function is called through dynamic setConfig callback function
7045 to update roam scan N probes
7046 \param hHal - HAL handle for device
7047 \param nProbes number of probe requests to be sent out
7048 \- return Success or failure
7049 -------------------------------------------------------------------------*/
7050eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
7051{
7052 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7053 eHalStatus status = eHAL_STATUS_SUCCESS;
7054
7055 status = sme_AcquireGlobalLock( &pMac->sme );
7056 if ( HAL_STATUS_SUCCESS( status ) )
7057 {
7058 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7059 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
7060 pMac->roam.configParam.nProbes,
7061 nProbes);
7062 pMac->roam.configParam.nProbes = nProbes;
7063 sme_ReleaseGlobalLock( &pMac->sme );
7064 }
7065#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7066 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7067 {
7068 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7069 REASON_NPROBES_CHANGED);
7070 }
7071#endif
7072 return status ;
7073}
7074
7075/* ---------------------------------------------------------------------------
7076 \fn sme_UpdateRoamScanHomeAwayTime
7077 \brief function to update roam scan Home away time
7078 This function is called through dynamic setConfig callback function
7079 to update roam scan home away time
7080 \param hHal - HAL handle for device
7081 \param nRoamScanAwayTime Scan home away time
7082 \- return Success or failure
7083 -------------------------------------------------------------------------*/
7084eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime)
7085{
7086 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7087 eHalStatus status = eHAL_STATUS_SUCCESS;
7088
7089 status = sme_AcquireGlobalLock( &pMac->sme );
7090 if ( HAL_STATUS_SUCCESS( status ) )
7091 {
7092 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7093 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
7094 pMac->roam.configParam.nRoamScanHomeAwayTime,
7095 nRoamScanHomeAwayTime);
7096 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
7097 sme_ReleaseGlobalLock( &pMac->sme );
7098 }
7099
7100#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7101 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7102 {
7103 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7104 REASON_HOME_AWAY_TIME_CHANGED);
7105 }
7106#endif
7107 return status;
7108}
7109
7110
7111/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007112 \fn sme_getRoamIntraBand
7113 \brief get Intra band roaming
7114 \param hHal - HAL handle for device
7115 \- return Success or failure
7116 -------------------------------------------------------------------------*/
7117v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
7118{
7119 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7120 return pMac->roam.configParam.nRoamIntraBand;
7121}
7122
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007123/* ---------------------------------------------------------------------------
7124 \fn sme_getRoamScanNProbes
7125 \brief get N Probes
7126 \param hHal - HAL handle for device
7127 \- return Success or failure
7128 -------------------------------------------------------------------------*/
7129v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
7130{
7131 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7132 return pMac->roam.configParam.nProbes;
7133}
7134
7135/* ---------------------------------------------------------------------------
7136 \fn sme_getRoamScanHomeAwayTime
7137 \brief get Roam scan home away time
7138 \param hHal - HAL handle for device
7139 \- return Success or failure
7140 -------------------------------------------------------------------------*/
7141v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
7142{
7143 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7144 return pMac->roam.configParam.nRoamScanHomeAwayTime;
7145}
7146
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007147
7148/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08007149 \fn sme_UpdateImmediateRoamRssiDiff
7150 \brief Update nImmediateRoamRssiDiff
7151 This function is called through dynamic setConfig callback function
7152 to configure nImmediateRoamRssiDiff
7153 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
7154 \param hHal - HAL handle for device
7155 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
7156 candidate and current AP.
7157 \- return Success or failure
7158 -------------------------------------------------------------------------*/
7159
7160eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
7161{
7162 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08007163 eHalStatus status = eHAL_STATUS_SUCCESS;
7164
7165 status = sme_AcquireGlobalLock( &pMac->sme );
7166 if ( HAL_STATUS_SUCCESS( status ) )
7167 {
7168 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7169 "LFR runtime successfully set immediate roam rssi diff to %d - old value is %d - roam state is %d",
7170 nImmediateRoamRssiDiff,
7171 pMac->roam.configParam.nImmediateRoamRssiDiff,
7172 pMac->roam.neighborRoamInfo.neighborRoamState);
7173 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
7174 sme_ReleaseGlobalLock( &pMac->sme );
7175 }
7176
7177 return status ;
7178}
7179
7180/* ---------------------------------------------------------------------------
7181 \fn sme_UpdateRoamRssiDiff
7182 \brief Update RoamRssiDiff
7183 This function is called through dynamic setConfig callback function
7184 to configure RoamRssiDiff
7185 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
7186 \param hHal - HAL handle for device
7187 \param RoamRssiDiff - minimum rssi difference between potential
7188 candidate and current AP.
7189 \- return Success or failure
7190 -------------------------------------------------------------------------*/
7191
7192eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
7193{
7194 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7195 eHalStatus status = eHAL_STATUS_SUCCESS;
7196
7197 status = sme_AcquireGlobalLock( &pMac->sme );
7198 if ( HAL_STATUS_SUCCESS( status ) )
7199 {
7200 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7201 "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %d",
7202 RoamRssiDiff,
7203 pMac->roam.configParam.RoamRssiDiff,
7204 pMac->roam.neighborRoamInfo.neighborRoamState);
7205 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
7206 sme_ReleaseGlobalLock( &pMac->sme );
7207 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007208#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7209 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7210 {
7211 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
7212 }
7213#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007214 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08007215}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007216
7217/*--------------------------------------------------------------------------
7218 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
7219 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7220 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007221 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007222 \param hHal - The handle returned by macOpen.
7223 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
7224 Other status means SME is failed to update isFastTransitionEnabled.
7225 \sa
7226 --------------------------------------------------------------------------*/
7227eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
7228 v_BOOL_t isFastTransitionEnabled)
7229{
7230 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08007231 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007232
Srinivas Girigowdade697412013-02-14 16:31:48 -08007233 status = sme_AcquireGlobalLock( &pMac->sme );
7234 if ( HAL_STATUS_SUCCESS( status ) )
7235 {
7236 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7237 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
7238 pMac->roam.configParam.isFastTransitionEnabled,
7239 isFastTransitionEnabled);
7240 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
7241 sme_ReleaseGlobalLock( &pMac->sme );
7242 }
7243
7244 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007245}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007246
7247/* ---------------------------------------------------------------------------
7248 \fn sme_UpdateWESMode
7249 \brief Update WES Mode
7250 This function is called through dynamic setConfig callback function
7251 to configure isWESModeEnabled
7252 \param hHal - HAL handle for device
7253 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
7254 Other status means SME is failed to update isWESModeEnabled.
7255 -------------------------------------------------------------------------*/
7256
7257eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
7258{
7259 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7260 eHalStatus status = eHAL_STATUS_SUCCESS;
7261
7262 status = sme_AcquireGlobalLock( &pMac->sme );
7263 if ( HAL_STATUS_SUCCESS( status ) )
7264 {
7265 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7266 "LFR runtime successfully set WES Mode to %d - old value is %d - roam state is %d",
7267 isWESModeEnabled,
7268 pMac->roam.configParam.isWESModeEnabled,
7269 pMac->roam.neighborRoamInfo.neighborRoamState);
7270 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
7271 sme_ReleaseGlobalLock( &pMac->sme );
7272 }
7273
7274 return status ;
7275}
7276
7277/* ---------------------------------------------------------------------------
7278 \fn sme_SetRoamScanControl
7279 \brief Set roam scan control
7280 This function is called to set roam scan control
7281 if roam scan control is set to 0, roaming scan cache is cleared
7282 any value other than 0 is treated as invalid value
7283 \param hHal - HAL handle for device
7284 \return eHAL_STATUS_SUCCESS - SME update config successfully.
7285 Other status means SME failure to update
7286 -------------------------------------------------------------------------*/
7287eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
7288{
7289 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7290 eHalStatus status = eHAL_STATUS_SUCCESS;
7291
7292 status = sme_AcquireGlobalLock( &pMac->sme );
7293 if ( HAL_STATUS_SUCCESS( status ) )
7294 {
7295 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7296 "LFR runtime successfully set roam scan control to %d - old value is %d - roam state is %d",
7297 roamScanControl,
7298 pMac->roam.configParam.nRoamScanControl,
7299 pMac->roam.neighborRoamInfo.neighborRoamState);
7300 pMac->roam.configParam.nRoamScanControl = roamScanControl;
7301 if ( 0 == roamScanControl)
7302 {
7303 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7304 "LFR runtime successfully cleared roam scan cache");
7305 csrFlushBgScanRoamChannelList(pMac);
7306#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7307 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7308 {
7309 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
7310 }
7311#endif
7312 }
7313 sme_ReleaseGlobalLock( &pMac->sme );
7314 }
7315 return status ;
7316}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007317#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */
7318
7319#ifdef FEATURE_WLAN_LFR
7320/*--------------------------------------------------------------------------
7321 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
7322 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7323 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007324 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007325 \param hHal - The handle returned by macOpen.
7326 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
7327 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
7328 \sa
7329 --------------------------------------------------------------------------*/
7330eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007331 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007332{
7333 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7334
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007335 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
7336 {
7337 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7338 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
7339 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
7340 isFastRoamIniFeatureEnabled);
7341 return eHAL_STATUS_SUCCESS;
7342 }
7343
Srinivas Girigowdade697412013-02-14 16:31:48 -08007344 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7345 "%s: FastRoamEnabled is changed from %d to %d", __func__,
7346 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
7347 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007348 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007349 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007350
7351 if(TRUE == isFastRoamIniFeatureEnabled)
7352 {
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007353 sme_UpdateConfigFwRssiMonitoring(hHal, TRUE);
7354 }
7355 else
7356 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08007357 /* CCX also depend on FW Monitoring.
7358 Hence Disabling LFR should check for CCX enable before disabling FW Monitoring */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007359#ifdef FEATURE_WLAN_CCX
7360 if(FALSE == pMac->roam.configParam.isCcxIniFeatureEnabled)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007361#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007362 {
7363 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Srinivas Girigowdade697412013-02-14 16:31:48 -08007364 "%s: Turn off FW Monitoring", __func__);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007365 sme_UpdateConfigFwRssiMonitoring(hHal, FALSE);
7366 }
7367 }
7368
7369 return eHAL_STATUS_SUCCESS;
7370}
7371#endif /* FEATURE_WLAN_LFR */
7372
7373#ifdef FEATURE_WLAN_CCX
7374/*--------------------------------------------------------------------------
7375 \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime
7376 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7377 isCcxIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007378 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007379 \param hHal - The handle returned by macOpen.
7380 \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully.
7381 Other status means SME is failed to update isCcxIniFeatureEnabled.
7382 \sa
7383 --------------------------------------------------------------------------*/
7384
7385eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007386 const v_BOOL_t isCcxIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007387{
7388 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7389
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007390 if (pMac->roam.configParam.isCcxIniFeatureEnabled == isCcxIniFeatureEnabled)
7391 {
7392 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7393 "%s: CCX Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
7394 pMac->roam.configParam.isCcxIniFeatureEnabled,
7395 isCcxIniFeatureEnabled);
7396 return eHAL_STATUS_SUCCESS;
7397 }
7398
Srinivas Girigowdade697412013-02-14 16:31:48 -08007399 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7400 "%s: CcxEnabled is changed from %d to %d", __func__,
7401 pMac->roam.configParam.isCcxIniFeatureEnabled,
7402 isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007403 pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007404 csrNeighborRoamUpdateCcxModeEnabled(pMac, isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007405
7406 if(TRUE == isCcxIniFeatureEnabled)
7407 {
7408 sme_UpdateFastTransitionEnabled(hHal, TRUE);
7409 sme_UpdateConfigFwRssiMonitoring(hHal, TRUE);
7410 }
7411 else
7412 {
Srinivas Girigowdade697412013-02-14 16:31:48 -08007413 /* LFR also depend on FW Monitoring.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007414 Hence Disabling CCX should check for LFR enable before disabling FW Monitoring and Fast Transition */
7415#ifdef FEATURE_WLAN_LFR
7416 if(FALSE == pMac->roam.configParam.isFastRoamIniFeatureEnabled)
7417#endif
7418 {
7419 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7420 "%s: Turn off FW Monitoring/Fast Transition", __func__);
7421 sme_UpdateFastTransitionEnabled(hHal, FALSE);
7422 sme_UpdateConfigFwRssiMonitoring(hHal, FALSE);
7423 }
7424 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007425#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7426 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7427 {
7428 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CCX_INI_CFG_CHANGED);
7429 }
7430#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007431 return eHAL_STATUS_SUCCESS;
7432}
7433#endif /* FEATURE_WLAN_CCX */
7434
7435/*--------------------------------------------------------------------------
7436 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
7437 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7438 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007439 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007440 \param hHal - The handle returned by macOpen.
7441 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
7442 Other status means SME is failed to update fEnableFwRssiMonitoring.
7443 \sa
7444 --------------------------------------------------------------------------*/
7445
7446eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
7447 v_BOOL_t fEnableFwRssiMonitoring)
7448{
7449 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
7450
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007451 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
7452 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
7453 {
7454 halStatus = eHAL_STATUS_FAILURE;
7455 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007456 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007457 }
7458
7459 return (halStatus);
7460}
7461
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007462#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08007463/*--------------------------------------------------------------------------
7464 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
7465 This is a synchronous call
7466 \param hHal - The handle returned by macOpen.
7467 \return eHAL_STATUS_SUCCESS - SME update config successful.
7468 Other status means SME is failed to update
7469 \sa
7470 --------------------------------------------------------------------------*/
7471eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
7472 v_U8_t neighborLookupRssiThreshold)
7473{
7474 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7475 eHalStatus status = eHAL_STATUS_SUCCESS;
7476
7477 status = sme_AcquireGlobalLock( &pMac->sme );
7478 if ( HAL_STATUS_SUCCESS( status ) )
7479 {
7480 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
7481 if (HAL_STATUS_SUCCESS(status))
7482 {
7483 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7484 "LFR runtime successfully set Lookup threshold to %d - old value is %d - roam state is %d",
7485 neighborLookupRssiThreshold,
7486 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
7487 pMac->roam.neighborRoamInfo.neighborRoamState);
7488 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
7489 neighborLookupRssiThreshold;
7490 }
7491 sme_ReleaseGlobalLock( &pMac->sme );
7492 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007493 return status;
7494}
7495
7496/*--------------------------------------------------------------------------
7497 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
7498 This is a synchronous call
7499 \param hHal - The handle returned by macOpen.
7500 \return eHAL_STATUS_SUCCESS - SME update config successful.
7501 Other status means SME is failed to update
7502 \sa
7503 --------------------------------------------------------------------------*/
7504eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
7505 v_U8_t neighborReassocRssiThreshold)
7506{
7507 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7508 eHalStatus status = eHAL_STATUS_SUCCESS;
7509
7510 status = sme_AcquireGlobalLock( &pMac->sme );
7511 if ( HAL_STATUS_SUCCESS( status ) )
7512 {
7513 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7514 "LFR runtime successfully set Reassoc threshold to %d - old value is %d - roam state is %d",
7515 neighborReassocRssiThreshold,
7516 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
7517 pMac->roam.neighborRoamInfo.neighborRoamState);
7518 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
7519 neighborReassocRssiThreshold;
7520 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
7521 neighborReassocRssiThreshold;
7522 sme_ReleaseGlobalLock( &pMac->sme );
7523 }
7524
7525 return status ;
7526}
7527
7528
7529/*--------------------------------------------------------------------------
7530 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
7531 This is a synchronous call
7532 \param hHal - The handle returned by macOpen.
7533 \return eHAL_STATUS_SUCCESS - SME update config successful.
7534 Other status means SME is failed to update
7535 \sa
7536 --------------------------------------------------------------------------*/
7537v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
7538{
7539 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7540 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
7541}
7542
7543/*--------------------------------------------------------------------------
7544 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
7545 This is a synchronous call
7546 \param hHal - The handle returned by macOpen.
7547 \return eHAL_STATUS_SUCCESS - SME update config successful.
7548 Other status means SME is failed to update
7549 \sa
7550 --------------------------------------------------------------------------*/
7551eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
7552 v_U16_t neighborScanResultsRefreshPeriod)
7553{
7554 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7555 eHalStatus status = eHAL_STATUS_SUCCESS;
7556
7557 status = sme_AcquireGlobalLock( &pMac->sme );
7558 if ( HAL_STATUS_SUCCESS( status ) )
7559 {
7560 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7561 "LFR runtime successfully set roam scan refresh period to %d - old value is %d - roam state is %d",
7562 neighborScanResultsRefreshPeriod,
7563 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
7564 pMac->roam.neighborRoamInfo.neighborRoamState);
7565 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
7566 neighborScanResultsRefreshPeriod;
7567 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
7568 neighborScanResultsRefreshPeriod;
7569
7570 sme_ReleaseGlobalLock( &pMac->sme );
7571 }
7572
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007573#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7574 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7575 {
7576 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7577 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
7578 }
7579#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007580 return status ;
7581}
7582
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007583#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7584/*--------------------------------------------------------------------------
7585 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
7586 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7587 gRoamScanOffloadEnabled.
7588 This is a synchronous call
7589 \param hHal - The handle returned by macOpen.
7590 \return eHAL_STATUS_SUCCESS - SME update config successfully.
7591 Other status means SME is failed to update.
7592 \sa
7593 --------------------------------------------------------------------------*/
7594
7595eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
7596 v_BOOL_t nRoamScanOffloadEnabled)
7597{
7598 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7599 eHalStatus status = eHAL_STATUS_SUCCESS;
7600
7601 status = sme_AcquireGlobalLock( &pMac->sme );
7602 if ( HAL_STATUS_SUCCESS( status ) )
7603 {
7604 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7605 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
7606 pMac->roam.configParam.isRoamOffloadScanEnabled,
7607 nRoamScanOffloadEnabled);
7608 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
7609 sme_ReleaseGlobalLock( &pMac->sme );
7610 }
7611
7612 return status ;
7613}
7614#endif
7615
Srinivas Girigowdade697412013-02-14 16:31:48 -08007616/*--------------------------------------------------------------------------
7617 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
7618 This is a synchronous call
7619 \param hHal - The handle returned by macOpen.
7620 \return v_U16_t - Neighbor scan results refresh period value
7621 \sa
7622 --------------------------------------------------------------------------*/
7623v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
7624{
7625 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7626 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
7627}
7628
7629/*--------------------------------------------------------------------------
7630 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
7631 This is a synchronuous call
7632 \param hHal - The handle returned by macOpen.
7633 \return eHAL_STATUS_SUCCESS - SME update config successful.
7634 Other status means SME is failed to update
7635 \sa
7636 --------------------------------------------------------------------------*/
7637v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
7638{
7639 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7640 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
7641}
7642
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007643/* ---------------------------------------------------------------------------
7644 \fn sme_UpdateEmptyScanRefreshPeriod
7645 \brief Update nEmptyScanRefreshPeriod
7646 This function is called through dynamic setConfig callback function
7647 to configure nEmptyScanRefreshPeriod
7648 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
7649 \param hHal - HAL handle for device
7650 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
7651 \- return Success or failure
7652 -------------------------------------------------------------------------*/
7653
7654eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
7655{
7656 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7657 eHalStatus status = eHAL_STATUS_SUCCESS;
7658
7659 status = sme_AcquireGlobalLock( &pMac->sme );
7660 if ( HAL_STATUS_SUCCESS( status ) )
7661 {
7662 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7663 "LFR runtime successfully set roam scan period to %d - old value is %d - roam state is %d",
7664 nEmptyScanRefreshPeriod,
7665 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
7666 pMac->roam.neighborRoamInfo.neighborRoamState);
7667 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
7668 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
7669 sme_ReleaseGlobalLock( &pMac->sme );
7670 }
7671
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07007672#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7673 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7674 {
7675 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7676 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
7677 }
7678#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007679 return status ;
7680}
7681
7682/* ---------------------------------------------------------------------------
7683 \fn sme_setNeighborScanMinChanTime
7684 \brief Update nNeighborScanMinChanTime
7685 This function is called through dynamic setConfig callback function
7686 to configure gNeighborScanChannelMinTime
7687 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
7688 \param hHal - HAL handle for device
7689 \param nNeighborScanMinChanTime - Channel minimum dwell time
7690 \- return Success or failure
7691 -------------------------------------------------------------------------*/
7692eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
7693{
7694 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7695 eHalStatus status = eHAL_STATUS_SUCCESS;
7696
7697 status = sme_AcquireGlobalLock( &pMac->sme );
7698 if ( HAL_STATUS_SUCCESS( status ) )
7699 {
7700 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7701 "LFR runtime successfully set channel min dwell time to %d - old value is %d - roam state is %d",
7702 nNeighborScanMinChanTime,
7703 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
7704 pMac->roam.neighborRoamInfo.neighborRoamState);
7705 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
7706 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
7707 sme_ReleaseGlobalLock( &pMac->sme );
7708 }
7709
7710 return status ;
7711}
7712
7713/* ---------------------------------------------------------------------------
7714 \fn sme_setNeighborScanMaxChanTime
7715 \brief Update nNeighborScanMaxChanTime
7716 This function is called through dynamic setConfig callback function
7717 to configure gNeighborScanChannelMaxTime
7718 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
7719 \param hHal - HAL handle for device
7720 \param nNeighborScanMinChanTime - Channel maximum dwell time
7721 \- return Success or failure
7722 -------------------------------------------------------------------------*/
7723eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
7724{
7725 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7726 eHalStatus status = eHAL_STATUS_SUCCESS;
7727
7728 status = sme_AcquireGlobalLock( &pMac->sme );
7729 if ( HAL_STATUS_SUCCESS( status ) )
7730 {
7731 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7732 "LFR runtime successfully set channel max dwell time to %d - old value is %d - roam state is %d",
7733 nNeighborScanMaxChanTime,
7734 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
7735 pMac->roam.neighborRoamInfo.neighborRoamState);
7736 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
7737 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
7738 sme_ReleaseGlobalLock( &pMac->sme );
7739 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07007740#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7741 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7742 {
7743 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7744 REASON_SCAN_CH_TIME_CHANGED);
7745 }
7746#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007747
7748 return status ;
7749}
7750
7751/* ---------------------------------------------------------------------------
7752 \fn sme_getNeighborScanMinChanTime
7753 \brief get neighbor scan min channel time
7754 \param hHal - The handle returned by macOpen.
7755 \return v_U16_t - channel min time value
7756 -------------------------------------------------------------------------*/
7757v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
7758{
7759 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7760 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
7761}
7762
7763/* ---------------------------------------------------------------------------
7764 \fn sme_getNeighborScanMaxChanTime
7765 \brief get neighbor scan max channel time
7766 \param hHal - The handle returned by macOpen.
7767 \return v_U16_t - channel max time value
7768 -------------------------------------------------------------------------*/
7769v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
7770{
7771 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7772 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
7773}
7774
7775/* ---------------------------------------------------------------------------
7776 \fn sme_setNeighborScanPeriod
7777 \brief Update nNeighborScanPeriod
7778 This function is called through dynamic setConfig callback function
7779 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07007780 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007781 \param hHal - HAL handle for device
7782 \param nNeighborScanPeriod - neighbor scan period
7783 \- return Success or failure
7784 -------------------------------------------------------------------------*/
7785eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
7786{
7787 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7788 eHalStatus status = eHAL_STATUS_SUCCESS;
7789
7790 status = sme_AcquireGlobalLock( &pMac->sme );
7791 if ( HAL_STATUS_SUCCESS( status ) )
7792 {
7793 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7794 "LFR runtime successfully set neighbor scan period to %d - old value is %d - roam state is %d",
7795 nNeighborScanPeriod,
7796 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
7797 pMac->roam.neighborRoamInfo.neighborRoamState);
7798 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
7799 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
7800 sme_ReleaseGlobalLock( &pMac->sme );
7801 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07007802#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7803 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7804 {
7805 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7806 REASON_SCAN_HOME_TIME_CHANGED);
7807 }
7808#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007809
7810 return status ;
7811}
7812
7813/* ---------------------------------------------------------------------------
7814 \fn sme_getNeighborScanPeriod
7815 \brief get neighbor scan period
7816 \param hHal - The handle returned by macOpen.
7817 \return v_U16_t - neighbor scan period
7818 -------------------------------------------------------------------------*/
7819v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
7820{
7821 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7822 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
7823}
7824
7825#endif
7826
Srinivas Girigowdade697412013-02-14 16:31:48 -08007827#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007828
Srinivas Girigowdade697412013-02-14 16:31:48 -08007829/*--------------------------------------------------------------------------
7830 \brief sme_getRoamRssiDiff() - get Roam rssi diff
7831 This is a synchronous call
7832 \param hHal - The handle returned by macOpen.
7833 \return v_U16_t - Rssi diff value
7834 \sa
7835 --------------------------------------------------------------------------*/
7836v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
7837{
7838 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7839 return pMac->roam.configParam.RoamRssiDiff;
7840}
7841
7842/*--------------------------------------------------------------------------
7843 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
7844 This is a synchronous call
7845 \param hHal - The handle returned by macOpen.
7846 \return eHAL_STATUS_SUCCESS - SME update config successful.
7847 Other status means SME is failed to update
7848 \sa
7849 --------------------------------------------------------------------------*/
7850eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
7851 tANI_U8 numChannels)
7852{
7853 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7854 eHalStatus status = eHAL_STATUS_SUCCESS;
7855 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007856 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08007857 tANI_U8 newChannelList[128] = {0};
7858 tANI_U8 i = 0, j = 0;
7859
7860 status = sme_AcquireGlobalLock( &pMac->sme );
7861 if ( HAL_STATUS_SUCCESS( status ) )
7862 {
7863 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
7864 {
7865 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
7866 {
7867 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
7868 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
7869 }
7870 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007871 csrFlushBgScanRoamChannelList(pMac);
7872 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Srinivas Girigowdade697412013-02-14 16:31:48 -08007873 status = csrUpdateBgScanConfigIniChannelList(pMac, csrGetCurrentBand(hHal));
7874
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007875 if ( HAL_STATUS_SUCCESS( status ))
Srinivas Girigowdade697412013-02-14 16:31:48 -08007876 {
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007877 sme_SetRoamScanControl(hHal, 1);
7878 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08007879 {
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007880 j = 0;
7881 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
7882 {
7883 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
7884 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
7885 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007886 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007887
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007888 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7889 "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d",
7890 newChannelList, oldChannelList,
7891 pMac->roam.neighborRoamInfo.neighborRoamState);
7892 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007893 sme_ReleaseGlobalLock( &pMac->sme );
7894 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007895#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7896 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7897 {
7898 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
7899 }
7900#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007901
7902 return status ;
7903}
7904
7905/*--------------------------------------------------------------------------
7906 \brief sme_ChangeCountryValidChannelListByRevision() - Change Korea valid channel list
7907 based on country revision number
7908 This is a synchronous call
7909 \param hHal - The handle returned by macOpen.
7910 \return eHAL_STATUS_SUCCESS - SME update config successful.
7911 Other status means SME is failed to update
7912 \sa
7913 --------------------------------------------------------------------------*/
7914eHalStatus sme_ChangeCountryValidChannelListByRevision(tHalHandle hHal,
7915 tANI_U8 Revision)
7916{
7917 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7918 eHalStatus status = eHAL_STATUS_SUCCESS;
7919
7920 status = sme_AcquireGlobalLock( &pMac->sme );
7921 if ( HAL_STATUS_SUCCESS( status ) )
7922 {
7923 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7924 "LFR runtime successfully set country/revision to %s/%d - old value is %s/%d - roam state is %d",
7925 "KR", Revision, "KR",
7926 pMac->roam.neighborRoamInfo.cfgParams.countryChannelInfo.revision,
7927 pMac->roam.neighborRoamInfo.neighborRoamState);
7928 csr_SetRevision(pMac, Revision);
7929 csrInitCountryValidChannelList(pMac, Revision);
7930 sme_ReleaseGlobalLock( &pMac->sme );
7931 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007932#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7933 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7934 {
7935 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_VALID_CHANNEL_LIST_CHANGED);
7936 }
7937#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007938
7939 return status ;
7940}
7941
7942
7943/*--------------------------------------------------------------------------
7944 \brief csrUpdateBgScanConfigIniChannelList() - Update bgscan roam cache
7945 This is a synchronous call
7946 \param hHal - The handle returned by macOpen.
7947 \return eHAL_STATUS_SUCCESS - SME update config successful.
7948 Other status means SME is failed to update
7949 \sa
7950 --------------------------------------------------------------------------*/
7951eHalStatus sme_UpdateBgScanConfigIniChannelList(tHalHandle hHal,
7952 eCsrBand eBand)
7953{
7954 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7955 return csrUpdateBgScanConfigIniChannelList(pMac, eBand);
7956}
7957
7958/*--------------------------------------------------------------------------
7959 \brief sme_getRoamScanChannelList() - get roam scan channel list
7960 This is a synchronous call
7961 \param hHal - The handle returned by macOpen.
7962 \return eHAL_STATUS_SUCCESS - SME update config successful.
7963 Other status means SME is failed to update
7964 \sa
7965 --------------------------------------------------------------------------*/
7966eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
7967 tANI_U8 *pNumChannels)
7968{
7969 int i = 0;
7970 tANI_U8 *pOutPtr = pChannelList;
7971 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7972 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
7973 eHalStatus status = eHAL_STATUS_SUCCESS;
7974
7975 status = sme_AcquireGlobalLock( &pMac->sme );
7976 if ( HAL_STATUS_SUCCESS( status ) )
7977 {
7978 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
7979 {
7980 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
7981 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007982 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08007983 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007984 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08007985 }
7986
7987 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
7988 for (i = 0; i < (*pNumChannels); i++)
7989 {
7990 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
7991 }
7992 pOutPtr[i] = '\0';
7993 sme_ReleaseGlobalLock( &pMac->sme );
7994 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007995 return status ;
7996}
7997
7998/*--------------------------------------------------------------------------
7999 \brief sme_GetCountryRevision() - get Country revision index
8000 This is a synchronous call
8001 \param hHal - The handle returned by macOpen.
8002 \return eHAL_STATUS_SUCCESS - SME update config successful.
8003 Other status means SME is failed to update
8004 \sa
8005 --------------------------------------------------------------------------*/
8006eHalStatus sme_GetCountryRevision(tHalHandle hHal, tANI_U8 *pRevision)
8007{
8008 /* this is valid for Country KR only now */
8009 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8010 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
8011 eHalStatus status = eHAL_STATUS_SUCCESS;
8012
8013 *pRevision = pNeighborRoamInfo->cfgParams.countryChannelInfo.revision;
8014
8015 return status;
8016}
8017
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008018/*--------------------------------------------------------------------------
8019 \brief sme_getIsCcxFeatureEnabled() - get CCX feature enabled or not
8020 This is a synchronuous call
8021 \param hHal - The handle returned by macOpen.
8022 \return TRUE (1) - if the CCX feature is enabled
8023 FALSE (0) - if feature is disabled (compile or runtime)
8024 \sa
8025 --------------------------------------------------------------------------*/
8026tANI_BOOLEAN sme_getIsCcxFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08008027{
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008028#ifdef FEATURE_WLAN_CCX
Srinivas Girigowdade697412013-02-14 16:31:48 -08008029 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008030 return pMac->roam.configParam.isCcxIniFeatureEnabled;
8031#else
8032 return eANI_BOOLEAN_FALSE;
8033#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008034}
8035
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008036/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008037 \brief sme_GetWESMode() - get WES Mode
8038 This is a synchronous call
8039 \param hHal - The handle returned by macOpen
8040 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
8041 \sa
8042 --------------------------------------------------------------------------*/
8043v_BOOL_t sme_GetWESMode(tHalHandle hHal)
8044{
8045 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8046 return pMac->roam.configParam.isWESModeEnabled;
8047}
8048
8049/*--------------------------------------------------------------------------
8050 \brief sme_GetRoamScanControl() - get scan control
8051 This is a synchronous call
8052 \param hHal - The handle returned by macOpen.
8053 \return v_BOOL_t - Enabled(1)/Disabled(0)
8054 \sa
8055 --------------------------------------------------------------------------*/
8056v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
8057{
8058 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8059 return pMac->roam.configParam.nRoamScanControl;
8060}
8061#endif
8062
8063/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008064 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
8065 This is a synchronuous call
8066 \param hHal - The handle returned by macOpen.
8067 \return TRUE (1) - if the feature is enabled
8068 FALSE (0) - if feature is disabled (compile or runtime)
8069 \sa
8070 --------------------------------------------------------------------------*/
8071tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
8072{
8073#ifdef FEATURE_WLAN_LFR
8074 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8075 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
8076#else
8077 return eANI_BOOLEAN_FALSE;
8078#endif
8079}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008080
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008081/*--------------------------------------------------------------------------
8082 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
8083 This is a synchronuous call
8084 \param hHal - The handle returned by macOpen.
8085 \return TRUE (1) - if the feature is enabled
8086 FALSE (0) - if feature is disabled (compile or runtime)
8087 \sa
8088 --------------------------------------------------------------------------*/
8089tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
8090{
8091#ifdef WLAN_FEATURE_VOWIFI_11R
8092 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8093 return pMac->roam.configParam.isFastTransitionEnabled;
8094#else
8095 return eANI_BOOLEAN_FALSE;
8096#endif
8097}
8098
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008099
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008100/* ---------------------------------------------------------------------------
8101 \fn sme_IsFeatureSupportedByFW
8102 \brief Check if an feature is enabled by FW
8103
8104 \param feattEnumValue - Enumeration value from placeHolderInCapBitmap
8105 \- return 1/0 (TRUE/FALSE)
8106 -------------------------------------------------------------------------*/
8107tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
8108{
8109 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
8110}
8111#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05308112
8113/* ---------------------------------------------------------------------------
8114 \fn sme_SendTdlsMgmtFrame
8115 \brief API to send TDLS management frames.
8116
8117 \param peerMac - peer's Mac Adress.
8118 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
8119 \- return VOS_STATUS_SUCCES
8120 -------------------------------------------------------------------------*/
8121VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
8122 tANI_U8 sessionId,
8123 tSirMacAddr peerMac,
8124 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
8125{
8126 eHalStatus status = eHAL_STATUS_SUCCESS;
8127 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8128
8129 status = sme_AcquireGlobalLock( &pMac->sme );
8130
8131 if ( HAL_STATUS_SUCCESS( status ) )
8132 {
8133 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
8134 sme_ReleaseGlobalLock( &pMac->sme );
8135 }
8136 return status ;
8137}
8138
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008139/* ---------------------------------------------------------------------------
8140 \fn sme_SendTdlsMgmtFrame
8141 \brief API to send TDLS management frames.
8142
8143 \param peerMac - peer's Mac Adress.
8144 \param frame_type - Type of TDLS mgmt frame to be sent.
8145 \param dialog - dialog token used in the frame.
8146 \param status - status to be incuded in the frame.
8147 \param buf - additional IEs to be included
8148 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08008149 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008150 \- return VOS_STATUS_SUCCES
8151 -------------------------------------------------------------------------*/
8152VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Hoonki Leea34dd892013-02-05 22:56:02 -08008153 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 -08008154{
8155 eHalStatus status = eHAL_STATUS_SUCCESS;
8156 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
8157 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8158
8159 status = sme_AcquireGlobalLock( &pMac->sme );
8160 if ( HAL_STATUS_SUCCESS( status ) )
8161 {
8162 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8163 sendTdlsReq.frameType = frame_type;
8164 sendTdlsReq.buf = buf;
8165 sendTdlsReq.len = len;
8166 sendTdlsReq.dialog = dialog;
8167 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08008168 sendTdlsReq.responder = responder;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008169
8170 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
8171
8172 sme_ReleaseGlobalLock( &pMac->sme );
8173 }
8174
8175 return status ;
8176
8177}
8178/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08008179 \fn sme_ChangeTdlsPeerSta
8180 \brief API to Update TDLS peer sta parameters.
8181
8182 \param peerMac - peer's Mac Adress.
8183 \param staParams - Peer Station Parameters
8184 \- return VOS_STATUS_SUCCES
8185 -------------------------------------------------------------------------*/
8186VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
8187 tCsrStaParams *pstaParams)
8188{
8189 eHalStatus status = eHAL_STATUS_SUCCESS;
8190 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8191
8192 status = sme_AcquireGlobalLock( &pMac->sme );
8193 if ( HAL_STATUS_SUCCESS( status ) )
8194 {
8195 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
8196
8197 sme_ReleaseGlobalLock( &pMac->sme );
8198 }
8199
8200 return status ;
8201
8202}
8203
8204/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008205 \fn sme_AddTdlsPeerSta
8206 \brief API to Add TDLS peer sta entry.
8207
8208 \param peerMac - peer's Mac Adress.
8209 \- return VOS_STATUS_SUCCES
8210 -------------------------------------------------------------------------*/
8211VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8212{
8213 eHalStatus status = eHAL_STATUS_SUCCESS;
8214 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8215
8216 status = sme_AcquireGlobalLock( &pMac->sme );
8217 if ( HAL_STATUS_SUCCESS( status ) )
8218 {
8219 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
8220
8221 sme_ReleaseGlobalLock( &pMac->sme );
8222 }
8223
8224 return status ;
8225
8226}
8227/* ---------------------------------------------------------------------------
8228 \fn sme_DeleteTdlsPeerSta
8229 \brief API to Delete TDLS peer sta entry.
8230
8231 \param peerMac - peer's Mac Adress.
8232 \- return VOS_STATUS_SUCCES
8233 -------------------------------------------------------------------------*/
8234VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8235{
8236 eHalStatus status = eHAL_STATUS_SUCCESS;
8237 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8238
8239 status = sme_AcquireGlobalLock( &pMac->sme );
8240 if ( HAL_STATUS_SUCCESS( status ) )
8241 {
8242 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
8243
8244 sme_ReleaseGlobalLock( &pMac->sme );
8245 }
8246
8247 return status ;
8248
8249}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07008250/* ---------------------------------------------------------------------------
8251 \fn sme_IsPmcBmps
8252 \API to Check if PMC state is BMPS.
8253
8254 \- return v_BOOL_t
8255 -------------------------------------------------------------------------*/
8256v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
8257{
8258 return (BMPS == pmcGetPmcState(hHal));
8259}
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07008260/* ---------------------------------------------------------------------------
8261 \fn sme_SetTdlsPowerSaveProhibited
8262 \API to set/reset the isTdlsPowerSaveProhibited.
8263
8264 \- return void
8265 -------------------------------------------------------------------------*/
8266void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
8267{
8268 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8269
8270 pMac->isTdlsPowerSaveProhibited = val;
8271 return;
8272}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008273#endif
8274#ifdef FEATURE_WLAN_TDLS_INTERNAL
8275/*
8276 * SME API to start TDLS discovery Procedure
8277 */
8278VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8279{
8280 VOS_STATUS status = VOS_STATUS_SUCCESS;
8281 tCsrTdlsDisRequest disReq = {{0}} ;
8282 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8283 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
8284
8285 return status ;
8286
8287}
8288
8289/*
8290 * Process TDLS discovery results
8291 */
8292v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
8293 tSmeTdlsDisResult *disResult, v_U8_t listType)
8294{
8295 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
8296 tSirTdlsPeerInfo *peerInfo = NULL ;
8297 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8298 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
8299 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
8300 tListElem *pEntry = NULL ;
8301 v_U8_t peerCnt = 0 ;
8302
8303 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008304 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008305 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
8306 while(pEntry)
8307 {
8308 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
8309 tdlsPeerStaLink) ;
8310 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
8311
8312 switch(listType)
8313 {
8314 case TDLS_SETUP_LIST:
8315 {
8316 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
8317 {
8318 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
8319 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
8320 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
8321 peerCnt++ ;
8322 }
8323 break ;
8324 }
8325 case TDLS_DIS_LIST:
8326 {
8327 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
8328 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
8329 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
8330 peerCnt++ ;
8331 break ;
8332 }
8333 default:
8334 {
8335 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008336 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008337 break ;
8338 }
8339 }
8340
8341 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
8342 }
8343
8344 return peerCnt ;
8345
8346}
8347
8348/*
8349 * SME API to start TDLS link setup Procedure.
8350 */
8351VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8352{
8353 VOS_STATUS status = VOS_STATUS_SUCCESS;
8354 tCsrTdlsSetupRequest setupReq = {{0}} ;
8355 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8356 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
8357 return status ;
8358
8359}
8360
8361/*
8362 * SME API to start TDLS link Teardown Procedure.
8363 */
8364VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8365{
8366 VOS_STATUS status = VOS_STATUS_SUCCESS;
8367 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
8368 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8369 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
8370 return status ;
8371
8372}
8373
8374#endif /* FEATURE_WLAN_TDLS */
8375
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -07008376eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
8377{
8378 eHalStatus status = eHAL_STATUS_FAILURE;
8379 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8380
8381 smsLog(pMac, LOG2, FL("enter"));
8382 status = sme_AcquireGlobalLock( &pMac->sme );
8383 if ( HAL_STATUS_SUCCESS( status ) )
8384 {
8385 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
8386 sme_ReleaseGlobalLock( &pMac->sme );
8387 }
8388 smsLog(pMac, LOG2, FL("exit status %d"), status);
8389
8390 return (status);
8391}
8392
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -07008393/*
8394 * SME API to enable/disable WLAN driver initiated SSR
8395 */
8396void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
8397{
8398 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8399 eHalStatus status = eHAL_STATUS_SUCCESS;
8400
8401 status = sme_AcquireGlobalLock(&pMac->sme);
8402 if (HAL_STATUS_SUCCESS(status))
8403 {
8404 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8405 "SSR level is changed %d", enableSSR);
8406 /* not serializing this messsage, as this is only going
8407 * to set a variable in WDA/WDI
8408 */
8409 WDA_SetEnableSSR(enableSSR);
8410 sme_ReleaseGlobalLock(&pMac->sme);
8411 }
8412 return;
8413}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07008414
8415/*
8416 * SME API to determine the channel bonding mode
8417 */
8418VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
8419{
8420 tSmeConfigParams smeConfig;
8421 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8422
8423 if (
8424#ifdef WLAN_FEATURE_11AC
8425 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
8426 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
8427#endif
8428 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
8429 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode
8430 )
8431 {
8432 return VOS_STATUS_SUCCESS;
8433 }
8434
8435 /* If channel bonding mode is not required */
8436 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
8437 return VOS_STATUS_SUCCESS;
8438 }
8439
8440 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
8441 sme_GetConfigParam(pMac, &smeConfig);
8442
8443#ifdef WLAN_FEATURE_11AC
8444 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
8445 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
8446 {
8447 if ( channel== 36 || channel == 52 || channel == 100 ||
8448 channel == 116 || channel == 149 )
8449 {
8450 smeConfig.csrConfig.channelBondingMode5GHz =
8451 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
8452 }
8453 else if ( channel == 40 || channel == 56 || channel == 104 ||
8454 channel == 120 || channel == 153 )
8455 {
8456 smeConfig.csrConfig.channelBondingMode5GHz =
8457 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
8458 }
8459 else if ( channel == 44 || channel == 60 || channel == 108 ||
8460 channel == 124 || channel == 157 )
8461 {
8462 smeConfig.csrConfig.channelBondingMode5GHz =
8463 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1;
8464 }
8465 else if ( channel == 48 || channel == 64 || channel == 112 ||
8466 channel == 128 || channel == 161 )
8467 {
8468 smeConfig.csrConfig.channelBondingMode5GHz =
8469 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
8470 }
8471 else if ( channel == 165 )
8472 {
8473 smeConfig.csrConfig.channelBondingMode5GHz = 0;
8474 }
8475 }
8476#endif
8477
8478 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
8479 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
8480 {
8481 if ( channel== 40 || channel == 48 || channel == 56 ||
8482 channel == 64 || channel == 104 || channel == 112 ||
8483 channel == 120 || channel == 128 || channel == 136 ||
8484 channel == 144 || channel == 153 || channel == 161 )
8485 {
8486 smeConfig.csrConfig.channelBondingMode5GHz = 1;
8487 }
8488 else if ( channel== 36 || channel == 44 || channel == 52 ||
8489 channel == 60 || channel == 100 || channel == 108 ||
8490 channel == 116 || channel == 124 || channel == 132 ||
8491 channel == 140 || channel == 149 || channel == 157 )
8492 {
8493 smeConfig.csrConfig.channelBondingMode5GHz = 2;
8494 }
8495 else if ( channel == 165 )
8496 {
8497 smeConfig.csrConfig.channelBondingMode5GHz = 0;
8498 }
8499 }
8500 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8501 "cbmode selected=%ld\n", smeConfig.csrConfig.channelBondingMode5GHz);
8502
8503 sme_UpdateConfig (pMac, &smeConfig);
8504 return VOS_STATUS_SUCCESS;
8505}
8506
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07008507#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8508/*--------------------------------------------------------------------------
8509 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
8510 from CSR.
8511 This is a synchronous call
8512 \param hHal - The handle returned by macOpen
8513 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
8514 BSSID, channel etc.)
8515 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
8516 Other status means SME is failed to send the request.
8517 \sa
8518 --------------------------------------------------------------------------*/
8519
8520eHalStatus sme_HandoffRequest(tHalHandle hHal,
8521 tCsrHandoffRequest *pHandoffInfo)
8522{
8523 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8524 eHalStatus status = eHAL_STATUS_SUCCESS;
8525
8526 status = sme_AcquireGlobalLock( &pMac->sme );
8527 if ( HAL_STATUS_SUCCESS( status ) )
8528 {
8529 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8530 "%s: invoked", __func__);
8531 status = csrHandoffRequest(pMac, pHandoffInfo);
8532 sme_ReleaseGlobalLock( &pMac->sme );
8533 }
8534
8535 return status ;
8536}
8537#endif
8538