blob: a3a19fdd1bb6102f08bc2c615a53f2201b1acd6f [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
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053093#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080094
Jeff Johnson295189b2012-06-20 16:38:30 -070095// TxMB Functions
96extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
97 tANI_U32 size, tSmeCmd **ppCmd );
98extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
99extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Jeff Johnson295189b2012-06-20 16:38:30 -0700100extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
101extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
102extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
103extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
104extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
105extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -0700106
107static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
108static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
109
110eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
111
112eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
113
114eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
115
116eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
117
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700118#ifdef FEATURE_WLAN_LFR
119tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
120#endif
121
Chet Lanctot186b5732013-03-18 10:26:30 -0700122#ifdef WLAN_FEATURE_11W
123eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
124 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
125#endif
126
Jeff Johnson295189b2012-06-20 16:38:30 -0700127//Internal SME APIs
128eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
129{
130 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
131
132 if(psSme)
133 {
134 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
135 {
136 status = eHAL_STATUS_SUCCESS;
137 }
138 }
139
140 return (status);
141}
142
143
144eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
145{
146 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
147
148 if(psSme)
149 {
150 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
151 {
152 status = eHAL_STATUS_SUCCESS;
153 }
154 }
155
156 return (status);
157}
158
159
160
161static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
162{
163 eHalStatus status;
164 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530165 tANI_U32 cmd_idx;
Jeff Johnson295189b2012-06-20 16:38:30 -0700166
167 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530168 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
169 &pMac->sme.smeCmdActiveList)))
170 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700171
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530172 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
173 &pMac->sme.smeCmdPendingList)))
174 goto end;
175
176 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
177 &pMac->sme.smeScanCmdActiveList)))
178 goto end;
179
180 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
181 &pMac->sme.smeScanCmdPendingList)))
182 goto end;
183
184 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
185 &pMac->sme.smeCmdFreeList)))
186 goto end;
187
188 status = palAllocateMemory(pMac->hHdd,
189 (void **)&pCmd,
190 sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
191 if (!HAL_STATUS_SUCCESS(status))
192 goto end;
193
194 palZeroMemory(pMac->hHdd, pCmd,
195 sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
196 pMac->sme.pSmeCmdBufAddr = pCmd;
197 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
198 {
199 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
200 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Jeff Johnson295189b2012-06-20 16:38:30 -0700201 }
202
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530203end:
204 if (!HAL_STATUS_SUCCESS(status))
205 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
206 status);
207
Jeff Johnson295189b2012-06-20 16:38:30 -0700208 return (status);
209}
210
211
212void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
213{
214 pCmd->command = eSmeNoCommand;
215 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
216}
217
218
219
220static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
221{
222 tListElem *pEntry;
223 tSmeCmd *pCommand;
224
225 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
226 {
227 //TODO: base on command type to call release functions
228 //reinitialize different command types so they can be reused
229 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
230 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
231 }
232}
233
234static void purgeSmeCmdList(tpAniSirGlobal pMac)
235{
236 //release any out standing commands back to free command list
237 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
238 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530239 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
240 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700241}
242
243void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId)
244{
245 //release any out standing commands back to free command list
246 tListElem *pEntry, *pNext;
247 tSmeCmd *pCommand;
248 tDblLinkList *pList = &pMac->sme.smeCmdPendingList;
249 tDblLinkList localList;
250
251 vos_mem_zero(&localList, sizeof(tDblLinkList));
252 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
253 {
254 smsLog(pMac, LOGE, FL(" failed to open list"));
255 return;
256 }
257
258 csrLLLock(pList);
259 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
260 while(pEntry != NULL)
261 {
262 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
263 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
264 if(pCommand->sessionId == sessionId)
265 {
266 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
267 {
268 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
269 }
270 }
271 pEntry = pNext;
272 }
273 csrLLUnlock(pList);
274
275 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
276 {
277 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
278 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
279 }
280 csrLLClose(&localList);
281
282}
283
284
285static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
286{
287 eHalStatus status = eHAL_STATUS_SUCCESS;
288
289 purgeSmeCmdList(pMac);
290 csrLLClose(&pMac->sme.smeCmdPendingList);
291 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530292 csrLLClose(&pMac->sme.smeScanCmdPendingList);
293 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700294 csrLLClose(&pMac->sme.smeCmdFreeList);
295
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800296 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
297 if(status != eHAL_STATUS_SUCCESS)
298 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800299 smsLog(pMac, LOGE,
300 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800301 goto done;
302 }
303
Jeff Johnson295189b2012-06-20 16:38:30 -0700304 if(NULL != pMac->sme.pSmeCmdBufAddr)
305 {
306 status = palFreeMemory(pMac->hHdd, pMac->sme.pSmeCmdBufAddr);
307 pMac->sme.pSmeCmdBufAddr = NULL;
308 }
309
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800310 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
311 if(status != eHAL_STATUS_SUCCESS)
312 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800313 smsLog(pMac, LOGE,
314 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800315 }
316done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700317 return (status);
318}
319
320
321void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
322{
323#ifdef WLAN_DEBUG
324 switch( pCmd->command )
325 {
326 case eSmeCommandScan:
327 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
328 break;
329
330 case eSmeCommandRoam:
331 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
332 break;
333
334 case eSmeCommandWmStatusChange:
335 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
336 break;
337
338 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800339 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700340 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
341 break;
342
343 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800344 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700345 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
346 break;
347
348 default:
349 break;
350 }
351#endif //#ifdef WLAN_DEBUG
352}
353
354tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
355{
356 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
357 tListElem *pEntry;
358
359 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
360
361 // If we can get another MS Msg buffer, then we are ok. Just link
362 // the entry onto the linked list. (We are using the linked list
363 // to keep track of tfhe message buffers).
364 if ( pEntry )
365 {
366 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
367 }
368 else {
369 int idx = 1;
370
371 //Cannot change pRetCmd here since it needs to return later.
372 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
373 if( pEntry )
374 {
375 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
376 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800377 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
379 if(pTempCmd)
380 {
381 if( eSmeCsrCommandMask & pTempCmd->command )
382 {
383 //CSR command is stuck. See what the reason code is for that command
384 dumpCsrCommandInfo(pMac, pTempCmd);
385 }
386 } //if(pTempCmd)
387
388 //dump what is in the pending queue
389 csrLLLock(&pMac->sme.smeCmdPendingList);
390 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
391 while(pEntry)
392 {
393 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800394 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700395 idx++, pTempCmd->command );
396 if( eSmeCsrCommandMask & pTempCmd->command )
397 {
398 //CSR command is stuck. See what the reason code is for that command
399 dumpCsrCommandInfo(pMac, pTempCmd);
400 }
401 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
402 }
403 csrLLUnlock(&pMac->sme.smeCmdPendingList);
404
405 //There may be some more command in CSR's own pending queue
406 csrLLLock(&pMac->roam.roamCmdPendingList);
407 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
408 while(pEntry)
409 {
410 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800411 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 idx++, pTempCmd->command );
413 dumpCsrCommandInfo(pMac, pTempCmd);
414 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
415 }
416 csrLLUnlock(&pMac->roam.roamCmdPendingList);
417 }
418
419 return( pRetCmd );
420}
421
422
423void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
424{
425 if ( fHighPriority )
426 {
427 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
428 }
429 else
430 {
431 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
432 }
433
434 // process the command queue...
435 smeProcessPendingQueue( pMac );
436
437 return;
438}
439
440
441static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
442{
443 eSmeCommandType pmcCommand = eSmeNoCommand;
444 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
445 tPmcState pmcState;
446 eHalStatus status;
447
448 do
449 {
450 pmcState = pmcGetPmcState(pMac);
451
452 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
453 if( !HAL_STATUS_SUCCESS(status) )
454 {
455 //PMC state is not right for the command, drop it
456 return ( eSmeDropCommand );
457 }
458 if( fFullPowerNeeded ) break;
459 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
460 ( eSmeCommandDelTs == pCommand->command ) );
461 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700462#ifdef FEATURE_OEM_DATA_SUPPORT
463 fFullPowerNeeded = (pmcState == IMPS &&
464 eSmeCommandOemDataReq == pCommand->command);
465 if(fFullPowerNeeded) break;
466#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700467 fFullPowerNeeded = (pmcState == IMPS &&
468 eSmeCommandRemainOnChannel == pCommand->command);
469 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700470 } while(0);
471
472 if( fFullPowerNeeded )
473 {
474 switch( pmcState )
475 {
476 case IMPS:
477 case STANDBY:
478 pmcCommand = eSmeCommandExitImps;
479 break;
480
481 case BMPS:
482 pmcCommand = eSmeCommandExitBmps;
483 break;
484
485 case UAPSD:
486 pmcCommand = eSmeCommandExitUapsd;
487 break;
488
489 case WOWL:
490 pmcCommand = eSmeCommandExitWowl;
491 break;
492
493 default:
494 break;
495 }
496 }
497
498 return ( pmcCommand );
499}
500
501
502//For commands that need to do extra cleanup.
503static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
504{
505 if( eSmePmcCommandMask & pCommand->command )
506 {
507 pmcAbortCommand( pMac, pCommand, fStopping );
508 }
509 else if ( eSmeCsrCommandMask & pCommand->command )
510 {
511 csrAbortCommand( pMac, pCommand, fStopping );
512 }
513 else
514 {
515 switch( pCommand->command )
516 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 case eSmeCommandRemainOnChannel:
518 if (NULL != pCommand->u.remainChlCmd.callback)
519 {
520 remainOnChanCallback callback =
521 pCommand->u.remainChlCmd.callback;
522 /* process the msg */
523 if( callback )
524 {
525 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
526 eCSR_SCAN_ABORT );
527 }
528 }
529 smeReleaseCommand( pMac, pCommand );
530 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 default:
532 smeReleaseCommand( pMac, pCommand );
533 break;
534 }
535 }
536}
537
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530538tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
539 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
540{
541 tListElem *pCurEntry = NULL;
542 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700543
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530544 /* Go through the list and return the command whose session id is not
545 * matching with the current ongoing scan cmd sessionId */
546 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
547 while (pCurEntry)
548 {
549 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
550 if (pCommand->sessionId != sessionId)
551 {
552 smsLog(pMac, LOG1, "selected the command with different sessionId");
553 return pCurEntry;
554 }
555
556 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
557 }
558
559 smsLog(pMac, LOG1, "No command pending with different sessionId");
560 return NULL;
561}
562
563tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
564{
565 tListElem *pEntry;
566 tSmeCmd *pCommand;
567 tListElem *pSmeEntry;
568 tSmeCmd *pSmeCommand;
569 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
570
571 csrLLLock( &pMac->sme.smeScanCmdActiveList );
572 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
573 LL_ACCESS_NOLOCK ))
574 {
575 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
576 LL_ACCESS_LOCK))
577 {
578 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
579 LL_ACCESS_LOCK );
580 if (pEntry)
581 {
582 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
583 //We cannot execute any command in wait-for-key state until setKey is through.
584 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
585 {
586 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
587 {
588 smsLog(pMac, LOGE,
589 " Cannot process command(%d) while waiting for key",
590 pCommand->command);
591 status = eANI_BOOLEAN_FALSE;
592 goto end;
593 }
594 }
595
596 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
597 LL_ACCESS_LOCK )))
598 {
599 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
600 LL_ACCESS_LOCK);
601 if (pEntry)
602 {
603 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
604 Link) ;
605
606 /* if scan is running on one interface and SME recei
607 ves the next command on the same interface then
608 dont the allow the command to be queued to
609 smeCmdPendingList. If next scan is allowed on
610 the same interface the CSR state machine will
611 get screwed up. */
612 if (pSmeCommand->sessionId == pCommand->sessionId)
613 {
614 status = eANI_BOOLEAN_FALSE;
615 goto end;
616 }
617 }
618 }
619 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
620 pEntry, LL_ACCESS_LOCK ) )
621 {
622 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
623 &pCommand->Link, LL_ACCESS_NOLOCK );
624
625 switch (pCommand->command)
626 {
627 case eSmeCommandScan:
628 smsLog(pMac, LOG1,
629 " Processing scan offload command ");
630 csrProcessScanCommand( pMac, pCommand );
631 break;
632 default:
633 smsLog(pMac, LOGE,
634 " Something wrong, wrong command enqueued"
635 " to smeScanCmdPendingList");
636 pEntry = csrLLRemoveHead(
637 &pMac->sme.smeScanCmdActiveList,
638 LL_ACCESS_NOLOCK );
639 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
640 smeReleaseCommand( pMac, pCommand );
641 break;
642 }
643 }
644 }
645 }
646 }
647end:
648 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
649 return status;
650}
Jeff Johnson295189b2012-06-20 16:38:30 -0700651
652tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
653{
654 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
655 eHalStatus status = eHAL_STATUS_SUCCESS;
656 tListElem *pEntry;
657 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530658 tListElem *pSmeEntry;
659 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 eSmeCommandType pmcCommand = eSmeNoCommand;
661
662 // if the ActiveList is empty, then nothing is active so we can process a
663 // pending command...
664 //alwasy lock active list before locking pending list
665 csrLLLock( &pMac->sme.smeCmdActiveList );
666 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
667 {
668 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
669 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530670 /* If scan command is pending in the smeScanCmdActive list
671 * then pick the command from smeCmdPendingList which is
672 * not matching with the scan command session id.
673 * At any point of time only one command will be allowed
674 * on a single session. */
675 if ((pMac->fScanOffload) &&
676 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
677 LL_ACCESS_LOCK)))
678 {
679 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
680 LL_ACCESS_LOCK);
681 if (pSmeEntry)
682 {
683 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
684
685 pEntry = csrGetCmdToProcess(pMac,
686 &pMac->sme.smeCmdPendingList,
687 pSmeCommand->sessionId,
688 LL_ACCESS_LOCK);
689 goto sme_process_cmd;
690 }
691 }
692
Jeff Johnson295189b2012-06-20 16:38:30 -0700693 //Peek the command
694 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530695sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700696 if( pEntry )
697 {
698 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530699
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 //We cannot execute any command in wait-for-key state until setKey is through.
701 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) )
702 {
703 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
704 {
705 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800706 smsLog(pMac, LOGE, " Cannot process command(%d) while waiting for key", pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530707 fContinue = eANI_BOOLEAN_FALSE;
708 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700709 }
710 }
711 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
712 if( eSmeDropCommand == pmcCommand )
713 {
714 //This command is not ok for current PMC state
715 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
716 {
717 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
718 }
719 csrLLUnlock( &pMac->sme.smeCmdActiveList );
720 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530721 fContinue = eANI_BOOLEAN_TRUE;
722 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700723 }
724 else if( eSmeNoCommand != pmcCommand )
725 {
726 tExitBmpsInfo exitBmpsInfo;
727 void *pv = NULL;
728 tANI_U32 size = 0;
729 tSmeCmd *pPmcCmd = NULL;
730
731 if( eSmeCommandExitBmps == pmcCommand )
732 {
733 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
734 pv = (void *)&exitBmpsInfo;
735 size = sizeof(tExitBmpsInfo);
736 }
737 //pmcCommand has to be one of the exit power save command
738 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
739 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
740 {
741 //Force this command to wake up the chip
742 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
743 csrLLUnlock( &pMac->sme.smeCmdActiveList );
744 fContinue = pmcProcessCommand( pMac, pPmcCmd );
745 if( fContinue )
746 {
747 //The command failed, remove it
748 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
749 {
750 pmcReleaseCommand( pMac, pPmcCmd );
751 }
752 }
753 }
754 else
755 {
756 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800757 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 -0700758 //Let it retry
759 fContinue = eANI_BOOLEAN_TRUE;
760 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530761 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700762 }
763 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
764 {
765 // we can reuse the pCommand
766
767 // Insert the command onto the ActiveList...
768 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
769
770 // .... and process the command.
771
772 switch ( pCommand->command )
773 {
774
775 case eSmeCommandScan:
776 csrLLUnlock( &pMac->sme.smeCmdActiveList );
777 status = csrProcessScanCommand( pMac, pCommand );
778 break;
779
780 case eSmeCommandRoam:
781 csrLLUnlock( &pMac->sme.smeCmdActiveList );
782 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800783 if(!HAL_STATUS_SUCCESS(status))
784 {
785 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
786 &pCommand->Link, LL_ACCESS_LOCK ) )
787 {
788 csrReleaseCommandRoam( pMac, pCommand );
789 }
790 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 break;
792
793 case eSmeCommandWmStatusChange:
794 csrLLUnlock( &pMac->sme.smeCmdActiveList );
795 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
796 break;
797
798 case eSmeCommandSetKey:
799 csrLLUnlock( &pMac->sme.smeCmdActiveList );
800 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
801 if(!HAL_STATUS_SUCCESS(status))
802 {
803 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
804 &pCommand->Link, LL_ACCESS_LOCK ) )
805 {
806 csrReleaseCommandSetKey( pMac, pCommand );
807 }
808 }
809 break;
810
811 case eSmeCommandRemoveKey:
812 csrLLUnlock( &pMac->sme.smeCmdActiveList );
813 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
814 if(!HAL_STATUS_SUCCESS(status))
815 {
816 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
817 &pCommand->Link, LL_ACCESS_LOCK ) )
818 {
819 csrReleaseCommandRemoveKey( pMac, pCommand );
820 }
821 }
822 break;
823
824 case eSmeCommandAddStaSession:
825 csrLLUnlock( &pMac->sme.smeCmdActiveList );
826 csrProcessAddStaSessionCommand( pMac, pCommand );
827 break;
828 case eSmeCommandDelStaSession:
829 csrLLUnlock( &pMac->sme.smeCmdActiveList );
830 csrProcessDelStaSessionCommand( pMac, pCommand );
831 break;
832
Jeff Johnsone7245742012-09-05 17:12:55 -0700833#ifdef FEATURE_OEM_DATA_SUPPORT
834 case eSmeCommandOemDataReq:
835 csrLLUnlock(&pMac->sme.smeCmdActiveList);
836 oemData_ProcessOemDataReqCommand(pMac, pCommand);
837 break;
838#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 case eSmeCommandRemainOnChannel:
840 csrLLUnlock(&pMac->sme.smeCmdActiveList);
841 p2pProcessRemainOnChannelCmd(pMac, pCommand);
842 break;
843 case eSmeCommandNoAUpdate:
844 csrLLUnlock( &pMac->sme.smeCmdActiveList );
845 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700846 case eSmeCommandEnterImps:
847 case eSmeCommandExitImps:
848 case eSmeCommandEnterBmps:
849 case eSmeCommandExitBmps:
850 case eSmeCommandEnterUapsd:
851 case eSmeCommandExitUapsd:
852 case eSmeCommandEnterWowl:
853 case eSmeCommandExitWowl:
854 csrLLUnlock( &pMac->sme.smeCmdActiveList );
855 fContinue = pmcProcessCommand( pMac, pCommand );
856 if( fContinue )
857 {
858 //The command failed, remove it
859 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
860 &pCommand->Link, LL_ACCESS_LOCK ) )
861 {
862 pmcReleaseCommand( pMac, pCommand );
863 }
864 }
865 break;
866
867 //Treat standby differently here because caller may not be able to handle
868 //the failure so we do our best here
869 case eSmeCommandEnterStandby:
870 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
871 {
872 //It can continue
873 csrLLUnlock( &pMac->sme.smeCmdActiveList );
874 fContinue = pmcProcessCommand( pMac, pCommand );
875 if( fContinue )
876 {
877 //The command failed, remove it
878 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
879 &pCommand->Link, LL_ACCESS_LOCK ) )
880 {
881 pmcReleaseCommand( pMac, pCommand );
882 }
883 }
884 }
885 else
886 {
887 //Need to issue a disconnect first before processing this command
888 tSmeCmd *pNewCmd;
889
890 //We need to re-run the command
891 fContinue = eANI_BOOLEAN_TRUE;
892 //Pull off the standby command first
893 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
894 &pCommand->Link, LL_ACCESS_NOLOCK ) )
895 {
896 csrLLUnlock( &pMac->sme.smeCmdActiveList );
897 //Need to call CSR function here because the disconnect command
898 //is handled by CSR
899 pNewCmd = csrGetCommandBuffer( pMac );
900 if( NULL != pNewCmd )
901 {
902 //Put the standby command to the head of the pending list first
903 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
904 LL_ACCESS_LOCK );
905 pNewCmd->command = eSmeCommandRoam;
906 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
907 //Put the disassoc command before the standby command
908 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
909 LL_ACCESS_LOCK );
910 }
911 else
912 {
913 //Continue the command here
914 fContinue = pmcProcessCommand( pMac, pCommand );
915 if( fContinue )
916 {
917 //The command failed, remove it
918 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
919 &pCommand->Link, LL_ACCESS_LOCK ) )
920 {
921 pmcReleaseCommand( pMac, pCommand );
922 }
923 }
924 }
925 }
926 else
927 {
928 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800929 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700930 VOS_ASSERT(0);
931 }
932 }
933 break;
934
935 case eSmeCommandAddTs:
936 case eSmeCommandDelTs:
937 csrLLUnlock( &pMac->sme.smeCmdActiveList );
938#ifndef WLAN_MDM_CODE_REDUCTION_OPT
939 fContinue = qosProcessCommand( pMac, pCommand );
940 if( fContinue )
941 {
942 //The command failed, remove it
943 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
944 &pCommand->Link, LL_ACCESS_NOLOCK ) )
945 {
946//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
947 qosReleaseCommand( pMac, pCommand );
948//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
949 }
950 }
951#endif
952 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800953#ifdef FEATURE_WLAN_TDLS
954 case eSmeCommandTdlsSendMgmt:
955 case eSmeCommandTdlsAddPeer:
956 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530957 case eSmeCommandTdlsLinkEstablish:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800958#ifdef FEATURE_WLAN_TDLS_INTERNAL
959 case eSmeCommandTdlsDiscovery:
960 case eSmeCommandTdlsLinkSetup:
961 case eSmeCommandTdlsLinkTear:
962 case eSmeCommandTdlsEnterUapsd:
963 case eSmeCommandTdlsExitUapsd:
964#endif
965 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -0800966 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800967 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800968
969 csrLLUnlock( &pMac->sme.smeCmdActiveList );
970 status = csrTdlsProcessCmd( pMac, pCommand );
971 }
972 break ;
973#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700974
975 default:
976 //something is wrong
977 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800978 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700979 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
980 csrLLUnlock( &pMac->sme.smeCmdActiveList );
981 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
982 smeReleaseCommand( pMac, pCommand );
983 status = eHAL_STATUS_FAILURE;
984 break;
985 }
986 if(!HAL_STATUS_SUCCESS(status))
987 {
988 fContinue = eANI_BOOLEAN_TRUE;
989 }
990 }//if(pEntry)
991 else
992 {
993 //This is odd. Some one else pull off the command.
994 csrLLUnlock( &pMac->sme.smeCmdActiveList );
995 }
996 }
997 else
998 {
999 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1000 }
1001 }
1002 else
1003 {
1004 //No command waiting
1005 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1006 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1007 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1008 {
1009 tANI_U32 nTime = 0;
1010
1011 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1012 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1013 {
1014 csrScanStartIdleScanTimer(pMac, nTime);
1015 }
1016 }
1017 }
1018 }
1019 else {
1020 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1021 }
1022
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301023sme_process_scan_queue:
1024 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1025 fContinue = eANI_BOOLEAN_FALSE;
1026
Jeff Johnson295189b2012-06-20 16:38:30 -07001027 return ( fContinue );
1028}
1029
1030void smeProcessPendingQueue( tpAniSirGlobal pMac )
1031{
1032 while( smeProcessCommand( pMac ) );
1033}
1034
1035
1036tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1037{
1038 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1039 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1040}
1041
1042
1043
1044//Global APIs
1045
1046/*--------------------------------------------------------------------------
1047
1048 \brief sme_Open() - Initialze all SME modules and put them at idle state
1049
1050 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1051 successfully return, all modules are at idle state ready to start.
1052
1053 smeOpen must be called before any other SME APIs can be involved.
1054 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001055 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001056 \param hHal - The handle returned by macOpen.
1057
1058 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1059
1060 Other status means SME is failed to be initialized
1061 \sa
1062
1063 --------------------------------------------------------------------------*/
1064eHalStatus sme_Open(tHalHandle hHal)
1065{
1066 eHalStatus status = eHAL_STATUS_FAILURE;
1067 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1068
1069 do {
1070 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001071 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1073 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001074 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001075 status = eHAL_STATUS_FAILURE;
1076 break;
1077 }
1078
1079 status = ccmOpen(hHal);
1080 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1081 smsLog( pMac, LOGE,
1082 "ccmOpen failed during initialization with status=%d", status );
1083 break;
1084 }
1085
1086 status = csrOpen(pMac);
1087 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1088 smsLog( pMac, LOGE,
1089 "csrOpen failed during initialization with status=%d", status );
1090 break;
1091 }
1092
1093 status = pmcOpen(hHal);
1094 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1095 smsLog( pMac, LOGE,
1096 "pmcOpen failed during initialization with status=%d", status );
1097 break;
1098 }
1099
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001100#ifdef FEATURE_WLAN_TDLS
1101 pMac->isTdlsPowerSaveProhibited = 0;
1102#endif
1103
Jeff Johnson295189b2012-06-20 16:38:30 -07001104#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1105 status = sme_QosOpen(pMac);
1106 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1107 smsLog( pMac, LOGE,
1108 "Qos open failed during initialization with status=%d", status );
1109 break;
1110 }
1111
1112 status = btcOpen(pMac);
1113 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1114 smsLog( pMac, LOGE,
1115 "btcOpen open failed during initialization with status=%d", status );
1116 break;
1117 }
1118#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001119#ifdef FEATURE_OEM_DATA_SUPPORT
1120 status = oemData_OemDataReqOpen(pMac);
1121 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1122 smsLog(pMac, LOGE,
1123 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1124 break;
1125 }
1126#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001127
1128 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1129 break;
1130
Jeff Johnson295189b2012-06-20 16:38:30 -07001131 {
1132 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1133 if ( NULL == pvosGCtx ){
1134 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1135 status = eHAL_STATUS_FAILURE;
1136 break;
1137 }
1138
1139 status = WLANSAP_Open( pvosGCtx );
1140 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1141 smsLog( pMac, LOGE,
1142 "WLANSAP_Open open failed during initialization with status=%d", status );
1143 break;
1144 }
1145 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001146#if defined WLAN_FEATURE_VOWIFI
1147 status = rrmOpen(pMac);
1148 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1149 smsLog( pMac, LOGE,
1150 "rrmOpen open failed during initialization with status=%d", status );
1151 break;
1152 }
1153#endif
1154
1155#if defined WLAN_FEATURE_VOWIFI_11R
1156 sme_FTOpen(pMac);
1157#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001158 sme_p2pOpen(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001159
1160 }while (0);
1161
1162 return status;
1163}
1164
Jeff Johnson295189b2012-06-20 16:38:30 -07001165/*--------------------------------------------------------------------------
1166
1167 \brief sme_set11dinfo() - Set the 11d information about valid channels
1168 and there power using information from nvRAM
1169 This function is called only for AP.
1170
Srinivas Girigowdade697412013-02-14 16:31:48 -08001171 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001172
1173 \param hHal - The handle returned by macOpen.
1174 \Param pSmeConfigParams - a pointer to a caller allocated object of
1175 typedef struct _smeConfigParams.
1176
1177 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1178
1179 Other status means SME is failed to update the config parameters.
1180 \sa
1181--------------------------------------------------------------------------*/
1182
1183eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1184{
1185 eHalStatus status = eHAL_STATUS_FAILURE;
1186 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1187
1188 if (NULL == pSmeConfigParams ) {
1189 smsLog( pMac, LOGE,
1190 "Empty config param structure for SME, nothing to update");
1191 return status;
1192 }
1193
1194 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1195 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001196 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001197 status );
1198 }
1199 return status;
1200}
1201
1202/*--------------------------------------------------------------------------
1203
1204 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1205
Srinivas Girigowdade697412013-02-14 16:31:48 -08001206 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001207
1208 \param hHal - The handle returned by HostapdAdapter.
1209 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1210
1211 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1212
1213 Other status means, failed to get the current regulatory domain.
1214 \sa
1215--------------------------------------------------------------------------*/
1216
1217eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1218{
1219 eHalStatus status = eHAL_STATUS_FAILURE;
1220 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1221
1222 if (NULL == domainIdSoftAp ) {
1223 smsLog( pMac, LOGE, "Uninitialized domain Id");
1224 return status;
1225 }
1226
1227 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1228 status = eHAL_STATUS_SUCCESS;
1229
1230 return status;
1231}
1232
1233
1234eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1235{
1236 eHalStatus status = eHAL_STATUS_FAILURE;
1237 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1238
1239 if (NULL == apCntryCode ) {
1240 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1241 return status;
1242 }
1243
1244 status = csrSetRegInfo(hHal, apCntryCode );
1245 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001246 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001247 status );
1248 }
1249 return status;
1250}
1251
Jeff Johnson295189b2012-06-20 16:38:30 -07001252#ifdef FEATURE_WLAN_SCAN_PNO
1253/*--------------------------------------------------------------------------
1254
1255 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
1256
1257 It is used at driver start up to inform RIVA of the default channel
1258 configuration.
1259
Srinivas Girigowdade697412013-02-14 16:31:48 -08001260 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001261
1262 \param hHal - The handle returned by macOpen.
1263
1264 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1265
1266 Other status means SME is failed to update the channel config.
1267 \sa
1268
1269 --------------------------------------------------------------------------*/
1270eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1271{
1272 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1273
1274 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
1275 &pMac->scan.base20MHzChannels, FALSE);
1276 return eHAL_STATUS_SUCCESS;
1277}
1278#endif // FEATURE_WLAN_SCAN_PNLO
1279
1280/*--------------------------------------------------------------------------
1281
1282 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1283
1284 The function updates some configuration for modules in SME, CCM, CSR, etc
1285 during SMEs close open sequence.
1286
1287 Modules inside SME apply the new configuration at the next transaction.
1288
Srinivas Girigowdade697412013-02-14 16:31:48 -08001289 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001290
1291 \param hHal - The handle returned by macOpen.
1292 \Param pSmeConfigParams - a pointer to a caller allocated object of
1293 typedef struct _smeConfigParams.
1294
1295 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1296
1297 Other status means SME is failed to update the config parameters.
1298 \sa
1299
1300 --------------------------------------------------------------------------*/
1301eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1302{
1303 eHalStatus status = eHAL_STATUS_FAILURE;
1304 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1305
1306 if (NULL == pSmeConfigParams ) {
1307 smsLog( pMac, LOGE,
1308 "Empty config param structure for SME, nothing to update");
1309 return status;
1310 }
1311
1312 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1313
1314 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001315 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001316 status );
1317 }
1318#if defined WLAN_FEATURE_P2P_INTERNAL
1319 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1320
1321 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001322 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001323 status );
1324 }
1325#endif
1326#if defined WLAN_FEATURE_VOWIFI
1327 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1328
1329 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001330 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001331 status );
1332 }
1333#endif
1334 //For SOC, CFG is set before start
1335 //We don't want to apply global CFG in connect state because that may cause some side affect
1336 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001337 csrIsAllSessionDisconnected( pMac) )
1338 {
1339 csrSetGlobalCfgs(pMac);
1340 }
1341
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301342 /* update the directed scan offload setting */
1343 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1344
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301345 if (pMac->fScanOffload)
1346 {
1347 /* If scan offload is enabled then lim has allow the sending of
1348 scan request to firmware even in powersave mode. The firmware has
1349 to take care of exiting from power save mode */
1350 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1351 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1352
1353 if (eHAL_STATUS_SUCCESS != status)
1354 {
1355 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1356 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1357 }
1358 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001359 return status;
1360}
1361
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301362#ifdef WLAN_FEATURE_GTK_OFFLOAD
1363void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1364 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1365{
1366 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1367
1368 if (NULL == pMac)
1369 {
1370 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1371 "%s: pMac is null", __func__);
1372 return ;
1373 }
1374 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1375 {
1376 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1377 "%s: HDD callback is null", __func__);
1378 return ;
1379 }
1380 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1381 pGtkOffloadGetInfoRsp);
1382}
1383#endif
1384
Jeff Johnson295189b2012-06-20 16:38:30 -07001385/* ---------------------------------------------------------------------------
1386 \fn sme_ChangeConfigParams
1387 \brief The SME API exposed for HDD to provide config params to SME during
1388 SMEs stop -> start sequence.
1389
1390 If HDD changed the domain that will cause a reset. This function will
1391 provide the new set of 11d information for the new domain. Currrently this
1392 API provides info regarding 11d only at reset but we can extend this for
1393 other params (PMC, QoS) which needs to be initialized again at reset.
1394
Srinivas Girigowdade697412013-02-14 16:31:48 -08001395 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001396
1397 \param hHal - The handle returned by macOpen.
1398
1399 \Param
1400 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1401 currently provides 11d related information like Country code,
1402 Regulatory domain, valid channel list, Tx power per channel, a
1403 list with active/passive scan allowed per valid channel.
1404
1405 \return eHalStatus
1406 ---------------------------------------------------------------------------*/
1407eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1408 tCsrUpdateConfigParam *pUpdateConfigParam)
1409{
1410 eHalStatus status = eHAL_STATUS_FAILURE;
1411 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1412
1413 if (NULL == pUpdateConfigParam ) {
1414 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001415 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001416 return status;
1417 }
1418
1419 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1420
1421 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001422 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001423 status );
1424 }
1425
1426 return status;
1427
1428}
1429
1430/*--------------------------------------------------------------------------
1431
1432 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1433 that the NIC is ready tio run.
1434
1435 The function is called by HDD at the end of initialization stage so PE/HAL can
1436 enable the NIC to running state.
1437
Srinivas Girigowdade697412013-02-14 16:31:48 -08001438 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001439 \param hHal - The handle returned by macOpen.
1440
1441 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1442 successfully.
1443
1444 Other status means SME failed to send the message to PE.
1445 \sa
1446
1447 --------------------------------------------------------------------------*/
1448eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1449{
1450 tSirSmeReadyReq Msg;
1451 eHalStatus status = eHAL_STATUS_FAILURE;
1452 tPmcPowerState powerState;
1453 tPmcSwitchState hwWlanSwitchState;
1454 tPmcSwitchState swWlanSwitchState;
1455 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1456
1457 do
1458 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001459
1460 Msg.messageType = eWNI_SME_SYS_READY_IND;
1461 Msg.length = sizeof( tSirSmeReadyReq );
1462
1463 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1464 {
1465 status = eHAL_STATUS_SUCCESS;
1466 }
1467 else
1468 {
1469 smsLog( pMac, LOGE,
1470 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1471 break;
1472 }
1473
1474 status = pmcQueryPowerState( hHal, &powerState,
1475 &hwWlanSwitchState, &swWlanSwitchState );
1476 if ( ! HAL_STATUS_SUCCESS( status ) )
1477 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001478 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 status );
1480 break;
1481 }
1482
1483 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1484 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1485 {
1486 status = csrReady(pMac);
1487 if ( ! HAL_STATUS_SUCCESS( status ) )
1488 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001489 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001490 break;
1491 }
1492 status = pmcReady(hHal);
1493 if ( ! HAL_STATUS_SUCCESS( status ) )
1494 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001495 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001496 break;
1497 }
1498#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1499 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1500 {
1501 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001502 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001503 break;
1504 }
1505#endif
1506
1507#if defined WLAN_FEATURE_VOWIFI
1508 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1509 {
1510 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001511 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001512 break;
1513 }
1514#endif
1515 }
1516 pMac->sme.state = SME_STATE_READY;
1517 } while( 0 );
1518
1519 return status;
1520}
1521
1522/*--------------------------------------------------------------------------
1523
1524 \brief sme_Start() - Put all SME modules at ready state.
1525
1526 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1527 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001528 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001529 \param hHal - The handle returned by macOpen.
1530
1531 \return eHAL_STATUS_SUCCESS - SME is ready.
1532
1533 Other status means SME is failed to start
1534 \sa
1535
1536 --------------------------------------------------------------------------*/
1537eHalStatus sme_Start(tHalHandle hHal)
1538{
1539 eHalStatus status = eHAL_STATUS_FAILURE;
1540 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1541
1542 do
1543 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001544 status = csrStart(pMac);
1545 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001546 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001547 status );
1548 break;
1549 }
1550
1551 status = pmcStart(hHal);
1552 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001553 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001554 status );
1555 break;
1556 }
1557
Jeff Johnson295189b2012-06-20 16:38:30 -07001558 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1559 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001560 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001561 status );
1562 break;
1563 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001564 pMac->sme.state = SME_STATE_START;
1565 }while (0);
1566
1567 return status;
1568}
1569
1570
1571#ifdef WLAN_FEATURE_PACKET_FILTERING
1572/******************************************************************************
1573*
1574* Name: sme_PCFilterMatchCountResponseHandler
1575*
1576* Description:
1577* Invoke Packet Coalescing Filter Match Count callback routine
1578*
1579* Parameters:
1580* hHal - HAL handle for device
1581* pMsg - Pointer to tRcvFltPktMatchRsp structure
1582*
1583* Returns: eHalStatus
1584*
1585******************************************************************************/
1586eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1587{
1588 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1589 eHalStatus status = eHAL_STATUS_SUCCESS;
1590 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1591
1592 if (NULL == pMsg)
1593 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001594 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001595 status = eHAL_STATUS_FAILURE;
1596 }
1597 else
1598 {
1599 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001600 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001601
1602 /* Call Packet Coalescing Filter Match Count callback routine. */
1603 if (pMac->pmc.FilterMatchCountCB != NULL)
1604 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1605 pRcvFltPktMatchRsp);
1606
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001607 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001608 pRcvFltPktMatchRsp->status);
1609
1610 pMac->pmc.FilterMatchCountCB = NULL;
1611 pMac->pmc.FilterMatchCountCBContext = NULL;
1612 }
1613
1614 return(status);
1615}
1616#endif // WLAN_FEATURE_PACKET_FILTERING
1617
1618
Chet Lanctot186b5732013-03-18 10:26:30 -07001619#ifdef WLAN_FEATURE_11W
1620/*------------------------------------------------------------------
1621 *
1622 * Handle the unprotected management frame indication from LIM and
1623 * forward it to HDD.
1624 *
1625 *------------------------------------------------------------------*/
1626
1627eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1628 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1629{
1630 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1631 eHalStatus status = eHAL_STATUS_SUCCESS;
1632 tCsrRoamInfo pRoamInfo = {0};
1633 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1634
1635 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1636 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1637 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1638
1639 /* forward the mgmt frame to HDD */
1640 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1641
1642 return status;
1643}
1644#endif
1645
1646
Jeff Johnson295189b2012-06-20 16:38:30 -07001647/*--------------------------------------------------------------------------
1648
1649 \brief sme_ProcessMsg() - The main message processor for SME.
1650
1651 The function is called by a message dispatcher when to process a message
1652 targeted for SME.
1653
Srinivas Girigowdade697412013-02-14 16:31:48 -08001654 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001655 \param hHal - The handle returned by macOpen.
1656 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1657
1658 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1659
1660 Other status means SME failed to process the message to HAL.
1661 \sa
1662
1663 --------------------------------------------------------------------------*/
1664eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1665{
1666 eHalStatus status = eHAL_STATUS_FAILURE;
1667 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1668
1669 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001670 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001671 return status;
1672 }
1673
1674 status = sme_AcquireGlobalLock( &pMac->sme );
1675 if ( HAL_STATUS_SUCCESS( status ) )
1676 {
1677 if( SME_IS_START(pMac) )
1678 {
1679 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1680 case eWNI_PMC_ENTER_BMPS_RSP:
1681 case eWNI_PMC_EXIT_BMPS_RSP:
1682 case eWNI_PMC_EXIT_BMPS_IND:
1683 case eWNI_PMC_ENTER_IMPS_RSP:
1684 case eWNI_PMC_EXIT_IMPS_RSP:
1685 case eWNI_PMC_SMPS_STATE_IND:
1686 case eWNI_PMC_ENTER_UAPSD_RSP:
1687 case eWNI_PMC_EXIT_UAPSD_RSP:
1688 case eWNI_PMC_ENTER_WOWL_RSP:
1689 case eWNI_PMC_EXIT_WOWL_RSP:
1690 //PMC
1691 if (pMsg->bodyptr)
1692 {
1693 pmcMessageProcessor(hHal, pMsg->bodyptr);
1694 status = eHAL_STATUS_SUCCESS;
1695 vos_mem_free( pMsg->bodyptr );
1696 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001697 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001698 }
1699 break;
1700
1701 case WNI_CFG_SET_CNF:
1702 case WNI_CFG_DNLD_CNF:
1703 case WNI_CFG_GET_RSP:
1704 case WNI_CFG_ADD_GRP_ADDR_CNF:
1705 case WNI_CFG_DEL_GRP_ADDR_CNF:
1706 //CCM
1707 if (pMsg->bodyptr)
1708 {
1709 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1710 status = eHAL_STATUS_SUCCESS;
1711 vos_mem_free( pMsg->bodyptr );
1712 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001713 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001714 }
1715 break;
1716
1717 case eWNI_SME_ADDTS_RSP:
1718 case eWNI_SME_DELTS_RSP:
1719 case eWNI_SME_DELTS_IND:
1720#ifdef WLAN_FEATURE_VOWIFI_11R
1721 case eWNI_SME_FT_AGGR_QOS_RSP:
1722#endif
1723 //QoS
1724 if (pMsg->bodyptr)
1725 {
1726#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1727 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
1728 vos_mem_free( pMsg->bodyptr );
1729#endif
1730 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001731 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001732 }
1733 break;
1734#if defined WLAN_FEATURE_VOWIFI
1735 case eWNI_SME_NEIGHBOR_REPORT_IND:
1736 case eWNI_SME_BEACON_REPORT_REQ_IND:
1737#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001738 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001739#endif
1740 if ( pMsg->bodyptr )
1741 {
1742 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
1743 vos_mem_free( pMsg->bodyptr );
1744 }
1745 else
1746 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001747 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001748 }
1749 break;
1750#endif
1751
Jeff Johnsone7245742012-09-05 17:12:55 -07001752#ifdef FEATURE_OEM_DATA_SUPPORT
1753 //Handle the eWNI_SME_OEM_DATA_RSP:
1754 case eWNI_SME_OEM_DATA_RSP:
1755 if(pMsg->bodyptr)
1756 {
1757 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
1758 vos_mem_free(pMsg->bodyptr);
1759 }
1760 else
1761 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001762 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07001763 }
1764 smeProcessPendingQueue( pMac );
1765 break;
1766#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001767
1768 case eWNI_SME_ADD_STA_SELF_RSP:
1769 if(pMsg->bodyptr)
1770 {
1771 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
1772 vos_mem_free(pMsg->bodyptr);
1773 }
1774 else
1775 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001776 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001777 }
1778 break;
1779 case eWNI_SME_DEL_STA_SELF_RSP:
1780 if(pMsg->bodyptr)
1781 {
1782 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
1783 vos_mem_free(pMsg->bodyptr);
1784 }
1785 else
1786 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001787 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001788 }
1789 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001790 case eWNI_SME_REMAIN_ON_CHN_RSP:
1791 if(pMsg->bodyptr)
1792 {
1793 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
1794 vos_mem_free(pMsg->bodyptr);
1795 }
1796 else
1797 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001798 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001799 }
1800 break;
1801 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
1802 if(pMsg->bodyptr)
1803 {
1804 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
1805 vos_mem_free(pMsg->bodyptr);
1806 }
1807 else
1808 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001809 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 -07001810 }
1811 break;
1812 case eWNI_SME_MGMT_FRM_IND:
1813 if(pMsg->bodyptr)
1814 {
1815 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
1816 vos_mem_free(pMsg->bodyptr);
1817 }
1818 else
1819 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001820 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001821 }
1822 break;
1823 case eWNI_SME_ACTION_FRAME_SEND_CNF:
1824 if(pMsg->bodyptr)
1825 {
1826 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
1827 vos_mem_free(pMsg->bodyptr);
1828 }
1829 else
1830 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001831 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001832 }
1833 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001834 case eWNI_SME_COEX_IND:
1835 if(pMsg->bodyptr)
1836 {
1837 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
1838 vos_mem_free(pMsg->bodyptr);
1839 }
1840 else
1841 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001842 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001843 }
1844 break;
1845
1846#ifdef FEATURE_WLAN_SCAN_PNO
1847 case eWNI_SME_PREF_NETWORK_FOUND_IND:
1848 if(pMsg->bodyptr)
1849 {
1850 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
1851 vos_mem_free(pMsg->bodyptr);
1852 }
1853 else
1854 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001855 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001856 }
1857 break;
1858#endif // FEATURE_WLAN_SCAN_PNO
1859
1860 case eWNI_SME_TX_PER_HIT_IND:
1861 if (pMac->sme.pTxPerHitCallback)
1862 {
1863 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
1864 }
1865 break;
1866
1867 case eWNI_SME_CHANGE_COUNTRY_CODE:
1868 if(pMsg->bodyptr)
1869 {
1870 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
1871 vos_mem_free(pMsg->bodyptr);
1872 }
1873 else
1874 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001875 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001876 }
1877 break;
1878
1879#ifdef WLAN_FEATURE_PACKET_FILTERING
1880 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
1881 if(pMsg->bodyptr)
1882 {
1883 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
1884 vos_mem_free(pMsg->bodyptr);
1885 }
1886 else
1887 {
1888 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001889 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001890 }
1891 break;
1892#endif // WLAN_FEATURE_PACKET_FILTERING
1893 case eWNI_SME_PRE_SWITCH_CHL_IND:
1894 {
1895 status = sme_HandlePreChannelSwitchInd(pMac);
1896 break;
1897 }
1898
1899 case eWNI_SME_POST_SWITCH_CHL_IND:
1900 {
1901 status = sme_HandlePostChannelSwitchInd(pMac);
1902 break;
1903 }
1904
1905#ifdef WLAN_WAKEUP_EVENTS
1906 case eWNI_SME_WAKE_REASON_IND:
1907 if(pMsg->bodyptr)
1908 {
1909 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
1910 vos_mem_free(pMsg->bodyptr);
1911 }
1912 else
1913 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001914 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001915 }
1916 break;
1917#endif // WLAN_WAKEUP_EVENTS
1918
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001919#ifdef FEATURE_WLAN_TDLS
1920 /*
1921 * command rescived from PE, SME tdls msg processor shall be called
1922 * to process commands recieved from PE
1923 */
1924 case eWNI_SME_TDLS_SEND_MGMT_RSP:
1925 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08001926 case eWNI_SME_TDLS_DEL_STA_RSP:
1927 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08001928 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08001929 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301930 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Gopichand Nakkala78a6c812013-05-13 16:39:49 +05301931#ifdef FEATURE_WLAN_TDLS_OXYGEN_DISAPPEAR_AP
1932 case eWNI_SME_TDLS_AP_DISAPPEAR_IND:
1933#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001934#ifdef FEATURE_WLAN_TDLS_INTERNAL
1935 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
1936 case eWNI_SME_TDLS_DISCOVERY_START_IND:
1937 case eWNI_SME_TDLS_LINK_START_RSP:
1938 case eWNI_SME_TDLS_LINK_START_IND:
1939 case eWNI_SME_TDLS_TEARDOWN_RSP:
1940 case eWNI_SME_TDLS_TEARDOWN_IND:
1941 case eWNI_SME_ADD_TDLS_PEER_IND:
1942 case eWNI_SME_DELETE_TDLS_PEER_IND:
1943#endif
1944 {
1945 if (pMsg->bodyptr)
1946 {
1947 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
1948 vos_mem_free( pMsg->bodyptr );
1949 }
1950 else
1951 {
1952 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001953 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001954 }
1955 break;
1956 }
1957#endif
1958
Chet Lanctot186b5732013-03-18 10:26:30 -07001959#ifdef WLAN_FEATURE_11W
1960 case eWNI_SME_UNPROT_MGMT_FRM_IND:
1961 if (pMsg->bodyptr)
1962 {
1963 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
1964 vos_mem_free(pMsg->bodyptr);
1965 }
1966 else
1967 {
1968 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
1969 }
1970 break;
1971#endif
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07001972#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1973 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
1974 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
1975 break;
1976#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07001977
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301978#ifdef WLAN_FEATURE_GTK_OFFLOAD
1979 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
1980 if (pMsg->bodyptr)
1981 {
1982 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
1983 vos_mem_free(pMsg->bodyptr);
1984 }
1985 else
1986 {
1987 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
1988 }
1989 break ;
1990#endif
Leo Chang9056f462013-08-01 19:21:11 -07001991
1992#ifdef FEATURE_WLAN_LPHB
1993 /* LPHB timeout indication arrived, send IND to client */
1994 case eWNI_SME_LPHB_WAIT_TIMEOUT_IND:
1995 if (pMac->sme.pLphbWaitTimeoutCb)
1996 {
1997 pMac->sme.pLphbWaitTimeoutCb(pMac->pAdapter, pMsg->bodyptr);
1998 }
1999 vos_mem_free(pMsg->bodyptr);
2000
2001 break;
2002#endif /* FEATURE_WLAN_LPHB */
2003
Jeff Johnson295189b2012-06-20 16:38:30 -07002004 default:
2005
2006 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2007 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2008 {
2009 //CSR
2010 if (pMsg->bodyptr)
2011 {
2012 status = csrMsgProcessor(hHal, pMsg->bodyptr);
2013 vos_mem_free( pMsg->bodyptr );
2014 }
2015 else
2016 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002017 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002018 }
2019 }
2020 else
2021 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002022 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002023 pMsg->type);
2024 if (pMsg->bodyptr)
2025 {
2026 vos_mem_free( pMsg->bodyptr );
2027 }
2028 }
2029 }//switch
2030 } //SME_IS_START
2031 else
2032 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002033 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002034 if (pMsg->bodyptr)
2035 {
2036 vos_mem_free( pMsg->bodyptr );
2037 }
2038 }
2039 sme_ReleaseGlobalLock( &pMac->sme );
2040 }
2041 else
2042 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002043 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002044 if (pMsg->bodyptr)
2045 {
2046 vos_mem_free( pMsg->bodyptr );
2047 }
2048 }
2049
2050 return status;
2051}
2052
2053
2054//No need to hold the global lock here because this function can only be called
2055//after sme_Stop.
2056v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2057{
2058 if( pMsg )
2059 {
2060 if (pMsg->bodyptr)
2061 {
2062 vos_mem_free( pMsg->bodyptr );
2063 }
2064 }
2065
2066}
2067
2068
2069/*--------------------------------------------------------------------------
2070
2071 \brief sme_Stop() - Stop all SME modules and put them at idle state
2072
2073 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2074 return, all modules are at idle state ready to start.
2075
Srinivas Girigowdade697412013-02-14 16:31:48 -08002076 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002077 \param hHal - The handle returned by macOpen
2078
2079 \return eHAL_STATUS_SUCCESS - SME is stopped.
2080
2081 Other status means SME is failed to stop but caller should still
2082 consider SME is stopped.
2083 \sa
2084
2085 --------------------------------------------------------------------------*/
2086eHalStatus sme_Stop(tHalHandle hHal, tANI_BOOLEAN pmcFlag)
2087{
2088 eHalStatus status = eHAL_STATUS_FAILURE;
2089 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2090 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2091
Jeff Johnson295189b2012-06-20 16:38:30 -07002092 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2093 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002094 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 status );
2096 fail_status = status;
2097 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002098
2099 p2pStop(hHal);
2100
2101 if(pmcFlag)
2102 {
2103 status = pmcStop(hHal);
2104 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002105 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002106 status );
2107 fail_status = status;
2108 }
2109 }
2110
2111 status = csrStop(pMac);
2112 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002113 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002114 status );
2115 fail_status = status;
2116 }
2117
2118 ccmStop(hHal);
2119
2120 purgeSmeCmdList(pMac);
2121
2122 if (!HAL_STATUS_SUCCESS( fail_status )) {
2123 status = fail_status;
2124 }
2125
2126 pMac->sme.state = SME_STATE_STOP;
2127
2128 return status;
2129}
2130
2131/*--------------------------------------------------------------------------
2132
2133 \brief sme_Close() - Release all SME modules and their resources.
2134
2135 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2136 return, all modules are at closed state.
2137
2138 No SME APIs can be involved after smeClose except smeOpen.
2139 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002140 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002141 \param hHal - The handle returned by macOpen
2142
2143 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2144
2145 Other status means SME is failed to be closed but caller still cannot
2146 call any other SME functions except smeOpen.
2147 \sa
2148
2149 --------------------------------------------------------------------------*/
2150eHalStatus sme_Close(tHalHandle hHal)
2151{
2152 eHalStatus status = eHAL_STATUS_FAILURE;
2153 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2154 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2155
2156 status = csrClose(pMac);
2157 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002158 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002159 status );
2160 fail_status = status;
2161 }
2162
Jeff Johnson295189b2012-06-20 16:38:30 -07002163 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2164 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002165 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 status );
2167 fail_status = status;
2168 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002169
2170#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2171 status = btcClose(hHal);
2172 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002173 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002174 status );
2175 fail_status = status;
2176 }
2177
2178 status = sme_QosClose(pMac);
2179 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002180 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002181 status );
2182 fail_status = status;
2183 }
2184#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002185#ifdef FEATURE_OEM_DATA_SUPPORT
2186 status = oemData_OemDataReqClose(hHal);
2187 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002188 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002189 status );
2190 fail_status = status;
2191 }
2192#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002193
2194 status = ccmClose(hHal);
2195 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002196 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 status );
2198 fail_status = status;
2199 }
2200
2201 status = pmcClose(hHal);
2202 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002203 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002204 status );
2205 fail_status = status;
2206 }
2207#if defined WLAN_FEATURE_VOWIFI
2208 status = rrmClose(hHal);
2209 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002210 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002211 status );
2212 fail_status = status;
2213 }
2214#endif
2215
2216#if defined WLAN_FEATURE_VOWIFI_11R
2217 sme_FTClose(hHal);
2218#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002219 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002220
2221 freeSmeCmdList(pMac);
2222
2223 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2224 {
2225 fail_status = eHAL_STATUS_FAILURE;
2226 }
2227
2228 if (!HAL_STATUS_SUCCESS( fail_status )) {
2229 status = fail_status;
2230 }
2231
2232 pMac->sme.state = SME_STATE_STOP;
2233
2234 return status;
2235}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002236#ifdef FEATURE_WLAN_LFR
2237tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2238{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002239#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002240 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2241 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2242 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2243 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2244 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2245 return eANI_BOOLEAN_FALSE;
2246 default:
2247 return eANI_BOOLEAN_TRUE;
2248 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002249#else
2250 /*
2251 * TODO: always return TRUE for now until
2252 * we figure out why we could be stuck in
2253 * one of the roaming states forever.
2254 */
2255 return eANI_BOOLEAN_TRUE;
2256#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002257}
2258#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002259/* ---------------------------------------------------------------------------
2260 \fn sme_ScanRequest
2261 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002262 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 \param pScanRequestID - pointer to an object to get back the request ID
2264 \param callback - a callback function that scan calls upon finish, will not
2265 be called if csrScanRequest returns error
2266 \param pContext - a pointer passed in for the callback
2267 \return eHalStatus
2268 ---------------------------------------------------------------------------*/
2269eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2270 tANI_U32 *pScanRequestID,
2271 csrScanCompleteCallback callback, void *pContext)
2272{
2273 eHalStatus status = eHAL_STATUS_FAILURE;
2274 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2275
2276 smsLog(pMac, LOG2, FL("enter"));
2277 do
2278 {
2279 if(pMac->scan.fScanEnable)
2280 {
2281 status = sme_AcquireGlobalLock( &pMac->sme );
2282 if ( HAL_STATUS_SUCCESS( status ) )
2283 {
2284 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002285#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002286 if(csrIsScanAllowed(pMac))
2287 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002288#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002289 status = csrScanRequest( hHal, sessionId, pscanReq,
2290 pScanRequestID, callback, pContext );
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002291#ifdef FEATURE_WLAN_LFR
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002292 }
2293 else
2294 {
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002295 smsLog(pMac, LOGE, FL("Scan denied in state %d (sub-state %d)"),
2296 pMac->roam.neighborRoamInfo.neighborRoamState,
2297 pMac->roam.curSubState[sessionId]);
2298 /*HandOff is in progress. So schedule this scan later*/
2299 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002300 }
2301#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002302 }
2303
2304 sme_ReleaseGlobalLock( &pMac->sme );
2305 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002306 else
2307 {
2308 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2309 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002310 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002311 else
2312 {
2313 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2314 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002315 } while( 0 );
2316
2317 return (status);
2318
2319
2320}
2321
2322/* ---------------------------------------------------------------------------
2323 \fn sme_ScanGetResult
2324 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002325 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002326 \param pFilter - If pFilter is NULL, all cached results are returned
2327 \param phResult - an object for the result.
2328 \return eHalStatus
2329 ---------------------------------------------------------------------------*/
2330eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2331 tScanResultHandle *phResult)
2332{
2333 eHalStatus status = eHAL_STATUS_FAILURE;
2334 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2335
2336 smsLog(pMac, LOG2, FL("enter"));
2337 status = sme_AcquireGlobalLock( &pMac->sme );
2338 if ( HAL_STATUS_SUCCESS( status ) )
2339 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002340 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002341 sme_ReleaseGlobalLock( &pMac->sme );
2342 }
2343 smsLog(pMac, LOG2, FL("exit status %d"), status);
2344
2345 return (status);
2346}
2347
2348
2349/* ---------------------------------------------------------------------------
2350 \fn sme_ScanFlushResult
2351 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002352 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 \return eHalStatus
2354 ---------------------------------------------------------------------------*/
2355eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2356{
2357 eHalStatus status = eHAL_STATUS_FAILURE;
2358 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2359
2360 status = sme_AcquireGlobalLock( &pMac->sme );
2361 if ( HAL_STATUS_SUCCESS( status ) )
2362 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002363 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002364 sme_ReleaseGlobalLock( &pMac->sme );
2365 }
2366
2367 return (status);
2368}
2369
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002370eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2371{
2372 eHalStatus status = eHAL_STATUS_FAILURE;
2373 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2374
2375 status = sme_AcquireGlobalLock( &pMac->sme );
2376 if ( HAL_STATUS_SUCCESS( status ) )
2377 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302378 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002379 sme_ReleaseGlobalLock( &pMac->sme );
2380 }
2381
2382 return (status);
2383}
Jeff Johnson295189b2012-06-20 16:38:30 -07002384
2385/* ---------------------------------------------------------------------------
2386 \fn sme_ScanResultGetFirst
2387 \brief a wrapper function to request CSR to returns the first element of
2388 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002389 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002390 \param hScanResult - returned from csrScanGetResult
2391 \return tCsrScanResultInfo * - NULL if no result
2392 ---------------------------------------------------------------------------*/
2393tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2394 tScanResultHandle hScanResult)
2395{
2396 eHalStatus status = eHAL_STATUS_FAILURE;
2397 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2398 tCsrScanResultInfo *pRet = NULL;
2399
2400 status = sme_AcquireGlobalLock( &pMac->sme );
2401 if ( HAL_STATUS_SUCCESS( status ) )
2402 {
2403 pRet = csrScanResultGetFirst( pMac, hScanResult );
2404 sme_ReleaseGlobalLock( &pMac->sme );
2405 }
2406
2407 return (pRet);
2408}
2409
2410
2411/* ---------------------------------------------------------------------------
2412 \fn sme_ScanResultGetNext
2413 \brief a wrapper function to request CSR to returns the next element of
2414 scan result. It can be called without calling csrScanResultGetFirst
2415 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002416 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002417 \param hScanResult - returned from csrScanGetResult
2418 \return Null if no result or reach the end
2419 ---------------------------------------------------------------------------*/
2420tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2421 tScanResultHandle hScanResult)
2422{
2423 eHalStatus status = eHAL_STATUS_FAILURE;
2424 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2425 tCsrScanResultInfo *pRet = NULL;
2426
2427 status = sme_AcquireGlobalLock( &pMac->sme );
2428 if ( HAL_STATUS_SUCCESS( status ) )
2429 {
2430 pRet = csrScanResultGetNext( pMac, hScanResult );
2431 sme_ReleaseGlobalLock( &pMac->sme );
2432 }
2433
2434 return (pRet);
2435}
2436
2437
2438/* ---------------------------------------------------------------------------
2439 \fn sme_ScanSetBGScanparams
2440 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002441 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002442 \param pScanReq - BG scan request structure
2443 \return eHalStatus
2444 ---------------------------------------------------------------------------*/
2445eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2446{
2447 eHalStatus status = eHAL_STATUS_FAILURE;
2448 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2449
2450 if( NULL != pScanReq )
2451 {
2452 status = sme_AcquireGlobalLock( &pMac->sme );
2453 if ( HAL_STATUS_SUCCESS( status ) )
2454 {
2455 status = csrScanSetBGScanparams( hHal, pScanReq );
2456 sme_ReleaseGlobalLock( &pMac->sme );
2457 }
2458 }
2459
2460 return (status);
2461}
2462
2463
2464/* ---------------------------------------------------------------------------
2465 \fn sme_ScanResultPurge
2466 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2467 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002468 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002469 \param hScanResult - returned from csrScanGetResult. hScanResult is
2470 considered gone by
2471 calling this function and even before this function reutrns.
2472 \return eHalStatus
2473 ---------------------------------------------------------------------------*/
2474eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2475{
2476 eHalStatus status = eHAL_STATUS_FAILURE;
2477 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2478
2479 status = sme_AcquireGlobalLock( &pMac->sme );
2480 if ( HAL_STATUS_SUCCESS( status ) )
2481 {
2482 status = csrScanResultPurge( hHal, hScanResult );
2483 sme_ReleaseGlobalLock( &pMac->sme );
2484 }
2485
2486 return (status);
2487}
2488
2489/* ---------------------------------------------------------------------------
2490 \fn sme_ScanGetPMKIDCandidateList
2491 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002492 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002493 \param pPmkidList - caller allocated buffer point to an array of
2494 tPmkidCandidateInfo
2495 \param pNumItems - pointer to a variable that has the number of
2496 tPmkidCandidateInfo allocated when retruning, this is
2497 either the number needed or number of items put into
2498 pPmkidList
2499 \return eHalStatus - when fail, it usually means the buffer allocated is not
2500 big enough and pNumItems
2501 has the number of tPmkidCandidateInfo.
2502 \Note: pNumItems is a number of tPmkidCandidateInfo,
2503 not sizeof(tPmkidCandidateInfo) * something
2504 ---------------------------------------------------------------------------*/
2505eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
2506 tPmkidCandidateInfo *pPmkidList,
2507 tANI_U32 *pNumItems )
2508{
2509 eHalStatus status = eHAL_STATUS_FAILURE;
2510 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2511
2512 status = sme_AcquireGlobalLock( &pMac->sme );
2513 if ( HAL_STATUS_SUCCESS( status ) )
2514 {
2515 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2516 sme_ReleaseGlobalLock( &pMac->sme );
2517 }
2518
2519 return (status);
2520}
2521
2522/*----------------------------------------------------------------------------
2523 \fn sme_RoamRegisterLinkQualityIndCallback
2524
2525 \brief
2526 a wrapper function to allow HDD to register a callback handler with CSR for
2527 link quality indications.
2528
2529 Only one callback may be registered at any time.
2530 In order to deregister the callback, a NULL cback may be provided.
2531
2532 Registration happens in the task context of the caller.
2533
2534 \param callback - Call back being registered
2535 \param pContext - user data
2536
2537 DEPENDENCIES: After CSR open
2538
2539 \return eHalStatus
2540-----------------------------------------------------------------------------*/
2541eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2542 csrRoamLinkQualityIndCallback callback,
2543 void *pContext)
2544{
2545 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2546}
2547
2548/* ---------------------------------------------------------------------------
2549 \fn sme_RoamRegisterCallback
2550 \brief a wrapper function to allow HDD to register a callback with CSR.
2551 Unlike scan, roam has one callback for all the roam requests
2552 \param callback - a callback function that roam calls upon when state changes
2553 \param pContext - a pointer passed in for the callback
2554 \return eHalStatus
2555 ---------------------------------------------------------------------------*/
2556eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2557 csrRoamCompleteCallback callback,
2558 void *pContext)
2559{
2560 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2561}
2562
2563eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2564{
2565 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2566 return pMac->roam.configParam.phyMode;
2567}
2568
2569/* ---------------------------------------------------------------------------
2570 \fn sme_RoamConnect
2571 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002572 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002573 \param sessionId - the sessionId returned by sme_OpenSession.
2574 \param pProfile - description of the network to which to connect
2575 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2576 from csrScanGetResult
2577 \param pRoamId - to get back the request ID
2578 \return eHalStatus
2579 ---------------------------------------------------------------------------*/
2580eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2581 tANI_U32 *pRoamId)
2582{
2583 eHalStatus status = eHAL_STATUS_FAILURE;
2584 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2585
2586 smsLog(pMac, LOG2, FL("enter"));
2587 status = sme_AcquireGlobalLock( &pMac->sme );
2588 if ( HAL_STATUS_SUCCESS( status ) )
2589 {
2590 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2591 {
2592 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2593 }
2594 else
2595 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002596 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002597 status = eHAL_STATUS_INVALID_PARAMETER;
2598 }
2599 sme_ReleaseGlobalLock( &pMac->sme );
2600 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002601 else
2602 {
2603 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2604 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002605
2606 return (status);
2607}
2608
2609/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05302610
2611 \fn sme_SetPhyMode
2612
2613 \brief Changes the PhyMode.
2614
2615 \param hHal - The handle returned by macOpen.
2616
2617 \param phyMode new phyMode which is to set
2618
2619 \return eHalStatus SUCCESS.
2620
2621 -------------------------------------------------------------------------------*/
2622eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
2623{
2624 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2625
2626 if (NULL == pMac)
2627 {
2628 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2629 "%s: invalid context", __func__);
2630 return eHAL_STATUS_FAILURE;
2631 }
2632
2633 pMac->roam.configParam.phyMode = phyMode;
2634 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
2635 pMac->roam.configParam.phyMode,
2636 pMac->roam.configParam.ProprietaryRatesEnabled);
2637
2638 return eHAL_STATUS_SUCCESS;
2639}
2640
2641/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07002642 \fn sme_RoamReassoc
2643 \brief a wrapper function to request CSR to inititiate a re-association
2644 \param pProfile - can be NULL to join the currently connected AP. In that
2645 case modProfileFields should carry the modified field(s) which could trigger
2646 reassoc
2647 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2648 that might need modification dynamically once STA is up & running and this
2649 could trigger a reassoc
2650 \param pRoamId - to get back the request ID
2651 \return eHalStatus
2652 -------------------------------------------------------------------------------*/
2653eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2654 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002655 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002656{
2657 eHalStatus status = eHAL_STATUS_FAILURE;
2658 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2659
2660 smsLog(pMac, LOG2, FL("enter"));
2661 status = sme_AcquireGlobalLock( &pMac->sme );
2662 if ( HAL_STATUS_SUCCESS( status ) )
2663 {
2664 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2665 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07002666 if((NULL == pProfile) && (fForce == 1))
2667 {
2668 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
2669 /* to force the AP initiate fresh 802.1x authentication need to clear
2670 * the PMKID cache for that set the following boolean. this is needed
2671 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
2672 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002673 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
2674 }
2675 else
2676 {
2677 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
2678 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002679 }
2680 else
2681 {
2682 status = eHAL_STATUS_INVALID_PARAMETER;
2683 }
2684 sme_ReleaseGlobalLock( &pMac->sme );
2685 }
2686
2687 return (status);
2688}
2689
2690/* ---------------------------------------------------------------------------
2691 \fn sme_RoamConnectToLastProfile
2692 \brief a wrapper function to request CSR to disconnect and reconnect with
2693 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08002694 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002695 \return eHalStatus. It returns fail if currently connected
2696 ---------------------------------------------------------------------------*/
2697eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
2698{
2699 eHalStatus status = eHAL_STATUS_FAILURE;
2700 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2701
2702 status = sme_AcquireGlobalLock( &pMac->sme );
2703 if ( HAL_STATUS_SUCCESS( status ) )
2704 {
2705 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2706 {
2707 status = csrRoamConnectToLastProfile( pMac, sessionId );
2708 }
2709 else
2710 {
2711 status = eHAL_STATUS_INVALID_PARAMETER;
2712 }
2713 sme_ReleaseGlobalLock( &pMac->sme );
2714 }
2715
2716 return (status);
2717}
2718
2719/* ---------------------------------------------------------------------------
2720 \fn sme_RoamDisconnect
2721 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08002722 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002723 \param reason -- To indicate the reason for disconnecting. Currently, only
2724 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
2725 \return eHalStatus
2726 ---------------------------------------------------------------------------*/
2727eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
2728{
2729 eHalStatus status = eHAL_STATUS_FAILURE;
2730 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2731
2732 smsLog(pMac, LOG2, FL("enter"));
2733 status = sme_AcquireGlobalLock( &pMac->sme );
2734 if ( HAL_STATUS_SUCCESS( status ) )
2735 {
2736 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2737 {
2738 status = csrRoamDisconnect( pMac, sessionId, reason );
2739 }
2740 else
2741 {
2742 status = eHAL_STATUS_INVALID_PARAMETER;
2743 }
2744 sme_ReleaseGlobalLock( &pMac->sme );
2745 }
2746
2747 return (status);
2748}
2749
Jeff Johnson295189b2012-06-20 16:38:30 -07002750/* ---------------------------------------------------------------------------
2751 \fn sme_RoamStopBss
2752 \brief To stop BSS for Soft AP. This is an asynchronous API.
2753 \param hHal - Global structure
2754 \param sessionId - sessionId of SoftAP
2755 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2756 -------------------------------------------------------------------------------*/
2757eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
2758{
2759 eHalStatus status = eHAL_STATUS_FAILURE;
2760 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2761
2762 smsLog(pMac, LOG2, FL("enter"));
2763 status = sme_AcquireGlobalLock( &pMac->sme );
2764 if ( HAL_STATUS_SUCCESS( status ) )
2765 {
2766 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2767 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05302768 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07002769 }
2770 else
2771 {
2772 status = eHAL_STATUS_INVALID_PARAMETER;
2773 }
2774 sme_ReleaseGlobalLock( &pMac->sme );
2775 }
2776
2777 return (status);
2778}
2779
2780/* ---------------------------------------------------------------------------
2781 \fn sme_RoamDisconnectSta
2782 \brief To disassociate a station. This is an asynchronous API.
2783 \param hHal - Global structure
2784 \param sessionId - sessionId of SoftAP
2785 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2786 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2787 -------------------------------------------------------------------------------*/
2788eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
2789 tANI_U8 *pPeerMacAddr)
2790{
2791 eHalStatus status = eHAL_STATUS_FAILURE;
2792 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2793
2794 if ( NULL == pMac )
2795 {
2796 VOS_ASSERT(0);
2797 return status;
2798 }
2799
2800 status = sme_AcquireGlobalLock( &pMac->sme );
2801 if ( HAL_STATUS_SUCCESS( status ) )
2802 {
2803 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2804 {
2805 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302806 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002807 }
2808 else
2809 {
2810 status = eHAL_STATUS_INVALID_PARAMETER;
2811 }
2812 sme_ReleaseGlobalLock( &pMac->sme );
2813 }
2814
2815 return (status);
2816}
2817
2818/* ---------------------------------------------------------------------------
2819 \fn sme_RoamDeauthSta
2820 \brief To disassociate a station. This is an asynchronous API.
2821 \param hHal - Global structure
2822 \param sessionId - sessionId of SoftAP
2823 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2824 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2825 -------------------------------------------------------------------------------*/
2826eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
2827 tANI_U8 *pPeerMacAddr)
2828{
2829 eHalStatus status = eHAL_STATUS_FAILURE;
2830 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2831
2832 if ( NULL == pMac )
2833 {
2834 VOS_ASSERT(0);
2835 return status;
2836 }
2837
2838 status = sme_AcquireGlobalLock( &pMac->sme );
2839 if ( HAL_STATUS_SUCCESS( status ) )
2840 {
2841 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2842 {
2843 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05302844 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002845 }
2846 else
2847 {
2848 status = eHAL_STATUS_INVALID_PARAMETER;
2849 }
2850 sme_ReleaseGlobalLock( &pMac->sme );
2851 }
2852
2853 return (status);
2854}
2855
2856/* ---------------------------------------------------------------------------
2857 \fn sme_RoamTKIPCounterMeasures
2858 \brief To start or stop TKIP counter measures. This is an asynchronous API.
2859 \param sessionId - sessionId of SoftAP
2860 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
2861 \return eHalStatus
2862 -------------------------------------------------------------------------------*/
2863eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
2864 tANI_BOOLEAN bEnable)
2865{
2866 eHalStatus status = eHAL_STATUS_FAILURE;
2867 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2868
2869 if ( NULL == pMac )
2870 {
2871 VOS_ASSERT(0);
2872 return status;
2873 }
2874
2875 status = sme_AcquireGlobalLock( &pMac->sme );
2876 if ( HAL_STATUS_SUCCESS( status ) )
2877 {
2878 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2879 {
2880 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
2881 }
2882 else
2883 {
2884 status = eHAL_STATUS_INVALID_PARAMETER;
2885 }
2886 sme_ReleaseGlobalLock( &pMac->sme );
2887 }
2888
2889 return (status);
2890}
2891
2892/* ---------------------------------------------------------------------------
2893 \fn sme_RoamGetAssociatedStas
2894 \brief To probe the list of associated stations from various modules of CORE stack.
2895 \This is an asynchronous API.
2896 \param sessionId - sessionId of SoftAP
2897 \param modId - Module from whom list of associtated stations is to be probed.
2898 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
2899 \param pUsrContext - Opaque HDD context
2900 \param pfnSapEventCallback - Sap event callback in HDD
2901 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
2902 \return eHalStatus
2903 -------------------------------------------------------------------------------*/
2904eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
2905 VOS_MODULE_ID modId, void *pUsrContext,
2906 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
2907{
2908 eHalStatus status = eHAL_STATUS_FAILURE;
2909 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2910
2911 if ( NULL == pMac )
2912 {
2913 VOS_ASSERT(0);
2914 return status;
2915 }
2916
2917 status = sme_AcquireGlobalLock( &pMac->sme );
2918 if ( HAL_STATUS_SUCCESS( status ) )
2919 {
2920 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2921 {
2922 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
2923 }
2924 else
2925 {
2926 status = eHAL_STATUS_INVALID_PARAMETER;
2927 }
2928 sme_ReleaseGlobalLock( &pMac->sme );
2929 }
2930
2931 return (status);
2932}
2933
2934/* ---------------------------------------------------------------------------
2935 \fn sme_RoamGetWpsSessionOverlap
2936 \brief To get the WPS PBC session overlap information.
2937 \This is an asynchronous API.
2938 \param sessionId - sessionId of SoftAP
2939 \param pUsrContext - Opaque HDD context
2940 \param pfnSapEventCallback - Sap event callback in HDD
2941 \pRemoveMac - pointer to Mac address which needs to be removed from session
2942 \return eHalStatus
2943 -------------------------------------------------------------------------------*/
2944eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
2945 void *pUsrContext, void
2946 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
2947{
2948 eHalStatus status = eHAL_STATUS_FAILURE;
2949 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2950
2951 if ( NULL == pMac )
2952 {
2953 VOS_ASSERT(0);
2954 return status;
2955 }
2956
2957 status = sme_AcquireGlobalLock( &pMac->sme );
2958 if ( HAL_STATUS_SUCCESS( status ) )
2959 {
2960 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2961 {
2962 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
2963 }
2964 else
2965 {
2966 status = eHAL_STATUS_INVALID_PARAMETER;
2967 }
2968 sme_ReleaseGlobalLock( &pMac->sme );
2969 }
2970
2971 return (status);
2972}
2973
Jeff Johnson295189b2012-06-20 16:38:30 -07002974
2975/* ---------------------------------------------------------------------------
2976 \fn sme_RoamGetConnectState
2977 \brief a wrapper function to request CSR to return the current connect state
2978 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08002979 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002980 \return eHalStatus
2981 ---------------------------------------------------------------------------*/
2982eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
2983{
2984 eHalStatus status = eHAL_STATUS_FAILURE;
2985 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2986
2987 status = sme_AcquireGlobalLock( &pMac->sme );
2988 if ( HAL_STATUS_SUCCESS( status ) )
2989 {
2990 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2991 {
2992 status = csrRoamGetConnectState( pMac, sessionId, pState );
2993 }
2994 else
2995 {
2996 status = eHAL_STATUS_INVALID_PARAMETER;
2997 }
2998 sme_ReleaseGlobalLock( &pMac->sme );
2999 }
3000
3001 return (status);
3002}
3003
3004/* ---------------------------------------------------------------------------
3005 \fn sme_RoamGetConnectProfile
3006 \brief a wrapper function to request CSR to return the current connect
3007 profile. Caller must call csrRoamFreeConnectProfile after it is done
3008 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003009 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003010 \param pProfile - pointer to a caller allocated structure
3011 tCsrRoamConnectedProfile
3012 \return eHalStatus. Failure if not connected
3013 ---------------------------------------------------------------------------*/
3014eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3015 tCsrRoamConnectedProfile *pProfile)
3016{
3017 eHalStatus status = eHAL_STATUS_FAILURE;
3018 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3019
3020 status = sme_AcquireGlobalLock( &pMac->sme );
3021 if ( HAL_STATUS_SUCCESS( status ) )
3022 {
3023 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3024 {
3025 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3026 }
3027 else
3028 {
3029 status = eHAL_STATUS_INVALID_PARAMETER;
3030 }
3031 sme_ReleaseGlobalLock( &pMac->sme );
3032 }
3033
3034 return (status);
3035}
3036
3037/* ---------------------------------------------------------------------------
3038 \fn sme_RoamFreeConnectProfile
3039 \brief a wrapper function to request CSR to free and reinitialize the
3040 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003041 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003042 \param pProfile - pointer to a caller allocated structure
3043 tCsrRoamConnectedProfile
3044 \return eHalStatus.
3045 ---------------------------------------------------------------------------*/
3046eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3047 tCsrRoamConnectedProfile *pProfile)
3048{
3049 eHalStatus status = eHAL_STATUS_FAILURE;
3050 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3051
3052 status = sme_AcquireGlobalLock( &pMac->sme );
3053 if ( HAL_STATUS_SUCCESS( status ) )
3054 {
3055 status = csrRoamFreeConnectProfile( pMac, pProfile );
3056 sme_ReleaseGlobalLock( &pMac->sme );
3057 }
3058
3059 return (status);
3060}
3061
3062/* ---------------------------------------------------------------------------
3063 \fn sme_RoamSetPMKIDCache
3064 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003065 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003066 \param pPMKIDCache - caller allocated buffer point to an array of
3067 tPmkidCacheInfo
3068 \param numItems - a variable that has the number of tPmkidCacheInfo
3069 allocated when retruning, this is either the number needed
3070 or number of items put into pPMKIDCache
3071 \return eHalStatus - when fail, it usually means the buffer allocated is not
3072 big enough and pNumItems has the number of
3073 tPmkidCacheInfo.
3074 \Note: pNumItems is a number of tPmkidCacheInfo,
3075 not sizeof(tPmkidCacheInfo) * something
3076 ---------------------------------------------------------------------------*/
3077eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
3078 tANI_U32 numItems )
3079{
3080 eHalStatus status = eHAL_STATUS_FAILURE;
3081 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3082
3083 status = sme_AcquireGlobalLock( &pMac->sme );
3084 if ( HAL_STATUS_SUCCESS( status ) )
3085 {
3086 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3087 {
3088 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
3089 }
3090 else
3091 {
3092 status = eHAL_STATUS_INVALID_PARAMETER;
3093 }
3094 sme_ReleaseGlobalLock( &pMac->sme );
3095 }
3096
3097 return (status);
3098}
3099
3100/* ---------------------------------------------------------------------------
3101 \fn sme_RoamGetSecurityReqIE
3102 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3103 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003104 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003105 \param pLen - caller allocated memory that has the length of pBuf as input.
3106 Upon returned, *pLen has the needed or IE length in pBuf.
3107 \param pBuf - Caller allocated memory that contain the IE field, if any,
3108 upon return
3109 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3110 \return eHalStatus - when fail, it usually means the buffer allocated is not
3111 big enough
3112 ---------------------------------------------------------------------------*/
3113eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3114 tANI_U8 *pBuf, eCsrSecurityType secType)
3115{
3116 eHalStatus status = eHAL_STATUS_FAILURE;
3117 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3118
3119 status = sme_AcquireGlobalLock( &pMac->sme );
3120 if ( HAL_STATUS_SUCCESS( status ) )
3121 {
3122 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3123 {
3124 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3125 }
3126 else
3127 {
3128 status = eHAL_STATUS_INVALID_PARAMETER;
3129 }
3130 sme_ReleaseGlobalLock( &pMac->sme );
3131 }
3132
3133 return (status);
3134}
3135
3136/* ---------------------------------------------------------------------------
3137 \fn sme_RoamGetSecurityRspIE
3138 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3139 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003140 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003141 \param pLen - caller allocated memory that has the length of pBuf as input.
3142 Upon returned, *pLen has the needed or IE length in pBuf.
3143 \param pBuf - Caller allocated memory that contain the IE field, if any,
3144 upon return
3145 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3146 \return eHalStatus - when fail, it usually means the buffer allocated is not
3147 big enough
3148 ---------------------------------------------------------------------------*/
3149eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3150 tANI_U8 *pBuf, eCsrSecurityType secType)
3151{
3152 eHalStatus status = eHAL_STATUS_FAILURE;
3153 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3154
3155 status = sme_AcquireGlobalLock( &pMac->sme );
3156 if ( HAL_STATUS_SUCCESS( status ) )
3157 {
3158 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3159 {
3160 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3161 }
3162 else
3163 {
3164 status = eHAL_STATUS_INVALID_PARAMETER;
3165 }
3166 sme_ReleaseGlobalLock( &pMac->sme );
3167 }
3168
3169 return (status);
3170
3171}
3172
3173
3174/* ---------------------------------------------------------------------------
3175 \fn sme_RoamGetNumPMKIDCache
3176 \brief a wrapper function to request CSR to return number of PMKID cache
3177 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003178 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003179 \return tANI_U32 - the number of PMKID cache entries
3180 ---------------------------------------------------------------------------*/
3181tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3182{
3183 eHalStatus status = eHAL_STATUS_FAILURE;
3184 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3185 tANI_U32 numPmkidCache = 0;
3186
3187 status = sme_AcquireGlobalLock( &pMac->sme );
3188 if ( HAL_STATUS_SUCCESS( status ) )
3189 {
3190 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3191 {
3192 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3193 status = eHAL_STATUS_SUCCESS;
3194 }
3195 else
3196 {
3197 status = eHAL_STATUS_INVALID_PARAMETER;
3198 }
3199 sme_ReleaseGlobalLock( &pMac->sme );
3200 }
3201
3202 return (numPmkidCache);
3203}
3204
3205/* ---------------------------------------------------------------------------
3206 \fn sme_RoamGetPMKIDCache
3207 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003208 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003209 \param pNum - caller allocated memory that has the space of the number of
3210 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3211 needed or actually number in tPmkidCacheInfo.
3212 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3213 any, upon return
3214 \return eHalStatus - when fail, it usually means the buffer allocated is not
3215 big enough
3216 ---------------------------------------------------------------------------*/
3217eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3218 tPmkidCacheInfo *pPmkidCache)
3219{
3220 eHalStatus status = eHAL_STATUS_FAILURE;
3221 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3222
3223 status = sme_AcquireGlobalLock( &pMac->sme );
3224 if ( HAL_STATUS_SUCCESS( status ) )
3225 {
3226 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3227 {
3228 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3229 }
3230 else
3231 {
3232 status = eHAL_STATUS_INVALID_PARAMETER;
3233 }
3234 sme_ReleaseGlobalLock( &pMac->sme );
3235 }
3236
3237 return (status);
3238}
3239
3240
3241/* ---------------------------------------------------------------------------
3242 \fn sme_GetConfigParam
3243 \brief a wrapper function that HDD calls to get the global settings
3244 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003245 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003246 \param pParam - caller allocated memory
3247 \return eHalStatus
3248 ---------------------------------------------------------------------------*/
3249eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3250{
3251 eHalStatus status = eHAL_STATUS_FAILURE;
3252 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3253
3254 status = sme_AcquireGlobalLock( &pMac->sme );
3255 if ( HAL_STATUS_SUCCESS( status ) )
3256 {
3257 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3258 if (status != eHAL_STATUS_SUCCESS)
3259 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003260 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003261 sme_ReleaseGlobalLock( &pMac->sme );
3262 return status;
3263 }
3264#if defined WLAN_FEATURE_P2P_INTERNAL
3265 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3266 if (status != eHAL_STATUS_SUCCESS)
3267 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003268 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003269 sme_ReleaseGlobalLock( &pMac->sme );
3270 return status;
3271 }
3272#endif
3273 sme_ReleaseGlobalLock( &pMac->sme );
3274 }
3275
3276 return (status);
3277}
3278
3279/* ---------------------------------------------------------------------------
3280 \fn sme_CfgSetInt
3281 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003282 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003283 \param cfgId - Configuration Parameter ID (type) for STA.
3284 \param ccmValue - The information related to Configuration Parameter ID
3285 which needs to be saved in CFG
3286 \param callback - To be registered by CSR with CCM. Once the CFG done with
3287 saving the information in the database, it notifies CCM &
3288 then the callback will be invoked to notify.
3289 \param toBeSaved - To save the request for future reference
3290 \return eHalStatus
3291 ---------------------------------------------------------------------------*/
3292eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3293 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3294{
3295 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3296}
3297
3298/* ---------------------------------------------------------------------------
3299 \fn sme_CfgSetStr
3300 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003301 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003302 \param cfgId - Configuration Parameter ID (type) for STA.
3303 \param pStr - Pointer to the byte array which carries the information needs
3304 to be saved in CFG
3305 \param length - Length of the data to be saved
3306 \param callback - To be registered by CSR with CCM. Once the CFG done with
3307 saving the information in the database, it notifies CCM &
3308 then the callback will be invoked to notify.
3309 \param toBeSaved - To save the request for future reference
3310 \return eHalStatus
3311 ---------------------------------------------------------------------------*/
3312eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3313 tANI_U32 length, tCcmCfgSetCallback callback,
3314 eAniBoolean toBeSaved)
3315{
3316 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3317}
3318
3319/* ---------------------------------------------------------------------------
3320 \fn sme_GetModifyProfileFields
3321 \brief HDD or SME - QOS calls this function to get the current values of
3322 connected profile fields, changing which can cause reassoc.
3323 This function must be called after CFG is downloaded and STA is in connected
3324 state. Also, make sure to call this function to get the current profile
3325 fields before calling the reassoc. So that pModifyProfileFields will have
3326 all the latest values plus the one(s) has been updated as part of reassoc
3327 request.
3328 \param pModifyProfileFields - pointer to the connected profile fields
3329 changing which can cause reassoc
3330
3331 \return eHalStatus
3332 -------------------------------------------------------------------------------*/
3333eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3334 tCsrRoamModifyProfileFields * pModifyProfileFields)
3335{
3336 eHalStatus status = eHAL_STATUS_FAILURE;
3337 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3338
3339 status = sme_AcquireGlobalLock( &pMac->sme );
3340 if ( HAL_STATUS_SUCCESS( status ) )
3341 {
3342 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3343 {
3344 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3345 }
3346 else
3347 {
3348 status = eHAL_STATUS_INVALID_PARAMETER;
3349 }
3350 sme_ReleaseGlobalLock( &pMac->sme );
3351 }
3352
3353 return (status);
3354}
3355
3356/*--------------------------------------------------------------------------
3357 \fn sme_SetConfigPowerSave
3358 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3359 For BMPS related configuration, this function also updates the CFG
3360 and sends a message to FW to pick up the new values. Note: Calling
3361 this function only updates the configuration and does not enable
3362 the specified power save mode.
3363 \param hHal - The handle returned by macOpen.
3364 \param psMode - Power Saving mode being modified
3365 \param pConfigParams - a pointer to a caller allocated object of type
3366 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3367 \return eHalStatus
3368 --------------------------------------------------------------------------*/
3369eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3370 void *pConfigParams)
3371{
3372 eHalStatus status = eHAL_STATUS_FAILURE;
3373 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3374
3375 if (NULL == pConfigParams ) {
3376 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3377 "nothing to update");
3378 return eHAL_STATUS_FAILURE;
3379 }
3380
3381 status = sme_AcquireGlobalLock( &pMac->sme );
3382 if ( HAL_STATUS_SUCCESS( status ) )
3383 {
3384 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3385 sme_ReleaseGlobalLock( &pMac->sme );
3386 }
3387
3388 return (status);
3389}
3390
3391/*--------------------------------------------------------------------------
3392 \fn sme_GetConfigPowerSave
3393 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3394 \param hHal - The handle returned by macOpen.
3395 \param psMode - Power Saving mode
3396 \param pConfigParams - a pointer to a caller allocated object of type
3397 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3398 \return eHalStatus
3399 --------------------------------------------------------------------------*/
3400eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3401 void *pConfigParams)
3402{
3403 eHalStatus status = eHAL_STATUS_FAILURE;
3404 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3405
3406 if (NULL == pConfigParams ) {
3407 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3408 "nothing to update");
3409 return eHAL_STATUS_FAILURE;
3410 }
3411
3412 status = sme_AcquireGlobalLock( &pMac->sme );
3413 if ( HAL_STATUS_SUCCESS( status ) )
3414 {
3415 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3416 sme_ReleaseGlobalLock( &pMac->sme );
3417 }
3418
3419 return (status);
3420}
3421
3422/* ---------------------------------------------------------------------------
3423 \fn sme_SignalPowerEvent
3424 \brief Signals to PMC that a power event has occurred. Used for putting
3425 the chip into deep sleep mode.
3426 \param hHal - The handle returned by macOpen.
3427 \param event - the event that has occurred
3428 \return eHalStatus
3429 ---------------------------------------------------------------------------*/
3430eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3431{
3432 eHalStatus status = eHAL_STATUS_FAILURE;
3433 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3434
3435 status = sme_AcquireGlobalLock( &pMac->sme );
3436 if ( HAL_STATUS_SUCCESS( status ) )
3437 {
3438 status = pmcSignalPowerEvent(hHal, event);
3439 sme_ReleaseGlobalLock( &pMac->sme );
3440 }
3441
3442 return (status);
3443}
3444
3445/* ---------------------------------------------------------------------------
3446 \fn sme_EnablePowerSave
3447 \brief Enables one of the power saving modes.
3448 \param hHal - The handle returned by macOpen.
3449 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3450 while the chip is operating in Full Power, PMC will start
3451 a timer that will try to put the chip in BMPS mode after
3452 expiry.
3453 \return eHalStatus
3454 ---------------------------------------------------------------------------*/
3455eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3456{
3457 eHalStatus status = eHAL_STATUS_FAILURE;
3458 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3459
3460 status = sme_AcquireGlobalLock( &pMac->sme );
3461 if ( HAL_STATUS_SUCCESS( status ) )
3462 {
3463 status = pmcEnablePowerSave(hHal, psMode);
3464 sme_ReleaseGlobalLock( &pMac->sme );
3465 }
3466
3467 return (status);
3468}
3469
3470/* ---------------------------------------------------------------------------
3471 \fn sme_DisablePowerSave
3472 \brief Disables one of the power saving modes.
3473 \param hHal - The handle returned by macOpen.
3474 \param psMode - The power saving mode to disable. Disabling does not imply
3475 that device will be brought out of the current PS mode. This
3476 is purely a configuration API.
3477 \return eHalStatus
3478 ---------------------------------------------------------------------------*/
3479eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3480{
3481 eHalStatus status = eHAL_STATUS_FAILURE;
3482 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3483
3484 status = sme_AcquireGlobalLock( &pMac->sme );
3485 if ( HAL_STATUS_SUCCESS( status ) )
3486 {
3487 status = pmcDisablePowerSave(hHal, psMode);
3488 sme_ReleaseGlobalLock( &pMac->sme );
3489 }
3490
3491 return (status);
3492 }
3493
3494/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303495+ \fn sme_SetHostPowerSave
3496+ \brief Enables BMPS logic to be controlled by User level apps
3497+ \param hHal - The handle returned by macOpen.
3498+ \param psMode - The power saving mode to disable. Disabling does not imply
3499+ that device will be brought out of the current PS mode. This
3500+ is purely a configuration API.
3501+ \return eHalStatus
3502+ ---------------------------------------------------------------------------*/
3503eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3504{
3505 eHalStatus status = eHAL_STATUS_FAILURE;
3506 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3507
3508 pMac->pmc.isHostPsEn = psMode;
3509
3510 return (status);
3511}
3512
3513/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003514 \fn sme_StartAutoBmpsTimer
3515 \brief Starts a timer that periodically polls all the registered
3516 module for entry into Bmps mode. This timer is started only if BMPS is
3517 enabled and whenever the device is in full power.
3518 \param hHal - The handle returned by macOpen.
3519 \return eHalStatus
3520 ---------------------------------------------------------------------------*/
3521eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3522{
3523 eHalStatus status = eHAL_STATUS_FAILURE;
3524 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3525
3526 status = sme_AcquireGlobalLock( &pMac->sme );
3527 if ( HAL_STATUS_SUCCESS( status ) )
3528 {
3529 status = pmcStartAutoBmpsTimer(hHal);
3530 sme_ReleaseGlobalLock( &pMac->sme );
3531 }
3532
3533 return (status);
3534}
3535/* ---------------------------------------------------------------------------
3536 \fn sme_StopAutoBmpsTimer
3537 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3538 Stopping the timer does not cause a device state change. Only the timer
3539 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3540 \param hHal - The handle returned by macOpen.
3541 \return eHalStatus
3542 ---------------------------------------------------------------------------*/
3543eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3544{
3545 eHalStatus status = eHAL_STATUS_FAILURE;
3546 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3547
3548 status = sme_AcquireGlobalLock( &pMac->sme );
3549 if ( HAL_STATUS_SUCCESS( status ) )
3550 {
3551 status = pmcStopAutoBmpsTimer(hHal);
3552 sme_ReleaseGlobalLock( &pMac->sme );
3553 }
3554
3555 return (status);
3556}
3557/* ---------------------------------------------------------------------------
3558 \fn sme_QueryPowerState
3559 \brief Returns the current power state of the device.
3560 \param hHal - The handle returned by macOpen.
3561 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3562 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3563 \return eHalStatus
3564 ---------------------------------------------------------------------------*/
3565eHalStatus sme_QueryPowerState (
3566 tHalHandle hHal,
3567 tPmcPowerState *pPowerState,
3568 tPmcSwitchState *pSwWlanSwitchState)
3569{
3570 eHalStatus status = eHAL_STATUS_FAILURE;
3571 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3572
3573 status = sme_AcquireGlobalLock( &pMac->sme );
3574 if ( HAL_STATUS_SUCCESS( status ) )
3575 {
3576 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3577 sme_ReleaseGlobalLock( &pMac->sme );
3578 }
3579
3580 return (status);
3581}
3582
3583/* ---------------------------------------------------------------------------
3584 \fn sme_IsPowerSaveEnabled
3585 \brief Checks if the device is able to enter a particular power save mode
3586 This does not imply that the device is in a particular PS mode
3587 \param hHal - The handle returned by macOpen.
3588 \param psMode - the power saving mode
3589 \return eHalStatus
3590 ---------------------------------------------------------------------------*/
3591tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
3592{
3593 eHalStatus status = eHAL_STATUS_FAILURE;
3594 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3595 tANI_BOOLEAN result = false;
3596
3597 status = sme_AcquireGlobalLock( &pMac->sme );
3598 if ( HAL_STATUS_SUCCESS( status ) )
3599 {
3600 result = pmcIsPowerSaveEnabled(hHal, psMode);
3601 sme_ReleaseGlobalLock( &pMac->sme );
3602 return result;
3603 }
3604
3605 return false;
3606}
3607
3608/* ---------------------------------------------------------------------------
3609 \fn sme_RequestFullPower
3610 \brief Request that the device be brought to full power state. When the
3611 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
3612 is enabled. On timer expiry PMC will attempt to put the device in
3613 BMPS mode if following holds true:
3614 - BMPS mode is enabled
3615 - Polling of all modules through the Power Save Check routine passes
3616 - STA is associated to an access point
3617 \param hHal - The handle returned by macOpen.
3618 \param - callbackRoutine Callback routine invoked in case of success/failure
3619 \return eHalStatus - status
3620 eHAL_STATUS_SUCCESS - device brought to full power state
3621 eHAL_STATUS_FAILURE - device cannot be brought to full power state
3622 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
3623 ---------------------------------------------------------------------------*/
3624eHalStatus sme_RequestFullPower (
3625 tHalHandle hHal,
3626 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3627 void *callbackContext,
3628 tRequestFullPowerReason fullPowerReason)
3629{
3630 eHalStatus status = eHAL_STATUS_FAILURE;
3631 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3632
3633 status = sme_AcquireGlobalLock( &pMac->sme );
3634 if ( HAL_STATUS_SUCCESS( status ) )
3635 {
3636 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
3637 sme_ReleaseGlobalLock( &pMac->sme );
3638 }
3639
3640 return (status);
3641}
3642
3643/* ---------------------------------------------------------------------------
3644 \fn sme_RequestBmps
3645 \brief Request that the device be put in BMPS state. Request will be
3646 accepted only if BMPS mode is enabled and power save check routine
3647 passes.
3648 \param hHal - The handle returned by macOpen.
3649 \param - callbackRoutine Callback routine invoked in case of success/failure
3650 \return eHalStatus
3651 eHAL_STATUS_SUCCESS - device is in BMPS state
3652 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
3653 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
3654 ---------------------------------------------------------------------------*/
3655eHalStatus sme_RequestBmps (
3656 tHalHandle hHal,
3657 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3658 void *callbackContext)
3659{
3660 eHalStatus status = eHAL_STATUS_FAILURE;
3661 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3662
3663 status = sme_AcquireGlobalLock( &pMac->sme );
3664 if ( HAL_STATUS_SUCCESS( status ) )
3665 {
3666 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
3667 sme_ReleaseGlobalLock( &pMac->sme );
3668 }
3669
3670 return (status);
3671}
3672
3673
3674/* ---------------------------------------------------------------------------
3675 \fn sme_SetDHCPTillPowerActiveFlag
3676 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
3677 entry by PMC
3678 \param hHal - The handle returned by macOpen.
3679 ---------------------------------------------------------------------------*/
3680void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
3681{
3682 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3683
3684 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
3685 pMac->pmc.remainInPowerActiveTillDHCP = flag;
3686}
3687
3688
3689/* ---------------------------------------------------------------------------
3690 \fn sme_StartUapsd
3691 \brief Request that the device be put in UAPSD state. If the device is in
3692 Full Power it will be put in BMPS mode first and then into UAPSD
3693 mode.
3694 \param hHal - The handle returned by macOpen.
3695 \param - callbackRoutine Callback routine invoked in case of success/failure
3696 eHAL_STATUS_SUCCESS - device is in UAPSD state
3697 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
3698 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
3699 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
3700 \return eHalStatus
3701 ---------------------------------------------------------------------------*/
3702eHalStatus sme_StartUapsd (
3703 tHalHandle hHal,
3704 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3705 void *callbackContext)
3706{
3707 eHalStatus status = eHAL_STATUS_FAILURE;
3708 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3709
3710 status = sme_AcquireGlobalLock( &pMac->sme );
3711 if ( HAL_STATUS_SUCCESS( status ) )
3712 {
3713 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
3714 sme_ReleaseGlobalLock( &pMac->sme );
3715 }
3716
3717 return (status);
3718 }
3719
3720/* ---------------------------------------------------------------------------
3721 \fn sme_StopUapsd
3722 \brief Request that the device be put out of UAPSD state. Device will be
3723 put in in BMPS state after stop UAPSD completes.
3724 \param hHal - The handle returned by macOpen.
3725 \return eHalStatus
3726 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
3727 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
3728 ---------------------------------------------------------------------------*/
3729eHalStatus sme_StopUapsd (tHalHandle hHal)
3730{
3731 eHalStatus status = eHAL_STATUS_FAILURE;
3732 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3733
3734 status = sme_AcquireGlobalLock( &pMac->sme );
3735 if ( HAL_STATUS_SUCCESS( status ) )
3736 {
3737 status = pmcStopUapsd(hHal);
3738 sme_ReleaseGlobalLock( &pMac->sme );
3739 }
3740
3741 return (status);
3742}
3743
3744/* ---------------------------------------------------------------------------
3745 \fn sme_RequestStandby
3746 \brief Request that the device be put in standby. It is HDD's responsibility
3747 to bring the chip to full power and do a disassoc before calling
3748 this API.
3749 \param hHal - The handle returned by macOpen.
3750 \param - callbackRoutine Callback routine invoked in case of success/failure
3751 \return eHalStatus
3752 eHAL_STATUS_SUCCESS - device is in Standby mode
3753 eHAL_STATUS_FAILURE - device cannot be put in standby mode
3754 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
3755 ---------------------------------------------------------------------------*/
3756eHalStatus sme_RequestStandby (
3757 tHalHandle hHal,
3758 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3759 void *callbackContext)
3760{
3761 eHalStatus status = eHAL_STATUS_FAILURE;
3762 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3763
3764 smsLog( pMac, LOG1, FL("") );
3765 status = sme_AcquireGlobalLock( &pMac->sme );
3766 if ( HAL_STATUS_SUCCESS( status ) )
3767 {
3768 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
3769 sme_ReleaseGlobalLock( &pMac->sme );
3770 }
3771
3772 return (status);
3773}
3774
3775/* ---------------------------------------------------------------------------
3776 \fn sme_RegisterPowerSaveCheck
3777 \brief Register a power save check routine that is called whenever
3778 the device is about to enter one of the power save modes.
3779 \param hHal - The handle returned by macOpen.
3780 \param checkRoutine - Power save check routine to be registered
3781 \return eHalStatus
3782 eHAL_STATUS_SUCCESS - successfully registered
3783 eHAL_STATUS_FAILURE - not successfully registered
3784 ---------------------------------------------------------------------------*/
3785eHalStatus sme_RegisterPowerSaveCheck (
3786 tHalHandle hHal,
3787 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
3788{
3789 eHalStatus status = eHAL_STATUS_FAILURE;
3790 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3791
3792 status = sme_AcquireGlobalLock( &pMac->sme );
3793 if ( HAL_STATUS_SUCCESS( status ) )
3794 {
3795 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
3796 sme_ReleaseGlobalLock( &pMac->sme );
3797 }
3798
3799 return (status);
3800}
3801
3802/* ---------------------------------------------------------------------------
3803 \fn sme_DeregisterPowerSaveCheck
3804 \brief Deregister a power save check routine
3805 \param hHal - The handle returned by macOpen.
3806 \param checkRoutine - Power save check routine to be deregistered
3807 \return eHalStatus
3808 eHAL_STATUS_SUCCESS - successfully deregistered
3809 eHAL_STATUS_FAILURE - not successfully deregistered
3810 ---------------------------------------------------------------------------*/
3811eHalStatus sme_DeregisterPowerSaveCheck (
3812 tHalHandle hHal,
3813 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
3814{
3815 eHalStatus status = eHAL_STATUS_FAILURE;
3816 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3817
3818 status = sme_AcquireGlobalLock( &pMac->sme );
3819 if ( HAL_STATUS_SUCCESS( status ) )
3820 {
3821 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
3822 sme_ReleaseGlobalLock( &pMac->sme );
3823 }
3824
3825 return (status);
3826}
3827
3828/* ---------------------------------------------------------------------------
3829 \fn sme_RegisterDeviceStateUpdateInd
3830 \brief Register a callback routine that is called whenever
3831 the device enters a new device state (Full Power, BMPS, UAPSD)
3832 \param hHal - The handle returned by macOpen.
3833 \param callbackRoutine - Callback routine to be registered
3834 \param callbackContext - Cookie to be passed back during callback
3835 \return eHalStatus
3836 eHAL_STATUS_SUCCESS - successfully registered
3837 eHAL_STATUS_FAILURE - not successfully registered
3838 ---------------------------------------------------------------------------*/
3839eHalStatus sme_RegisterDeviceStateUpdateInd (
3840 tHalHandle hHal,
3841 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
3842 void *callbackContext)
3843{
3844 eHalStatus status = eHAL_STATUS_FAILURE;
3845 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3846
3847 status = sme_AcquireGlobalLock( &pMac->sme );
3848 if ( HAL_STATUS_SUCCESS( status ) )
3849 {
3850 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
3851 sme_ReleaseGlobalLock( &pMac->sme );
3852 }
3853
3854 return (status);
3855}
3856
3857/* ---------------------------------------------------------------------------
3858 \fn sme_DeregisterDeviceStateUpdateInd
3859 \brief Deregister a routine that was registered for device state changes
3860 \param hHal - The handle returned by macOpen.
3861 \param callbackRoutine - Callback routine to be deregistered
3862 \return eHalStatus
3863 eHAL_STATUS_SUCCESS - successfully deregistered
3864 eHAL_STATUS_FAILURE - not successfully deregistered
3865 ---------------------------------------------------------------------------*/
3866eHalStatus sme_DeregisterDeviceStateUpdateInd (
3867 tHalHandle hHal,
3868 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
3869{
3870 eHalStatus status = eHAL_STATUS_FAILURE;
3871 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3872
3873 status = sme_AcquireGlobalLock( &pMac->sme );
3874 if ( HAL_STATUS_SUCCESS( status ) )
3875 {
3876 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
3877 sme_ReleaseGlobalLock( &pMac->sme );
3878 }
3879
3880 return (status);
3881}
3882
3883/* ---------------------------------------------------------------------------
3884 \fn sme_WowlAddBcastPattern
3885 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
3886 do a pattern match on these patterns when Wowl is enabled during BMPS
3887 mode. Note that Firmware performs the pattern matching only on
3888 broadcast frames and while Libra is in BMPS mode.
3889 \param hHal - The handle returned by macOpen.
3890 \param pattern - Pattern to be added
3891 \return eHalStatus
3892 eHAL_STATUS_FAILURE Cannot add pattern
3893 eHAL_STATUS_SUCCESS Request accepted.
3894 ---------------------------------------------------------------------------*/
3895eHalStatus sme_WowlAddBcastPattern (
3896 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003897 tpSirWowlAddBcastPtrn pattern,
3898 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003899{
3900 eHalStatus status = eHAL_STATUS_FAILURE;
3901 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3902 status = sme_AcquireGlobalLock( &pMac->sme );
3903 if ( HAL_STATUS_SUCCESS( status ) )
3904 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003905 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003906 sme_ReleaseGlobalLock( &pMac->sme );
3907 }
3908
3909 return (status);
3910}
3911
3912/* ---------------------------------------------------------------------------
3913 \fn sme_WowlDelBcastPattern
3914 \brief Delete a pattern that was added for Pattern Byte Matching.
3915 \param hHal - The handle returned by macOpen.
3916 \param pattern - Pattern to be deleted
3917 \return eHalStatus
3918 eHAL_STATUS_FAILURE Cannot delete pattern
3919 eHAL_STATUS_SUCCESS Request accepted.
3920 ---------------------------------------------------------------------------*/
3921eHalStatus sme_WowlDelBcastPattern (
3922 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003923 tpSirWowlDelBcastPtrn pattern,
3924 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003925{
3926 eHalStatus status = eHAL_STATUS_FAILURE;
3927 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3928 status = sme_AcquireGlobalLock( &pMac->sme );
3929 if ( HAL_STATUS_SUCCESS( status ) )
3930 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003931 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003932 sme_ReleaseGlobalLock( &pMac->sme );
3933 }
3934
3935 return (status);
3936}
3937
3938/* ---------------------------------------------------------------------------
3939 \fn sme_EnterWowl
3940 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
3941 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
3942 SME will will cache the information that WOWL has been enabled and
3943 attempt to put the device in BMPS. On entry into BMPS, SME will
3944 enable the WOWL mode.
3945 Note 1: If we exit BMPS mode (someone requests full power), we
3946 will NOT resume WOWL when we go back to BMPS again. Request for full
3947 power (while in WOWL mode) means disable WOWL and go to full power.
3948 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
3949 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
3950 are required. Currently there is no requirement or use case to support
3951 UAPSD and WOWL at the same time.
3952
3953 \param hHal - The handle returned by macOpen.
3954 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
3955 Used for success/failure notification by SME
3956 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
3957 at the time of callback.
3958 \param wakeReasonIndCB - Callback routine provided by HDD.
3959 Used for Wake Reason Indication by SME
3960 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
3961 at the time of callback.
3962 \return eHalStatus
3963 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
3964 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
3965 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
3966 BMPS mode is entered.
3967 ---------------------------------------------------------------------------*/
3968eHalStatus sme_EnterWowl (
3969 tHalHandle hHal,
3970 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
3971 void *enterWowlCallbackContext,
3972#ifdef WLAN_WAKEUP_EVENTS
3973 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
3974 void *wakeIndicationCBContext,
3975#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003976 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07003977{
3978 eHalStatus status = eHAL_STATUS_FAILURE;
3979 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3980 status = sme_AcquireGlobalLock( &pMac->sme );
3981 if ( HAL_STATUS_SUCCESS( status ) )
3982 {
3983 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
3984#ifdef WLAN_WAKEUP_EVENTS
3985 wakeIndicationCB, wakeIndicationCBContext,
3986#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07003987 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003988 sme_ReleaseGlobalLock( &pMac->sme );
3989 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003990 return (status);
3991}
3992/* ---------------------------------------------------------------------------
3993 \fn sme_ExitWowl
3994 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
3995 SME will initiate exit from WoWLAN mode and device will be put in BMPS
3996 mode.
3997 \param hHal - The handle returned by macOpen.
3998 \return eHalStatus
3999 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4000 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4001 ---------------------------------------------------------------------------*/
4002eHalStatus sme_ExitWowl (tHalHandle hHal)
4003{
4004 eHalStatus status = eHAL_STATUS_FAILURE;
4005 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4006 status = sme_AcquireGlobalLock( &pMac->sme );
4007 if ( HAL_STATUS_SUCCESS( status ) )
4008 {
4009 status = pmcExitWowl (hHal);
4010 sme_ReleaseGlobalLock( &pMac->sme );
4011 }
4012
4013 return (status);
4014}
4015
4016/* ---------------------------------------------------------------------------
4017
4018 \fn sme_RoamSetKey
4019
4020 \brief To set encryption key. This function should be called only when connected
4021 This is an asynchronous API.
4022
4023 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4024
4025 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4026
4027 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4028
4029 FAILURE or RESOURCES The API finished and failed.
4030
4031 -------------------------------------------------------------------------------*/
4032eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4033{
4034 eHalStatus status = eHAL_STATUS_FAILURE;
4035 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4036 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004037 tANI_U32 i;
4038 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004039
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004040 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4041 {
4042 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4043 return eHAL_STATUS_FAILURE;
4044 }
4045
Jeff Johnson295189b2012-06-20 16:38:30 -07004046 status = sme_AcquireGlobalLock( &pMac->sme );
4047 if ( HAL_STATUS_SUCCESS( status ) )
4048 {
4049 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4050 if(pRoamId)
4051 {
4052 *pRoamId = roamId;
4053 }
4054
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004055 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004056
4057 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004058 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004059
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004060 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004061
4062 pSession = CSR_GET_SESSION(pMac, sessionId);
4063
Jeff Johnson32d95a32012-09-10 13:15:23 -07004064 if(!pSession)
4065 {
4066 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004067 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004068 return eHAL_STATUS_FAILURE;
4069 }
4070
Jeff Johnson295189b2012-06-20 16:38:30 -07004071 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4072 {
4073 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4074 {
4075 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4076 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4077 {
4078 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4079 }
4080 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4081 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4082 {
4083 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4084 }
4085 }
4086 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004087
4088 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4089 sme_ReleaseGlobalLock( &pMac->sme );
4090 }
4091
4092 return (status);
4093}
4094
4095
4096/* ---------------------------------------------------------------------------
4097
4098 \fn sme_RoamRemoveKey
4099
4100 \brief To set encryption key. This is an asynchronous API.
4101
4102 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4103
4104 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4105
4106 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4107
4108 FAILURE or RESOURCES The API finished and failed.
4109
4110 -------------------------------------------------------------------------------*/
4111eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4112 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4113{
4114 eHalStatus status = eHAL_STATUS_FAILURE;
4115 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4116 tANI_U32 roamId;
4117
4118 status = sme_AcquireGlobalLock( &pMac->sme );
4119 if ( HAL_STATUS_SUCCESS( status ) )
4120 {
4121 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4122 if(pRoamId)
4123 {
4124 *pRoamId = roamId;
4125 }
4126 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4127 sme_ReleaseGlobalLock( &pMac->sme );
4128 }
4129
4130 return (status);
4131}
4132
4133/* ---------------------------------------------------------------------------
4134 \fn sme_GetRssi
4135 \brief a wrapper function that client calls to register a callback to get RSSI
4136
4137 \param callback - SME sends back the requested stats using the callback
4138 \param staId - The station ID for which the stats is requested for
4139 \param pContext - user context to be passed back along with the callback
4140 \param pVosContext - vos context
4141 \return eHalStatus
4142 ---------------------------------------------------------------------------*/
4143eHalStatus sme_GetRssi(tHalHandle hHal,
4144 tCsrRssiCallback callback,
4145 tANI_U8 staId, tCsrBssid bssId,
4146 void *pContext, void* pVosContext)
4147{
4148 eHalStatus status = eHAL_STATUS_FAILURE;
4149 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4150
4151 status = sme_AcquireGlobalLock( &pMac->sme );
4152 if ( HAL_STATUS_SUCCESS( status ) )
4153 {
4154 status = csrGetRssi( pMac, callback,
4155 staId, bssId, pContext, pVosContext);
4156 sme_ReleaseGlobalLock( &pMac->sme );
4157 }
4158 return (status);
4159}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304160
4161/* ---------------------------------------------------------------------------
4162 \fn sme_GetSnr
4163 \brief a wrapper function that client calls to register a callback to
4164 get SNR
4165
4166 \param callback - SME sends back the requested stats using the callback
4167 \param staId - The station ID for which the stats is requested for
4168 \param pContext - user context to be passed back along with the callback
4169 \param pVosContext - vos context
4170 \return eHalStatus
4171 ---------------------------------------------------------------------------*/
4172eHalStatus sme_GetSnr(tHalHandle hHal,
4173 tCsrSnrCallback callback,
4174 tANI_U8 staId, tCsrBssid bssId,
4175 void *pContext)
4176{
4177 eHalStatus status = eHAL_STATUS_FAILURE;
4178 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4179
4180 status = sme_AcquireGlobalLock( &pMac->sme );
4181 if ( HAL_STATUS_SUCCESS( status ) )
4182 {
4183 status = csrGetSnr(pMac, callback,
4184 staId, bssId, pContext);
4185 sme_ReleaseGlobalLock( &pMac->sme );
4186 }
4187 return status;
4188}
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004189#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
4190/* ---------------------------------------------------------------------------
4191 \fn sme_GetRoamRssi
4192 \brief a wrapper function that client calls to register a callback to get Roam RSSI
4193
4194 \param callback - SME sends back the requested stats using the callback
4195 \param staId - The station ID for which the stats is requested for
4196 \param pContext - user context to be passed back along with the callback
4197 \param pVosContext - vos context
4198 \return eHalStatus
4199 ---------------------------------------------------------------------------*/
4200eHalStatus sme_GetRoamRssi(tHalHandle hHal,
4201 tCsrRssiCallback callback,
4202 tANI_U8 staId, tCsrBssid bssId,
4203 void *pContext, void* pVosContext)
4204{
4205 eHalStatus status = eHAL_STATUS_FAILURE;
4206 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4207
4208 status = sme_AcquireGlobalLock( &pMac->sme );
4209 if ( HAL_STATUS_SUCCESS( status ) )
4210 {
4211 status = csrGetRoamRssi( pMac, callback,
4212 staId, bssId, pContext, pVosContext);
4213 sme_ReleaseGlobalLock( &pMac->sme );
4214 }
4215 return (status);
4216}
4217#endif
4218
Jeff Johnson295189b2012-06-20 16:38:30 -07004219
4220/* ---------------------------------------------------------------------------
4221 \fn sme_GetStatistics
4222 \brief a wrapper function that client calls to register a callback to get
4223 different PHY level statistics from CSR.
4224
4225 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
4226 \param statsMask - The different category/categories of stats requester is looking for
4227 \param callback - SME sends back the requested stats using the callback
4228 \param periodicity - If requester needs periodic update in millisec, 0 means
4229 it's an one time request
4230 \param cache - If requester is happy with cached stats
4231 \param staId - The station ID for which the stats is requested for
4232 \param pContext - user context to be passed back along with the callback
4233 \return eHalStatus
4234 ---------------------------------------------------------------------------*/
4235eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
4236 tANI_U32 statsMask,
4237 tCsrStatsCallback callback,
4238 tANI_U32 periodicity, tANI_BOOLEAN cache,
4239 tANI_U8 staId, void *pContext)
4240{
4241 eHalStatus status = eHAL_STATUS_FAILURE;
4242 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4243
4244 status = sme_AcquireGlobalLock( &pMac->sme );
4245 if ( HAL_STATUS_SUCCESS( status ) )
4246 {
4247 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
4248 periodicity, cache, staId, pContext);
4249 sme_ReleaseGlobalLock( &pMac->sme );
4250 }
4251
4252 return (status);
4253
4254}
4255
4256/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05304257 \fn smeGetTLSTAState
4258 \helper function to get the TL STA State whenever the function is called.
4259
4260 \param staId - The staID to be passed to the TL
4261 to get the relevant TL STA State
4262 \return the state as tANI_U16
4263 ---------------------------------------------------------------------------*/
4264tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
4265{
4266 tANI_U16 tlSTAState = TL_INIT_STATE;
4267 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4268 eHalStatus status = eHAL_STATUS_FAILURE;
4269
4270 status = sme_AcquireGlobalLock( &pMac->sme );
4271 if ( HAL_STATUS_SUCCESS( status ) )
4272 {
4273 tlSTAState = csrGetTLSTAState( pMac, staId);
4274 sme_ReleaseGlobalLock( &pMac->sme );
4275 }
4276
4277 return tlSTAState;
4278}
4279
4280/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004281
4282 \fn sme_GetCountryCode
4283
4284 \brief To return the current country code. If no country code is applied, default country code is
4285 used to fill the buffer.
4286 If 11d supported is turned off, an error is return and the last applied/default country code is used.
4287 This is a synchronous API.
4288
4289 \param pBuf - pointer to a caller allocated buffer for returned country code.
4290
4291 \param pbLen For input, this parameter indicates how big is the buffer.
4292 Upon return, this parameter has the number of bytes for country. If pBuf
4293 doesn't have enough space, this function returns
4294 fail status and this parameter contains the number that is needed.
4295
4296 \return eHalStatus SUCCESS.
4297
4298 FAILURE or RESOURCES The API finished and failed.
4299
4300 -------------------------------------------------------------------------------*/
4301eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
4302{
4303 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4304
4305 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
4306}
4307
4308
4309/* ---------------------------------------------------------------------------
4310
4311 \fn sme_SetCountryCode
4312
4313 \brief To change the current/default country code.
4314 If 11d supported is turned off, an error is return.
4315 This is a synchronous API.
4316
4317 \param pCountry - pointer to a caller allocated buffer for the country code.
4318
4319 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
4320 whether a reset is required.
4321
4322 \return eHalStatus SUCCESS.
4323
4324 FAILURE or RESOURCES The API finished and failed.
4325
4326 -------------------------------------------------------------------------------*/
4327eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
4328{
4329 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4330
4331 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4332}
4333
4334
4335/* ---------------------------------------------------------------------------
4336 \fn sme_ResetCountryCodeInformation
4337 \brief this function is to reset the country code current being used back to EEPROM default
4338 this includes channel list and power setting. This is a synchronous API.
4339 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4340 a restart is needed to apply the change
4341 \return eHalStatus
4342 -------------------------------------------------------------------------------*/
4343eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4344{
4345 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4346
4347 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4348}
4349
4350
4351/* ---------------------------------------------------------------------------
4352 \fn sme_GetSupportedCountryCode
4353 \brief this function is to get a list of the country code current being supported
4354 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4355 this has the country code list. 3 bytes for each country code. This may be NULL if
4356 caller wants to know the needed byte count.
4357 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4358 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4359 \return eHalStatus
4360 -------------------------------------------------------------------------------*/
4361eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4362{
4363 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4364
4365 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4366}
4367
4368
4369/* ---------------------------------------------------------------------------
4370 \fn sme_GetCurrentRegulatoryDomain
4371 \brief this function is to get the current regulatory domain. This is a synchronous API.
4372 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4373 SME. The function fails if 11d support is turned off.
4374 \param pDomain - Caller allocated buffer to return the current domain.
4375 \return eHalStatus SUCCESS.
4376
4377 FAILURE or RESOURCES The API finished and failed.
4378 -------------------------------------------------------------------------------*/
4379eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4380{
4381 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4382 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4383
4384 if( pDomain )
4385 {
4386 if( csrIs11dSupported( pMac ) )
4387 {
4388 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4389 status = eHAL_STATUS_SUCCESS;
4390 }
4391 else
4392 {
4393 status = eHAL_STATUS_FAILURE;
4394 }
4395 }
4396
4397 return ( status );
4398}
4399
4400
4401/* ---------------------------------------------------------------------------
4402 \fn sme_SetRegulatoryDomain
4403 \brief this function is to set the current regulatory domain.
4404 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4405 SME. This is a synchronous API.
4406 \param domainId - indicate the domain (defined in the driver) needs to set to.
4407 See v_REGDOMAIN_t for definition
4408 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4409 a restart is needed to apply the change
4410 \return eHalStatus
4411 -------------------------------------------------------------------------------*/
4412eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4413{
4414 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4415
4416 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4417}
4418
4419
4420/* ---------------------------------------------------------------------------
4421
4422 \fn sme_GetRegulatoryDomainForCountry
4423
4424 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4425
4426 \param pCountry - pointer to a caller allocated buffer for input country code.
4427
4428 \param pDomainId Upon successful return, it is the domain that country belongs to.
4429 If it is NULL, returning success means that the country code is known.
4430
4431 \return eHalStatus SUCCESS.
4432
4433 FAILURE or RESOURCES The API finished and failed.
4434
4435 -------------------------------------------------------------------------------*/
4436eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4437{
4438 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4439
4440 return ( csrGetRegulatoryDomainForCountry( pMac, pCountry, pDomainId ) );
4441}
4442
4443
4444
4445
4446/* ---------------------------------------------------------------------------
4447
4448 \fn sme_GetSupportedRegulatoryDomains
4449
4450 \brief To return a list of supported regulatory domains. This is a synchronous API.
4451
4452 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4453
4454 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4455 Upon return, this parameter has the number for supported domains. If pDomains
4456 doesn't have enough space for all the supported domains, this function returns
4457 fail status and this parameter contains the number that is needed.
4458
4459 \return eHalStatus SUCCESS.
4460
4461 FAILURE or RESOURCES The API finished and failed.
4462
4463 -------------------------------------------------------------------------------*/
4464eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4465{
4466 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4467
4468 //We support all domains for now
4469 if( pNumDomains )
4470 {
4471 if( NUM_REG_DOMAINS <= *pNumDomains )
4472 {
4473 status = eHAL_STATUS_SUCCESS;
4474 }
4475 *pNumDomains = NUM_REG_DOMAINS;
4476 }
4477 if( HAL_STATUS_SUCCESS( status ) )
4478 {
4479 if( pDomains )
4480 {
4481 pDomains[0] = REGDOMAIN_FCC;
4482 pDomains[1] = REGDOMAIN_ETSI;
4483 pDomains[2] = REGDOMAIN_JAPAN;
4484 pDomains[3] = REGDOMAIN_WORLD;
4485 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
4486 pDomains[5] = REGDOMAIN_APAC;
4487 pDomains[6] = REGDOMAIN_KOREA;
4488 pDomains[7] = REGDOMAIN_HI_5GHZ;
4489 pDomains[8] = REGDOMAIN_NO_5GHZ;
4490 }
4491 else
4492 {
4493 status = eHAL_STATUS_INVALID_PARAMETER;
4494 }
4495 }
4496
4497 return ( status );
4498}
4499
4500
4501//some support functions
4502tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
4503{
4504 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4505
4506 return ( csrIs11dSupported( pMac ) );
4507}
4508
4509
4510tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
4511{
4512 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4513
4514 return ( csrIs11hSupported( pMac ) );
4515}
4516
4517
4518tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
4519{
4520 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4521
4522 return ( csrIsWmmSupported( pMac ) );
4523}
4524
4525//Upper layer to get the list of the base channels to scan for passively 11d info from csr
4526eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
4527{
4528 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4529
4530 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
4531}
4532
4533/* ---------------------------------------------------------------------------
4534
4535 \fn sme_ChangeCountryCode
4536
4537 \brief Change Country code from upperlayer during WLAN driver operation.
4538 This is a synchronous API.
4539
4540 \param hHal - The handle returned by macOpen.
4541
4542 \param pCountry New Country Code String
4543
4544 \return eHalStatus SUCCESS.
4545
4546 FAILURE or RESOURCES The API finished and failed.
4547
4548 -------------------------------------------------------------------------------*/
4549eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
4550 tSmeChangeCountryCallback callback,
4551 tANI_U8 *pCountry,
4552 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304553 void* pVosContext,
4554 tAniBool countryFromUserSpace )
Jeff Johnson295189b2012-06-20 16:38:30 -07004555{
4556 eHalStatus status = eHAL_STATUS_FAILURE;
4557 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4558 vos_msg_t msg;
4559 tAniChangeCountryCodeReq *pMsg;
4560
4561 status = sme_AcquireGlobalLock( &pMac->sme );
4562 if ( HAL_STATUS_SUCCESS( status ) )
4563 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004564 smsLog(pMac, LOG1, FL(" called"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004565 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, sizeof(tAniChangeCountryCodeReq));
4566 if ( !HAL_STATUS_SUCCESS(status) )
4567 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004568 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004569 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07004570 return status;
4571 }
4572
4573 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
4574 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
4575 palCopyMemory(pMac->hHdd, pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304576 pMsg->countryFromUserSpace = countryFromUserSpace;
Jeff Johnson295189b2012-06-20 16:38:30 -07004577 pMsg->changeCCCallback = callback;
4578 pMsg->pDevContext = pContext;
4579 pMsg->pVosContext = pVosContext;
4580
4581 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
4582 msg.bodyptr = pMsg;
4583 msg.reserved = 0;
4584
4585 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
4586 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004587 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Jeff Johnson295189b2012-06-20 16:38:30 -07004588 palFreeMemory(pMac->hHdd, (void *)pMsg);
4589 status = eHAL_STATUS_FAILURE;
4590 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004591 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004592 sme_ReleaseGlobalLock( &pMac->sme );
4593 }
4594
4595 return (status);
4596}
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05304597/* ---------------------------------------------------------------------------
4598
4599 \fn sme_DHCPStartInd
4600
4601 \brief API to signal the FW about the DHCP Start event.
4602
4603 \param hHal - HAL handle for device.
4604
4605 \param device_mode - mode(AP,SAP etc) of the device.
4606
4607 \param macAddr - MAC address of the device.
4608
4609 \return eHalStatus SUCCESS.
4610
4611 FAILURE or RESOURCES The API finished and failed.
4612 --------------------------------------------------------------------------*/
4613eHalStatus sme_DHCPStartInd( tHalHandle hHal,
4614 tANI_U8 device_mode,
4615 tANI_U8 *macAddr )
4616{
4617 eHalStatus status;
4618 VOS_STATUS vosStatus;
4619 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4620 vos_msg_t vosMessage;
4621 tAniDHCPInd *pMsg;
4622
4623 status = sme_AcquireGlobalLock(&pMac->sme);
4624 if ( eHAL_STATUS_SUCCESS == status)
4625 {
4626 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
4627 if (NULL == pMsg)
4628 {
4629 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4630 "%s: Not able to allocate memory for dhcp start", __func__);
4631 sme_ReleaseGlobalLock( &pMac->sme );
4632 return eHAL_STATUS_FAILURE;
4633 }
4634 pMsg->msgType = WDA_DHCP_START_IND;
4635 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
4636 pMsg->device_mode = device_mode;
4637 vos_mem_copy( pMsg->macAddr, macAddr, sizeof(tSirMacAddr));
4638
4639 vosMessage.type = WDA_DHCP_START_IND;
4640 vosMessage.bodyptr = pMsg;
4641 vosMessage.reserved = 0;
4642
4643 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
4644 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
4645 {
4646 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4647 "%s: Post DHCP Start MSG fail", __func__);
4648 vos_mem_free(pMsg);
4649 status = eHAL_STATUS_FAILURE;
4650 }
4651 sme_ReleaseGlobalLock( &pMac->sme );
4652 }
4653 return (status);
4654}
4655/* ---------------------------------------------------------------------------
4656 \fn sme_DHCPStopInd
4657
4658 \brief API to signal the FW about the DHCP complete event.
4659
4660 \param hHal - HAL handle for device.
4661
4662 \param device_mode - mode(AP, SAP etc) of the device.
4663
4664 \param macAddr - MAC address of the device.
4665
4666 \return eHalStatus SUCCESS.
4667 FAILURE or RESOURCES The API finished and failed.
4668 --------------------------------------------------------------------------*/
4669eHalStatus sme_DHCPStopInd( tHalHandle hHal,
4670 tANI_U8 device_mode,
4671 tANI_U8 *macAddr )
4672{
4673 eHalStatus status;
4674 VOS_STATUS vosStatus;
4675 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4676 vos_msg_t vosMessage;
4677 tAniDHCPInd *pMsg;
4678
4679 status = sme_AcquireGlobalLock(&pMac->sme);
4680 if ( eHAL_STATUS_SUCCESS == status)
4681 {
4682 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
4683 if (NULL == pMsg)
4684 {
4685 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4686 "%s: Not able to allocate memory for dhcp stop", __func__);
4687 sme_ReleaseGlobalLock( &pMac->sme );
4688 return eHAL_STATUS_FAILURE;
4689 }
4690
4691 pMsg->msgType = WDA_DHCP_STOP_IND;
4692 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
4693 pMsg->device_mode = device_mode;
4694 vos_mem_copy( pMsg->macAddr, macAddr, sizeof(tSirMacAddr));
4695
4696 vosMessage.type = WDA_DHCP_STOP_IND;
4697 vosMessage.bodyptr = pMsg;
4698 vosMessage.reserved = 0;
4699
4700 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
4701 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
4702 {
4703 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4704 "%s: Post DHCP Stop MSG fail", __func__);
4705 vos_mem_free(pMsg);
4706 status = eHAL_STATUS_FAILURE;
4707 }
4708
4709 sme_ReleaseGlobalLock( &pMac->sme );
4710 }
4711 return (status);
4712}
4713
Jeff Johnson295189b2012-06-20 16:38:30 -07004714
4715/* ---------------------------------------------------------------------------
4716 \fn sme_BtcSignalBtEvent
4717 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
4718 BT event type and the current operating mode of Libra (full power,
4719 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
4720 would be employed.
4721 \param hHal - The handle returned by macOpen.
4722 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
4723 Caller owns the memory and is responsible for freeing it.
4724 \return VOS_STATUS
4725 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
4726 if BTC execution mode is set to BTC_WLAN_ONLY
4727 or BTC_PTA_ONLY.
4728 VOS_STATUS_SUCCESS BT Event passed to HAL
4729 ---------------------------------------------------------------------------*/
4730VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
4731{
4732 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4733#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4734 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4735
4736 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4737 {
4738 status = btcSignalBTEvent (hHal, pBtEvent);
4739 sme_ReleaseGlobalLock( &pMac->sme );
4740 }
4741#endif
4742 return (status);
4743}
4744
4745/* ---------------------------------------------------------------------------
4746 \fn sme_BtcSetConfig
4747 \brief API to change the current Bluetooth Coexistence (BTC) configuration
4748 This function should be invoked only after CFG download has completed.
4749 Calling it after sme_HDDReadyInd is recommended.
4750 \param hHal - The handle returned by macOpen.
4751 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
4752 Caller owns the memory and is responsible for freeing it.
4753 \return VOS_STATUS
4754 VOS_STATUS_E_FAILURE Config not passed to HAL.
4755 VOS_STATUS_SUCCESS Config passed to HAL
4756 ---------------------------------------------------------------------------*/
4757VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4758{
4759 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4760#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4761 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4762 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4763 {
4764 status = btcSetConfig (hHal, pSmeBtcConfig);
4765 sme_ReleaseGlobalLock( &pMac->sme );
4766 }
4767#endif
4768 return (status);
4769}
4770
4771/* ---------------------------------------------------------------------------
4772 \fn sme_BtcGetConfig
4773 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
4774 \param hHal - The handle returned by macOpen.
4775 \param pSmeBtcConfig - Pointer to a caller allocated object of type
4776 tSmeBtcConfig. Caller owns the memory and is responsible
4777 for freeing it.
4778 \return VOS_STATUS
4779 VOS_STATUS_E_FAILURE - failure
4780 VOS_STATUS_SUCCESS success
4781 ---------------------------------------------------------------------------*/
4782VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
4783{
4784 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4785#ifndef WLAN_MDM_CODE_REDUCTION_OPT
4786 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4787
4788 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4789 {
4790 status = btcGetConfig (hHal, pSmeBtcConfig);
4791 sme_ReleaseGlobalLock( &pMac->sme );
4792 }
4793#endif
4794 return (status);
4795}
4796/* ---------------------------------------------------------------------------
4797 \fn sme_SetCfgPrivacy
4798 \brief API to set configure privacy parameters
4799 \param hHal - The handle returned by macOpen.
4800 \param pProfile - Pointer CSR Roam profile.
4801 \param fPrivacy - This parameter indicates status of privacy
4802
4803 \return void
4804 ---------------------------------------------------------------------------*/
4805void sme_SetCfgPrivacy( tHalHandle hHal,
4806 tCsrRoamProfile *pProfile,
4807 tANI_BOOLEAN fPrivacy
4808 )
4809{
4810 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4811 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4812 {
4813 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
4814 sme_ReleaseGlobalLock( &pMac->sme );
4815 }
4816}
4817
4818#if defined WLAN_FEATURE_VOWIFI
4819/* ---------------------------------------------------------------------------
4820 \fn sme_NeighborReportRequest
4821 \brief API to request neighbor report.
4822 \param hHal - The handle returned by macOpen.
4823 \param pRrmNeighborReq - Pointer to a caller allocated object of type
4824 tRrmNeighborReq. Caller owns the memory and is responsible
4825 for freeing it.
4826 \return VOS_STATUS
4827 VOS_STATUS_E_FAILURE - failure
4828 VOS_STATUS_SUCCESS success
4829 ---------------------------------------------------------------------------*/
4830VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
4831 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
4832{
4833 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4834 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4835
4836 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
4837 {
4838 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
4839 sme_ReleaseGlobalLock( &pMac->sme );
4840 }
4841
4842 return (status);
4843}
4844#endif
4845
4846//The following are debug APIs to support direct read/write register/memory
4847//They are placed in SME because HW cannot be access when in LOW_POWER state
4848//AND not connected. The knowledge and synchronization is done in SME
4849
4850//sme_DbgReadRegister
4851//Caller needs to validate the input values
4852VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
4853{
4854 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4855 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004856 tPmcPowerState PowerState;
4857 tANI_U32 sessionId = 0;
4858
4859 /* 1) To make Quarky work in FTM mode **************************************/
4860
4861 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4862 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004863 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004864 {
4865 return VOS_STATUS_SUCCESS;
4866 }
4867 return VOS_STATUS_E_FAILURE;
4868 }
4869
4870 /* 2) NON FTM mode driver *************************************************/
4871
4872 /* Acquire SME global lock */
4873 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4874 {
4875 return VOS_STATUS_E_FAILURE;
4876 }
4877
4878 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4879 {
4880 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4881 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4882 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08004883 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004884 {
4885 status = VOS_STATUS_SUCCESS;
4886 }
4887 else
4888 {
4889 status = VOS_STATUS_E_FAILURE;
4890 }
4891 }
4892 else
4893 {
4894 status = VOS_STATUS_E_FAILURE;
4895 }
4896 }
4897
4898 /* This is a hack for Qualky/pttWniSocket
4899 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
4900 if ( VOS_STATUS_SUCCESS != status )
4901 {
4902 *pRegValue = 0xDEADBEEF;
4903 status = VOS_STATUS_SUCCESS;
4904 }
4905
4906 /* Release SME global lock */
4907 sme_ReleaseGlobalLock(&pMac->sme);
4908
4909 return (status);
4910}
4911
4912
4913//sme_DbgWriteRegister
4914//Caller needs to validate the input values
4915VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
4916{
4917 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4918 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07004919 tPmcPowerState PowerState;
4920 tANI_U32 sessionId = 0;
4921
4922 /* 1) To make Quarky work in FTM mode **************************************/
4923
4924 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4925 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004926 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004927 {
4928 return VOS_STATUS_SUCCESS;
4929 }
4930 return VOS_STATUS_E_FAILURE;
4931 }
4932
4933 /* 2) NON FTM mode driver *************************************************/
4934
4935 /* Acquire SME global lock */
4936 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4937 {
4938 return VOS_STATUS_E_FAILURE;
4939 }
4940
4941 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
4942 {
4943 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
4944 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
4945 {
Jeff Johnson295189b2012-06-20 16:38:30 -07004946 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07004947 {
4948 status = VOS_STATUS_SUCCESS;
4949 }
4950 else
4951 {
4952 status = VOS_STATUS_E_FAILURE;
4953 }
4954 }
4955 else
4956 {
4957 status = VOS_STATUS_E_FAILURE;
4958 }
4959 }
4960
4961 /* Release SME global lock */
4962 sme_ReleaseGlobalLock(&pMac->sme);
4963
4964 return (status);
4965}
4966
4967
4968
4969//sme_DbgReadMemory
4970//Caller needs to validate the input values
4971//pBuf caller allocated buffer has the length of nLen
4972VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
4973{
4974 VOS_STATUS status = VOS_STATUS_E_FAILURE;
4975 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07004976 tPmcPowerState PowerState;
4977 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004978 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
4979 tANI_U32 arg1 = memAddr;
4980 tANI_U32 arg2 = nLen/4;
4981 tANI_U32 arg3 = 4;
4982 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07004983 /* 1) To make Quarky work in FTM mode **************************************/
4984
4985 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
4986 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08004987 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07004988 {
4989 return VOS_STATUS_SUCCESS;
4990 }
4991 return VOS_STATUS_E_FAILURE;
4992 }
4993
4994 /* 2) NON FTM mode driver *************************************************/
4995
4996 /* Acquire SME global lock */
4997 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
4998 {
4999 return VOS_STATUS_E_FAILURE;
5000 }
5001
5002 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5003 {
5004 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5005 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5006 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005007 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005008 {
5009 status = VOS_STATUS_SUCCESS;
5010 }
5011 else
5012 {
5013 status = VOS_STATUS_E_FAILURE;
5014 }
5015 }
5016 else
5017 {
5018 status = VOS_STATUS_E_FAILURE;
5019 }
5020 }
5021
5022 /* This is a hack for Qualky/pttWniSocket
5023 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5024 if (VOS_STATUS_SUCCESS != status)
5025 {
5026 vos_mem_set(pBuf, nLen, 0xCD);
5027 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005028 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005029 }
5030
5031 /* Release SME lock */
5032 sme_ReleaseGlobalLock(&pMac->sme);
5033
5034 return (status);
5035}
5036
5037
5038//sme_DbgWriteMemory
5039//Caller needs to validate the input values
5040VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5041{
5042 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5043 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005044 tPmcPowerState PowerState;
5045 tANI_U32 sessionId = 0;
5046
5047 /* 1) To make Quarky work in FTM mode **************************************/
5048
5049 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5050 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005051 {
5052 return VOS_STATUS_SUCCESS;
5053 }
5054 return VOS_STATUS_E_FAILURE;
5055 }
5056
5057 /* 2) NON FTM mode driver *************************************************/
5058
5059 /* Acquire SME global lock */
5060 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5061 {
5062 return VOS_STATUS_E_FAILURE;
5063 }
5064
5065 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5066 {
5067 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5068 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5069 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005070 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07005071 {
5072 status = VOS_STATUS_SUCCESS;
5073 }
5074 else
5075 {
5076 status = VOS_STATUS_E_FAILURE;
5077 }
5078 }
5079 else
5080 {
5081 status = VOS_STATUS_E_FAILURE;
5082 }
5083 }
5084
5085 /* Release Global lock */
5086 sme_ReleaseGlobalLock(&pMac->sme);
5087
5088 return (status);
5089}
5090
5091
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005092void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07005093{
5094#ifdef WLAN_DEBUG
5095 // Verify against current log level
5096 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
5097 return;
5098 else
5099 {
5100 va_list marker;
5101
5102 va_start( marker, pString ); /* Initialize variable arguments. */
5103
5104 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
5105
5106 va_end( marker ); /* Reset variable arguments. */
5107 }
5108#endif
5109}
Jeff Johnson295189b2012-06-20 16:38:30 -07005110
Jeff Johnson295189b2012-06-20 16:38:30 -07005111/* ---------------------------------------------------------------------------
5112 \fn sme_GetWcnssWlanCompiledVersion
5113 \brief This API returns the version of the WCNSS WLAN API with
5114 which the HOST driver was built
5115 \param hHal - The handle returned by macOpen.
5116 \param pVersion - Points to the Version structure to be filled
5117 \return VOS_STATUS
5118 VOS_STATUS_E_INVAL - failure
5119 VOS_STATUS_SUCCESS success
5120 ---------------------------------------------------------------------------*/
5121VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
5122 tSirVersionType *pVersion)
5123{
5124 VOS_STATUS status = VOS_STATUS_SUCCESS;
5125 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5126 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5127
5128 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5129 {
5130 if( pVersion != NULL )
5131 {
5132 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
5133 }
5134 else
5135 {
5136 status = VOS_STATUS_E_INVAL;
5137 }
5138 sme_ReleaseGlobalLock( &pMac->sme );
5139 }
5140
5141 return (status);
5142}
5143
5144
5145/* ---------------------------------------------------------------------------
5146 \fn sme_GetWcnssWlanReportedVersion
5147 \brief This API returns the version of the WCNSS WLAN API with
5148 which the WCNSS driver reports it was built
5149 \param hHal - The handle returned by macOpen.
5150 \param pVersion - Points to the Version structure to be filled
5151 \return VOS_STATUS
5152 VOS_STATUS_E_INVAL - failure
5153 VOS_STATUS_SUCCESS success
5154 ---------------------------------------------------------------------------*/
5155VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
5156 tSirVersionType *pVersion)
5157{
5158 VOS_STATUS status = VOS_STATUS_SUCCESS;
5159 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5160 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5161
5162 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5163 {
5164 if( pVersion != NULL )
5165 {
5166 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
5167 }
5168 else
5169 {
5170 status = VOS_STATUS_E_INVAL;
5171 }
5172 sme_ReleaseGlobalLock( &pMac->sme );
5173 }
5174
5175 return (status);
5176}
5177
5178
5179/* ---------------------------------------------------------------------------
5180 \fn sme_GetWcnssSoftwareVersion
5181 \brief This API returns the version string of the WCNSS driver
5182 \param hHal - The handle returned by macOpen.
5183 \param pVersion - Points to the Version string buffer to be filled
5184 \param versionBufferSize - THe size of the Version string buffer
5185 \return VOS_STATUS
5186 VOS_STATUS_E_INVAL - failure
5187 VOS_STATUS_SUCCESS success
5188 ---------------------------------------------------------------------------*/
5189VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
5190 tANI_U8 *pVersion,
5191 tANI_U32 versionBufferSize)
5192{
5193 VOS_STATUS status = VOS_STATUS_SUCCESS;
5194 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5195 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5196
5197 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5198 {
5199 if( pVersion != NULL )
5200 {
5201 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
5202 versionBufferSize);
5203 }
5204 else
5205 {
5206 status = VOS_STATUS_E_INVAL;
5207 }
5208 sme_ReleaseGlobalLock( &pMac->sme );
5209 }
5210
5211 return (status);
5212}
5213
5214
5215/* ---------------------------------------------------------------------------
5216 \fn sme_GetWcnssHardwareVersion
5217 \brief This API returns the version string of the WCNSS hardware
5218 \param hHal - The handle returned by macOpen.
5219 \param pVersion - Points to the Version string buffer to be filled
5220 \param versionBufferSize - THe size of the Version string buffer
5221 \return VOS_STATUS
5222 VOS_STATUS_E_INVAL - failure
5223 VOS_STATUS_SUCCESS success
5224 ---------------------------------------------------------------------------*/
5225VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
5226 tANI_U8 *pVersion,
5227 tANI_U32 versionBufferSize)
5228{
5229 VOS_STATUS status = VOS_STATUS_SUCCESS;
5230 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5231 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5232
5233 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5234 {
5235 if( pVersion != NULL )
5236 {
5237 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
5238 versionBufferSize);
5239 }
5240 else
5241 {
5242 status = VOS_STATUS_E_INVAL;
5243 }
5244 sme_ReleaseGlobalLock( &pMac->sme );
5245 }
5246
5247 return (status);
5248}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08005249
Jeff Johnson295189b2012-06-20 16:38:30 -07005250
5251#ifdef FEATURE_WLAN_WAPI
5252/* ---------------------------------------------------------------------------
5253 \fn sme_RoamSetBKIDCache
5254 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
5255 candidate list.
5256 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5257 it is opened (by calling halOpen).
5258 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
5259 \param numItems - a variable that has the number of tBkidCacheInfo allocated
5260 when retruning, this is the number of items put into pBKIDCache
5261 \return eHalStatus - when fail, it usually means the buffer allocated is not
5262 big enough and pNumItems has the number of tBkidCacheInfo.
5263 ---------------------------------------------------------------------------*/
5264eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
5265 tANI_U32 numItems )
5266{
5267 eHalStatus status = eHAL_STATUS_FAILURE;
5268 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5269
5270 status = sme_AcquireGlobalLock( &pMac->sme );
5271 if ( HAL_STATUS_SUCCESS( status ) )
5272 {
5273 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
5274 sme_ReleaseGlobalLock( &pMac->sme );
5275 }
5276
5277 return (status);
5278}
5279
5280/* ---------------------------------------------------------------------------
5281 \fn sme_RoamGetBKIDCache
5282 \brief The SME API exposed to HDD to allow HDD to request SME to return its
5283 BKID cache.
5284 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5285 it is opened (by calling halOpen).
5286 \param pNum - caller allocated memory that has the space of the number of
5287 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
5288 in SME cache.
5289 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
5290 upon return
5291 \return eHalStatus - when fail, it usually means the buffer allocated is not
5292 big enough.
5293 ---------------------------------------------------------------------------*/
5294eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
5295 tBkidCacheInfo *pBkidCache)
5296{
5297 eHalStatus status = eHAL_STATUS_FAILURE;
5298 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5299
5300 status = sme_AcquireGlobalLock( &pMac->sme );
5301 if ( HAL_STATUS_SUCCESS( status ) )
5302 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005303 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005304 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
5305 sme_ReleaseGlobalLock( &pMac->sme );
5306 }
5307
5308 return (status);
5309}
5310
5311/* ---------------------------------------------------------------------------
5312 \fn sme_RoamGetNumBKIDCache
5313 \brief The SME API exposed to HDD to allow HDD to request SME to return the
5314 number of BKID cache entries.
5315 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5316 it is opened (by calling halOpen).
5317 \return tANI_U32 - the number of BKID cache entries.
5318 ---------------------------------------------------------------------------*/
5319tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
5320{
5321 eHalStatus status = eHAL_STATUS_FAILURE;
5322 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5323 tANI_U32 numBkidCache = 0;
5324
5325 status = sme_AcquireGlobalLock( &pMac->sme );
5326 if ( HAL_STATUS_SUCCESS( status ) )
5327 {
5328 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
5329 sme_ReleaseGlobalLock( &pMac->sme );
5330 }
5331
5332 return (numBkidCache);
5333}
5334
5335/* ---------------------------------------------------------------------------
5336 \fn sme_ScanGetBKIDCandidateList
5337 \brief a wrapper function to return the BKID candidate list
5338 \param pBkidList - caller allocated buffer point to an array of
5339 tBkidCandidateInfo
5340 \param pNumItems - pointer to a variable that has the number of
5341 tBkidCandidateInfo allocated when retruning, this is
5342 either the number needed or number of items put into
5343 pPmkidList
5344 \return eHalStatus - when fail, it usually means the buffer allocated is not
5345 big enough and pNumItems
5346 has the number of tBkidCandidateInfo.
5347 \Note: pNumItems is a number of tBkidCandidateInfo,
5348 not sizeof(tBkidCandidateInfo) * something
5349 ---------------------------------------------------------------------------*/
5350eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
5351 tBkidCandidateInfo *pBkidList,
5352 tANI_U32 *pNumItems )
5353{
5354 eHalStatus status = eHAL_STATUS_FAILURE;
5355 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5356
5357 status = sme_AcquireGlobalLock( &pMac->sme );
5358 if ( HAL_STATUS_SUCCESS( status ) )
5359 {
5360 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
5361 sme_ReleaseGlobalLock( &pMac->sme );
5362 }
5363
5364 return (status);
5365}
5366#endif /* FEATURE_WLAN_WAPI */
5367
Jeff Johnsone7245742012-09-05 17:12:55 -07005368#ifdef FEATURE_OEM_DATA_SUPPORT
5369
5370/*****************************************************************************
5371 OEM DATA related modifications and function additions
5372 *****************************************************************************/
5373
5374/* ---------------------------------------------------------------------------
5375 \fn sme_getOemDataRsp
5376 \brief a wrapper function to obtain the OEM DATA RSP
5377 \param pOemDataRsp - A pointer to the response object
5378 \param pContext - a pointer passed in for the callback
5379 \return eHalStatus
5380 ---------------------------------------------------------------------------*/
5381eHalStatus sme_getOemDataRsp(tHalHandle hHal,
5382 tOemDataRsp **pOemDataRsp)
5383{
5384 eHalStatus status = eHAL_STATUS_SUCCESS;
5385 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5386
5387 do
5388 {
5389 //acquire the lock for the sme object
5390 status = sme_AcquireGlobalLock(&pMac->sme);
5391
5392 if(!HAL_STATUS_SUCCESS(status))
5393 {
5394 break;
5395 }
5396
5397 if(pMac->oemData.pOemDataRsp != NULL)
5398 {
5399 *pOemDataRsp = pMac->oemData.pOemDataRsp;
5400 }
5401 else
5402 {
5403 status = eHAL_STATUS_FAILURE;
5404 }
5405
5406 //release the lock for the sme object
5407 sme_ReleaseGlobalLock( &pMac->sme );
5408
5409 } while(0);
5410
5411 return status;
5412}
5413
5414/* ---------------------------------------------------------------------------
5415 \fn sme_OemDataReq
5416 \brief a wrapper function for OEM DATA REQ
5417 \param sessionId - session id to be used.
5418 \param pOemDataReqId - pointer to an object to get back the request ID
5419 \param callback - a callback function that is called upon finish
5420 \param pContext - a pointer passed in for the callback
5421 \return eHalStatus
5422 ---------------------------------------------------------------------------*/
5423eHalStatus sme_OemDataReq(tHalHandle hHal,
5424 tANI_U8 sessionId,
5425 tOemDataReqConfig *pOemDataReqConfig,
5426 tANI_U32 *pOemDataReqID,
5427 oemData_OemDataReqCompleteCallback callback,
5428 void *pContext)
5429{
5430 eHalStatus status = eHAL_STATUS_SUCCESS;
5431 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5432
5433 do
5434 {
5435 //acquire the lock for the sme object
5436 status = sme_AcquireGlobalLock(&pMac->sme);
5437 if(HAL_STATUS_SUCCESS(status))
5438 {
5439 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
5440
5441 if(pOemDataReqID)
5442 {
5443 *pOemDataReqID = lOemDataReqId;
5444 }
5445 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005446 {
5447 sme_ReleaseGlobalLock( &pMac->sme );
5448 return eHAL_STATUS_FAILURE;
5449 }
Jeff Johnsone7245742012-09-05 17:12:55 -07005450
5451 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
5452
5453 //release the lock for the sme object
5454 sme_ReleaseGlobalLock( &pMac->sme );
5455 }
5456 } while(0);
5457
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005458 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07005459
5460 return(status);
5461}
5462
5463#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07005464
5465/*--------------------------------------------------------------------------
5466
5467 \brief sme_OpenSession() - Open a session for scan/roam operation.
5468
5469 This is a synchronous API.
5470
5471
5472 \param hHal - The handle returned by macOpen.
5473 \param callback - A pointer to the function caller specifies for roam/connect status indication
5474 \param pContext - The context passed with callback
5475 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
5476 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
5477
5478 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
5479
5480 Other status means SME is failed to open the session.
5481 eHAL_STATUS_RESOURCES - no more session available.
5482 \sa
5483
5484 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07005485eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
5486 void *pContext, tANI_U8 *pSelfMacAddr,
5487 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005488{
5489 eHalStatus status;
5490 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5491
5492 if( NULL == pbSessionId )
5493 {
5494 status = eHAL_STATUS_INVALID_PARAMETER;
5495 }
5496 else
5497 {
5498 status = sme_AcquireGlobalLock( &pMac->sme );
5499 if ( HAL_STATUS_SUCCESS( status ) )
5500 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07005501 status = csrRoamOpenSession(pMac, callback, pContext,
5502 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005503
5504 sme_ReleaseGlobalLock( &pMac->sme );
5505 }
5506 }
5507
5508 return ( status );
5509}
5510
5511
5512/*--------------------------------------------------------------------------
5513
5514 \brief sme_CloseSession() - Open a session for scan/roam operation.
5515
5516 This is a synchronous API.
5517
5518
5519 \param hHal - The handle returned by macOpen.
5520
5521 \param sessionId - A previous opened session's ID.
5522
5523 \return eHAL_STATUS_SUCCESS - session is closed.
5524
5525 Other status means SME is failed to open the session.
5526 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
5527 \sa
5528
5529 --------------------------------------------------------------------------*/
5530eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
5531 csrRoamSessionCloseCallback callback, void *pContext)
5532{
5533 eHalStatus status;
5534 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5535
5536 status = sme_AcquireGlobalLock( &pMac->sme );
5537 if ( HAL_STATUS_SUCCESS( status ) )
5538 {
5539 status = csrRoamCloseSession( pMac, sessionId, FALSE,
5540 callback, pContext );
5541
5542 sme_ReleaseGlobalLock( &pMac->sme );
5543 }
5544
5545 return ( status );
5546}
5547
Jeff Johnson295189b2012-06-20 16:38:30 -07005548/* ---------------------------------------------------------------------------
5549
5550 \fn sme_RoamUpdateAPWPSIE
5551
5552 \brief To update AP's WPS IE. This function should be called after SME AP session is created
5553 This is an asynchronous API.
5554
5555 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
5556
5557 \return eHalStatus – SUCCESS –
5558
5559 FAILURE or RESOURCES – The API finished and failed.
5560
5561 -------------------------------------------------------------------------------*/
5562eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
5563{
5564
5565 eHalStatus status = eHAL_STATUS_FAILURE;
5566 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5567
5568 status = sme_AcquireGlobalLock( &pMac->sme );
5569 if ( HAL_STATUS_SUCCESS( status ) )
5570 {
5571
5572 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
5573
5574 sme_ReleaseGlobalLock( &pMac->sme );
5575 }
5576
5577 return (status);
5578}
5579/* ---------------------------------------------------------------------------
5580
5581 \fn sme_RoamUpdateAPWPARSNIEs
5582
5583 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
5584 This is an asynchronous API.
5585
5586 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
5587
5588 \return eHalStatus – SUCCESS –
5589
5590 FAILURE or RESOURCES – The API finished and failed.
5591
5592 -------------------------------------------------------------------------------*/
5593eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
5594{
5595
5596 eHalStatus status = eHAL_STATUS_FAILURE;
5597 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5598
5599 status = sme_AcquireGlobalLock( &pMac->sme );
5600 if ( HAL_STATUS_SUCCESS( status ) )
5601 {
5602
5603 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
5604
5605 sme_ReleaseGlobalLock( &pMac->sme );
5606 }
5607
5608 return (status);
5609}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005610/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005611
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005612 \fn sme_ChangeMCCBeaconInterval
5613
5614 \brief To update P2P-GO beaconInterval. This function should be called after
5615 disassociating all the station is done
5616 This is an asynchronous API.
5617
5618 \param
5619
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005620 \return eHalStatus SUCCESS
5621 FAILURE or RESOURCES
5622 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005623
5624 -------------------------------------------------------------------------------*/
5625eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
5626{
5627 eHalStatus status = eHAL_STATUS_FAILURE;
5628 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5629
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005630 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005631 status = sme_AcquireGlobalLock( &pMac->sme );
5632 if ( HAL_STATUS_SUCCESS( status ) )
5633 {
5634 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
5635 sme_ReleaseGlobalLock( &pMac->sme );
5636 }
5637 return (status);
5638}
Jeff Johnson295189b2012-06-20 16:38:30 -07005639
5640/*-------------------------------------------------------------------------------*
5641
5642 \fn sme_sendBTAmpEvent
5643
5644 \brief to receive the coex priorty request from BT-AMP PAL
5645 and send the BT_AMP link state to HAL
5646
5647 \param btAmpEvent - btAmpEvent
5648
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005649 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07005650
5651 FAILURE: API failed
5652
5653-------------------------------------------------------------------------------*/
5654
5655eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
5656{
5657 vos_msg_t msg;
5658 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
5659 eHalStatus status = eHAL_STATUS_FAILURE;
5660
5661 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tpSmeBtAmpEvent));
5662 if (NULL == ptrSmeBtAmpEvent)
5663 {
5664 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005665 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005666 return status;
5667 }
5668
5669 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
5670 msg.type = WDA_SIGNAL_BTAMP_EVENT;
5671 msg.reserved = 0;
5672 msg.bodyptr = ptrSmeBtAmpEvent;
5673
5674 //status = halFW_SendBTAmpEventMesg(pMac, event);
5675
5676 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
5677 {
5678 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005679 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005680 vos_mem_free(ptrSmeBtAmpEvent);
5681 return status;
5682 }
5683
5684 return eHAL_STATUS_SUCCESS;
5685
5686}
5687
5688/* ---------------------------------------------------------------------------
5689 \fn sme_SetHostOffload
5690 \brief API to set the host offload feature.
5691 \param hHal - The handle returned by macOpen.
5692 \param pRequest - Pointer to the offload request.
5693 \return eHalStatus
5694 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005695eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
5696 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005697{
5698 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07005699 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005700
5701 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5702 {
5703#ifdef WLAN_NS_OFFLOAD
5704 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
5705 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005706 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005707 }
5708 else
5709#endif //WLAN_NS_OFFLOAD
5710 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005711 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005712 }
5713 sme_ReleaseGlobalLock( &pMac->sme );
5714 }
5715
5716 return (status);
5717}
5718
5719#ifdef WLAN_FEATURE_GTK_OFFLOAD
5720/* ---------------------------------------------------------------------------
5721 \fn sme_SetGTKOffload
5722 \brief API to set GTK offload information.
5723 \param hHal - The handle returned by macOpen.
5724 \param pRequest - Pointer to the GTK offload request.
5725 \return eHalStatus
5726 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005727eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
5728 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005729{
5730 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5731 eHalStatus status;
5732
5733 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5734 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005735 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005736 sme_ReleaseGlobalLock( &pMac->sme );
5737 }
5738
5739 return (status);
5740}
5741
5742/* ---------------------------------------------------------------------------
5743 \fn sme_GetGTKOffload
5744 \brief API to get GTK offload information.
5745 \param hHal - The handle returned by macOpen.
5746 \param pRequest - Pointer to the GTK offload response.
5747 \return eHalStatus
5748 ---------------------------------------------------------------------------*/
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005749eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
5750 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07005751{
5752 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5753 eHalStatus status;
5754
5755 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5756 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005757 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005758 sme_ReleaseGlobalLock( &pMac->sme );
5759 }
5760
5761 return (status);
5762}
5763#endif // WLAN_FEATURE_GTK_OFFLOAD
5764
5765/* ---------------------------------------------------------------------------
5766 \fn sme_SetKeepAlive
5767 \brief API to set the Keep Alive feature.
5768 \param hHal - The handle returned by macOpen.
5769 \param pRequest - Pointer to the Keep Alive request.
5770 \return eHalStatus
5771 ---------------------------------------------------------------------------*/
Jeff Johnsone7245742012-09-05 17:12:55 -07005772eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
5773 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07005774{
5775 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5776 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07005777 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5778 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07005779 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07005780 sme_ReleaseGlobalLock( &pMac->sme );
5781 }
5782
5783 return (status);
5784}
5785
5786#ifdef FEATURE_WLAN_SCAN_PNO
5787/* ---------------------------------------------------------------------------
5788 \fn sme_SetPreferredNetworkList
5789 \brief API to set the Preferred Network List Offload feature.
5790 \param hHal - The handle returned by macOpen.
5791 \param pRequest - Pointer to the offload request.
5792 \return eHalStatus
5793 ---------------------------------------------------------------------------*/
5794eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
5795{
5796 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5797 eHalStatus status;
5798
5799 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5800 {
5801 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
5802 sme_ReleaseGlobalLock( &pMac->sme );
5803 }
5804
5805 return (status);
5806}
5807
5808eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
5809{
5810 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5811 eHalStatus status;
5812
5813 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5814 {
5815 pmcSetRssiFilter(hHal, rssiThreshold);
5816 sme_ReleaseGlobalLock( &pMac->sme );
5817 }
5818
5819 return (status);
5820}
5821
5822#endif // FEATURE_WLAN_SCAN_PNO
5823
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005824eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07005825{
5826 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5827 eHalStatus status;
5828
5829 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5830 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08005831 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07005832 sme_ReleaseGlobalLock( &pMac->sme );
5833 }
5834
5835 return (status);
5836}
5837
5838/* ---------------------------------------------------------------------------
5839 \fn sme_AbortMacScan
5840 \brief API to cancel MAC scan.
5841 \param hHal - The handle returned by macOpen.
5842 \return VOS_STATUS
5843 VOS_STATUS_E_FAILURE - failure
5844 VOS_STATUS_SUCCESS success
5845 ---------------------------------------------------------------------------*/
5846eHalStatus sme_AbortMacScan(tHalHandle hHal)
5847{
5848 eHalStatus status;
5849 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5850
5851 status = sme_AcquireGlobalLock( &pMac->sme );
5852 if ( HAL_STATUS_SUCCESS( status ) )
5853 {
5854 status = csrScanAbortMacScan(pMac);
5855
5856 sme_ReleaseGlobalLock( &pMac->sme );
5857 }
5858
5859 return ( status );
5860}
5861
5862/* ----------------------------------------------------------------------------
5863 \fn sme_GetOperationChannel
5864 \brief API to get current channel on which STA is parked
5865 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005866 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07005867 \returns eHAL_STATUS_SUCCESS
5868 eHAL_STATUS_FAILURE
5869-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005870eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07005871{
Jeff Johnson295189b2012-06-20 16:38:30 -07005872 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5873 tCsrRoamSession *pSession;
5874
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005875 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07005876 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005877 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07005878
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005879 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
5880 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005881 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07005882 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
5883 {
5884 *pChannel =pSession->connectedProfile.operationChannel;
5885 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07005886 }
5887 }
5888 return eHAL_STATUS_FAILURE;
5889}// sme_GetOperationChannel ends here
5890
Jeff Johnson295189b2012-06-20 16:38:30 -07005891/* ---------------------------------------------------------------------------
5892
5893 \fn sme_RegisterMgtFrame
5894
5895 \brief To register managment frame of specified type and subtype.
5896 \param frameType - type of the frame that needs to be passed to HDD.
5897 \param matchData - data which needs to be matched before passing frame
5898 to HDD.
5899 \param matchDataLen - Length of matched data.
5900 \return eHalStatus
5901 -------------------------------------------------------------------------------*/
5902eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5903 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5904{
5905 eHalStatus status = eHAL_STATUS_SUCCESS;
5906 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5907
5908 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5909 {
5910 tSirRegisterMgmtFrame *pMsg;
5911 tANI_U16 len;
5912 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005913
5914 if(!pSession)
5915 {
5916 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005917 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005918 return eHAL_STATUS_FAILURE;
5919 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005920
5921 if( !pSession->sessionActive )
5922 {
5923 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005924 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005925 sme_ReleaseGlobalLock( &pMac->sme );
5926 return eHAL_STATUS_FAILURE;
5927 }
5928
5929 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5930
5931 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5932 if(HAL_STATUS_SUCCESS(status))
5933 {
5934 palZeroMemory(pMac->hHdd, pMsg, len);
5935 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5936 pMsg->length = len;
5937 pMsg->sessionId = sessionId;
5938 pMsg->registerFrame = VOS_TRUE;
5939 pMsg->frameType = frameType;
5940 pMsg->matchLen = matchLen;
5941 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5942 status = palSendMBMessage(pMac->hHdd, pMsg);
5943 }
5944 sme_ReleaseGlobalLock( &pMac->sme );
5945 }
5946 return status;
5947}
5948
5949/* ---------------------------------------------------------------------------
5950
5951 \fn sme_DeregisterMgtFrame
5952
5953 \brief To De-register managment frame of specified type and subtype.
5954 \param frameType - type of the frame that needs to be passed to HDD.
5955 \param matchData - data which needs to be matched before passing frame
5956 to HDD.
5957 \param matchDataLen - Length of matched data.
5958 \return eHalStatus
5959 -------------------------------------------------------------------------------*/
5960eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
5961 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
5962{
5963 eHalStatus status = eHAL_STATUS_SUCCESS;
5964 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5965
5966 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
5967 {
5968 tSirRegisterMgmtFrame *pMsg;
5969 tANI_U16 len;
5970 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005971
5972 if(!pSession)
5973 {
5974 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005975 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07005976 return eHAL_STATUS_FAILURE;
5977 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005978
5979 if( !pSession->sessionActive )
5980 {
5981 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07005982 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07005983 sme_ReleaseGlobalLock( &pMac->sme );
5984 return eHAL_STATUS_FAILURE;
5985 }
5986
5987 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
5988
5989 status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, len );
5990 if(HAL_STATUS_SUCCESS(status))
5991 {
5992 palZeroMemory(pMac->hHdd, pMsg, len);
5993 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
5994 pMsg->length = len;
5995 pMsg->registerFrame = VOS_FALSE;
5996 pMsg->frameType = frameType;
5997 pMsg->matchLen = matchLen;
5998 palCopyMemory( pMac, pMsg->matchData, matchData, matchLen);
5999 status = palSendMBMessage(pMac->hHdd, pMsg);
6000 }
6001 sme_ReleaseGlobalLock( &pMac->sme );
6002 }
6003 return status;
6004}
6005
6006/* ---------------------------------------------------------------------------
6007 \fn sme_RemainOnChannel
6008 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
6009 \param hHal - The handle returned by macOpen.
6010 \param pRequest - channel
6011 \param duration - duration in ms
6012 \param callback - HDD registered callback to process reaminOnChannelRsp
6013 \param context - HDD Callback param
6014 \return eHalStatus
6015 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006016eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
6017 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306018 remainOnChanCallback callback,
6019 void *pContext,
6020 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07006021{
6022 eHalStatus status = eHAL_STATUS_SUCCESS;
6023 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6024
6025 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6026 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306027 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
6028 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07006029#ifdef WLAN_FEATURE_P2P_INTERNAL
6030 , eP2PRemainOnChnReasonUnknown
6031#endif
6032 );
6033 sme_ReleaseGlobalLock( &pMac->sme );
6034 }
6035 return(status);
6036}
6037
6038/* ---------------------------------------------------------------------------
6039 \fn sme_ReportProbeReq
6040 \brief API to enable/disable forwarding of probeReq to apps in p2p.
6041 \param hHal - The handle returned by macOpen.
6042 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
6043 \return eHalStatus
6044 ---------------------------------------------------------------------------*/
6045
6046#ifndef WLAN_FEATURE_CONCURRENT_P2P
6047eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
6048{
6049 eHalStatus status = eHAL_STATUS_SUCCESS;
6050 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6051
6052 do
6053 {
6054 //acquire the lock for the sme object
6055 status = sme_AcquireGlobalLock(&pMac->sme);
6056 if(HAL_STATUS_SUCCESS(status))
6057 {
6058 /* call set in context */
6059 pMac->p2pContext.probeReqForwarding = flag;
6060 //release the lock for the sme object
6061 sme_ReleaseGlobalLock( &pMac->sme );
6062 }
6063 } while(0);
6064
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006065 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006066
6067 return(status);
6068}
6069
6070/* ---------------------------------------------------------------------------
6071 \fn sme_updateP2pIe
6072 \brief API to set the P2p Ie in p2p context
6073 \param hHal - The handle returned by macOpen.
6074 \param p2pIe - Ptr to p2pIe from HDD.
6075 \param p2pIeLength: length of p2pIe
6076 \return eHalStatus
6077 ---------------------------------------------------------------------------*/
6078
6079eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
6080{
6081 eHalStatus status = eHAL_STATUS_SUCCESS;
6082 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6083
6084 //acquire the lock for the sme object
6085 status = sme_AcquireGlobalLock(&pMac->sme);
6086 if(HAL_STATUS_SUCCESS(status))
6087 {
6088 if(NULL != pMac->p2pContext.probeRspIe){
6089 vos_mem_free(pMac->p2pContext.probeRspIe);
6090 pMac->p2pContext.probeRspIeLength = 0;
6091 }
6092
6093 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
6094 if (NULL == pMac->p2pContext.probeRspIe)
6095 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006096 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006097 pMac->p2pContext.probeRspIeLength = 0;
6098 status = eHAL_STATUS_FAILURE;
6099 }
6100 else
6101 {
6102 pMac->p2pContext.probeRspIeLength = p2pIeLength;
6103
6104 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
6105 pMac->p2pContext.probeRspIe,
6106 pMac->p2pContext.probeRspIeLength );
6107 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
6108 p2pIeLength);
6109 }
6110
6111 //release the lock for the sme object
6112 sme_ReleaseGlobalLock( &pMac->sme );
6113 }
6114
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006115 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006116
6117 return(status);
6118}
6119#endif
6120
6121/* ---------------------------------------------------------------------------
6122 \fn sme_sendAction
6123 \brief API to send action frame from supplicant.
6124 \param hHal - The handle returned by macOpen.
6125 \return eHalStatus
6126 ---------------------------------------------------------------------------*/
6127
6128eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006129 const tANI_U8 *pBuf, tANI_U32 len,
6130 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07006131{
6132 eHalStatus status = eHAL_STATUS_SUCCESS;
6133 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6134
6135 //acquire the lock for the sme object
6136 status = sme_AcquireGlobalLock(&pMac->sme);
6137 if(HAL_STATUS_SUCCESS(status))
6138 {
Jeff Johnsone7245742012-09-05 17:12:55 -07006139 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07006140 //release the lock for the sme object
6141 sme_ReleaseGlobalLock( &pMac->sme );
6142 }
6143
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006144 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006145
6146 return(status);
6147}
6148
6149eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
6150{
6151 eHalStatus status = eHAL_STATUS_SUCCESS;
6152 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6153
6154 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6155 {
6156 status = p2pCancelRemainOnChannel (hHal, sessionId);
6157 sme_ReleaseGlobalLock( &pMac->sme );
6158 }
6159 return(status);
6160}
6161
6162//Power Save Related
6163eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
6164{
6165 eHalStatus status = eHAL_STATUS_SUCCESS;
6166 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6167
6168 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6169 {
6170 status = p2pSetPs (hHal, data);
6171 sme_ReleaseGlobalLock( &pMac->sme );
6172 }
6173 return(status);
6174}
6175
Jeff Johnson295189b2012-06-20 16:38:30 -07006176
6177/* ---------------------------------------------------------------------------
6178
6179 \fn sme_ConfigureRxpFilter
6180
6181 \brief
6182 SME will pass this request to lower mac to set/reset the filter on RXP for
6183 multicast & broadcast traffic.
6184
6185 \param
6186
6187 hHal - The handle returned by macOpen.
6188
6189 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
6190 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
6191 on this param. In future we can use this as a mask to set various types of
6192 filters as suggested below:
6193 FILTER_ALL_MULTICAST:
6194 FILTER_ALL_BROADCAST:
6195 FILTER_ALL_MULTICAST_BROADCAST:
6196
6197
6198 \return eHalStatus
6199
6200
6201--------------------------------------------------------------------------- */
6202eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
6203 tpSirWlanSetRxpFilters wlanRxpFilterParam)
6204{
6205 eHalStatus status = eHAL_STATUS_SUCCESS;
6206 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6207 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6208 vos_msg_t vosMessage;
6209
6210 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6211 {
6212 /* serialize the req through MC thread */
6213 vosMessage.bodyptr = wlanRxpFilterParam;
6214 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
6215 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6216 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6217 {
6218 status = eHAL_STATUS_FAILURE;
6219 }
6220 sme_ReleaseGlobalLock( &pMac->sme );
6221 }
6222 return(status);
6223}
6224
Jeff Johnson295189b2012-06-20 16:38:30 -07006225/* ---------------------------------------------------------------------------
6226
6227 \fn sme_ConfigureSuspendInd
6228
6229 \brief
6230 SME will pass this request to lower mac to Indicate that the wlan needs to
6231 be suspended
6232
6233 \param
6234
6235 hHal - The handle returned by macOpen.
6236
6237 wlanSuspendParam- Depicts the wlan suspend params
6238
6239
6240 \return eHalStatus
6241
6242
6243--------------------------------------------------------------------------- */
6244eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
6245 tpSirWlanSuspendParam wlanSuspendParam)
6246{
6247 eHalStatus status = eHAL_STATUS_SUCCESS;
6248 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6249 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6250 vos_msg_t vosMessage;
6251
6252 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6253 {
6254 /* serialize the req through MC thread */
6255 vosMessage.bodyptr = wlanSuspendParam;
6256 vosMessage.type = WDA_WLAN_SUSPEND_IND;
6257 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6258 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6259 {
6260 status = eHAL_STATUS_FAILURE;
6261 }
6262 sme_ReleaseGlobalLock( &pMac->sme );
6263 }
6264 return(status);
6265}
6266
6267/* ---------------------------------------------------------------------------
6268
6269 \fn sme_ConfigureResumeReq
6270
6271 \brief
6272 SME will pass this request to lower mac to Indicate that the wlan needs to
6273 be Resumed
6274
6275 \param
6276
6277 hHal - The handle returned by macOpen.
6278
6279 wlanResumeParam- Depicts the wlan resume params
6280
6281
6282 \return eHalStatus
6283
6284
6285--------------------------------------------------------------------------- */
6286eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
6287 tpSirWlanResumeParam wlanResumeParam)
6288{
6289 eHalStatus status = eHAL_STATUS_SUCCESS;
6290 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6291 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6292 vos_msg_t vosMessage;
6293
6294 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6295 {
6296 /* serialize the req through MC thread */
6297 vosMessage.bodyptr = wlanResumeParam;
6298 vosMessage.type = WDA_WLAN_RESUME_REQ;
6299 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6300 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6301 {
6302 status = eHAL_STATUS_FAILURE;
6303 }
6304 sme_ReleaseGlobalLock( &pMac->sme );
6305 }
6306 return(status);
6307}
6308
Jeff Johnson295189b2012-06-20 16:38:30 -07006309/* ---------------------------------------------------------------------------
6310
6311 \fn sme_GetInfraSessionId
6312
6313 \brief To get the session ID for infra session, if connected
6314 This is a synchronous API.
6315
6316 \param hHal - The handle returned by macOpen.
6317
6318 \return sessionid, -1 if infra session is not connected
6319
6320 -------------------------------------------------------------------------------*/
6321tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
6322{
6323 eHalStatus status = eHAL_STATUS_FAILURE;
6324 tANI_S8 sessionid = -1;
6325 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6326
6327 status = sme_AcquireGlobalLock( &pMac->sme );
6328 if ( HAL_STATUS_SUCCESS( status ) )
6329 {
6330
6331 sessionid = csrGetInfraSessionId( pMac);
6332
6333 sme_ReleaseGlobalLock( &pMac->sme );
6334 }
6335
6336 return (sessionid);
6337}
6338
6339/* ---------------------------------------------------------------------------
6340
6341 \fn sme_GetInfraOperationChannel
6342
6343 \brief To get the operating channel for infra session, if connected
6344 This is a synchronous API.
6345
6346 \param hHal - The handle returned by macOpen.
6347 \param sessionId - the sessionId returned by sme_OpenSession.
6348
6349 \return operating channel, 0 if infra session is not connected
6350
6351 -------------------------------------------------------------------------------*/
6352tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
6353{
6354 eHalStatus status = eHAL_STATUS_FAILURE;
6355 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6356 tANI_U8 channel = 0;
6357 status = sme_AcquireGlobalLock( &pMac->sme );
6358 if ( HAL_STATUS_SUCCESS( status ) )
6359 {
6360
6361 channel = csrGetInfraOperationChannel( pMac, sessionId);
6362
6363 sme_ReleaseGlobalLock( &pMac->sme );
6364 }
6365
6366 return (channel);
6367}
6368
6369//This routine will return poerating channel on which other BSS is operating to be used for concurrency mode.
6370//If other BSS is not up or not connected it will return 0
6371tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
6372{
6373 eHalStatus status = eHAL_STATUS_FAILURE;
6374 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6375 tANI_U8 channel = 0;
6376 status = sme_AcquireGlobalLock( &pMac->sme );
6377 if ( HAL_STATUS_SUCCESS( status ) )
6378 {
6379
6380 channel = csrGetConcurrentOperationChannel( pMac );
6381 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006382 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07006383 sme_ReleaseGlobalLock( &pMac->sme );
6384 }
6385
6386 return (channel);
6387}
6388
6389#ifdef FEATURE_WLAN_SCAN_PNO
6390/******************************************************************************
6391*
6392* Name: sme_PreferredNetworkFoundInd
6393*
6394* Description:
6395* Invoke Preferred Network Found Indication
6396*
6397* Parameters:
6398* hHal - HAL handle for device
6399* pMsg - found network description
6400*
6401* Returns: eHalStatus
6402*
6403******************************************************************************/
6404eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
6405{
6406 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6407 eHalStatus status = eHAL_STATUS_SUCCESS;
6408 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07006409 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
6410 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006411
6412 if (NULL == pMsg)
6413 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006414 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006415 status = eHAL_STATUS_FAILURE;
6416 }
6417 else
6418 {
6419 if (pPrefNetworkFoundInd->ssId.length > 0)
6420 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07006421 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
6422 pPrefNetworkFoundInd->ssId.length);
6423 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
6424 dumpSsId[ssIdLength] = 0;
6425 smsLog(pMac, LOG2, "%s:SSID=%s frame length %d",
6426 __func__, dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07006427
Srikant Kuppa066904f2013-05-07 13:56:02 -07006428 //Save the frame to scan result
6429 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
6430 {
6431 //we may have a frame
6432 status = csrScanSavePreferredNetworkFound(pMac,
6433 pPrefNetworkFoundInd);
6434 if (!HAL_STATUS_SUCCESS(status))
6435 {
6436 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
6437 }
6438 }
6439 else
6440 {
6441 smsLog(pMac, LOGE, FL(" not enough data length %d needed %d"),
6442 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07006443 }
6444
Srikant Kuppa066904f2013-05-07 13:56:02 -07006445 /* Call Preferred Netowrk Found Indication callback routine. */
6446 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
6447 {
6448 pMac->pmc.prefNetwFoundCB(
6449 pMac->pmc.preferredNetworkFoundIndCallbackContext,
6450 pPrefNetworkFoundInd);
6451 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006452 }
6453 else
6454 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006455 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006456 status = eHAL_STATUS_FAILURE;
6457 }
6458 }
6459
6460
6461 return(status);
6462}
6463
6464#endif // FEATURE_WLAN_SCAN_PNO
6465
6466
6467eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
6468{
6469 eHalStatus status = eHAL_STATUS_FAILURE;
6470 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6471
6472 status = sme_AcquireGlobalLock( &pMac->sme );
6473 if ( HAL_STATUS_SUCCESS( status ) )
6474 {
6475 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
6476 sme_ReleaseGlobalLock( &pMac->sme );
6477 }
6478
6479 return (status);
6480}
6481
6482
6483/* ---------------------------------------------------------------------------
6484
6485 \fn sme_SetTxPerTracking
6486
6487 \brief Set Tx PER tracking configuration parameters
6488
6489 \param hHal - The handle returned by macOpen.
6490 \param pTxPerTrackingConf - Tx PER configuration parameters
6491
6492 \return eHalStatus
6493
6494 -------------------------------------------------------------------------------*/
6495eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
6496 void (*pCallbackfn) (void *pCallbackContext),
6497 void *pCallbackContext,
6498 tpSirTxPerTrackingParam pTxPerTrackingParam)
6499{
6500 vos_msg_t msg;
6501 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
6502 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6503
6504 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6505 {
6506 pMac->sme.pTxPerHitCallback = pCallbackfn;
6507 pMac->sme.pTxPerHitCbContext = pCallbackContext;
6508 sme_ReleaseGlobalLock( &pMac->sme );
6509 }
6510
6511 // free this memory in failure case or WDA request callback function
6512 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
6513 if (NULL == pTxPerTrackingParamReq)
6514 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006515 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 -07006516 return eHAL_STATUS_FAILURE;
6517 }
6518
6519 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam, sizeof(tSirTxPerTrackingParam));
6520 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
6521 msg.reserved = 0;
6522 msg.bodyptr = pTxPerTrackingParamReq;
6523
6524 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6525 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006526 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 -07006527 vos_mem_free(pTxPerTrackingParamReq);
6528 return eHAL_STATUS_FAILURE;
6529 }
6530
6531 return eHAL_STATUS_SUCCESS;
6532}
6533
6534/* ---------------------------------------------------------------------------
6535
6536 \fn sme_HandleChangeCountryCode
6537
6538 \brief Change Country code, Reg Domain and channel list
6539
6540 \details Country Code Priority
6541 0 = 11D > Configured Country > NV
6542 1 = Configured Country > 11D > NV
6543 If Supplicant country code is priority than 11d is disabled.
6544 If 11D is enabled, we update the country code after every scan.
6545 Hence when Supplicant country code is priority, we don't need 11D info.
6546 Country code from Supplicant is set as current courtry code.
6547 User can send reset command XX (instead of country code) to reset the
6548 country code to default values which is read from NV.
6549 In case of reset, 11D is enabled and default NV code is Set as current country code
6550 If 11D is priority,
6551 Than Supplicant country code code is set to default code. But 11D code is set as current country code
6552
6553 \param pMac - The handle returned by macOpen.
6554 \param pMsgBuf - MSG Buffer
6555
6556 \return eHalStatus
6557
6558 -------------------------------------------------------------------------------*/
6559eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
6560{
6561 eHalStatus status = eHAL_STATUS_SUCCESS;
6562 tAniChangeCountryCodeReq *pMsg;
6563 v_REGDOMAIN_t domainIdIoctl;
6564 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6565 static uNvTables nvTables;
6566 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
6567
6568
6569 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
6570 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
6571 {
6572 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6573
6574 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
6575
6576 /* read the country code from NV and use it */
6577 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
6578 {
6579 palCopyMemory( pMac->hHdd, pMsg->countryCode , nvTables.defaultCountryTable.countryCode, WNI_CFG_COUNTRY_CODE_LEN );
6580 }
6581 else
6582 {
6583 status = eHAL_STATUS_FAILURE;
6584 return status;
6585 }
6586 }
6587 else
6588 {
6589 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05306590 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
6591 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07006592 {
6593 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
6594 }
6595 }
6596
6597 /* WEXT set country code means
6598 * 11D should be supported?
6599 * 11D Channel should be enforced?
6600 * 11D Country code should be matched?
6601 * 11D Reg Domian should be matched?
6602 * Country string changed */
6603 if(pMac->roam.configParam.Is11dSupportEnabled &&
6604 pMac->roam.configParam.fEnforce11dChannels &&
6605 pMac->roam.configParam.fEnforceCountryCodeMatch &&
6606 pMac->roam.configParam.fEnforceDefaultDomain &&
6607 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
6608 {
6609 /* All 11D related options are already enabled
6610 * Country string is not changed
6611 * Do not need do anything for country code change request */
6612 return eHAL_STATUS_SUCCESS;
6613 }
6614
6615 /* Set Current Country code and Current Regulatory domain */
6616 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
6617 if(eHAL_STATUS_SUCCESS != status)
6618 {
6619 /* Supplicant country code failed. So give 11D priority */
6620 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
6621 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
6622 return status;
6623 }
6624
Jeff Johnson295189b2012-06-20 16:38:30 -07006625 /* overwrite the defualt country code */
6626 palCopyMemory(pMac->hHdd, pMac->scan.countryCodeDefault, pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
6627
6628 /* Get Domain ID from country code */
6629 status = csrGetRegulatoryDomainForCountry( pMac, pMac->scan.countryCodeCurrent,(v_REGDOMAIN_t *) &domainIdIoctl );
6630 if ( status != eHAL_STATUS_SUCCESS )
6631 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006632 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006633 return status;
6634 }
6635
6636 status = WDA_SetRegDomain(pMac, domainIdIoctl);
6637
6638 if ( status != eHAL_STATUS_SUCCESS )
6639 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006640 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07006641 return status;
6642 }
6643
6644 /* set to default domain ID */
6645 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
6646
6647 /* get the channels based on new cc */
6648 status = csrInitGetChannels( pMac );
6649
6650 if ( status != eHAL_STATUS_SUCCESS )
6651 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006652 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07006653 return status;
6654 }
6655
6656 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08006657 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Jeff Johnson295189b2012-06-20 16:38:30 -07006658 if( pMsg->changeCCCallback )
6659 {
6660 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
6661 }
6662
6663 return eHAL_STATUS_SUCCESS;
6664}
6665
6666#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08006667eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07006668{
6669 tpSirRcvFltMcAddrList pRequestBuf;
6670 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006671 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07006672 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07006673
6674 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05306675 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006676 pMulticastAddrs->ulMulticastAddrCnt,
6677 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07006678
6679 /*
6680 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08006681 */
6682 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
6683 csrIsConnStateInfra(pMac, sessionId))
6684 {
6685 pSession = CSR_GET_SESSION( pMac, sessionId );
6686 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006687
6688 if(pSession == NULL )
6689 {
6690 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006691 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006692 return eHAL_STATUS_FAILURE;
6693 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006694
Jeff Johnson295189b2012-06-20 16:38:30 -07006695 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
6696 if (NULL == pRequestBuf)
6697 {
6698 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006699 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006700 return eHAL_STATUS_FAILED_ALLOC;
6701 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08006702
6703 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
6704 {
6705 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
6706 "indication as we are not connected", __func__);
6707 vos_mem_free(pRequestBuf);
6708 return eHAL_STATUS_FAILURE;
6709 }
6710
Jeff Johnson295189b2012-06-20 16:38:30 -07006711 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
6712
Jeff Johnsone7245742012-09-05 17:12:55 -07006713 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6714 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
6715 sizeof(tSirMacAddr));
6716
Jeff Johnson295189b2012-06-20 16:38:30 -07006717 msg.type = WDA_8023_MULTICAST_LIST_REQ;
6718 msg.reserved = 0;
6719 msg.bodyptr = pRequestBuf;
6720 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6721 {
6722 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006723 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006724 vos_mem_free(pRequestBuf);
6725 return eHAL_STATUS_FAILURE;
6726 }
6727
6728 return eHAL_STATUS_SUCCESS;
6729}
6730
Jeff Johnsone7245742012-09-05 17:12:55 -07006731eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
6732 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006733{
6734 tpSirRcvPktFilterCfgType pRequestBuf;
6735 v_SINT_t allocSize;
6736 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006737 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6738 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006739 v_U8_t idx=0;
6740
6741 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006742 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006743 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
6744
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07006745 allocSize = sizeof(tSirRcvPktFilterCfgType);
6746
Jeff Johnson295189b2012-06-20 16:38:30 -07006747 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006748
6749 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006750 {
6751 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006752 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006753 return eHAL_STATUS_FAILED_ALLOC;
6754 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006755
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006756 if( NULL == pSession )
6757 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006758 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006759 vos_mem_free(pRequestBuf);
6760 return eHAL_STATUS_FAILURE;
6761 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006762
6763 vos_mem_copy( pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6764 vos_mem_copy( pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006765 sizeof(tSirMacAddr));
6766
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006767 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
6768
Jeff Johnson295189b2012-06-20 16:38:30 -07006769 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
6770 msg.reserved = 0;
6771 msg.bodyptr = pRequestBuf;
6772
6773 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6774 "FT %d FID %d ",
6775 pRequestBuf->filterType, pRequestBuf->filterId);
6776
6777 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
6778 "params %d CT %d",
6779 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
6780
6781 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
6782 {
6783
6784 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006785 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07006786 pRequestBuf->paramsData[idx].protocolLayer,
6787 pRequestBuf->paramsData[idx].cmpFlag);
6788
6789 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006790 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006791 pRequestBuf->paramsData[idx].dataOffset,
6792 pRequestBuf->paramsData[idx].dataLength);
6793
6794 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006795 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006796 pRequestBuf->paramsData[idx].compareData[0],
6797 pRequestBuf->paramsData[idx].compareData[1],
6798 pRequestBuf->paramsData[idx].compareData[2],
6799 pRequestBuf->paramsData[idx].compareData[3],
6800 pRequestBuf->paramsData[idx].compareData[4],
6801 pRequestBuf->paramsData[idx].compareData[5]);
6802
6803 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006804 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07006805 pRequestBuf->paramsData[idx].dataMask[0],
6806 pRequestBuf->paramsData[idx].dataMask[1],
6807 pRequestBuf->paramsData[idx].dataMask[2],
6808 pRequestBuf->paramsData[idx].dataMask[3],
6809 pRequestBuf->paramsData[idx].dataMask[4],
6810 pRequestBuf->paramsData[idx].dataMask[5]);
6811
6812 }
6813
6814 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6815 {
6816 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006817 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006818 vos_mem_free(pRequestBuf);
6819 return eHAL_STATUS_FAILURE;
6820 }
6821
6822 return eHAL_STATUS_SUCCESS;
6823}
6824
6825eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
6826 FilterMatchCountCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006827 void *callbackContext,
6828 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006829{
6830 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6831 eHalStatus status;
6832
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006833 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006834
6835 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
6836 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006837 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006838 sme_ReleaseGlobalLock( &pMac->sme );
6839 }
6840
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006841 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006842
6843 return (status);
6844}
6845
Jeff Johnsone7245742012-09-05 17:12:55 -07006846eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
6847 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006848{
6849 tpSirRcvFltPktClearParam pRequestBuf;
6850 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07006851 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6852 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006853
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006854 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07006855 pRcvFltPktClearParam->filterId);
6856
6857 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006858 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07006859 {
6860 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
6861 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006862 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006863 return eHAL_STATUS_FAILED_ALLOC;
6864 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006865 if( NULL == pSession )
6866 {
6867 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006868 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006869 vos_mem_free(pRequestBuf);
6870 return eHAL_STATUS_FAILURE;
6871 }
Jeff Johnson295189b2012-06-20 16:38:30 -07006872
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006873 vos_mem_copy( pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr));
6874 vos_mem_copy( pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
Jeff Johnsone7245742012-09-05 17:12:55 -07006875 sizeof(tSirMacAddr));
6876
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006877 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
6878
Jeff Johnson295189b2012-06-20 16:38:30 -07006879 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
6880 msg.reserved = 0;
6881 msg.bodyptr = pRequestBuf;
6882 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6883 {
6884 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006885 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006886 vos_mem_free(pRequestBuf);
6887 return eHAL_STATUS_FAILURE;
6888 }
6889
6890 return eHAL_STATUS_SUCCESS;
6891}
6892#endif // WLAN_FEATURE_PACKET_FILTERING
6893
6894/* ---------------------------------------------------------------------------
6895 \fn sme_PreChannelSwitchIndFullPowerCB
6896 \brief call back function for the PMC full power request because of pre
6897 channel switch.
6898 \param callbackContext
6899 \param status
6900 ---------------------------------------------------------------------------*/
6901void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
6902 eHalStatus status)
6903{
6904 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
6905 tSirMbMsg *pMsg;
6906 tANI_U16 msgLen;
6907
6908 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
6909 status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen);
6910 if(HAL_STATUS_SUCCESS(status))
6911 {
6912 palZeroMemory(pMac->hHdd, (void *)pMsg, msgLen);
6913 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
6914 pMsg->msgLen = pal_cpu_to_be16(msgLen);
6915 status = palSendMBMessage(pMac->hHdd, pMsg);
6916 }
6917
6918 return;
6919}
6920
6921/* ---------------------------------------------------------------------------
6922 \fn sme_HandlePreChannelSwitchInd
6923 \brief Processes the indcation from PE for pre-channel switch.
6924 \param hHal
6925 \- The handle returned by macOpen. return eHalStatus
6926 ---------------------------------------------------------------------------*/
6927eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
6928{
6929 eHalStatus status = eHAL_STATUS_FAILURE;
6930 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6931 status = sme_AcquireGlobalLock( &pMac->sme );
6932 if ( HAL_STATUS_SUCCESS( status ) )
6933 {
6934 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
6935 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
6936 sme_ReleaseGlobalLock( &pMac->sme );
6937 }
6938
6939 return (status);
6940}
6941
6942/* ---------------------------------------------------------------------------
6943 \fn sme_HandlePostChannelSwitchInd
6944 \brief Processes the indcation from PE for post-channel switch.
6945 \param hHal
6946 \- The handle returned by macOpen. return eHalStatus
6947 ---------------------------------------------------------------------------*/
6948eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
6949{
6950 eHalStatus status = eHAL_STATUS_FAILURE;
6951 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6952
6953 status = sme_AcquireGlobalLock( &pMac->sme );
6954 if ( HAL_STATUS_SUCCESS( status ) )
6955 {
6956 status = pmcRequestBmps(hHal, NULL, NULL);
6957 sme_ReleaseGlobalLock( &pMac->sme );
6958 }
6959
6960 return (status);
6961}
6962
6963/* ---------------------------------------------------------------------------
6964
6965 \fn sme_IsChannelValid
6966
6967 \brief To check if the channel is valid for currently established domain
6968 This is a synchronous API.
6969
6970 \param hHal - The handle returned by macOpen.
6971 \param channel - channel to verify
6972
6973 \return TRUE/FALSE, TRUE if channel is valid
6974
6975 -------------------------------------------------------------------------------*/
6976tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
6977{
6978 eHalStatus status = eHAL_STATUS_FAILURE;
6979 tANI_BOOLEAN valid = FALSE;
6980 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6981
6982 status = sme_AcquireGlobalLock( &pMac->sme );
6983 if ( HAL_STATUS_SUCCESS( status ) )
6984 {
6985
6986 valid = csrRoamIsChannelValid( pMac, channel);
6987
6988 sme_ReleaseGlobalLock( &pMac->sme );
6989 }
6990
6991 return (valid);
6992}
6993
6994/* ---------------------------------------------------------------------------
6995 \fn sme_SetFreqBand
6996 \brief Used to set frequency band.
6997 \param hHal
6998 \eBand band value to be configured
6999 \- return eHalStatus
7000 -------------------------------------------------------------------------*/
7001eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
7002{
7003 eHalStatus status = eHAL_STATUS_FAILURE;
7004 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7005
7006 status = sme_AcquireGlobalLock( &pMac->sme );
7007 if ( HAL_STATUS_SUCCESS( status ) )
7008 {
7009 status = csrSetBand(hHal, eBand);
7010 sme_ReleaseGlobalLock( &pMac->sme );
7011 }
7012 return status;
7013}
7014
7015/* ---------------------------------------------------------------------------
7016 \fn sme_GetFreqBand
7017 \brief Used to get the current band settings.
7018 \param hHal
7019 \pBand pointer to hold band value
7020 \- return eHalStatus
7021 -------------------------------------------------------------------------*/
7022eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
7023{
7024 eHalStatus status = eHAL_STATUS_FAILURE;
7025 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7026
7027 status = sme_AcquireGlobalLock( &pMac->sme );
7028 if ( HAL_STATUS_SUCCESS( status ) )
7029 {
7030 *pBand = csrGetCurrentBand( hHal );
7031 sme_ReleaseGlobalLock( &pMac->sme );
7032 }
7033 return status;
7034}
7035
7036#ifdef WLAN_WAKEUP_EVENTS
7037/******************************************************************************
7038 \fn sme_WakeReasonIndCallback
7039
7040 \brief
7041 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
7042
7043 \param hHal - HAL handle for device
7044 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
7045
7046 \return eHalStatus
7047******************************************************************************/
7048eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
7049{
7050 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7051 eHalStatus status = eHAL_STATUS_SUCCESS;
7052 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
7053
7054 if (NULL == pMsg)
7055 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007056 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007057 status = eHAL_STATUS_FAILURE;
7058 }
7059 else
7060 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007061 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07007062
7063 /* Call Wake Reason Indication callback routine. */
7064 if (pMac->pmc.wakeReasonIndCB != NULL)
7065 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
7066
7067 pMac->pmc.wakeReasonIndCB = NULL;
7068 pMac->pmc.wakeReasonIndCBContext = NULL;
7069
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007070 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07007071 }
7072
7073 return(status);
7074}
7075#endif // WLAN_WAKEUP_EVENTS
7076
7077
7078/* ---------------------------------------------------------------------------
7079
7080 \fn sme_SetMaxTxPower
7081
7082 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
7083 not persist over reboots.
7084
7085 \param hHal
7086 \param pBssid BSSID to set the power cap for
7087 \param pBssid pSelfMacAddress self MAC Address
7088 \param pBssid power to set in dB
7089 \- return eHalStatus
7090
7091 -------------------------------------------------------------------------------*/
7092eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
7093 tSirMacAddr pSelfMacAddress, v_S7_t dB)
7094{
7095 vos_msg_t msg;
7096 tpMaxTxPowerParams pMaxTxParams = NULL;
7097
7098 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
7099 if (NULL == pMaxTxParams)
7100 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007101 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 -07007102 return eHAL_STATUS_FAILURE;
7103 }
7104
7105 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
7106 vos_mem_copy(pMaxTxParams->selfStaMacAddr , pSelfMacAddress,
7107 SIR_MAC_ADDR_LENGTH);
7108 pMaxTxParams->power = dB;
7109
7110 msg.type = WDA_SET_MAX_TX_POWER_REQ;
7111 msg.reserved = 0;
7112 msg.bodyptr = pMaxTxParams;
7113
7114 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7115 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007116 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 -07007117 vos_mem_free(pMaxTxParams);
7118 return eHAL_STATUS_FAILURE;
7119 }
7120
7121 return eHAL_STATUS_SUCCESS;
7122}
7123
Jeff Johnson295189b2012-06-20 16:38:30 -07007124/* ---------------------------------------------------------------------------
7125
schang86c22c42013-03-13 18:41:24 -07007126 \fn sme_SetTxPower
7127
7128 \brief Set Transmit Power dynamically. Note: this setting will
7129 not persist over reboots.
7130
7131 \param hHal
7132 \param sessionId Target Session ID
7133 \param mW power to set in mW
7134 \- return eHalStatus
7135
7136 -------------------------------------------------------------------------------*/
7137eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
7138{
7139
7140 eHalStatus status = eHAL_STATUS_FAILURE;
7141 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7142
7143 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
7144 status = sme_AcquireGlobalLock(&pMac->sme);
7145 if (HAL_STATUS_SUCCESS(status))
7146 {
7147 status = csrSetTxPower(pMac, sessionId, mW);
7148 sme_ReleaseGlobalLock(&pMac->sme);
7149 }
7150 return status;
7151}
7152
7153/* ---------------------------------------------------------------------------
7154
Jeff Johnson295189b2012-06-20 16:38:30 -07007155 \fn sme_HideSSID
7156
7157 \brief hide/show SSID dynamically. Note: this setting will
7158 not persist over reboots.
7159
7160 \param hHal
7161 \param sessionId
7162 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
7163 \- return eHalStatus
7164
7165 -------------------------------------------------------------------------------*/
7166eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
7167{
7168 eHalStatus status = eHAL_STATUS_SUCCESS;
7169 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7170 tANI_U16 len;
7171
7172 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7173 {
7174 tpSirUpdateParams pMsg;
7175 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007176
7177 if(!pSession)
7178 {
7179 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007180 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007181 return eHAL_STATUS_FAILURE;
7182 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007183
7184 if( !pSession->sessionActive )
7185 VOS_ASSERT(0);
7186
7187 /* Create the message and send to lim */
7188 len = sizeof(tSirUpdateParams);
7189 status = palAllocateMemory( pMac->hHdd, (void **)&pMsg, len );
7190 if(HAL_STATUS_SUCCESS(status))
7191 {
7192 palZeroMemory(pMac->hHdd, pMsg, sizeof(tSirUpdateParams) );
7193 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
7194 pMsg->length = len;
7195 /* Data starts from here */
7196 pMsg->sessionId = sessionId;
7197 pMsg->ssidHidden = ssidHidden;
7198 status = palSendMBMessage(pMac->hHdd, pMsg);
7199 }
7200 sme_ReleaseGlobalLock( &pMac->sme );
7201 }
7202 return status;
7203}
Jeff Johnson295189b2012-06-20 16:38:30 -07007204
7205/* ---------------------------------------------------------------------------
7206
7207 \fn sme_SetTmLevel
7208 \brief Set Thermal Mitigation Level to RIVA
7209 \param hHal - The handle returned by macOpen.
7210 \param newTMLevel - new Thermal Mitigation Level
7211 \param tmMode - Thermal Mitigation handle mode, default 0
7212 \return eHalStatus
7213 ---------------------------------------------------------------------------*/
7214eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
7215{
7216 eHalStatus status = eHAL_STATUS_SUCCESS;
7217 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7218 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7219 vos_msg_t vosMessage;
7220 tAniSetTmLevelReq *setTmLevelReq = NULL;
7221
7222 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7223 {
7224 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
7225 if(NULL == setTmLevelReq)
7226 {
7227 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007228 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007229 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07007230 return eHAL_STATUS_FAILURE;
7231 }
7232
7233 setTmLevelReq->tmMode = tmMode;
7234 setTmLevelReq->newTmLevel = newTMLevel;
7235
7236 /* serialize the req through MC thread */
7237 vosMessage.bodyptr = setTmLevelReq;
7238 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
7239 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7240 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7241 {
7242 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007243 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007244 vos_mem_free(setTmLevelReq);
7245 status = eHAL_STATUS_FAILURE;
7246 }
7247 sme_ReleaseGlobalLock( &pMac->sme );
7248 }
7249 return(status);
7250}
7251
7252/*---------------------------------------------------------------------------
7253
7254 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
7255 Host and FW.
7256
7257 \param hHal - HAL handle for device
7258
7259 \return NONE
7260
7261---------------------------------------------------------------------------*/
7262void sme_featureCapsExchange( tHalHandle hHal)
7263{
7264 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
7265 WDA_featureCapsExchange(vosContext);
7266}
Jeff Johnsond13512a2012-07-17 11:42:19 -07007267
Yathish9f22e662012-12-10 14:21:35 -08007268/*---------------------------------------------------------------------------
7269
7270 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
7271 in Host.
7272
7273 \param hHal - HAL handle for device
7274
7275 \return NONE
7276
7277---------------------------------------------------------------------------*/
7278void sme_disableFeatureCapablity(tANI_U8 feature_index)
7279{
7280 WDA_disableCapablityFeature(feature_index);
7281}
7282
7283
Jeff Johnsond13512a2012-07-17 11:42:19 -07007284
7285/* ---------------------------------------------------------------------------
7286
7287 \fn sme_GetDefaultCountryCode
7288
7289 \brief Get the default country code from NV
7290
7291 \param hHal
7292 \param pCountry
7293 \- return eHalStatus
7294
7295 -------------------------------------------------------------------------------*/
7296eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
7297{
7298 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7299 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
7300}
7301
7302/* ---------------------------------------------------------------------------
7303
7304 \fn sme_GetCurrentCountryCode
7305
7306 \brief Get the current country code
7307
7308 \param hHal
7309 \param pCountry
7310 \- return eHalStatus
7311
7312 -------------------------------------------------------------------------------*/
7313eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
7314{
7315 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7316 return csrGetCurrentCountryCode(pMac, pCountry);
7317}
7318
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07007319/* ---------------------------------------------------------------------------
7320 \fn sme_transportDebug
7321 \brief Dynamically monitoring Transport channels
7322 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07007323 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08007324 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07007325 \param toggleStallDetect Enable stall detect feature
7326 This feature will take effect to data performance
7327 Not integrate till fully verification
7328 \- return NONE
7329 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07007330void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07007331{
schang6295e542013-03-12 15:31:23 -07007332 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7333
7334 if (NULL == pMac)
7335 {
7336 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
7337 "%s: invalid context", __func__);
7338 return;
7339 }
7340 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07007341}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007342
Kiran4a17ebe2013-01-31 10:43:43 -08007343/* ---------------------------------------------------------------------------
7344 \fn sme_ResetPowerValuesFor5G
7345 \brief Reset the power values for 5G band with NV power values.
7346 \param hHal - HAL handle for device
7347 \- return NONE
7348 -------------------------------------------------------------------------*/
7349void sme_ResetPowerValuesFor5G (tHalHandle hHal)
7350{
7351 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
7352 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
7353 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
7354}
7355
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007356#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
7357/* ---------------------------------------------------------------------------
7358 \fn sme_UpdateRoamPrefer5GHz
7359 \brief enable/disable Roam prefer 5G runtime option
7360 This function is called through dynamic setConfig callback function
7361 to configure the Roam prefer 5G runtime option
7362 \param hHal - HAL handle for device
7363 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
7364 \- return Success or failure
7365 -------------------------------------------------------------------------*/
7366
7367eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
7368{
7369 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08007370 eHalStatus status = eHAL_STATUS_SUCCESS;
7371
7372 status = sme_AcquireGlobalLock( &pMac->sme );
7373 if ( HAL_STATUS_SUCCESS( status ) )
7374 {
7375 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7376 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
7377 pMac->roam.configParam.nRoamPrefer5GHz,
7378 nRoamPrefer5GHz);
7379 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
7380 sme_ReleaseGlobalLock( &pMac->sme );
7381 }
7382
7383 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08007384}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08007385
7386/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007387 \fn sme_setRoamIntraBand
7388 \brief enable/disable Intra band roaming
7389 This function is called through dynamic setConfig callback function
7390 to configure the intra band roaming
7391 \param hHal - HAL handle for device
7392 \param nRoamIntraBand Enable/Disable Intra band roaming
7393 \- return Success or failure
7394 -------------------------------------------------------------------------*/
7395eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
7396{
7397 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7398 eHalStatus status = eHAL_STATUS_SUCCESS;
7399
7400 status = sme_AcquireGlobalLock( &pMac->sme );
7401 if ( HAL_STATUS_SUCCESS( status ) )
7402 {
7403 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7404 "%s: gRoamIntraBand is changed from %d to %d", __func__,
7405 pMac->roam.configParam.nRoamIntraBand,
7406 nRoamIntraBand);
7407 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
7408 sme_ReleaseGlobalLock( &pMac->sme );
7409 }
7410
7411 return status ;
7412}
7413
7414/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007415 \fn sme_UpdateRoamScanNProbes
7416 \brief function to update roam scan N probes
7417 This function is called through dynamic setConfig callback function
7418 to update roam scan N probes
7419 \param hHal - HAL handle for device
7420 \param nProbes number of probe requests to be sent out
7421 \- return Success or failure
7422 -------------------------------------------------------------------------*/
7423eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
7424{
7425 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7426 eHalStatus status = eHAL_STATUS_SUCCESS;
7427
7428 status = sme_AcquireGlobalLock( &pMac->sme );
7429 if ( HAL_STATUS_SUCCESS( status ) )
7430 {
7431 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7432 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
7433 pMac->roam.configParam.nProbes,
7434 nProbes);
7435 pMac->roam.configParam.nProbes = nProbes;
7436 sme_ReleaseGlobalLock( &pMac->sme );
7437 }
7438#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7439 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7440 {
7441 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7442 REASON_NPROBES_CHANGED);
7443 }
7444#endif
7445 return status ;
7446}
7447
7448/* ---------------------------------------------------------------------------
7449 \fn sme_UpdateRoamScanHomeAwayTime
7450 \brief function to update roam scan Home away time
7451 This function is called through dynamic setConfig callback function
7452 to update roam scan home away time
7453 \param hHal - HAL handle for device
7454 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07007455 \param bSendOffloadCmd If TRUE then send offload command to firmware
7456 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007457 \- return Success or failure
7458 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07007459eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
7460 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007461{
7462 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7463 eHalStatus status = eHAL_STATUS_SUCCESS;
7464
7465 status = sme_AcquireGlobalLock( &pMac->sme );
7466 if ( HAL_STATUS_SUCCESS( status ) )
7467 {
7468 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7469 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
7470 pMac->roam.configParam.nRoamScanHomeAwayTime,
7471 nRoamScanHomeAwayTime);
7472 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
7473 sme_ReleaseGlobalLock( &pMac->sme );
7474 }
7475
7476#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07007477 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007478 {
7479 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7480 REASON_HOME_AWAY_TIME_CHANGED);
7481 }
7482#endif
7483 return status;
7484}
7485
7486
7487/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007488 \fn sme_getRoamIntraBand
7489 \brief get Intra band roaming
7490 \param hHal - HAL handle for device
7491 \- return Success or failure
7492 -------------------------------------------------------------------------*/
7493v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
7494{
7495 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7496 return pMac->roam.configParam.nRoamIntraBand;
7497}
7498
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07007499/* ---------------------------------------------------------------------------
7500 \fn sme_getRoamScanNProbes
7501 \brief get N Probes
7502 \param hHal - HAL handle for device
7503 \- return Success or failure
7504 -------------------------------------------------------------------------*/
7505v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
7506{
7507 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7508 return pMac->roam.configParam.nProbes;
7509}
7510
7511/* ---------------------------------------------------------------------------
7512 \fn sme_getRoamScanHomeAwayTime
7513 \brief get Roam scan home away time
7514 \param hHal - HAL handle for device
7515 \- return Success or failure
7516 -------------------------------------------------------------------------*/
7517v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
7518{
7519 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7520 return pMac->roam.configParam.nRoamScanHomeAwayTime;
7521}
7522
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007523
7524/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08007525 \fn sme_UpdateImmediateRoamRssiDiff
7526 \brief Update nImmediateRoamRssiDiff
7527 This function is called through dynamic setConfig callback function
7528 to configure nImmediateRoamRssiDiff
7529 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
7530 \param hHal - HAL handle for device
7531 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
7532 candidate and current AP.
7533 \- return Success or failure
7534 -------------------------------------------------------------------------*/
7535
7536eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
7537{
7538 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08007539 eHalStatus status = eHAL_STATUS_SUCCESS;
7540
7541 status = sme_AcquireGlobalLock( &pMac->sme );
7542 if ( HAL_STATUS_SUCCESS( status ) )
7543 {
7544 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7545 "LFR runtime successfully set immediate roam rssi diff to %d - old value is %d - roam state is %d",
7546 nImmediateRoamRssiDiff,
7547 pMac->roam.configParam.nImmediateRoamRssiDiff,
7548 pMac->roam.neighborRoamInfo.neighborRoamState);
7549 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
7550 sme_ReleaseGlobalLock( &pMac->sme );
7551 }
7552
7553 return status ;
7554}
7555
7556/* ---------------------------------------------------------------------------
7557 \fn sme_UpdateRoamRssiDiff
7558 \brief Update RoamRssiDiff
7559 This function is called through dynamic setConfig callback function
7560 to configure RoamRssiDiff
7561 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
7562 \param hHal - HAL handle for device
7563 \param RoamRssiDiff - minimum rssi difference between potential
7564 candidate and current AP.
7565 \- return Success or failure
7566 -------------------------------------------------------------------------*/
7567
7568eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
7569{
7570 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7571 eHalStatus status = eHAL_STATUS_SUCCESS;
7572
7573 status = sme_AcquireGlobalLock( &pMac->sme );
7574 if ( HAL_STATUS_SUCCESS( status ) )
7575 {
7576 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7577 "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %d",
7578 RoamRssiDiff,
7579 pMac->roam.configParam.RoamRssiDiff,
7580 pMac->roam.neighborRoamInfo.neighborRoamState);
7581 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
7582 sme_ReleaseGlobalLock( &pMac->sme );
7583 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007584#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7585 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7586 {
7587 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
7588 }
7589#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007590 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08007591}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007592
7593/*--------------------------------------------------------------------------
7594 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
7595 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7596 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007597 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007598 \param hHal - The handle returned by macOpen.
7599 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
7600 Other status means SME is failed to update isFastTransitionEnabled.
7601 \sa
7602 --------------------------------------------------------------------------*/
7603eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
7604 v_BOOL_t isFastTransitionEnabled)
7605{
7606 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08007607 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007608
Srinivas Girigowdade697412013-02-14 16:31:48 -08007609 status = sme_AcquireGlobalLock( &pMac->sme );
7610 if ( HAL_STATUS_SUCCESS( status ) )
7611 {
7612 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7613 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
7614 pMac->roam.configParam.isFastTransitionEnabled,
7615 isFastTransitionEnabled);
7616 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
7617 sme_ReleaseGlobalLock( &pMac->sme );
7618 }
7619
7620 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007621}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007622
7623/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07007624 \fn sme_SetRoamScanControl
7625 \brief Set roam scan control
7626 This function is called to set roam scan control
7627 if roam scan control is set to 0, roaming scan cache is cleared
7628 any value other than 0 is treated as invalid value
7629 \param hHal - HAL handle for device
7630 \return eHAL_STATUS_SUCCESS - SME update config successfully.
7631 Other status means SME failure to update
7632 -------------------------------------------------------------------------*/
7633eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
7634{
7635 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7636 eHalStatus status = eHAL_STATUS_SUCCESS;
7637
7638 status = sme_AcquireGlobalLock( &pMac->sme );
7639 if ( HAL_STATUS_SUCCESS( status ) )
7640 {
7641 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7642 "LFR runtime successfully set roam scan control to %d - old value is %d - roam state is %d",
7643 roamScanControl,
7644 pMac->roam.configParam.nRoamScanControl,
7645 pMac->roam.neighborRoamInfo.neighborRoamState);
7646 pMac->roam.configParam.nRoamScanControl = roamScanControl;
7647 if ( 0 == roamScanControl)
7648 {
7649 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7650 "LFR runtime successfully cleared roam scan cache");
7651 csrFlushBgScanRoamChannelList(pMac);
7652#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7653 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7654 {
7655 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
7656 }
7657#endif
7658 }
7659 sme_ReleaseGlobalLock( &pMac->sme );
7660 }
7661 return status ;
7662}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007663#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */
7664
7665#ifdef FEATURE_WLAN_LFR
7666/*--------------------------------------------------------------------------
7667 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
7668 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7669 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007670 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007671 \param hHal - The handle returned by macOpen.
7672 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
7673 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
7674 \sa
7675 --------------------------------------------------------------------------*/
7676eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007677 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007678{
7679 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7680
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007681 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
7682 {
7683 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7684 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
7685 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
7686 isFastRoamIniFeatureEnabled);
7687 return eHAL_STATUS_SUCCESS;
7688 }
7689
Srinivas Girigowdade697412013-02-14 16:31:48 -08007690 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7691 "%s: FastRoamEnabled is changed from %d to %d", __func__,
7692 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
7693 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007694 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007695 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007696
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007697 return eHAL_STATUS_SUCCESS;
7698}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07007699
7700#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7701/*--------------------------------------------------------------------------
7702 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
7703 This is a synchronuous call
7704 \param hHal - The handle returned by macOpen.
7705 \return eHAL_STATUS_SUCCESS
7706 Other status means SME is failed
7707 \sa
7708 --------------------------------------------------------------------------*/
7709
7710eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
7711 v_BOOL_t bFastRoamInConIniFeatureEnabled)
7712{
7713
7714 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7715 eHalStatus status = eHAL_STATUS_SUCCESS;
7716
7717 status = sme_AcquireGlobalLock( &pMac->sme );
7718 if ( HAL_STATUS_SUCCESS( status ) )
7719 {
7720 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
7721 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
7722 {
7723 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
7724 }
7725 sme_ReleaseGlobalLock( &pMac->sme );
7726 }
7727
7728 return status;
7729}
7730#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007731#endif /* FEATURE_WLAN_LFR */
7732
7733#ifdef FEATURE_WLAN_CCX
7734/*--------------------------------------------------------------------------
7735 \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime
7736 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7737 isCcxIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007738 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007739 \param hHal - The handle returned by macOpen.
7740 \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully.
7741 Other status means SME is failed to update isCcxIniFeatureEnabled.
7742 \sa
7743 --------------------------------------------------------------------------*/
7744
7745eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007746 const v_BOOL_t isCcxIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007747{
7748 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7749
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007750 if (pMac->roam.configParam.isCcxIniFeatureEnabled == isCcxIniFeatureEnabled)
7751 {
7752 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7753 "%s: CCX Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
7754 pMac->roam.configParam.isCcxIniFeatureEnabled,
7755 isCcxIniFeatureEnabled);
7756 return eHAL_STATUS_SUCCESS;
7757 }
7758
Srinivas Girigowdade697412013-02-14 16:31:48 -08007759 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7760 "%s: CcxEnabled is changed from %d to %d", __func__,
7761 pMac->roam.configParam.isCcxIniFeatureEnabled,
7762 isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007763 pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007764 csrNeighborRoamUpdateCcxModeEnabled(pMac, isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007765
7766 if(TRUE == isCcxIniFeatureEnabled)
7767 {
7768 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007769 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07007770
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007771#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7772 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7773 {
7774 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CCX_INI_CFG_CHANGED);
7775 }
7776#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007777 return eHAL_STATUS_SUCCESS;
7778}
7779#endif /* FEATURE_WLAN_CCX */
7780
7781/*--------------------------------------------------------------------------
7782 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
7783 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7784 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08007785 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007786 \param hHal - The handle returned by macOpen.
7787 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
7788 Other status means SME is failed to update fEnableFwRssiMonitoring.
7789 \sa
7790 --------------------------------------------------------------------------*/
7791
7792eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
7793 v_BOOL_t fEnableFwRssiMonitoring)
7794{
7795 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
7796
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007797 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
7798 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
7799 {
7800 halStatus = eHAL_STATUS_FAILURE;
7801 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007802 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08007803 }
7804
7805 return (halStatus);
7806}
7807
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007808#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08007809/*--------------------------------------------------------------------------
7810 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
7811 This is a synchronous call
7812 \param hHal - The handle returned by macOpen.
7813 \return eHAL_STATUS_SUCCESS - SME update config successful.
7814 Other status means SME is failed to update
7815 \sa
7816 --------------------------------------------------------------------------*/
7817eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
7818 v_U8_t neighborLookupRssiThreshold)
7819{
7820 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7821 eHalStatus status = eHAL_STATUS_SUCCESS;
7822
7823 status = sme_AcquireGlobalLock( &pMac->sme );
7824 if ( HAL_STATUS_SUCCESS( status ) )
7825 {
7826 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
7827 if (HAL_STATUS_SUCCESS(status))
7828 {
7829 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7830 "LFR runtime successfully set Lookup threshold to %d - old value is %d - roam state is %d",
7831 neighborLookupRssiThreshold,
7832 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
7833 pMac->roam.neighborRoamInfo.neighborRoamState);
7834 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
7835 neighborLookupRssiThreshold;
7836 }
7837 sme_ReleaseGlobalLock( &pMac->sme );
7838 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08007839 return status;
7840}
7841
7842/*--------------------------------------------------------------------------
7843 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
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_setNeighborReassocRssiThreshold(tHalHandle hHal,
7851 v_U8_t neighborReassocRssiThreshold)
7852{
7853 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7854 eHalStatus status = eHAL_STATUS_SUCCESS;
7855
7856 status = sme_AcquireGlobalLock( &pMac->sme );
7857 if ( HAL_STATUS_SUCCESS( status ) )
7858 {
7859 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7860 "LFR runtime successfully set Reassoc threshold to %d - old value is %d - roam state is %d",
7861 neighborReassocRssiThreshold,
7862 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
7863 pMac->roam.neighborRoamInfo.neighborRoamState);
7864 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
7865 neighborReassocRssiThreshold;
7866 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
7867 neighborReassocRssiThreshold;
7868 sme_ReleaseGlobalLock( &pMac->sme );
7869 }
7870
7871 return status ;
7872}
7873
7874
7875/*--------------------------------------------------------------------------
7876 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
7877 This is a synchronous call
7878 \param hHal - The handle returned by macOpen.
7879 \return eHAL_STATUS_SUCCESS - SME update config successful.
7880 Other status means SME is failed to update
7881 \sa
7882 --------------------------------------------------------------------------*/
7883v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
7884{
7885 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7886 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
7887}
7888
7889/*--------------------------------------------------------------------------
7890 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
7891 This is a synchronous call
7892 \param hHal - The handle returned by macOpen.
7893 \return eHAL_STATUS_SUCCESS - SME update config successful.
7894 Other status means SME is failed to update
7895 \sa
7896 --------------------------------------------------------------------------*/
7897eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
7898 v_U16_t neighborScanResultsRefreshPeriod)
7899{
7900 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7901 eHalStatus status = eHAL_STATUS_SUCCESS;
7902
7903 status = sme_AcquireGlobalLock( &pMac->sme );
7904 if ( HAL_STATUS_SUCCESS( status ) )
7905 {
7906 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
7907 "LFR runtime successfully set roam scan refresh period to %d - old value is %d - roam state is %d",
7908 neighborScanResultsRefreshPeriod,
7909 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
7910 pMac->roam.neighborRoamInfo.neighborRoamState);
7911 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
7912 neighborScanResultsRefreshPeriod;
7913 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
7914 neighborScanResultsRefreshPeriod;
7915
7916 sme_ReleaseGlobalLock( &pMac->sme );
7917 }
7918
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007919#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7920 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
7921 {
7922 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
7923 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
7924 }
7925#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08007926 return status ;
7927}
7928
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07007929#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
7930/*--------------------------------------------------------------------------
7931 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
7932 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
7933 gRoamScanOffloadEnabled.
7934 This is a synchronous call
7935 \param hHal - The handle returned by macOpen.
7936 \return eHAL_STATUS_SUCCESS - SME update config successfully.
7937 Other status means SME is failed to update.
7938 \sa
7939 --------------------------------------------------------------------------*/
7940
7941eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
7942 v_BOOL_t nRoamScanOffloadEnabled)
7943{
7944 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7945 eHalStatus status = eHAL_STATUS_SUCCESS;
7946
7947 status = sme_AcquireGlobalLock( &pMac->sme );
7948 if ( HAL_STATUS_SUCCESS( status ) )
7949 {
7950 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
7951 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
7952 pMac->roam.configParam.isRoamOffloadScanEnabled,
7953 nRoamScanOffloadEnabled);
7954 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
7955 sme_ReleaseGlobalLock( &pMac->sme );
7956 }
7957
7958 return status ;
7959}
7960#endif
7961
Srinivas Girigowdade697412013-02-14 16:31:48 -08007962/*--------------------------------------------------------------------------
7963 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
7964 This is a synchronous call
7965 \param hHal - The handle returned by macOpen.
7966 \return v_U16_t - Neighbor scan results refresh period value
7967 \sa
7968 --------------------------------------------------------------------------*/
7969v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
7970{
7971 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7972 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
7973}
7974
7975/*--------------------------------------------------------------------------
7976 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
7977 This is a synchronuous call
7978 \param hHal - The handle returned by macOpen.
7979 \return eHAL_STATUS_SUCCESS - SME update config successful.
7980 Other status means SME is failed to update
7981 \sa
7982 --------------------------------------------------------------------------*/
7983v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
7984{
7985 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7986 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
7987}
7988
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07007989/* ---------------------------------------------------------------------------
7990 \fn sme_UpdateEmptyScanRefreshPeriod
7991 \brief Update nEmptyScanRefreshPeriod
7992 This function is called through dynamic setConfig callback function
7993 to configure nEmptyScanRefreshPeriod
7994 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
7995 \param hHal - HAL handle for device
7996 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
7997 \- return Success or failure
7998 -------------------------------------------------------------------------*/
7999
8000eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
8001{
8002 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8003 eHalStatus status = eHAL_STATUS_SUCCESS;
8004
8005 status = sme_AcquireGlobalLock( &pMac->sme );
8006 if ( HAL_STATUS_SUCCESS( status ) )
8007 {
8008 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8009 "LFR runtime successfully set roam scan period to %d - old value is %d - roam state is %d",
8010 nEmptyScanRefreshPeriod,
8011 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
8012 pMac->roam.neighborRoamInfo.neighborRoamState);
8013 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
8014 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
8015 sme_ReleaseGlobalLock( &pMac->sme );
8016 }
8017
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07008018#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8019 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8020 {
8021 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8022 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
8023 }
8024#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008025 return status ;
8026}
8027
8028/* ---------------------------------------------------------------------------
8029 \fn sme_setNeighborScanMinChanTime
8030 \brief Update nNeighborScanMinChanTime
8031 This function is called through dynamic setConfig callback function
8032 to configure gNeighborScanChannelMinTime
8033 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
8034 \param hHal - HAL handle for device
8035 \param nNeighborScanMinChanTime - Channel minimum dwell time
8036 \- return Success or failure
8037 -------------------------------------------------------------------------*/
8038eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
8039{
8040 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8041 eHalStatus status = eHAL_STATUS_SUCCESS;
8042
8043 status = sme_AcquireGlobalLock( &pMac->sme );
8044 if ( HAL_STATUS_SUCCESS( status ) )
8045 {
8046 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8047 "LFR runtime successfully set channel min dwell time to %d - old value is %d - roam state is %d",
8048 nNeighborScanMinChanTime,
8049 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
8050 pMac->roam.neighborRoamInfo.neighborRoamState);
8051 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
8052 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
8053 sme_ReleaseGlobalLock( &pMac->sme );
8054 }
8055
8056 return status ;
8057}
8058
8059/* ---------------------------------------------------------------------------
8060 \fn sme_setNeighborScanMaxChanTime
8061 \brief Update nNeighborScanMaxChanTime
8062 This function is called through dynamic setConfig callback function
8063 to configure gNeighborScanChannelMaxTime
8064 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
8065 \param hHal - HAL handle for device
8066 \param nNeighborScanMinChanTime - Channel maximum dwell time
8067 \- return Success or failure
8068 -------------------------------------------------------------------------*/
8069eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
8070{
8071 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8072 eHalStatus status = eHAL_STATUS_SUCCESS;
8073
8074 status = sme_AcquireGlobalLock( &pMac->sme );
8075 if ( HAL_STATUS_SUCCESS( status ) )
8076 {
8077 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8078 "LFR runtime successfully set channel max dwell time to %d - old value is %d - roam state is %d",
8079 nNeighborScanMaxChanTime,
8080 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
8081 pMac->roam.neighborRoamInfo.neighborRoamState);
8082 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
8083 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
8084 sme_ReleaseGlobalLock( &pMac->sme );
8085 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07008086#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8087 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8088 {
8089 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8090 REASON_SCAN_CH_TIME_CHANGED);
8091 }
8092#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008093
8094 return status ;
8095}
8096
8097/* ---------------------------------------------------------------------------
8098 \fn sme_getNeighborScanMinChanTime
8099 \brief get neighbor scan min channel time
8100 \param hHal - The handle returned by macOpen.
8101 \return v_U16_t - channel min time value
8102 -------------------------------------------------------------------------*/
8103v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
8104{
8105 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8106 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
8107}
8108
8109/* ---------------------------------------------------------------------------
8110 \fn sme_getNeighborScanMaxChanTime
8111 \brief get neighbor scan max channel time
8112 \param hHal - The handle returned by macOpen.
8113 \return v_U16_t - channel max time value
8114 -------------------------------------------------------------------------*/
8115v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
8116{
8117 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8118 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
8119}
8120
8121/* ---------------------------------------------------------------------------
8122 \fn sme_setNeighborScanPeriod
8123 \brief Update nNeighborScanPeriod
8124 This function is called through dynamic setConfig callback function
8125 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07008126 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008127 \param hHal - HAL handle for device
8128 \param nNeighborScanPeriod - neighbor scan period
8129 \- return Success or failure
8130 -------------------------------------------------------------------------*/
8131eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
8132{
8133 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8134 eHalStatus status = eHAL_STATUS_SUCCESS;
8135
8136 status = sme_AcquireGlobalLock( &pMac->sme );
8137 if ( HAL_STATUS_SUCCESS( status ) )
8138 {
8139 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8140 "LFR runtime successfully set neighbor scan period to %d - old value is %d - roam state is %d",
8141 nNeighborScanPeriod,
8142 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
8143 pMac->roam.neighborRoamInfo.neighborRoamState);
8144 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
8145 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
8146 sme_ReleaseGlobalLock( &pMac->sme );
8147 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07008148#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8149 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8150 {
8151 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8152 REASON_SCAN_HOME_TIME_CHANGED);
8153 }
8154#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008155
8156 return status ;
8157}
8158
8159/* ---------------------------------------------------------------------------
8160 \fn sme_getNeighborScanPeriod
8161 \brief get neighbor scan period
8162 \param hHal - The handle returned by macOpen.
8163 \return v_U16_t - neighbor scan period
8164 -------------------------------------------------------------------------*/
8165v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
8166{
8167 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8168 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
8169}
8170
8171#endif
8172
Srinivas Girigowdade697412013-02-14 16:31:48 -08008173#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008174
Srinivas Girigowdade697412013-02-14 16:31:48 -08008175/*--------------------------------------------------------------------------
8176 \brief sme_getRoamRssiDiff() - get Roam rssi diff
8177 This is a synchronous call
8178 \param hHal - The handle returned by macOpen.
8179 \return v_U16_t - Rssi diff value
8180 \sa
8181 --------------------------------------------------------------------------*/
8182v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
8183{
8184 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8185 return pMac->roam.configParam.RoamRssiDiff;
8186}
8187
8188/*--------------------------------------------------------------------------
8189 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
8190 This is a synchronous call
8191 \param hHal - The handle returned by macOpen.
8192 \return eHAL_STATUS_SUCCESS - SME update config successful.
8193 Other status means SME is failed to update
8194 \sa
8195 --------------------------------------------------------------------------*/
8196eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
8197 tANI_U8 numChannels)
8198{
8199 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8200 eHalStatus status = eHAL_STATUS_SUCCESS;
8201 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008202 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08008203 tANI_U8 newChannelList[128] = {0};
8204 tANI_U8 i = 0, j = 0;
8205
8206 status = sme_AcquireGlobalLock( &pMac->sme );
8207 if ( HAL_STATUS_SUCCESS( status ) )
8208 {
8209 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
8210 {
8211 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
8212 {
8213 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
8214 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
8215 }
8216 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008217 csrFlushBgScanRoamChannelList(pMac);
8218 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Srinivas Girigowdade697412013-02-14 16:31:48 -08008219 status = csrUpdateBgScanConfigIniChannelList(pMac, csrGetCurrentBand(hHal));
8220
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008221 if ( HAL_STATUS_SUCCESS( status ))
Srinivas Girigowdade697412013-02-14 16:31:48 -08008222 {
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008223 sme_SetRoamScanControl(hHal, 1);
8224 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08008225 {
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008226 j = 0;
8227 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
8228 {
8229 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
8230 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
8231 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008232 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008233
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008234 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8235 "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d",
8236 newChannelList, oldChannelList,
8237 pMac->roam.neighborRoamInfo.neighborRoamState);
8238 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008239 sme_ReleaseGlobalLock( &pMac->sme );
8240 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008241#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8242 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8243 {
8244 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
8245 }
8246#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008247
8248 return status ;
8249}
8250
8251/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -08008252 \brief csrUpdateBgScanConfigIniChannelList() - Update bgscan roam cache
8253 This is a synchronous call
8254 \param hHal - The handle returned by macOpen.
8255 \return eHAL_STATUS_SUCCESS - SME update config successful.
8256 Other status means SME is failed to update
8257 \sa
8258 --------------------------------------------------------------------------*/
8259eHalStatus sme_UpdateBgScanConfigIniChannelList(tHalHandle hHal,
8260 eCsrBand eBand)
8261{
8262 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8263 return csrUpdateBgScanConfigIniChannelList(pMac, eBand);
8264}
8265
8266/*--------------------------------------------------------------------------
8267 \brief sme_getRoamScanChannelList() - get roam scan channel list
8268 This is a synchronous call
8269 \param hHal - The handle returned by macOpen.
8270 \return eHAL_STATUS_SUCCESS - SME update config successful.
8271 Other status means SME is failed to update
8272 \sa
8273 --------------------------------------------------------------------------*/
8274eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
8275 tANI_U8 *pNumChannels)
8276{
8277 int i = 0;
8278 tANI_U8 *pOutPtr = pChannelList;
8279 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8280 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
8281 eHalStatus status = eHAL_STATUS_SUCCESS;
8282
8283 status = sme_AcquireGlobalLock( &pMac->sme );
8284 if ( HAL_STATUS_SUCCESS( status ) )
8285 {
8286 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
8287 {
8288 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
8289 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008290 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08008291 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008292 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08008293 }
8294
8295 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
8296 for (i = 0; i < (*pNumChannels); i++)
8297 {
8298 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
8299 }
8300 pOutPtr[i] = '\0';
8301 sme_ReleaseGlobalLock( &pMac->sme );
8302 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008303 return status ;
8304}
8305
8306/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008307 \brief sme_getIsCcxFeatureEnabled() - get CCX feature enabled or not
8308 This is a synchronuous call
8309 \param hHal - The handle returned by macOpen.
8310 \return TRUE (1) - if the CCX feature is enabled
8311 FALSE (0) - if feature is disabled (compile or runtime)
8312 \sa
8313 --------------------------------------------------------------------------*/
8314tANI_BOOLEAN sme_getIsCcxFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08008315{
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008316#ifdef FEATURE_WLAN_CCX
Srinivas Girigowdade697412013-02-14 16:31:48 -08008317 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008318 return pMac->roam.configParam.isCcxIniFeatureEnabled;
8319#else
8320 return eANI_BOOLEAN_FALSE;
8321#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008322}
8323
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008324/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008325 \brief sme_GetRoamScanControl() - get scan control
8326 This is a synchronous call
8327 \param hHal - The handle returned by macOpen.
8328 \return v_BOOL_t - Enabled(1)/Disabled(0)
8329 \sa
8330 --------------------------------------------------------------------------*/
8331v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
8332{
8333 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8334 return pMac->roam.configParam.nRoamScanControl;
8335}
8336#endif
8337
8338/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008339 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
8340 This is a synchronuous call
8341 \param hHal - The handle returned by macOpen.
8342 \return TRUE (1) - if the feature is enabled
8343 FALSE (0) - if feature is disabled (compile or runtime)
8344 \sa
8345 --------------------------------------------------------------------------*/
8346tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
8347{
8348#ifdef FEATURE_WLAN_LFR
8349 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8350 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
8351#else
8352 return eANI_BOOLEAN_FALSE;
8353#endif
8354}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008355
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008356/*--------------------------------------------------------------------------
8357 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
8358 This is a synchronuous call
8359 \param hHal - The handle returned by macOpen.
8360 \return TRUE (1) - if the feature is enabled
8361 FALSE (0) - if feature is disabled (compile or runtime)
8362 \sa
8363 --------------------------------------------------------------------------*/
8364tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
8365{
8366#ifdef WLAN_FEATURE_VOWIFI_11R
8367 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8368 return pMac->roam.configParam.isFastTransitionEnabled;
8369#else
8370 return eANI_BOOLEAN_FALSE;
8371#endif
8372}
8373
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008374
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008375/* ---------------------------------------------------------------------------
8376 \fn sme_IsFeatureSupportedByFW
8377 \brief Check if an feature is enabled by FW
8378
8379 \param feattEnumValue - Enumeration value from placeHolderInCapBitmap
8380 \- return 1/0 (TRUE/FALSE)
8381 -------------------------------------------------------------------------*/
8382tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
8383{
8384 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
8385}
8386#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05308387
8388/* ---------------------------------------------------------------------------
8389 \fn sme_SendTdlsMgmtFrame
8390 \brief API to send TDLS management frames.
8391
8392 \param peerMac - peer's Mac Adress.
8393 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
8394 \- return VOS_STATUS_SUCCES
8395 -------------------------------------------------------------------------*/
8396VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
8397 tANI_U8 sessionId,
8398 tSirMacAddr peerMac,
8399 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
8400{
8401 eHalStatus status = eHAL_STATUS_SUCCESS;
8402 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8403
8404 status = sme_AcquireGlobalLock( &pMac->sme );
8405
8406 if ( HAL_STATUS_SUCCESS( status ) )
8407 {
8408 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
8409 sme_ReleaseGlobalLock( &pMac->sme );
8410 }
8411 return status ;
8412}
8413
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008414/* ---------------------------------------------------------------------------
8415 \fn sme_SendTdlsMgmtFrame
8416 \brief API to send TDLS management frames.
8417
8418 \param peerMac - peer's Mac Adress.
8419 \param frame_type - Type of TDLS mgmt frame to be sent.
8420 \param dialog - dialog token used in the frame.
8421 \param status - status to be incuded in the frame.
8422 \param buf - additional IEs to be included
8423 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08008424 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008425 \- return VOS_STATUS_SUCCES
8426 -------------------------------------------------------------------------*/
8427VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Hoonki Leea34dd892013-02-05 22:56:02 -08008428 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 -08008429{
8430 eHalStatus status = eHAL_STATUS_SUCCESS;
8431 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
8432 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8433
8434 status = sme_AcquireGlobalLock( &pMac->sme );
8435 if ( HAL_STATUS_SUCCESS( status ) )
8436 {
8437 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8438 sendTdlsReq.frameType = frame_type;
8439 sendTdlsReq.buf = buf;
8440 sendTdlsReq.len = len;
8441 sendTdlsReq.dialog = dialog;
8442 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08008443 sendTdlsReq.responder = responder;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008444
8445 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
8446
8447 sme_ReleaseGlobalLock( &pMac->sme );
8448 }
8449
8450 return status ;
8451
8452}
8453/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08008454 \fn sme_ChangeTdlsPeerSta
8455 \brief API to Update TDLS peer sta parameters.
8456
8457 \param peerMac - peer's Mac Adress.
8458 \param staParams - Peer Station Parameters
8459 \- return VOS_STATUS_SUCCES
8460 -------------------------------------------------------------------------*/
8461VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
8462 tCsrStaParams *pstaParams)
8463{
8464 eHalStatus status = eHAL_STATUS_SUCCESS;
8465 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8466
8467 status = sme_AcquireGlobalLock( &pMac->sme );
8468 if ( HAL_STATUS_SUCCESS( status ) )
8469 {
8470 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
8471
8472 sme_ReleaseGlobalLock( &pMac->sme );
8473 }
8474
8475 return status ;
8476
8477}
8478
8479/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008480 \fn sme_AddTdlsPeerSta
8481 \brief API to Add TDLS peer sta entry.
8482
8483 \param peerMac - peer's Mac Adress.
8484 \- return VOS_STATUS_SUCCES
8485 -------------------------------------------------------------------------*/
8486VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8487{
8488 eHalStatus status = eHAL_STATUS_SUCCESS;
8489 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8490
8491 status = sme_AcquireGlobalLock( &pMac->sme );
8492 if ( HAL_STATUS_SUCCESS( status ) )
8493 {
8494 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
8495
8496 sme_ReleaseGlobalLock( &pMac->sme );
8497 }
8498
8499 return status ;
8500
8501}
8502/* ---------------------------------------------------------------------------
8503 \fn sme_DeleteTdlsPeerSta
8504 \brief API to Delete TDLS peer sta entry.
8505
8506 \param peerMac - peer's Mac Adress.
8507 \- return VOS_STATUS_SUCCES
8508 -------------------------------------------------------------------------*/
8509VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8510{
8511 eHalStatus status = eHAL_STATUS_SUCCESS;
8512 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8513
8514 status = sme_AcquireGlobalLock( &pMac->sme );
8515 if ( HAL_STATUS_SUCCESS( status ) )
8516 {
8517 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
8518
8519 sme_ReleaseGlobalLock( &pMac->sme );
8520 }
8521
8522 return status ;
8523
8524}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07008525/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07008526 \fn sme_SetTdlsPowerSaveProhibited
8527 \API to set/reset the isTdlsPowerSaveProhibited.
8528
8529 \- return void
8530 -------------------------------------------------------------------------*/
8531void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
8532{
8533 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8534
8535 pMac->isTdlsPowerSaveProhibited = val;
8536 return;
8537}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008538#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +05308539/* ---------------------------------------------------------------------------
8540 \fn sme_IsPmcBmps
8541 \API to Check if PMC state is BMPS.
8542
8543 \- return v_BOOL_t
8544 -------------------------------------------------------------------------*/
8545v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
8546{
8547 return (BMPS == pmcGetPmcState(hHal));
8548}
8549
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008550#ifdef FEATURE_WLAN_TDLS_INTERNAL
8551/*
8552 * SME API to start TDLS discovery Procedure
8553 */
8554VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8555{
8556 VOS_STATUS status = VOS_STATUS_SUCCESS;
8557 tCsrTdlsDisRequest disReq = {{0}} ;
8558 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8559 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
8560
8561 return status ;
8562
8563}
8564
8565/*
8566 * Process TDLS discovery results
8567 */
8568v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
8569 tSmeTdlsDisResult *disResult, v_U8_t listType)
8570{
8571 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
8572 tSirTdlsPeerInfo *peerInfo = NULL ;
8573 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8574 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
8575 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
8576 tListElem *pEntry = NULL ;
8577 v_U8_t peerCnt = 0 ;
8578
8579 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008580 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008581 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
8582 while(pEntry)
8583 {
8584 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
8585 tdlsPeerStaLink) ;
8586 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
8587
8588 switch(listType)
8589 {
8590 case TDLS_SETUP_LIST:
8591 {
8592 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
8593 {
8594 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
8595 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
8596 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
8597 peerCnt++ ;
8598 }
8599 break ;
8600 }
8601 case TDLS_DIS_LIST:
8602 {
8603 palCopyMemory(pMac->hHdd, disResult[peerCnt].tdlsPeerMac,
8604 peerInfo->peerMac, sizeof(tSirMacAddr)) ;
8605 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
8606 peerCnt++ ;
8607 break ;
8608 }
8609 default:
8610 {
8611 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008612 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08008613 break ;
8614 }
8615 }
8616
8617 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
8618 }
8619
8620 return peerCnt ;
8621
8622}
8623
8624/*
8625 * SME API to start TDLS link setup Procedure.
8626 */
8627VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8628{
8629 VOS_STATUS status = VOS_STATUS_SUCCESS;
8630 tCsrTdlsSetupRequest setupReq = {{0}} ;
8631 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8632 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
8633 return status ;
8634
8635}
8636
8637/*
8638 * SME API to start TDLS link Teardown Procedure.
8639 */
8640VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
8641{
8642 VOS_STATUS status = VOS_STATUS_SUCCESS;
8643 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
8644 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
8645 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
8646 return status ;
8647
8648}
8649
8650#endif /* FEATURE_WLAN_TDLS */
8651
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -07008652eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
8653{
8654 eHalStatus status = eHAL_STATUS_FAILURE;
8655 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8656
8657 smsLog(pMac, LOG2, FL("enter"));
8658 status = sme_AcquireGlobalLock( &pMac->sme );
8659 if ( HAL_STATUS_SUCCESS( status ) )
8660 {
8661 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
8662 sme_ReleaseGlobalLock( &pMac->sme );
8663 }
8664 smsLog(pMac, LOG2, FL("exit status %d"), status);
8665
8666 return (status);
8667}
8668
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -07008669/*
8670 * SME API to enable/disable WLAN driver initiated SSR
8671 */
8672void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
8673{
8674 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8675 eHalStatus status = eHAL_STATUS_SUCCESS;
8676
8677 status = sme_AcquireGlobalLock(&pMac->sme);
8678 if (HAL_STATUS_SUCCESS(status))
8679 {
8680 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8681 "SSR level is changed %d", enableSSR);
8682 /* not serializing this messsage, as this is only going
8683 * to set a variable in WDA/WDI
8684 */
8685 WDA_SetEnableSSR(enableSSR);
8686 sme_ReleaseGlobalLock(&pMac->sme);
8687 }
8688 return;
8689}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07008690
8691/*
8692 * SME API to determine the channel bonding mode
8693 */
8694VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
8695{
8696 tSmeConfigParams smeConfig;
8697 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8698
8699 if (
8700#ifdef WLAN_FEATURE_11AC
8701 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
8702 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
8703#endif
8704 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
8705 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode
8706 )
8707 {
8708 return VOS_STATUS_SUCCESS;
8709 }
8710
8711 /* If channel bonding mode is not required */
8712 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
8713 return VOS_STATUS_SUCCESS;
8714 }
8715
8716 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
8717 sme_GetConfigParam(pMac, &smeConfig);
8718
8719#ifdef WLAN_FEATURE_11AC
8720 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
8721 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
8722 {
8723 if ( channel== 36 || channel == 52 || channel == 100 ||
8724 channel == 116 || channel == 149 )
8725 {
8726 smeConfig.csrConfig.channelBondingMode5GHz =
8727 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
8728 }
8729 else if ( channel == 40 || channel == 56 || channel == 104 ||
8730 channel == 120 || channel == 153 )
8731 {
8732 smeConfig.csrConfig.channelBondingMode5GHz =
8733 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
8734 }
8735 else if ( channel == 44 || channel == 60 || channel == 108 ||
8736 channel == 124 || channel == 157 )
8737 {
8738 smeConfig.csrConfig.channelBondingMode5GHz =
8739 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1;
8740 }
8741 else if ( channel == 48 || channel == 64 || channel == 112 ||
8742 channel == 128 || channel == 161 )
8743 {
8744 smeConfig.csrConfig.channelBondingMode5GHz =
8745 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
8746 }
8747 else if ( channel == 165 )
8748 {
8749 smeConfig.csrConfig.channelBondingMode5GHz = 0;
8750 }
8751 }
8752#endif
8753
8754 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
8755 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
8756 {
8757 if ( channel== 40 || channel == 48 || channel == 56 ||
8758 channel == 64 || channel == 104 || channel == 112 ||
8759 channel == 120 || channel == 128 || channel == 136 ||
8760 channel == 144 || channel == 153 || channel == 161 )
8761 {
8762 smeConfig.csrConfig.channelBondingMode5GHz = 1;
8763 }
8764 else if ( channel== 36 || channel == 44 || channel == 52 ||
8765 channel == 60 || channel == 100 || channel == 108 ||
8766 channel == 116 || channel == 124 || channel == 132 ||
8767 channel == 140 || channel == 149 || channel == 157 )
8768 {
8769 smeConfig.csrConfig.channelBondingMode5GHz = 2;
8770 }
8771 else if ( channel == 165 )
8772 {
8773 smeConfig.csrConfig.channelBondingMode5GHz = 0;
8774 }
8775 }
8776 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8777 "cbmode selected=%ld\n", smeConfig.csrConfig.channelBondingMode5GHz);
8778
8779 sme_UpdateConfig (pMac, &smeConfig);
8780 return VOS_STATUS_SUCCESS;
8781}
8782
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07008783/*--------------------------------------------------------------------------
8784
8785 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
8786 \param hHal - The handle returned by macOpen.
8787 \param currDeviceMode - Current operating device mode.
8788 --------------------------------------------------------------------------*/
8789
8790void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
8791{
8792 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8793 pMac->sme.currDeviceMode = currDeviceMode;
8794 return;
8795}
8796
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07008797#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8798/*--------------------------------------------------------------------------
8799 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
8800 from CSR.
8801 This is a synchronous call
8802 \param hHal - The handle returned by macOpen
8803 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
8804 BSSID, channel etc.)
8805 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
8806 Other status means SME is failed to send the request.
8807 \sa
8808 --------------------------------------------------------------------------*/
8809
8810eHalStatus sme_HandoffRequest(tHalHandle hHal,
8811 tCsrHandoffRequest *pHandoffInfo)
8812{
8813 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8814 eHalStatus status = eHAL_STATUS_SUCCESS;
8815
8816 status = sme_AcquireGlobalLock( &pMac->sme );
8817 if ( HAL_STATUS_SUCCESS( status ) )
8818 {
8819 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8820 "%s: invoked", __func__);
8821 status = csrHandoffRequest(pMac, pHandoffInfo);
8822 sme_ReleaseGlobalLock( &pMac->sme );
8823 }
8824
8825 return status ;
8826}
8827#endif
8828
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -07008829/*
8830 * SME API to check if there is any infra station or
8831 * P2P client is connected
8832 */
8833VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
8834{
8835 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8836 if(csrIsInfraConnected(pMac))
8837 {
8838 return VOS_STATUS_SUCCESS;
8839 }
8840 return VOS_STATUS_E_FAILURE;
8841}
8842
Leo Chang9056f462013-08-01 19:21:11 -07008843
8844#ifdef FEATURE_WLAN_LPHB
8845/* ---------------------------------------------------------------------------
8846 \fn sme_LPHBConfigReq
8847 \API to make configuration LPHB within FW.
8848 \param hHal - The handle returned by macOpen
8849 \param lphdReq - LPHB request argument by client
8850 \param pCallbackfn - LPHB timeout notification callback function pointer
8851 \- return Configuration message posting status, SUCCESS or Fail
8852 -------------------------------------------------------------------------*/
8853eHalStatus sme_LPHBConfigReq
8854(
8855 tHalHandle hHal,
8856 tSirLPHBReq *lphdReq,
8857 void (*pCallbackfn)(void *pAdapter, void *indParam)
8858)
8859{
8860 eHalStatus status = eHAL_STATUS_SUCCESS;
8861 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8862 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8863 vos_msg_t vosMessage;
8864
8865 status = sme_AcquireGlobalLock(&pMac->sme);
8866 if (eHAL_STATUS_SUCCESS == status)
8867 {
8868 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
8869 (NULL == pCallbackfn) &&
8870 (NULL == pMac->sme.pLphbWaitTimeoutCb))
8871 {
8872 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8873 "%s: Indication Call back did not registered", __func__);
8874 sme_ReleaseGlobalLock(&pMac->sme);
8875 return eHAL_STATUS_FAILURE;
8876 }
8877 else if (NULL != pCallbackfn)
8878 {
8879 pMac->sme.pLphbWaitTimeoutCb = pCallbackfn;
8880 }
8881
8882 /* serialize the req through MC thread */
8883 vosMessage.bodyptr = lphdReq;
8884 vosMessage.type = WDA_LPHB_CONF_REQ;
8885 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
8886 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
8887 {
8888 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8889 "%s: Post Config LPHB MSG fail", __func__);
8890 status = eHAL_STATUS_FAILURE;
8891 }
8892 sme_ReleaseGlobalLock(&pMac->sme);
8893 }
8894
8895 return(status);
8896}
8897#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -07008898/*--------------------------------------------------------------------------
8899 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
8900 scan parameter.
8901 This is a synchronous call
8902 \param hHal - The handle returned by macOpen
8903 \return NONE.
8904 \sa
8905 --------------------------------------------------------------------------*/
8906void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
8907 tANI_U8 nNumP2PChan)
8908{
8909 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8910
8911 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
8912 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
8913
8914 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8915 "%s: SCAN nNumStaChanCombinedConc : %d,"
8916 "nNumP2PChanCombinedConc : %d ",
8917 __func__, nNumStaChan, nNumP2PChan);
8918
8919 return;
8920
8921}
Leo Chang9056f462013-08-01 19:21:11 -07008922
Yue Mab9c86f42013-08-14 15:59:08 -07008923/* ---------------------------------------------------------------------------
8924 \fn sme_AddPeriodicTxPtrn
8925 \brief API to Periodic TX Pattern Offload feature
8926 \param hHal - The handle returned by macOpen
8927 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
8928 \return eHalStatus
8929 ---------------------------------------------------------------------------*/
8930eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
8931 *addPeriodicTxPtrnParams)
8932{
8933 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8934 eHalStatus status;
8935 vos_msg_t msg;
8936
8937 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
8938 {
8939 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
8940 msg.bodyptr = addPeriodicTxPtrnParams;
8941
8942 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
8943 {
8944 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
8945 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
8946 __func__);
8947
8948 sme_ReleaseGlobalLock(&pMac->sme);
8949 return eHAL_STATUS_FAILURE;
8950 }
8951
8952 sme_ReleaseGlobalLock(&pMac->sme);
8953 return eHAL_STATUS_SUCCESS;
8954 }
8955
8956 return status;
8957}
8958
8959/* ---------------------------------------------------------------------------
8960 \fn sme_DelPeriodicTxPtrn
8961 \brief API to Periodic TX Pattern Offload feature
8962 \param hHal - The handle returned by macOpen
8963 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
8964 \return eHalStatus
8965 ---------------------------------------------------------------------------*/
8966eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
8967 *delPeriodicTxPtrnParams)
8968{
8969 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8970 eHalStatus status;
8971 vos_msg_t msg;
8972
8973 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
8974 {
8975 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
8976 msg.bodyptr = delPeriodicTxPtrnParams;
8977
8978 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
8979 {
8980 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
8981 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
8982 __func__);
8983
8984 sme_ReleaseGlobalLock(&pMac->sme);
8985 return eHAL_STATUS_FAILURE;
8986 }
8987
8988 sme_ReleaseGlobalLock(&pMac->sme);
8989 return eHAL_STATUS_SUCCESS;
8990 }
8991
8992 return status;
8993}
8994