blob: a395336f9eb989e06e984e991d1a5952d03e2d97 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -08002 * Copyright (c) 2012-2014 Qualcomm Atheros, Inc.
3 * All Rights Reserved.
4 * Qualcomm Atheros Confidential and Proprietary.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08005 */
Jeff Johnson295189b2012-06-20 16:38:30 -07006/**=========================================================================
7
8 \file smeApi.c
9
10 \brief Definitions for SME APIs
11
Kiet Lamaa8e15a2014-02-11 23:30:06 -080012 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
13
14 Qualcomm Confidential and Proprietary.
15
Jeff Johnson295189b2012-06-20 16:38:30 -070016 ========================================================================*/
17
18/*===========================================================================
19
20 EDIT HISTORY FOR FILE
21
22
23 This section contains comments describing changes made to the module.
24 Notice that changes are listed in reverse chronological order.
25
26
27
28 when who what, where, why
29---------- --- --------------------------------------------------------
3006/03/10 js Added support to hostapd driven
31 * deauth/disassoc/mic failure
32
33===========================================================================*/
34
35/*--------------------------------------------------------------------------
36 Include Files
37 ------------------------------------------------------------------------*/
38
Jeff Johnson295189b2012-06-20 16:38:30 -070039
40#include "smsDebug.h"
41#include "sme_Api.h"
42#include "csrInsideApi.h"
43#include "smeInside.h"
44#include "csrInternal.h"
45#include "wlan_qct_wda.h"
46#include "halMsgApi.h"
Katya Nigam70d68332013-09-16 16:49:45 +053047#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070048#include "sme_Trace.h"
Katya Nigambcb705f2013-12-26 14:26:22 +053049#include "vos_types.h"
50#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070051
Jeff Johnson295189b2012-06-20 16:38:30 -070052#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070053
54
55
Jeff Johnson295189b2012-06-20 16:38:30 -070056extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
57
58#include <wlan_qct_pal_api.h>
Katya Nigam70d68332013-09-16 16:49:45 +053059#define LOG_SIZE 256
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080060#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053061#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080062
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070063
64#define CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE 1000*30 //30s
65
Jeff Johnson295189b2012-06-20 16:38:30 -070066// TxMB Functions
67extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
68 tANI_U32 size, tSmeCmd **ppCmd );
69extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
70extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Jeff Johnson295189b2012-06-20 16:38:30 -070071extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
72extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
73extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
74extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
75extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
76extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -070077
78static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
79static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
80
81eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
82
83eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
84
Amar Singhal0d15bd52013-10-12 23:13:13 -070085eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
86
Jeff Johnson295189b2012-06-20 16:38:30 -070087eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
88
89eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
90
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -070091#ifdef FEATURE_WLAN_LFR
92tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
93#endif
94
Chet Lanctot186b5732013-03-18 10:26:30 -070095#ifdef WLAN_FEATURE_11W
96eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
97 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
98#endif
99
Jeff Johnson295189b2012-06-20 16:38:30 -0700100//Internal SME APIs
101eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
102{
103 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
104
105 if(psSme)
106 {
107 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
108 {
109 status = eHAL_STATUS_SUCCESS;
110 }
111 }
112
113 return (status);
114}
115
116
117eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
118{
119 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
120
121 if(psSme)
122 {
123 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
124 {
125 status = eHAL_STATUS_SUCCESS;
126 }
127 }
128
129 return (status);
130}
131
132
133
134static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
135{
136 eHalStatus status;
137 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530138 tANI_U32 cmd_idx;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700139 VOS_STATUS vosStatus;
140 vos_timer_t* cmdTimeoutTimer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700141
142 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530143 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
144 &pMac->sme.smeCmdActiveList)))
145 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700146
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530147 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
148 &pMac->sme.smeCmdPendingList)))
149 goto end;
150
151 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
152 &pMac->sme.smeScanCmdActiveList)))
153 goto end;
154
155 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
156 &pMac->sme.smeScanCmdPendingList)))
157 goto end;
158
159 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
160 &pMac->sme.smeCmdFreeList)))
161 goto end;
162
Kiet Lam64c1b492013-07-12 13:56:44 +0530163 pCmd = vos_mem_malloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
164 if ( NULL == pCmd )
165 status = eHAL_STATUS_FAILURE;
166 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530167 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530168 status = eHAL_STATUS_SUCCESS;
169
170 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
171 pMac->sme.pSmeCmdBufAddr = pCmd;
172
173 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
174 {
175 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530176 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530177 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700178 }
179
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700180 /* This timer is only to debug the active list command timeout */
181
182 cmdTimeoutTimer = (vos_timer_t*)vos_mem_malloc(sizeof(vos_timer_t));
183 if (cmdTimeoutTimer)
184 {
185 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = cmdTimeoutTimer;
186 vosStatus =
187 vos_timer_init( pMac->sme.smeCmdActiveList.cmdTimeoutTimer,
188 VOS_TIMER_TYPE_SW,
189 activeListCmdTimeoutHandle,
190 (void*) pMac);
191
192 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
193 {
194 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
195 "Init Timer fail for active list command process time out");
196 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
197 }
198 else
199 {
200 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
201 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
202 }
203 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530204end:
205 if (!HAL_STATUS_SUCCESS(status))
206 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
207 status);
208
Jeff Johnson295189b2012-06-20 16:38:30 -0700209 return (status);
210}
211
212
213void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
214{
215 pCmd->command = eSmeNoCommand;
216 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
217}
218
219
220
221static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
222{
223 tListElem *pEntry;
224 tSmeCmd *pCommand;
225
226 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
227 {
228 //TODO: base on command type to call release functions
229 //reinitialize different command types so they can be reused
230 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
231 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
232 }
233}
234
235static void purgeSmeCmdList(tpAniSirGlobal pMac)
236{
237 //release any out standing commands back to free command list
238 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
239 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530240 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
241 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700242}
243
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530244void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
245 tDblLinkList *pList)
Jeff Johnson295189b2012-06-20 16:38:30 -0700246{
247 //release any out standing commands back to free command list
248 tListElem *pEntry, *pNext;
249 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700250 tDblLinkList localList;
251
252 vos_mem_zero(&localList, sizeof(tDblLinkList));
253 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
254 {
255 smsLog(pMac, LOGE, FL(" failed to open list"));
256 return;
257 }
258
259 csrLLLock(pList);
260 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
261 while(pEntry != NULL)
262 {
263 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
264 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
265 if(pCommand->sessionId == sessionId)
266 {
267 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
268 {
269 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
270 }
271 }
272 pEntry = pNext;
273 }
274 csrLLUnlock(pList);
275
276 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
277 {
278 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
279 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
280 }
281 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700282}
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
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700296 /*destroy active list command time out timer */
297 vos_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
298 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
299 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL;
300
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800301 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
302 if(status != eHAL_STATUS_SUCCESS)
303 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800304 smsLog(pMac, LOGE,
305 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800306 goto done;
307 }
308
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 if(NULL != pMac->sme.pSmeCmdBufAddr)
310 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530311 vos_mem_free(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700312 pMac->sme.pSmeCmdBufAddr = NULL;
313 }
314
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800315 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
316 if(status != eHAL_STATUS_SUCCESS)
317 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800318 smsLog(pMac, LOGE,
319 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800320 }
321done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700322 return (status);
323}
324
325
326void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
327{
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 switch( pCmd->command )
329 {
330 case eSmeCommandScan:
331 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
332 break;
333
334 case eSmeCommandRoam:
335 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
336 break;
337
338 case eSmeCommandWmStatusChange:
339 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
340 break;
341
342 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800343 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700344 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
345 break;
346
347 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800348 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
350 break;
351
352 default:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700353 smsLog( pMac, LOGE, " default: Unhandled command %d",
354 pCmd->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700355 break;
356 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700357}
358
359tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
360{
361 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
362 tListElem *pEntry;
363
364 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
365
366 // If we can get another MS Msg buffer, then we are ok. Just link
367 // the entry onto the linked list. (We are using the linked list
368 // to keep track of tfhe message buffers).
369 if ( pEntry )
370 {
371 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
372 }
373 else {
374 int idx = 1;
375
376 //Cannot change pRetCmd here since it needs to return later.
377 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
378 if( pEntry )
379 {
380 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
381 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800382 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
384 if(pTempCmd)
385 {
386 if( eSmeCsrCommandMask & pTempCmd->command )
387 {
388 //CSR command is stuck. See what the reason code is for that command
389 dumpCsrCommandInfo(pMac, pTempCmd);
390 }
391 } //if(pTempCmd)
392
393 //dump what is in the pending queue
394 csrLLLock(&pMac->sme.smeCmdPendingList);
395 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
396 while(pEntry)
397 {
398 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800399 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 idx++, pTempCmd->command );
401 if( eSmeCsrCommandMask & pTempCmd->command )
402 {
403 //CSR command is stuck. See what the reason code is for that command
404 dumpCsrCommandInfo(pMac, pTempCmd);
405 }
406 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
407 }
408 csrLLUnlock(&pMac->sme.smeCmdPendingList);
409
410 //There may be some more command in CSR's own pending queue
411 csrLLLock(&pMac->roam.roamCmdPendingList);
412 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
413 while(pEntry)
414 {
415 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800416 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700417 idx++, pTempCmd->command );
418 dumpCsrCommandInfo(pMac, pTempCmd);
419 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
420 }
421 csrLLUnlock(&pMac->roam.roamCmdPendingList);
422 }
423
424 return( pRetCmd );
425}
426
427
428void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
429{
430 if ( fHighPriority )
431 {
432 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
433 }
434 else
435 {
436 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
437 }
438
439 // process the command queue...
440 smeProcessPendingQueue( pMac );
441
442 return;
443}
444
445
446static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
447{
448 eSmeCommandType pmcCommand = eSmeNoCommand;
449 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
450 tPmcState pmcState;
451 eHalStatus status;
452
453 do
454 {
455 pmcState = pmcGetPmcState(pMac);
456
457 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
458 if( !HAL_STATUS_SUCCESS(status) )
459 {
460 //PMC state is not right for the command, drop it
461 return ( eSmeDropCommand );
462 }
463 if( fFullPowerNeeded ) break;
464 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
465 ( eSmeCommandDelTs == pCommand->command ) );
466 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700467#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700468 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700469 eSmeCommandOemDataReq == pCommand->command);
470 if(fFullPowerNeeded) break;
471#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700472 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 eSmeCommandRemainOnChannel == pCommand->command);
474 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700475 } while(0);
476
477 if( fFullPowerNeeded )
478 {
479 switch( pmcState )
480 {
481 case IMPS:
482 case STANDBY:
483 pmcCommand = eSmeCommandExitImps;
484 break;
485
486 case BMPS:
487 pmcCommand = eSmeCommandExitBmps;
488 break;
489
490 case UAPSD:
491 pmcCommand = eSmeCommandExitUapsd;
492 break;
493
494 case WOWL:
495 pmcCommand = eSmeCommandExitWowl;
496 break;
497
498 default:
499 break;
500 }
501 }
502
503 return ( pmcCommand );
504}
505
506
507//For commands that need to do extra cleanup.
508static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
509{
510 if( eSmePmcCommandMask & pCommand->command )
511 {
512 pmcAbortCommand( pMac, pCommand, fStopping );
513 }
514 else if ( eSmeCsrCommandMask & pCommand->command )
515 {
516 csrAbortCommand( pMac, pCommand, fStopping );
517 }
518 else
519 {
520 switch( pCommand->command )
521 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700522 case eSmeCommandRemainOnChannel:
523 if (NULL != pCommand->u.remainChlCmd.callback)
524 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700525 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700526 pCommand->u.remainChlCmd.callback;
527 /* process the msg */
528 if( callback )
529 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700530 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 eCSR_SCAN_ABORT );
532 }
533 }
534 smeReleaseCommand( pMac, pCommand );
535 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 default:
537 smeReleaseCommand( pMac, pCommand );
538 break;
539 }
540 }
541}
542
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530543tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
544 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
545{
546 tListElem *pCurEntry = NULL;
547 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700548
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530549 /* Go through the list and return the command whose session id is not
550 * matching with the current ongoing scan cmd sessionId */
551 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
552 while (pCurEntry)
553 {
554 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
555 if (pCommand->sessionId != sessionId)
556 {
557 smsLog(pMac, LOG1, "selected the command with different sessionId");
558 return pCurEntry;
559 }
560
561 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
562 }
563
564 smsLog(pMac, LOG1, "No command pending with different sessionId");
565 return NULL;
566}
567
568tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
569{
570 tListElem *pEntry;
571 tSmeCmd *pCommand;
572 tListElem *pSmeEntry;
573 tSmeCmd *pSmeCommand;
574 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
575
576 csrLLLock( &pMac->sme.smeScanCmdActiveList );
577 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
578 LL_ACCESS_NOLOCK ))
579 {
580 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
581 LL_ACCESS_LOCK))
582 {
583 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
584 LL_ACCESS_LOCK );
585 if (pEntry)
586 {
587 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
588 //We cannot execute any command in wait-for-key state until setKey is through.
589 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
590 {
591 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
592 {
593 smsLog(pMac, LOGE,
594 " Cannot process command(%d) while waiting for key",
595 pCommand->command);
596 status = eANI_BOOLEAN_FALSE;
597 goto end;
598 }
599 }
600
601 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
602 LL_ACCESS_LOCK )))
603 {
604 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
605 LL_ACCESS_LOCK);
606 if (pEntry)
607 {
608 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
609 Link) ;
610
611 /* if scan is running on one interface and SME recei
612 ves the next command on the same interface then
613 dont the allow the command to be queued to
614 smeCmdPendingList. If next scan is allowed on
615 the same interface the CSR state machine will
616 get screwed up. */
617 if (pSmeCommand->sessionId == pCommand->sessionId)
618 {
619 status = eANI_BOOLEAN_FALSE;
620 goto end;
621 }
622 }
623 }
624 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
625 pEntry, LL_ACCESS_LOCK ) )
626 {
627 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
628 &pCommand->Link, LL_ACCESS_NOLOCK );
629
630 switch (pCommand->command)
631 {
632 case eSmeCommandScan:
633 smsLog(pMac, LOG1,
634 " Processing scan offload command ");
635 csrProcessScanCommand( pMac, pCommand );
636 break;
637 default:
638 smsLog(pMac, LOGE,
639 " Something wrong, wrong command enqueued"
640 " to smeScanCmdPendingList");
641 pEntry = csrLLRemoveHead(
642 &pMac->sme.smeScanCmdActiveList,
643 LL_ACCESS_NOLOCK );
644 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
645 smeReleaseCommand( pMac, pCommand );
646 break;
647 }
648 }
649 }
650 }
651 }
652end:
653 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
654 return status;
655}
Jeff Johnson295189b2012-06-20 16:38:30 -0700656
657tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
658{
659 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
660 eHalStatus status = eHAL_STATUS_SUCCESS;
661 tListElem *pEntry;
662 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530663 tListElem *pSmeEntry;
664 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700665 eSmeCommandType pmcCommand = eSmeNoCommand;
666
667 // if the ActiveList is empty, then nothing is active so we can process a
668 // pending command...
669 //alwasy lock active list before locking pending list
670 csrLLLock( &pMac->sme.smeCmdActiveList );
671 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
672 {
673 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
674 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530675 /* If scan command is pending in the smeScanCmdActive list
676 * then pick the command from smeCmdPendingList which is
677 * not matching with the scan command session id.
678 * At any point of time only one command will be allowed
679 * on a single session. */
680 if ((pMac->fScanOffload) &&
681 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
682 LL_ACCESS_LOCK)))
683 {
684 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
685 LL_ACCESS_LOCK);
686 if (pSmeEntry)
687 {
688 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
689
690 pEntry = csrGetCmdToProcess(pMac,
691 &pMac->sme.smeCmdPendingList,
692 pSmeCommand->sessionId,
693 LL_ACCESS_LOCK);
694 goto sme_process_cmd;
695 }
696 }
697
Jeff Johnson295189b2012-06-20 16:38:30 -0700698 //Peek the command
699 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530700sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700701 if( pEntry )
702 {
703 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530704
Jeff Johnson295189b2012-06-20 16:38:30 -0700705 //We cannot execute any command in wait-for-key state until setKey is through.
706 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) )
707 {
708 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
709 {
710 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800711 smsLog(pMac, LOGE, " Cannot process command(%d) while waiting for key", pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530712 fContinue = eANI_BOOLEAN_FALSE;
713 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700714 }
715 }
716 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
717 if( eSmeDropCommand == pmcCommand )
718 {
719 //This command is not ok for current PMC state
720 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
721 {
722 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
723 }
724 csrLLUnlock( &pMac->sme.smeCmdActiveList );
725 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530726 fContinue = eANI_BOOLEAN_TRUE;
727 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 }
729 else if( eSmeNoCommand != pmcCommand )
730 {
731 tExitBmpsInfo exitBmpsInfo;
732 void *pv = NULL;
733 tANI_U32 size = 0;
734 tSmeCmd *pPmcCmd = NULL;
735
736 if( eSmeCommandExitBmps == pmcCommand )
737 {
738 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
739 pv = (void *)&exitBmpsInfo;
740 size = sizeof(tExitBmpsInfo);
741 }
742 //pmcCommand has to be one of the exit power save command
743 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
744 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
745 {
746 //Force this command to wake up the chip
747 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
748 csrLLUnlock( &pMac->sme.smeCmdActiveList );
749 fContinue = pmcProcessCommand( pMac, pPmcCmd );
750 if( fContinue )
751 {
752 //The command failed, remove it
753 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
754 {
755 pmcReleaseCommand( pMac, pPmcCmd );
756 }
757 }
758 }
759 else
760 {
761 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800762 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 -0700763 //Let it retry
764 fContinue = eANI_BOOLEAN_TRUE;
765 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530766 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 }
768 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
769 {
770 // we can reuse the pCommand
771
772 // Insert the command onto the ActiveList...
773 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
774
775 // .... and process the command.
776
Katya Nigambcb705f2013-12-26 14:26:22 +0530777 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -0700778 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700779 switch ( pCommand->command )
780 {
781
782 case eSmeCommandScan:
783 csrLLUnlock( &pMac->sme.smeCmdActiveList );
784 status = csrProcessScanCommand( pMac, pCommand );
785 break;
786
787 case eSmeCommandRoam:
788 csrLLUnlock( &pMac->sme.smeCmdActiveList );
789 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800790 if(!HAL_STATUS_SUCCESS(status))
791 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700792 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800793 &pCommand->Link, LL_ACCESS_LOCK ) )
794 {
795 csrReleaseCommandRoam( pMac, pCommand );
796 }
797 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700798 break;
799
800 case eSmeCommandWmStatusChange:
801 csrLLUnlock( &pMac->sme.smeCmdActiveList );
802 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
803 break;
804
805 case eSmeCommandSetKey:
806 csrLLUnlock( &pMac->sme.smeCmdActiveList );
807 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
808 if(!HAL_STATUS_SUCCESS(status))
809 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700810 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 &pCommand->Link, LL_ACCESS_LOCK ) )
812 {
813 csrReleaseCommandSetKey( pMac, pCommand );
814 }
815 }
816 break;
817
818 case eSmeCommandRemoveKey:
819 csrLLUnlock( &pMac->sme.smeCmdActiveList );
820 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
821 if(!HAL_STATUS_SUCCESS(status))
822 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700823 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700824 &pCommand->Link, LL_ACCESS_LOCK ) )
825 {
826 csrReleaseCommandRemoveKey( pMac, pCommand );
827 }
828 }
829 break;
830
831 case eSmeCommandAddStaSession:
832 csrLLUnlock( &pMac->sme.smeCmdActiveList );
833 csrProcessAddStaSessionCommand( pMac, pCommand );
834 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700835 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -0700836 csrLLUnlock( &pMac->sme.smeCmdActiveList );
837 csrProcessDelStaSessionCommand( pMac, pCommand );
838 break;
839
Jeff Johnsone7245742012-09-05 17:12:55 -0700840#ifdef FEATURE_OEM_DATA_SUPPORT
841 case eSmeCommandOemDataReq:
842 csrLLUnlock(&pMac->sme.smeCmdActiveList);
843 oemData_ProcessOemDataReqCommand(pMac, pCommand);
844 break;
845#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700846 case eSmeCommandRemainOnChannel:
847 csrLLUnlock(&pMac->sme.smeCmdActiveList);
848 p2pProcessRemainOnChannelCmd(pMac, pCommand);
849 break;
850 case eSmeCommandNoAUpdate:
851 csrLLUnlock( &pMac->sme.smeCmdActiveList );
852 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700853 case eSmeCommandEnterImps:
854 case eSmeCommandExitImps:
855 case eSmeCommandEnterBmps:
856 case eSmeCommandExitBmps:
857 case eSmeCommandEnterUapsd:
858 case eSmeCommandExitUapsd:
859 case eSmeCommandEnterWowl:
860 case eSmeCommandExitWowl:
861 csrLLUnlock( &pMac->sme.smeCmdActiveList );
862 fContinue = pmcProcessCommand( pMac, pCommand );
863 if( fContinue )
864 {
865 //The command failed, remove it
866 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
867 &pCommand->Link, LL_ACCESS_LOCK ) )
868 {
869 pmcReleaseCommand( pMac, pCommand );
870 }
871 }
872 break;
873
874 //Treat standby differently here because caller may not be able to handle
875 //the failure so we do our best here
876 case eSmeCommandEnterStandby:
877 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
878 {
879 //It can continue
880 csrLLUnlock( &pMac->sme.smeCmdActiveList );
881 fContinue = pmcProcessCommand( pMac, pCommand );
882 if( fContinue )
883 {
884 //The command failed, remove it
885 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
886 &pCommand->Link, LL_ACCESS_LOCK ) )
887 {
888 pmcReleaseCommand( pMac, pCommand );
889 }
890 }
891 }
892 else
893 {
894 //Need to issue a disconnect first before processing this command
895 tSmeCmd *pNewCmd;
896
897 //We need to re-run the command
898 fContinue = eANI_BOOLEAN_TRUE;
899 //Pull off the standby command first
900 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
901 &pCommand->Link, LL_ACCESS_NOLOCK ) )
902 {
903 csrLLUnlock( &pMac->sme.smeCmdActiveList );
904 //Need to call CSR function here because the disconnect command
905 //is handled by CSR
906 pNewCmd = csrGetCommandBuffer( pMac );
907 if( NULL != pNewCmd )
908 {
909 //Put the standby command to the head of the pending list first
910 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
911 LL_ACCESS_LOCK );
912 pNewCmd->command = eSmeCommandRoam;
913 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
914 //Put the disassoc command before the standby command
915 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
916 LL_ACCESS_LOCK );
917 }
918 else
919 {
920 //Continue the command here
921 fContinue = pmcProcessCommand( pMac, pCommand );
922 if( fContinue )
923 {
924 //The command failed, remove it
925 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
926 &pCommand->Link, LL_ACCESS_LOCK ) )
927 {
928 pmcReleaseCommand( pMac, pCommand );
929 }
930 }
931 }
932 }
933 else
934 {
935 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800936 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700937 VOS_ASSERT(0);
938 }
939 }
940 break;
941
942 case eSmeCommandAddTs:
943 case eSmeCommandDelTs:
944 csrLLUnlock( &pMac->sme.smeCmdActiveList );
945#ifndef WLAN_MDM_CODE_REDUCTION_OPT
946 fContinue = qosProcessCommand( pMac, pCommand );
947 if( fContinue )
948 {
949 //The command failed, remove it
950 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
951 &pCommand->Link, LL_ACCESS_NOLOCK ) )
952 {
953//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
954 qosReleaseCommand( pMac, pCommand );
955//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
956 }
957 }
958#endif
959 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800960#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700961 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800962 case eSmeCommandTdlsAddPeer:
963 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530964 case eSmeCommandTdlsLinkEstablish:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800965#ifdef FEATURE_WLAN_TDLS_INTERNAL
966 case eSmeCommandTdlsDiscovery:
967 case eSmeCommandTdlsLinkSetup:
968 case eSmeCommandTdlsLinkTear:
969 case eSmeCommandTdlsEnterUapsd:
970 case eSmeCommandTdlsExitUapsd:
971#endif
972 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -0800973 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800974 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800975
976 csrLLUnlock( &pMac->sme.smeCmdActiveList );
977 status = csrTdlsProcessCmd( pMac, pCommand );
978 }
979 break ;
980#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700981
982 default:
983 //something is wrong
984 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800985 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700986 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
987 csrLLUnlock( &pMac->sme.smeCmdActiveList );
988 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
989 smeReleaseCommand( pMac, pCommand );
990 status = eHAL_STATUS_FAILURE;
991 break;
992 }
993 if(!HAL_STATUS_SUCCESS(status))
994 {
995 fContinue = eANI_BOOLEAN_TRUE;
996 }
997 }//if(pEntry)
998 else
999 {
1000 //This is odd. Some one else pull off the command.
1001 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1002 }
1003 }
1004 else
1005 {
1006 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1007 }
1008 }
1009 else
1010 {
1011 //No command waiting
1012 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1013 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1014 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1015 {
1016 tANI_U32 nTime = 0;
1017
1018 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1019 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1020 {
1021 csrScanStartIdleScanTimer(pMac, nTime);
1022 }
1023 }
1024 }
1025 }
1026 else {
1027 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1028 }
1029
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301030sme_process_scan_queue:
1031 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1032 fContinue = eANI_BOOLEAN_FALSE;
1033
Jeff Johnson295189b2012-06-20 16:38:30 -07001034 return ( fContinue );
1035}
1036
1037void smeProcessPendingQueue( tpAniSirGlobal pMac )
1038{
1039 while( smeProcessCommand( pMac ) );
1040}
1041
1042
1043tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1044{
1045 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1046 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1047}
1048
1049
1050
1051//Global APIs
1052
1053/*--------------------------------------------------------------------------
1054
1055 \brief sme_Open() - Initialze all SME modules and put them at idle state
1056
1057 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1058 successfully return, all modules are at idle state ready to start.
1059
1060 smeOpen must be called before any other SME APIs can be involved.
1061 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001062 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001063 \param hHal - The handle returned by macOpen.
1064
1065 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1066
1067 Other status means SME is failed to be initialized
1068 \sa
1069
1070 --------------------------------------------------------------------------*/
1071eHalStatus sme_Open(tHalHandle hHal)
1072{
1073 eHalStatus status = eHAL_STATUS_FAILURE;
1074 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1075
1076 do {
1077 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001078 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001079 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1080 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001081 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001082 status = eHAL_STATUS_FAILURE;
1083 break;
1084 }
1085
1086 status = ccmOpen(hHal);
1087 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1088 smsLog( pMac, LOGE,
1089 "ccmOpen failed during initialization with status=%d", status );
1090 break;
1091 }
1092
1093 status = csrOpen(pMac);
1094 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1095 smsLog( pMac, LOGE,
1096 "csrOpen failed during initialization with status=%d", status );
1097 break;
1098 }
1099
1100 status = pmcOpen(hHal);
1101 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1102 smsLog( pMac, LOGE,
1103 "pmcOpen failed during initialization with status=%d", status );
1104 break;
1105 }
1106
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001107#ifdef FEATURE_WLAN_TDLS
1108 pMac->isTdlsPowerSaveProhibited = 0;
1109#endif
1110
Jeff Johnson295189b2012-06-20 16:38:30 -07001111#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1112 status = sme_QosOpen(pMac);
1113 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1114 smsLog( pMac, LOGE,
1115 "Qos open failed during initialization with status=%d", status );
1116 break;
1117 }
1118
1119 status = btcOpen(pMac);
1120 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1121 smsLog( pMac, LOGE,
1122 "btcOpen open failed during initialization with status=%d", status );
1123 break;
1124 }
1125#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001126#ifdef FEATURE_OEM_DATA_SUPPORT
1127 status = oemData_OemDataReqOpen(pMac);
1128 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1129 smsLog(pMac, LOGE,
1130 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1131 break;
1132 }
1133#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001134
1135 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1136 break;
1137
Jeff Johnson295189b2012-06-20 16:38:30 -07001138 {
1139 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1140 if ( NULL == pvosGCtx ){
1141 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1142 status = eHAL_STATUS_FAILURE;
1143 break;
1144 }
1145
1146 status = WLANSAP_Open( pvosGCtx );
1147 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1148 smsLog( pMac, LOGE,
1149 "WLANSAP_Open open failed during initialization with status=%d", status );
1150 break;
1151 }
1152 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001153#if defined WLAN_FEATURE_VOWIFI
1154 status = rrmOpen(pMac);
1155 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1156 smsLog( pMac, LOGE,
1157 "rrmOpen open failed during initialization with status=%d", status );
1158 break;
1159 }
1160#endif
1161
1162#if defined WLAN_FEATURE_VOWIFI_11R
1163 sme_FTOpen(pMac);
1164#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001165 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001166 smeTraceInit(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001167
1168 }while (0);
1169
1170 return status;
1171}
1172
Jeff Johnson295189b2012-06-20 16:38:30 -07001173/*--------------------------------------------------------------------------
1174
1175 \brief sme_set11dinfo() - Set the 11d information about valid channels
1176 and there power using information from nvRAM
1177 This function is called only for AP.
1178
Srinivas Girigowdade697412013-02-14 16:31:48 -08001179 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001180
1181 \param hHal - The handle returned by macOpen.
1182 \Param pSmeConfigParams - a pointer to a caller allocated object of
1183 typedef struct _smeConfigParams.
1184
1185 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1186
1187 Other status means SME is failed to update the config parameters.
1188 \sa
1189--------------------------------------------------------------------------*/
1190
1191eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1192{
1193 eHalStatus status = eHAL_STATUS_FAILURE;
1194 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1195
Katya Nigambcb705f2013-12-26 14:26:22 +05301196 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001197 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001198 if (NULL == pSmeConfigParams ) {
1199 smsLog( pMac, LOGE,
1200 "Empty config param structure for SME, nothing to update");
1201 return status;
1202 }
1203
1204 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1205 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001206 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001207 status );
1208 }
1209 return status;
1210}
1211
1212/*--------------------------------------------------------------------------
1213
1214 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1215
Srinivas Girigowdade697412013-02-14 16:31:48 -08001216 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001217
1218 \param hHal - The handle returned by HostapdAdapter.
1219 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1220
1221 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1222
1223 Other status means, failed to get the current regulatory domain.
1224 \sa
1225--------------------------------------------------------------------------*/
1226
1227eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1228{
1229 eHalStatus status = eHAL_STATUS_FAILURE;
1230 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1231
Katya Nigambcb705f2013-12-26 14:26:22 +05301232 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001233 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001234 if (NULL == domainIdSoftAp ) {
1235 smsLog( pMac, LOGE, "Uninitialized domain Id");
1236 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001237 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001238
1239 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1240 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001241
Jeff Johnson295189b2012-06-20 16:38:30 -07001242 return status;
1243}
1244
1245
1246eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1247{
1248 eHalStatus status = eHAL_STATUS_FAILURE;
1249 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1250
Katya Nigambcb705f2013-12-26 14:26:22 +05301251 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001252 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001253 if (NULL == apCntryCode ) {
1254 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1255 return status;
1256 }
1257
1258 status = csrSetRegInfo(hHal, apCntryCode );
1259 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001260 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001261 status );
1262 }
1263 return status;
1264}
1265
Jeff Johnson295189b2012-06-20 16:38:30 -07001266#ifdef FEATURE_WLAN_SCAN_PNO
1267/*--------------------------------------------------------------------------
1268
1269 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001270
1271 It is used at driver start up to inform RIVA of the default channel
1272 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001273
Srinivas Girigowdade697412013-02-14 16:31:48 -08001274 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001275
1276 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001277
Jeff Johnson295189b2012-06-20 16:38:30 -07001278 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1279
1280 Other status means SME is failed to update the channel config.
1281 \sa
1282
1283 --------------------------------------------------------------------------*/
1284eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1285{
1286 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1287
Katya Nigambcb705f2013-12-26 14:26:22 +05301288 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001289 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1290 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001291 &pMac->scan.base20MHzChannels, FALSE);
1292 return eHAL_STATUS_SUCCESS;
1293}
1294#endif // FEATURE_WLAN_SCAN_PNLO
1295
1296/*--------------------------------------------------------------------------
1297
1298 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1299
1300 The function updates some configuration for modules in SME, CCM, CSR, etc
1301 during SMEs close open sequence.
1302
1303 Modules inside SME apply the new configuration at the next transaction.
1304
Srinivas Girigowdade697412013-02-14 16:31:48 -08001305 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001306
1307 \param hHal - The handle returned by macOpen.
1308 \Param pSmeConfigParams - a pointer to a caller allocated object of
1309 typedef struct _smeConfigParams.
1310
1311 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1312
1313 Other status means SME is failed to update the config parameters.
1314 \sa
1315
1316 --------------------------------------------------------------------------*/
1317eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1318{
1319 eHalStatus status = eHAL_STATUS_FAILURE;
1320 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1321
Katya Nigambcb705f2013-12-26 14:26:22 +05301322 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001323 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001324 if (NULL == pSmeConfigParams ) {
1325 smsLog( pMac, LOGE,
1326 "Empty config param structure for SME, nothing to update");
1327 return status;
1328 }
1329
1330 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1331
1332 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001333 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001334 status );
1335 }
1336#if defined WLAN_FEATURE_P2P_INTERNAL
1337 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1338
1339 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001340 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001341 status );
1342 }
1343#endif
1344#if defined WLAN_FEATURE_VOWIFI
1345 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1346
1347 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001348 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001349 status );
1350 }
1351#endif
1352 //For SOC, CFG is set before start
1353 //We don't want to apply global CFG in connect state because that may cause some side affect
1354 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001355 csrIsAllSessionDisconnected( pMac) )
1356 {
1357 csrSetGlobalCfgs(pMac);
1358 }
1359
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301360 /* update the directed scan offload setting */
1361 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1362
Sandeep Puligilla60342762014-01-30 21:05:37 +05301363 /* Enable channel bonding mode in 2.4GHz */
1364 if ((pSmeConfigParams->csrConfig.channelBondingMode24GHz == TRUE) &&
1365 (IS_HT40_OBSS_SCAN_FEATURE_ENABLE))
1366 {
1367 ccmCfgSetInt(hHal,WNI_CFG_CHANNEL_BONDING_24G,
1368 eANI_BOOLEAN_TRUE, NULL,eANI_BOOLEAN_FALSE);
1369 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
1370 "Setting channelBondingMode24GHz:%d " ,
1371 pSmeConfigParams->csrConfig.channelBondingMode24GHz);
1372 }
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301373 if (pMac->fScanOffload)
1374 {
1375 /* If scan offload is enabled then lim has allow the sending of
1376 scan request to firmware even in powersave mode. The firmware has
1377 to take care of exiting from power save mode */
1378 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1379 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1380
1381 if (eHAL_STATUS_SUCCESS != status)
1382 {
1383 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1384 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1385 }
1386 }
krunal sonie9002db2013-11-25 14:24:17 -08001387 pMac->isCoalesingInIBSSAllowed =
1388 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001389 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Jeff Johnson295189b2012-06-20 16:38:30 -07001390 return status;
1391}
1392
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301393#ifdef WLAN_FEATURE_GTK_OFFLOAD
1394void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1395 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1396{
1397 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1398
1399 if (NULL == pMac)
1400 {
1401 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1402 "%s: pMac is null", __func__);
1403 return ;
1404 }
1405 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1406 {
1407 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1408 "%s: HDD callback is null", __func__);
1409 return ;
1410 }
1411 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1412 pGtkOffloadGetInfoRsp);
1413}
1414#endif
1415
Jeff Johnson295189b2012-06-20 16:38:30 -07001416/* ---------------------------------------------------------------------------
1417 \fn sme_ChangeConfigParams
1418 \brief The SME API exposed for HDD to provide config params to SME during
1419 SMEs stop -> start sequence.
1420
1421 If HDD changed the domain that will cause a reset. This function will
1422 provide the new set of 11d information for the new domain. Currrently this
1423 API provides info regarding 11d only at reset but we can extend this for
1424 other params (PMC, QoS) which needs to be initialized again at reset.
1425
Srinivas Girigowdade697412013-02-14 16:31:48 -08001426 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001427
1428 \param hHal - The handle returned by macOpen.
1429
1430 \Param
1431 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1432 currently provides 11d related information like Country code,
1433 Regulatory domain, valid channel list, Tx power per channel, a
1434 list with active/passive scan allowed per valid channel.
1435
1436 \return eHalStatus
1437 ---------------------------------------------------------------------------*/
1438eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1439 tCsrUpdateConfigParam *pUpdateConfigParam)
1440{
1441 eHalStatus status = eHAL_STATUS_FAILURE;
1442 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1443
1444 if (NULL == pUpdateConfigParam ) {
1445 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001446 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001447 return status;
1448 }
1449
1450 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1451
1452 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001453 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001454 status );
1455 }
1456
1457 return status;
1458
1459}
1460
1461/*--------------------------------------------------------------------------
1462
1463 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1464 that the NIC is ready tio run.
1465
1466 The function is called by HDD at the end of initialization stage so PE/HAL can
1467 enable the NIC to running state.
1468
Srinivas Girigowdade697412013-02-14 16:31:48 -08001469 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001470 \param hHal - The handle returned by macOpen.
1471
1472 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1473 successfully.
1474
1475 Other status means SME failed to send the message to PE.
1476 \sa
1477
1478 --------------------------------------------------------------------------*/
1479eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1480{
1481 tSirSmeReadyReq Msg;
1482 eHalStatus status = eHAL_STATUS_FAILURE;
1483 tPmcPowerState powerState;
1484 tPmcSwitchState hwWlanSwitchState;
1485 tPmcSwitchState swWlanSwitchState;
1486 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1487
Katya Nigambcb705f2013-12-26 14:26:22 +05301488 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001489 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001490 do
1491 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001492
1493 Msg.messageType = eWNI_SME_SYS_READY_IND;
1494 Msg.length = sizeof( tSirSmeReadyReq );
1495
1496 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1497 {
1498 status = eHAL_STATUS_SUCCESS;
1499 }
1500 else
1501 {
1502 smsLog( pMac, LOGE,
1503 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1504 break;
1505 }
1506
1507 status = pmcQueryPowerState( hHal, &powerState,
1508 &hwWlanSwitchState, &swWlanSwitchState );
1509 if ( ! HAL_STATUS_SUCCESS( status ) )
1510 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001511 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001512 status );
1513 break;
1514 }
1515
1516 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1517 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1518 {
1519 status = csrReady(pMac);
1520 if ( ! HAL_STATUS_SUCCESS( status ) )
1521 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001522 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001523 break;
1524 }
1525 status = pmcReady(hHal);
1526 if ( ! HAL_STATUS_SUCCESS( status ) )
1527 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001528 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001529 break;
1530 }
1531#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1532 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1533 {
1534 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001535 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001536 break;
1537 }
1538#endif
1539
1540#if defined WLAN_FEATURE_VOWIFI
1541 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1542 {
1543 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001544 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001545 break;
1546 }
1547#endif
1548 }
1549 pMac->sme.state = SME_STATE_READY;
1550 } while( 0 );
1551
1552 return status;
1553}
1554
1555/*--------------------------------------------------------------------------
1556
1557 \brief sme_Start() - Put all SME modules at ready state.
1558
1559 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1560 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001561 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001562 \param hHal - The handle returned by macOpen.
1563
1564 \return eHAL_STATUS_SUCCESS - SME is ready.
1565
1566 Other status means SME is failed to start
1567 \sa
1568
1569 --------------------------------------------------------------------------*/
1570eHalStatus sme_Start(tHalHandle hHal)
1571{
1572 eHalStatus status = eHAL_STATUS_FAILURE;
1573 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1574
1575 do
1576 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 status = csrStart(pMac);
1578 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001579 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001580 status );
1581 break;
1582 }
1583
1584 status = pmcStart(hHal);
1585 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001586 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001587 status );
1588 break;
1589 }
1590
Jeff Johnson295189b2012-06-20 16:38:30 -07001591 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1592 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001593 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001594 status );
1595 break;
1596 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001597 pMac->sme.state = SME_STATE_START;
1598 }while (0);
1599
1600 return status;
1601}
1602
1603
1604#ifdef WLAN_FEATURE_PACKET_FILTERING
1605/******************************************************************************
1606*
1607* Name: sme_PCFilterMatchCountResponseHandler
1608*
1609* Description:
1610* Invoke Packet Coalescing Filter Match Count callback routine
1611*
1612* Parameters:
1613* hHal - HAL handle for device
1614* pMsg - Pointer to tRcvFltPktMatchRsp structure
1615*
1616* Returns: eHalStatus
1617*
1618******************************************************************************/
1619eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1620{
1621 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1622 eHalStatus status = eHAL_STATUS_SUCCESS;
1623 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1624
1625 if (NULL == pMsg)
1626 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001627 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001628 status = eHAL_STATUS_FAILURE;
1629 }
1630 else
1631 {
1632 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001633 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001634
1635 /* Call Packet Coalescing Filter Match Count callback routine. */
1636 if (pMac->pmc.FilterMatchCountCB != NULL)
1637 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1638 pRcvFltPktMatchRsp);
1639
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001640 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001641 pRcvFltPktMatchRsp->status);
1642
1643 pMac->pmc.FilterMatchCountCB = NULL;
1644 pMac->pmc.FilterMatchCountCBContext = NULL;
1645 }
1646
1647 return(status);
1648}
1649#endif // WLAN_FEATURE_PACKET_FILTERING
1650
1651
Chet Lanctot186b5732013-03-18 10:26:30 -07001652#ifdef WLAN_FEATURE_11W
1653/*------------------------------------------------------------------
1654 *
1655 * Handle the unprotected management frame indication from LIM and
1656 * forward it to HDD.
1657 *
1658 *------------------------------------------------------------------*/
1659
1660eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1661 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1662{
1663 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1664 eHalStatus status = eHAL_STATUS_SUCCESS;
1665 tCsrRoamInfo pRoamInfo = {0};
1666 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1667
1668 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1669 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1670 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1671
1672 /* forward the mgmt frame to HDD */
1673 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1674
1675 return status;
1676}
1677#endif
1678
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001679#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
1680/*------------------------------------------------------------------
1681 *
1682 * Handle the tsm ie indication from LIM and forward it to HDD.
1683 *
1684 *------------------------------------------------------------------*/
1685
1686eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1687{
1688 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1689 eHalStatus status = eHAL_STATUS_SUCCESS;
1690 tCsrRoamInfo pRoamInfo = {0};
1691 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1692
1693 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1694 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1695 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1696
1697 /* forward the tsm ie information to HDD */
1698 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1699
1700 return status;
1701}
1702
1703/* ---------------------------------------------------------------------------
1704 \fn sme_SetCCKMIe
1705 \brief function to store the CCKM IE passed from supplicant and use it while packing
1706 reassociation request
1707 \param hHal - HAL handle for device
1708 \param pCckmIe - pointer to CCKM IE data
1709 \param pCckmIeLen - length of the CCKM IE
1710 \- return Success or failure
1711 -------------------------------------------------------------------------*/
1712eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1713 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1714{
1715 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1716 eHalStatus status = eHAL_STATUS_SUCCESS;
1717
1718 status = sme_AcquireGlobalLock( &pMac->sme );
1719 if ( HAL_STATUS_SUCCESS( status ) )
1720 {
1721 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1722 sme_ReleaseGlobalLock( &pMac->sme );
1723 }
1724 return status;
1725}
1726
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001727/* ---------------------------------------------------------------------------
1728 \fn sme_SetCcxBeaconRequest
1729 \brief function to set CCX beacon request parameters
1730 \param hHal - HAL handle for device
1731 \param sessionId - Session id
1732 \param pCcxBcnReq - pointer to CCX beacon request
1733 \- return Success or failure
1734 -------------------------------------------------------------------------*/
1735eHalStatus sme_SetCcxBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
1736 const tCsrCcxBeaconReq* pCcxBcnReq)
1737{
1738 eHalStatus status = eSIR_SUCCESS;
1739 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1740 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
1741 tCsrCcxBeaconReqParams *pBeaconReq = NULL;
1742 tANI_U8 counter = 0;
1743 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
1744 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
1745
1746 /* Store the info in RRM context */
1747 vos_mem_copy(&pSmeRrmContext->ccxBcnReqInfo, pCcxBcnReq, sizeof(tCsrCcxBeaconReq));
1748
1749 //Prepare the request to send to SME.
1750 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
1751 if(NULL == pSmeBcnReportReq)
1752 {
1753 smsLog(pMac, LOGP, "Memory Allocation Failure!!! CCX BcnReq Ind to SME");
1754 return eSIR_FAILURE;
1755 }
1756
1757 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
1758 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
1759
1760 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
1761 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
1762 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
1763 pSmeBcnReportReq->channelInfo.channelNum = 255;
1764 pSmeBcnReportReq->channelList.numChannels = pCcxBcnReq->numBcnReqIe;
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08001765 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_CCX_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001766
1767 for (counter = 0; counter < pCcxBcnReq->numBcnReqIe; counter++)
1768 {
1769 pBeaconReq = (tCsrCcxBeaconReqParams *)&pCcxBcnReq->bcnReq[counter];
1770 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
1771 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
1772 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
1773 }
1774
1775 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
1776 return status;
1777}
1778
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001779#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
1780
Chet Lanctot186b5732013-03-18 10:26:30 -07001781
Jeff Johnson295189b2012-06-20 16:38:30 -07001782/*--------------------------------------------------------------------------
1783
1784 \brief sme_ProcessMsg() - The main message processor for SME.
1785
1786 The function is called by a message dispatcher when to process a message
1787 targeted for SME.
1788
Srinivas Girigowdade697412013-02-14 16:31:48 -08001789 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001790 \param hHal - The handle returned by macOpen.
1791 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1792
1793 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1794
1795 Other status means SME failed to process the message to HAL.
1796 \sa
1797
1798 --------------------------------------------------------------------------*/
1799eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1800{
1801 eHalStatus status = eHAL_STATUS_FAILURE;
1802 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1803
1804 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001805 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001806 return status;
1807 }
1808
1809 status = sme_AcquireGlobalLock( &pMac->sme );
1810 if ( HAL_STATUS_SUCCESS( status ) )
1811 {
1812 if( SME_IS_START(pMac) )
1813 {
1814 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1815 case eWNI_PMC_ENTER_BMPS_RSP:
1816 case eWNI_PMC_EXIT_BMPS_RSP:
1817 case eWNI_PMC_EXIT_BMPS_IND:
1818 case eWNI_PMC_ENTER_IMPS_RSP:
1819 case eWNI_PMC_EXIT_IMPS_RSP:
1820 case eWNI_PMC_SMPS_STATE_IND:
1821 case eWNI_PMC_ENTER_UAPSD_RSP:
1822 case eWNI_PMC_EXIT_UAPSD_RSP:
1823 case eWNI_PMC_ENTER_WOWL_RSP:
1824 case eWNI_PMC_EXIT_WOWL_RSP:
1825 //PMC
1826 if (pMsg->bodyptr)
1827 {
1828 pmcMessageProcessor(hHal, pMsg->bodyptr);
1829 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301830 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001831 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001832 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 }
1834 break;
1835
1836 case WNI_CFG_SET_CNF:
1837 case WNI_CFG_DNLD_CNF:
1838 case WNI_CFG_GET_RSP:
1839 case WNI_CFG_ADD_GRP_ADDR_CNF:
1840 case WNI_CFG_DEL_GRP_ADDR_CNF:
1841 //CCM
1842 if (pMsg->bodyptr)
1843 {
1844 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1845 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301846 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001847 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001848 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001849 }
1850 break;
1851
1852 case eWNI_SME_ADDTS_RSP:
1853 case eWNI_SME_DELTS_RSP:
1854 case eWNI_SME_DELTS_IND:
1855#ifdef WLAN_FEATURE_VOWIFI_11R
1856 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001857#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001858 //QoS
1859 if (pMsg->bodyptr)
1860 {
1861#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1862 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05301863 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001864#endif
1865 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001866 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001867 }
1868 break;
1869#if defined WLAN_FEATURE_VOWIFI
1870 case eWNI_SME_NEIGHBOR_REPORT_IND:
1871 case eWNI_SME_BEACON_REPORT_REQ_IND:
1872#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001873 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001874#endif
1875 if ( pMsg->bodyptr )
1876 {
1877 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05301878 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001879 }
1880 else
1881 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001882 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001883 }
1884 break;
1885#endif
1886
Jeff Johnsone7245742012-09-05 17:12:55 -07001887#ifdef FEATURE_OEM_DATA_SUPPORT
1888 //Handle the eWNI_SME_OEM_DATA_RSP:
1889 case eWNI_SME_OEM_DATA_RSP:
1890 if(pMsg->bodyptr)
1891 {
1892 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
1893 vos_mem_free(pMsg->bodyptr);
1894 }
1895 else
1896 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001897 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07001898 }
1899 smeProcessPendingQueue( pMac );
1900 break;
1901#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001902
1903 case eWNI_SME_ADD_STA_SELF_RSP:
1904 if(pMsg->bodyptr)
1905 {
1906 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
1907 vos_mem_free(pMsg->bodyptr);
1908 }
1909 else
1910 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001911 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001912 }
1913 break;
1914 case eWNI_SME_DEL_STA_SELF_RSP:
1915 if(pMsg->bodyptr)
1916 {
1917 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
1918 vos_mem_free(pMsg->bodyptr);
1919 }
1920 else
1921 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001922 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001923 }
1924 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001925 case eWNI_SME_REMAIN_ON_CHN_RSP:
1926 if(pMsg->bodyptr)
1927 {
1928 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
1929 vos_mem_free(pMsg->bodyptr);
1930 }
1931 else
1932 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001933 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001934 }
1935 break;
1936 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
1937 if(pMsg->bodyptr)
1938 {
1939 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
1940 vos_mem_free(pMsg->bodyptr);
1941 }
1942 else
1943 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001944 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 -07001945 }
1946 break;
1947 case eWNI_SME_MGMT_FRM_IND:
1948 if(pMsg->bodyptr)
1949 {
1950 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
1951 vos_mem_free(pMsg->bodyptr);
1952 }
1953 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001954 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001955 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001956 }
1957 break;
1958 case eWNI_SME_ACTION_FRAME_SEND_CNF:
1959 if(pMsg->bodyptr)
1960 {
1961 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
1962 vos_mem_free(pMsg->bodyptr);
1963 }
1964 else
1965 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001966 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001967 }
1968 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001969 case eWNI_SME_COEX_IND:
1970 if(pMsg->bodyptr)
1971 {
1972 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
1973 vos_mem_free(pMsg->bodyptr);
1974 }
1975 else
1976 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001977 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001978 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001979 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001980
1981#ifdef FEATURE_WLAN_SCAN_PNO
1982 case eWNI_SME_PREF_NETWORK_FOUND_IND:
1983 if(pMsg->bodyptr)
1984 {
1985 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
1986 vos_mem_free(pMsg->bodyptr);
1987 }
1988 else
1989 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001990 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001991 }
1992 break;
1993#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001994
Jeff Johnson295189b2012-06-20 16:38:30 -07001995 case eWNI_SME_TX_PER_HIT_IND:
1996 if (pMac->sme.pTxPerHitCallback)
1997 {
1998 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
1999 }
2000 break;
2001
2002 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002003 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002004 {
2005 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2006 vos_mem_free(pMsg->bodyptr);
2007 }
2008 else
2009 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002010 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2011 }
2012 break;
2013
2014 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2015 if (pMsg->bodyptr)
2016 {
2017 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2018 vos_mem_free(pMsg->bodyptr);
2019 }
2020 else
2021 {
2022 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002023 }
2024 break;
2025
2026#ifdef WLAN_FEATURE_PACKET_FILTERING
2027 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2028 if(pMsg->bodyptr)
2029 {
2030 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2031 vos_mem_free(pMsg->bodyptr);
2032 }
2033 else
2034 {
2035 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002036 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002037 }
2038 break;
2039#endif // WLAN_FEATURE_PACKET_FILTERING
2040 case eWNI_SME_PRE_SWITCH_CHL_IND:
2041 {
2042 status = sme_HandlePreChannelSwitchInd(pMac);
2043 break;
2044 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002045
Jeff Johnson295189b2012-06-20 16:38:30 -07002046 case eWNI_SME_POST_SWITCH_CHL_IND:
2047 {
2048 status = sme_HandlePostChannelSwitchInd(pMac);
2049 break;
2050 }
2051
2052#ifdef WLAN_WAKEUP_EVENTS
2053 case eWNI_SME_WAKE_REASON_IND:
2054 if(pMsg->bodyptr)
2055 {
2056 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2057 vos_mem_free(pMsg->bodyptr);
2058 }
2059 else
2060 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002061 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002062 }
2063 break;
2064#endif // WLAN_WAKEUP_EVENTS
2065
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002066#ifdef FEATURE_WLAN_TDLS
2067 /*
2068 * command rescived from PE, SME tdls msg processor shall be called
2069 * to process commands recieved from PE
2070 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002071 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2072 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002073 case eWNI_SME_TDLS_DEL_STA_RSP:
2074 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002075 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002076 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302077 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002078#ifdef FEATURE_WLAN_TDLS_INTERNAL
2079 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
2080 case eWNI_SME_TDLS_DISCOVERY_START_IND:
2081 case eWNI_SME_TDLS_LINK_START_RSP:
2082 case eWNI_SME_TDLS_LINK_START_IND:
2083 case eWNI_SME_TDLS_TEARDOWN_RSP:
2084 case eWNI_SME_TDLS_TEARDOWN_IND:
2085 case eWNI_SME_ADD_TDLS_PEER_IND:
2086 case eWNI_SME_DELETE_TDLS_PEER_IND:
2087#endif
2088 {
2089 if (pMsg->bodyptr)
2090 {
2091 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302092 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002093 }
2094 else
2095 {
2096 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002097 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002098 }
2099 break;
2100 }
2101#endif
2102
Chet Lanctot186b5732013-03-18 10:26:30 -07002103#ifdef WLAN_FEATURE_11W
2104 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2105 if (pMsg->bodyptr)
2106 {
2107 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2108 vos_mem_free(pMsg->bodyptr);
2109 }
2110 else
2111 {
2112 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2113 }
2114 break;
2115#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002116#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
2117 case eWNI_SME_TSM_IE_IND:
2118 {
2119 if (pMsg->bodyptr)
2120 {
2121 sme_TsmIeInd(pMac, pMsg->bodyptr);
2122 vos_mem_free(pMsg->bodyptr);
2123 }
2124 else
2125 {
2126 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2127 }
2128 break;
2129 }
2130#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002131#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2132 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2133 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2134 break;
2135#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002136
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302137#ifdef WLAN_FEATURE_GTK_OFFLOAD
2138 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2139 if (pMsg->bodyptr)
2140 {
2141 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
2142 vos_mem_free(pMsg->bodyptr);
2143 }
2144 else
2145 {
2146 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2147 }
2148 break ;
2149#endif
Leo Chang9056f462013-08-01 19:21:11 -07002150
2151#ifdef FEATURE_WLAN_LPHB
2152 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002153 case eWNI_SME_LPHB_IND:
2154 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002155 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002156 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002157 }
2158 vos_mem_free(pMsg->bodyptr);
2159
2160 break;
2161#endif /* FEATURE_WLAN_LPHB */
2162
Leo Chang0b0e45a2013-12-15 15:18:55 -08002163#ifdef FEATURE_WLAN_CH_AVOID
2164 /* LPHB timeout indication arrived, send IND to client */
2165 case eWNI_SME_CH_AVOID_IND:
2166 if (pMac->sme.pChAvoidNotificationCb)
2167 {
2168 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2169 "%s: CH avoid notification", __func__);
2170 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2171 }
2172 vos_mem_free(pMsg->bodyptr);
2173
2174 break;
2175#endif /* FEATURE_WLAN_CH_AVOID */
2176
Jeff Johnson295189b2012-06-20 16:38:30 -07002177 default:
2178
2179 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2180 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2181 {
2182 //CSR
2183 if (pMsg->bodyptr)
2184 {
2185 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302186 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002187 }
2188 else
2189 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002190 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 }
2192 }
2193 else
2194 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002195 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002196 pMsg->type);
2197 if (pMsg->bodyptr)
2198 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302199 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002200 }
2201 }
2202 }//switch
2203 } //SME_IS_START
2204 else
2205 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002206 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002207 if (pMsg->bodyptr)
2208 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302209 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002210 }
2211 }
2212 sme_ReleaseGlobalLock( &pMac->sme );
2213 }
2214 else
2215 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002216 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002217 if (pMsg->bodyptr)
2218 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302219 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 }
2221 }
2222
2223 return status;
2224}
2225
2226
2227//No need to hold the global lock here because this function can only be called
2228//after sme_Stop.
2229v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2230{
2231 if( pMsg )
2232 {
2233 if (pMsg->bodyptr)
2234 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302235 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002236 }
2237 }
2238
2239}
2240
2241
2242/*--------------------------------------------------------------------------
2243
2244 \brief sme_Stop() - Stop all SME modules and put them at idle state
2245
2246 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2247 return, all modules are at idle state ready to start.
2248
Srinivas Girigowdade697412013-02-14 16:31:48 -08002249 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002250 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302251 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002252
2253 \return eHAL_STATUS_SUCCESS - SME is stopped.
2254
2255 Other status means SME is failed to stop but caller should still
2256 consider SME is stopped.
2257 \sa
2258
2259 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302260eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002261{
2262 eHalStatus status = eHAL_STATUS_FAILURE;
2263 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2264 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2265
Jeff Johnson295189b2012-06-20 16:38:30 -07002266 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2267 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002268 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 status );
2270 fail_status = status;
2271 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002272
2273 p2pStop(hHal);
2274
Kiet Lama72a2322013-11-15 11:18:11 +05302275 status = pmcStop(hHal);
2276 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2277 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2278 status );
2279 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002280 }
2281
Kiet Lama72a2322013-11-15 11:18:11 +05302282 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002284 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002285 status );
2286 fail_status = status;
2287 }
2288
2289 ccmStop(hHal);
2290
2291 purgeSmeCmdList(pMac);
2292
2293 if (!HAL_STATUS_SUCCESS( fail_status )) {
2294 status = fail_status;
2295 }
2296
2297 pMac->sme.state = SME_STATE_STOP;
2298
2299 return status;
2300}
2301
2302/*--------------------------------------------------------------------------
2303
2304 \brief sme_Close() - Release all SME modules and their resources.
2305
2306 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2307 return, all modules are at closed state.
2308
2309 No SME APIs can be involved after smeClose except smeOpen.
2310 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002311 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002312 \param hHal - The handle returned by macOpen
2313
2314 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2315
2316 Other status means SME is failed to be closed but caller still cannot
2317 call any other SME functions except smeOpen.
2318 \sa
2319
2320 --------------------------------------------------------------------------*/
2321eHalStatus sme_Close(tHalHandle hHal)
2322{
2323 eHalStatus status = eHAL_STATUS_FAILURE;
2324 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2325 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2326
2327 status = csrClose(pMac);
2328 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002329 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002330 status );
2331 fail_status = status;
2332 }
2333
Jeff Johnson295189b2012-06-20 16:38:30 -07002334 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2335 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002336 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002337 status );
2338 fail_status = status;
2339 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002340
2341#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2342 status = btcClose(hHal);
2343 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002344 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002345 status );
2346 fail_status = status;
2347 }
2348
2349 status = sme_QosClose(pMac);
2350 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002351 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002352 status );
2353 fail_status = status;
2354 }
2355#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002356#ifdef FEATURE_OEM_DATA_SUPPORT
2357 status = oemData_OemDataReqClose(hHal);
2358 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002359 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002360 status );
2361 fail_status = status;
2362 }
2363#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002364
2365 status = ccmClose(hHal);
2366 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002367 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002368 status );
2369 fail_status = status;
2370 }
2371
2372 status = pmcClose(hHal);
2373 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002374 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002375 status );
2376 fail_status = status;
2377 }
2378#if defined WLAN_FEATURE_VOWIFI
2379 status = rrmClose(hHal);
2380 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002381 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002382 status );
2383 fail_status = status;
2384 }
2385#endif
2386
2387#if defined WLAN_FEATURE_VOWIFI_11R
2388 sme_FTClose(hHal);
2389#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002390 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002391
2392 freeSmeCmdList(pMac);
2393
2394 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2395 {
2396 fail_status = eHAL_STATUS_FAILURE;
2397 }
2398
2399 if (!HAL_STATUS_SUCCESS( fail_status )) {
2400 status = fail_status;
2401 }
2402
2403 pMac->sme.state = SME_STATE_STOP;
2404
2405 return status;
2406}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002407#ifdef FEATURE_WLAN_LFR
2408tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2409{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002410#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002411 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2412 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2413 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2414 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2415 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2416 return eANI_BOOLEAN_FALSE;
2417 default:
2418 return eANI_BOOLEAN_TRUE;
2419 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002420#else
2421 /*
2422 * TODO: always return TRUE for now until
2423 * we figure out why we could be stuck in
2424 * one of the roaming states forever.
2425 */
2426 return eANI_BOOLEAN_TRUE;
2427#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002428}
2429#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002430/* ---------------------------------------------------------------------------
2431 \fn sme_ScanRequest
2432 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002433 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002434 \param pScanRequestID - pointer to an object to get back the request ID
2435 \param callback - a callback function that scan calls upon finish, will not
2436 be called if csrScanRequest returns error
2437 \param pContext - a pointer passed in for the callback
2438 \return eHalStatus
2439 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002440eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2441 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002442 csrScanCompleteCallback callback, void *pContext)
2443{
2444 eHalStatus status = eHAL_STATUS_FAILURE;
2445 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05302446 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002447 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002448 smsLog(pMac, LOG2, FL("enter"));
2449 do
2450 {
2451 if(pMac->scan.fScanEnable)
2452 {
2453 status = sme_AcquireGlobalLock( &pMac->sme );
2454 if ( HAL_STATUS_SUCCESS( status ) )
2455 {
2456 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002457#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002458 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002459 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002460#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002461 status = csrScanRequest( hHal, sessionId, pscanReq,
2462 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05302463 if ( !HAL_STATUS_SUCCESS( status ) )
2464 {
2465 smsLog(pMac, LOGE, FL("csrScanRequest failed"
2466 " SId=%d"), sessionId);
2467 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002468#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002469 }
2470 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002471 {
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002472 smsLog(pMac, LOGE, FL("Scan denied in state %d (sub-state %d)"),
2473 pMac->roam.neighborRoamInfo.neighborRoamState,
2474 pMac->roam.curSubState[sessionId]);
2475 /*HandOff is in progress. So schedule this scan later*/
2476 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002477 }
2478#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002479 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002480
Jeff Johnson295189b2012-06-20 16:38:30 -07002481 sme_ReleaseGlobalLock( &pMac->sme );
2482 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002483 else
2484 {
2485 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2486 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002487 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002488 else
2489 {
2490 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2491 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002492 } while( 0 );
2493
2494 return (status);
2495
2496
2497}
2498
2499/* ---------------------------------------------------------------------------
2500 \fn sme_ScanGetResult
2501 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002502 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002503 \param pFilter - If pFilter is NULL, all cached results are returned
2504 \param phResult - an object for the result.
2505 \return eHalStatus
2506 ---------------------------------------------------------------------------*/
2507eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2508 tScanResultHandle *phResult)
2509{
2510 eHalStatus status = eHAL_STATUS_FAILURE;
2511 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2512
Katya Nigambcb705f2013-12-26 14:26:22 +05302513 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002514 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002515 smsLog(pMac, LOG2, FL("enter"));
2516 status = sme_AcquireGlobalLock( &pMac->sme );
2517 if ( HAL_STATUS_SUCCESS( status ) )
2518 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002519 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002520 sme_ReleaseGlobalLock( &pMac->sme );
2521 }
2522 smsLog(pMac, LOG2, FL("exit status %d"), status);
2523
2524 return (status);
2525}
2526
2527
2528/* ---------------------------------------------------------------------------
2529 \fn sme_ScanFlushResult
2530 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002531 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002532 \return eHalStatus
2533 ---------------------------------------------------------------------------*/
2534eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2535{
2536 eHalStatus status = eHAL_STATUS_FAILURE;
2537 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2538
Katya Nigambcb705f2013-12-26 14:26:22 +05302539 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002540 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002541 status = sme_AcquireGlobalLock( &pMac->sme );
2542 if ( HAL_STATUS_SUCCESS( status ) )
2543 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002544 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002545 sme_ReleaseGlobalLock( &pMac->sme );
2546 }
2547
2548 return (status);
2549}
2550
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05302551/* ---------------------------------------------------------------------------
2552 \fn sme_FilterScanResults
2553 \brief a wrapper function to request CSR to clear scan results.
2554 This is a synchronous call
2555 \return eHalStatus
2556 ---------------------------------------------------------------------------*/
2557eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
2558{
2559 eHalStatus status = eHAL_STATUS_SUCCESS;
2560 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2561
2562 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2563 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
2564 status = sme_AcquireGlobalLock( &pMac->sme );
2565 if ( HAL_STATUS_SUCCESS( status ) )
2566 {
2567 csrScanFilterResults(pMac);
2568 sme_ReleaseGlobalLock( &pMac->sme );
2569 }
2570
2571 return (status);
2572}
2573
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002574eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2575{
2576 eHalStatus status = eHAL_STATUS_FAILURE;
2577 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2578
Katya Nigambcb705f2013-12-26 14:26:22 +05302579 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002580 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002581 status = sme_AcquireGlobalLock( &pMac->sme );
2582 if ( HAL_STATUS_SUCCESS( status ) )
2583 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302584 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002585 sme_ReleaseGlobalLock( &pMac->sme );
2586 }
2587
2588 return (status);
2589}
Jeff Johnson295189b2012-06-20 16:38:30 -07002590
2591/* ---------------------------------------------------------------------------
2592 \fn sme_ScanResultGetFirst
2593 \brief a wrapper function to request CSR to returns the first element of
2594 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002595 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002596 \param hScanResult - returned from csrScanGetResult
2597 \return tCsrScanResultInfo * - NULL if no result
2598 ---------------------------------------------------------------------------*/
2599tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2600 tScanResultHandle hScanResult)
2601{
2602 eHalStatus status = eHAL_STATUS_FAILURE;
2603 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2604 tCsrScanResultInfo *pRet = NULL;
2605
Katya Nigambcb705f2013-12-26 14:26:22 +05302606 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002607 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002608 status = sme_AcquireGlobalLock( &pMac->sme );
2609 if ( HAL_STATUS_SUCCESS( status ) )
2610 {
2611 pRet = csrScanResultGetFirst( pMac, hScanResult );
2612 sme_ReleaseGlobalLock( &pMac->sme );
2613 }
2614
2615 return (pRet);
2616}
2617
2618
2619/* ---------------------------------------------------------------------------
2620 \fn sme_ScanResultGetNext
2621 \brief a wrapper function to request CSR to returns the next element of
2622 scan result. It can be called without calling csrScanResultGetFirst
2623 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002624 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002625 \param hScanResult - returned from csrScanGetResult
2626 \return Null if no result or reach the end
2627 ---------------------------------------------------------------------------*/
2628tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2629 tScanResultHandle hScanResult)
2630{
2631 eHalStatus status = eHAL_STATUS_FAILURE;
2632 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2633 tCsrScanResultInfo *pRet = NULL;
2634
Katya Nigambcb705f2013-12-26 14:26:22 +05302635 MTRACE(vos_trace(VOS_MODULE_ID_SME ,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002636 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002637 status = sme_AcquireGlobalLock( &pMac->sme );
2638 if ( HAL_STATUS_SUCCESS( status ) )
2639 {
2640 pRet = csrScanResultGetNext( pMac, hScanResult );
2641 sme_ReleaseGlobalLock( &pMac->sme );
2642 }
2643
2644 return (pRet);
2645}
2646
2647
2648/* ---------------------------------------------------------------------------
2649 \fn sme_ScanSetBGScanparams
2650 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002651 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002652 \param pScanReq - BG scan request structure
2653 \return eHalStatus
2654 ---------------------------------------------------------------------------*/
2655eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2656{
2657 eHalStatus status = eHAL_STATUS_FAILURE;
2658 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2659
2660 if( NULL != pScanReq )
2661 {
2662 status = sme_AcquireGlobalLock( &pMac->sme );
2663 if ( HAL_STATUS_SUCCESS( status ) )
2664 {
2665 status = csrScanSetBGScanparams( hHal, pScanReq );
2666 sme_ReleaseGlobalLock( &pMac->sme );
2667 }
2668 }
2669
2670 return (status);
2671}
2672
2673
2674/* ---------------------------------------------------------------------------
2675 \fn sme_ScanResultPurge
2676 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2677 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002678 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002679 \param hScanResult - returned from csrScanGetResult. hScanResult is
2680 considered gone by
2681 calling this function and even before this function reutrns.
2682 \return eHalStatus
2683 ---------------------------------------------------------------------------*/
2684eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2685{
2686 eHalStatus status = eHAL_STATUS_FAILURE;
2687 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2688
Katya Nigambcb705f2013-12-26 14:26:22 +05302689 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002690 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002691 status = sme_AcquireGlobalLock( &pMac->sme );
2692 if ( HAL_STATUS_SUCCESS( status ) )
2693 {
2694 status = csrScanResultPurge( hHal, hScanResult );
2695 sme_ReleaseGlobalLock( &pMac->sme );
2696 }
2697
2698 return (status);
2699}
2700
2701/* ---------------------------------------------------------------------------
2702 \fn sme_ScanGetPMKIDCandidateList
2703 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002704 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002705 \param pPmkidList - caller allocated buffer point to an array of
2706 tPmkidCandidateInfo
2707 \param pNumItems - pointer to a variable that has the number of
2708 tPmkidCandidateInfo allocated when retruning, this is
2709 either the number needed or number of items put into
2710 pPmkidList
2711 \return eHalStatus - when fail, it usually means the buffer allocated is not
2712 big enough and pNumItems
2713 has the number of tPmkidCandidateInfo.
2714 \Note: pNumItems is a number of tPmkidCandidateInfo,
2715 not sizeof(tPmkidCandidateInfo) * something
2716 ---------------------------------------------------------------------------*/
2717eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002718 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07002719 tANI_U32 *pNumItems )
2720{
2721 eHalStatus status = eHAL_STATUS_FAILURE;
2722 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2723
2724 status = sme_AcquireGlobalLock( &pMac->sme );
2725 if ( HAL_STATUS_SUCCESS( status ) )
2726 {
2727 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2728 sme_ReleaseGlobalLock( &pMac->sme );
2729 }
2730
2731 return (status);
2732}
2733
2734/*----------------------------------------------------------------------------
2735 \fn sme_RoamRegisterLinkQualityIndCallback
2736
2737 \brief
2738 a wrapper function to allow HDD to register a callback handler with CSR for
2739 link quality indications.
2740
2741 Only one callback may be registered at any time.
2742 In order to deregister the callback, a NULL cback may be provided.
2743
2744 Registration happens in the task context of the caller.
2745
2746 \param callback - Call back being registered
2747 \param pContext - user data
2748
2749 DEPENDENCIES: After CSR open
2750
2751 \return eHalStatus
2752-----------------------------------------------------------------------------*/
2753eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2754 csrRoamLinkQualityIndCallback callback,
2755 void *pContext)
2756{
2757 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2758}
2759
2760/* ---------------------------------------------------------------------------
2761 \fn sme_RoamRegisterCallback
2762 \brief a wrapper function to allow HDD to register a callback with CSR.
2763 Unlike scan, roam has one callback for all the roam requests
2764 \param callback - a callback function that roam calls upon when state changes
2765 \param pContext - a pointer passed in for the callback
2766 \return eHalStatus
2767 ---------------------------------------------------------------------------*/
2768eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2769 csrRoamCompleteCallback callback,
2770 void *pContext)
2771{
2772 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2773}
2774
2775eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2776{
2777 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2778 return pMac->roam.configParam.phyMode;
2779}
2780
2781/* ---------------------------------------------------------------------------
2782 \fn sme_RoamConnect
2783 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002784 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002785 \param sessionId - the sessionId returned by sme_OpenSession.
2786 \param pProfile - description of the network to which to connect
2787 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2788 from csrScanGetResult
2789 \param pRoamId - to get back the request ID
2790 \return eHalStatus
2791 ---------------------------------------------------------------------------*/
2792eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2793 tANI_U32 *pRoamId)
2794{
2795 eHalStatus status = eHAL_STATUS_FAILURE;
2796 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2797
Katya Nigambcb705f2013-12-26 14:26:22 +05302798 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002799 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002800 smsLog(pMac, LOG2, FL("enter"));
2801 status = sme_AcquireGlobalLock( &pMac->sme );
2802 if ( HAL_STATUS_SUCCESS( status ) )
2803 {
2804 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2805 {
2806 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2807 }
2808 else
2809 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002810 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002811 status = eHAL_STATUS_INVALID_PARAMETER;
2812 }
2813 sme_ReleaseGlobalLock( &pMac->sme );
2814 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002815 else
2816 {
2817 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2818 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002819
2820 return (status);
2821}
2822
2823/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05302824
2825 \fn sme_SetPhyMode
2826
2827 \brief Changes the PhyMode.
2828
2829 \param hHal - The handle returned by macOpen.
2830
2831 \param phyMode new phyMode which is to set
2832
2833 \return eHalStatus SUCCESS.
2834
2835 -------------------------------------------------------------------------------*/
2836eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
2837{
2838 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2839
2840 if (NULL == pMac)
2841 {
2842 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2843 "%s: invalid context", __func__);
2844 return eHAL_STATUS_FAILURE;
2845 }
2846
2847 pMac->roam.configParam.phyMode = phyMode;
2848 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
2849 pMac->roam.configParam.phyMode,
2850 pMac->roam.configParam.ProprietaryRatesEnabled);
2851
2852 return eHAL_STATUS_SUCCESS;
2853}
2854
2855/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07002856 \fn sme_RoamReassoc
2857 \brief a wrapper function to request CSR to inititiate a re-association
2858 \param pProfile - can be NULL to join the currently connected AP. In that
2859 case modProfileFields should carry the modified field(s) which could trigger
2860 reassoc
2861 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2862 that might need modification dynamically once STA is up & running and this
2863 could trigger a reassoc
2864 \param pRoamId - to get back the request ID
2865 \return eHalStatus
2866 -------------------------------------------------------------------------------*/
2867eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2868 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002869 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002870{
2871 eHalStatus status = eHAL_STATUS_FAILURE;
2872 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2873
Katya Nigambcb705f2013-12-26 14:26:22 +05302874 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002875 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002876 smsLog(pMac, LOG2, FL("enter"));
2877 status = sme_AcquireGlobalLock( &pMac->sme );
2878 if ( HAL_STATUS_SUCCESS( status ) )
2879 {
2880 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2881 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002882 if((NULL == pProfile) && (fForce == 1))
2883 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07002884 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
2885 /* to force the AP initiate fresh 802.1x authentication need to clear
2886 * the PMKID cache for that set the following boolean. this is needed
2887 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
2888 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002889 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
2890 }
2891 else
2892 {
2893 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002894 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002895 }
2896 else
2897 {
2898 status = eHAL_STATUS_INVALID_PARAMETER;
2899 }
2900 sme_ReleaseGlobalLock( &pMac->sme );
2901 }
2902
2903 return (status);
2904}
2905
2906/* ---------------------------------------------------------------------------
2907 \fn sme_RoamConnectToLastProfile
2908 \brief a wrapper function to request CSR to disconnect and reconnect with
2909 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08002910 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002911 \return eHalStatus. It returns fail if currently connected
2912 ---------------------------------------------------------------------------*/
2913eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
2914{
2915 eHalStatus status = eHAL_STATUS_FAILURE;
2916 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2917
2918 status = sme_AcquireGlobalLock( &pMac->sme );
2919 if ( HAL_STATUS_SUCCESS( status ) )
2920 {
2921 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2922 {
2923 status = csrRoamConnectToLastProfile( pMac, sessionId );
2924 }
2925 else
2926 {
2927 status = eHAL_STATUS_INVALID_PARAMETER;
2928 }
2929 sme_ReleaseGlobalLock( &pMac->sme );
2930 }
2931
2932 return (status);
2933}
2934
2935/* ---------------------------------------------------------------------------
2936 \fn sme_RoamDisconnect
2937 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08002938 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002939 \param reason -- To indicate the reason for disconnecting. Currently, only
2940 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
2941 \return eHalStatus
2942 ---------------------------------------------------------------------------*/
2943eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
2944{
2945 eHalStatus status = eHAL_STATUS_FAILURE;
2946 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2947
Katya Nigambcb705f2013-12-26 14:26:22 +05302948 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002949 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07002950 smsLog(pMac, LOG2, FL("enter"));
2951 status = sme_AcquireGlobalLock( &pMac->sme );
2952 if ( HAL_STATUS_SUCCESS( status ) )
2953 {
2954 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2955 {
2956 status = csrRoamDisconnect( pMac, sessionId, reason );
2957 }
2958 else
2959 {
2960 status = eHAL_STATUS_INVALID_PARAMETER;
2961 }
2962 sme_ReleaseGlobalLock( &pMac->sme );
2963 }
2964
2965 return (status);
2966}
2967
Jeff Johnson295189b2012-06-20 16:38:30 -07002968/* ---------------------------------------------------------------------------
2969 \fn sme_RoamStopBss
2970 \brief To stop BSS for Soft AP. This is an asynchronous API.
2971 \param hHal - Global structure
2972 \param sessionId - sessionId of SoftAP
2973 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
2974 -------------------------------------------------------------------------------*/
2975eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
2976{
2977 eHalStatus status = eHAL_STATUS_FAILURE;
2978 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2979
2980 smsLog(pMac, LOG2, FL("enter"));
2981 status = sme_AcquireGlobalLock( &pMac->sme );
2982 if ( HAL_STATUS_SUCCESS( status ) )
2983 {
2984 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2985 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05302986 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07002987 }
2988 else
2989 {
2990 status = eHAL_STATUS_INVALID_PARAMETER;
2991 }
2992 sme_ReleaseGlobalLock( &pMac->sme );
2993 }
2994
2995 return (status);
2996}
2997
2998/* ---------------------------------------------------------------------------
2999 \fn sme_RoamDisconnectSta
3000 \brief To disassociate a station. This is an asynchronous API.
3001 \param hHal - Global structure
3002 \param sessionId - sessionId of SoftAP
3003 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3004 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3005 -------------------------------------------------------------------------------*/
3006eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
3007 tANI_U8 *pPeerMacAddr)
3008{
3009 eHalStatus status = eHAL_STATUS_FAILURE;
3010 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3011
3012 if ( NULL == pMac )
3013 {
3014 VOS_ASSERT(0);
3015 return status;
3016 }
3017
3018 status = sme_AcquireGlobalLock( &pMac->sme );
3019 if ( HAL_STATUS_SUCCESS( status ) )
3020 {
3021 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3022 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003023 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303024 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003025 }
3026 else
3027 {
3028 status = eHAL_STATUS_INVALID_PARAMETER;
3029 }
3030 sme_ReleaseGlobalLock( &pMac->sme );
3031 }
3032
3033 return (status);
3034}
3035
3036/* ---------------------------------------------------------------------------
3037 \fn sme_RoamDeauthSta
3038 \brief To disassociate a station. This is an asynchronous API.
3039 \param hHal - Global structure
3040 \param sessionId - sessionId of SoftAP
3041 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3042 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3043 -------------------------------------------------------------------------------*/
3044eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
3045 tANI_U8 *pPeerMacAddr)
3046{
3047 eHalStatus status = eHAL_STATUS_FAILURE;
3048 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3049
3050 if ( NULL == pMac )
3051 {
3052 VOS_ASSERT(0);
3053 return status;
3054 }
3055
3056 status = sme_AcquireGlobalLock( &pMac->sme );
3057 if ( HAL_STATUS_SUCCESS( status ) )
3058 {
3059 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3060 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003061 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303062 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003063 }
3064 else
3065 {
3066 status = eHAL_STATUS_INVALID_PARAMETER;
3067 }
3068 sme_ReleaseGlobalLock( &pMac->sme );
3069 }
3070
3071 return (status);
3072}
3073
3074/* ---------------------------------------------------------------------------
3075 \fn sme_RoamTKIPCounterMeasures
3076 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3077 \param sessionId - sessionId of SoftAP
3078 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3079 \return eHalStatus
3080 -------------------------------------------------------------------------------*/
3081eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3082 tANI_BOOLEAN bEnable)
3083{
3084 eHalStatus status = eHAL_STATUS_FAILURE;
3085 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3086
3087 if ( NULL == pMac )
3088 {
3089 VOS_ASSERT(0);
3090 return status;
3091 }
3092
3093 status = sme_AcquireGlobalLock( &pMac->sme );
3094 if ( HAL_STATUS_SUCCESS( status ) )
3095 {
3096 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3097 {
3098 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3099 }
3100 else
3101 {
3102 status = eHAL_STATUS_INVALID_PARAMETER;
3103 }
3104 sme_ReleaseGlobalLock( &pMac->sme );
3105 }
3106
3107 return (status);
3108}
3109
3110/* ---------------------------------------------------------------------------
3111 \fn sme_RoamGetAssociatedStas
3112 \brief To probe the list of associated stations from various modules of CORE stack.
3113 \This is an asynchronous API.
3114 \param sessionId - sessionId of SoftAP
3115 \param modId - Module from whom list of associtated stations is to be probed.
3116 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3117 \param pUsrContext - Opaque HDD context
3118 \param pfnSapEventCallback - Sap event callback in HDD
3119 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3120 \return eHalStatus
3121 -------------------------------------------------------------------------------*/
3122eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3123 VOS_MODULE_ID modId, void *pUsrContext,
3124 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3125{
3126 eHalStatus status = eHAL_STATUS_FAILURE;
3127 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3128
3129 if ( NULL == pMac )
3130 {
3131 VOS_ASSERT(0);
3132 return status;
3133 }
3134
3135 status = sme_AcquireGlobalLock( &pMac->sme );
3136 if ( HAL_STATUS_SUCCESS( status ) )
3137 {
3138 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3139 {
3140 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3141 }
3142 else
3143 {
3144 status = eHAL_STATUS_INVALID_PARAMETER;
3145 }
3146 sme_ReleaseGlobalLock( &pMac->sme );
3147 }
3148
3149 return (status);
3150}
3151
3152/* ---------------------------------------------------------------------------
3153 \fn sme_RoamGetWpsSessionOverlap
3154 \brief To get the WPS PBC session overlap information.
3155 \This is an asynchronous API.
3156 \param sessionId - sessionId of SoftAP
3157 \param pUsrContext - Opaque HDD context
3158 \param pfnSapEventCallback - Sap event callback in HDD
3159 \pRemoveMac - pointer to Mac address which needs to be removed from session
3160 \return eHalStatus
3161 -------------------------------------------------------------------------------*/
3162eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003163 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07003164 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3165{
3166 eHalStatus status = eHAL_STATUS_FAILURE;
3167 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3168
3169 if ( NULL == pMac )
3170 {
3171 VOS_ASSERT(0);
3172 return status;
3173 }
3174
3175 status = sme_AcquireGlobalLock( &pMac->sme );
3176 if ( HAL_STATUS_SUCCESS( status ) )
3177 {
3178 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3179 {
3180 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3181 }
3182 else
3183 {
3184 status = eHAL_STATUS_INVALID_PARAMETER;
3185 }
3186 sme_ReleaseGlobalLock( &pMac->sme );
3187 }
3188
3189 return (status);
3190}
3191
Jeff Johnson295189b2012-06-20 16:38:30 -07003192
3193/* ---------------------------------------------------------------------------
3194 \fn sme_RoamGetConnectState
3195 \brief a wrapper function to request CSR to return the current connect state
3196 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003197 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003198 \return eHalStatus
3199 ---------------------------------------------------------------------------*/
3200eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3201{
3202 eHalStatus status = eHAL_STATUS_FAILURE;
3203 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3204
3205 status = sme_AcquireGlobalLock( &pMac->sme );
3206 if ( HAL_STATUS_SUCCESS( status ) )
3207 {
3208 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3209 {
3210 status = csrRoamGetConnectState( pMac, sessionId, pState );
3211 }
3212 else
3213 {
3214 status = eHAL_STATUS_INVALID_PARAMETER;
3215 }
3216 sme_ReleaseGlobalLock( &pMac->sme );
3217 }
3218
3219 return (status);
3220}
3221
3222/* ---------------------------------------------------------------------------
3223 \fn sme_RoamGetConnectProfile
3224 \brief a wrapper function to request CSR to return the current connect
3225 profile. Caller must call csrRoamFreeConnectProfile after it is done
3226 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003227 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003228 \param pProfile - pointer to a caller allocated structure
3229 tCsrRoamConnectedProfile
3230 \return eHalStatus. Failure if not connected
3231 ---------------------------------------------------------------------------*/
3232eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3233 tCsrRoamConnectedProfile *pProfile)
3234{
3235 eHalStatus status = eHAL_STATUS_FAILURE;
3236 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3237
Katya Nigambcb705f2013-12-26 14:26:22 +05303238 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003239 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003240 status = sme_AcquireGlobalLock( &pMac->sme );
3241 if ( HAL_STATUS_SUCCESS( status ) )
3242 {
3243 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3244 {
3245 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3246 }
3247 else
3248 {
3249 status = eHAL_STATUS_INVALID_PARAMETER;
3250 }
3251 sme_ReleaseGlobalLock( &pMac->sme );
3252 }
3253
3254 return (status);
3255}
3256
3257/* ---------------------------------------------------------------------------
3258 \fn sme_RoamFreeConnectProfile
3259 \brief a wrapper function to request CSR to free and reinitialize the
3260 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003261 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003262 \param pProfile - pointer to a caller allocated structure
3263 tCsrRoamConnectedProfile
3264 \return eHalStatus.
3265 ---------------------------------------------------------------------------*/
3266eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3267 tCsrRoamConnectedProfile *pProfile)
3268{
3269 eHalStatus status = eHAL_STATUS_FAILURE;
3270 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3271
Katya Nigambcb705f2013-12-26 14:26:22 +05303272 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003273 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003274 status = sme_AcquireGlobalLock( &pMac->sme );
3275 if ( HAL_STATUS_SUCCESS( status ) )
3276 {
3277 status = csrRoamFreeConnectProfile( pMac, pProfile );
3278 sme_ReleaseGlobalLock( &pMac->sme );
3279 }
3280
3281 return (status);
3282}
3283
3284/* ---------------------------------------------------------------------------
3285 \fn sme_RoamSetPMKIDCache
3286 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003287 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003288 \param pPMKIDCache - caller allocated buffer point to an array of
3289 tPmkidCacheInfo
3290 \param numItems - a variable that has the number of tPmkidCacheInfo
3291 allocated when retruning, this is either the number needed
3292 or number of items put into pPMKIDCache
3293 \return eHalStatus - when fail, it usually means the buffer allocated is not
3294 big enough and pNumItems has the number of
3295 tPmkidCacheInfo.
3296 \Note: pNumItems is a number of tPmkidCacheInfo,
3297 not sizeof(tPmkidCacheInfo) * something
3298 ---------------------------------------------------------------------------*/
3299eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
3300 tANI_U32 numItems )
3301{
3302 eHalStatus status = eHAL_STATUS_FAILURE;
3303 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3304
Katya Nigambcb705f2013-12-26 14:26:22 +05303305 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003306 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003307 status = sme_AcquireGlobalLock( &pMac->sme );
3308 if ( HAL_STATUS_SUCCESS( status ) )
3309 {
3310 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3311 {
3312 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
3313 }
3314 else
3315 {
3316 status = eHAL_STATUS_INVALID_PARAMETER;
3317 }
3318 sme_ReleaseGlobalLock( &pMac->sme );
3319 }
3320
3321 return (status);
3322}
3323
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003324eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId, tANI_U8 *pBSSId )
3325{
3326 eHalStatus status = eHAL_STATUS_FAILURE;
3327 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3328 status = sme_AcquireGlobalLock( &pMac->sme );
3329 if ( HAL_STATUS_SUCCESS( status ) )
3330 {
3331 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3332 {
3333 status = csrRoamDelPMKIDfromCache( pMac, sessionId, pBSSId );
3334 }
3335 else
3336 {
3337 status = eHAL_STATUS_INVALID_PARAMETER;
3338 }
3339 sme_ReleaseGlobalLock( &pMac->sme );
3340 }
3341 return (status);
3342}
Wilson Yang47b58192013-12-11 11:40:19 -08003343
Jeff Johnson295189b2012-06-20 16:38:30 -07003344/* ---------------------------------------------------------------------------
3345 \fn sme_RoamGetSecurityReqIE
3346 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3347 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003348 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003349 \param pLen - caller allocated memory that has the length of pBuf as input.
3350 Upon returned, *pLen has the needed or IE length in pBuf.
3351 \param pBuf - Caller allocated memory that contain the IE field, if any,
3352 upon return
3353 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3354 \return eHalStatus - when fail, it usually means the buffer allocated is not
3355 big enough
3356 ---------------------------------------------------------------------------*/
3357eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3358 tANI_U8 *pBuf, eCsrSecurityType secType)
3359{
3360 eHalStatus status = eHAL_STATUS_FAILURE;
3361 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3362
3363 status = sme_AcquireGlobalLock( &pMac->sme );
3364 if ( HAL_STATUS_SUCCESS( status ) )
3365 {
3366 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3367 {
3368 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3369 }
3370 else
3371 {
3372 status = eHAL_STATUS_INVALID_PARAMETER;
3373 }
3374 sme_ReleaseGlobalLock( &pMac->sme );
3375 }
3376
3377 return (status);
3378}
3379
3380/* ---------------------------------------------------------------------------
3381 \fn sme_RoamGetSecurityRspIE
3382 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3383 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003384 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003385 \param pLen - caller allocated memory that has the length of pBuf as input.
3386 Upon returned, *pLen has the needed or IE length in pBuf.
3387 \param pBuf - Caller allocated memory that contain the IE field, if any,
3388 upon return
3389 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3390 \return eHalStatus - when fail, it usually means the buffer allocated is not
3391 big enough
3392 ---------------------------------------------------------------------------*/
3393eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3394 tANI_U8 *pBuf, eCsrSecurityType secType)
3395{
3396 eHalStatus status = eHAL_STATUS_FAILURE;
3397 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3398
3399 status = sme_AcquireGlobalLock( &pMac->sme );
3400 if ( HAL_STATUS_SUCCESS( status ) )
3401 {
3402 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3403 {
3404 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3405 }
3406 else
3407 {
3408 status = eHAL_STATUS_INVALID_PARAMETER;
3409 }
3410 sme_ReleaseGlobalLock( &pMac->sme );
3411 }
3412
3413 return (status);
3414
3415}
3416
3417
3418/* ---------------------------------------------------------------------------
3419 \fn sme_RoamGetNumPMKIDCache
3420 \brief a wrapper function to request CSR to return number of PMKID cache
3421 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003422 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003423 \return tANI_U32 - the number of PMKID cache entries
3424 ---------------------------------------------------------------------------*/
3425tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3426{
3427 eHalStatus status = eHAL_STATUS_FAILURE;
3428 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3429 tANI_U32 numPmkidCache = 0;
3430
3431 status = sme_AcquireGlobalLock( &pMac->sme );
3432 if ( HAL_STATUS_SUCCESS( status ) )
3433 {
3434 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3435 {
3436 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3437 status = eHAL_STATUS_SUCCESS;
3438 }
3439 else
3440 {
3441 status = eHAL_STATUS_INVALID_PARAMETER;
3442 }
3443 sme_ReleaseGlobalLock( &pMac->sme );
3444 }
3445
3446 return (numPmkidCache);
3447}
3448
3449/* ---------------------------------------------------------------------------
3450 \fn sme_RoamGetPMKIDCache
3451 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003452 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003453 \param pNum - caller allocated memory that has the space of the number of
3454 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3455 needed or actually number in tPmkidCacheInfo.
3456 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3457 any, upon return
3458 \return eHalStatus - when fail, it usually means the buffer allocated is not
3459 big enough
3460 ---------------------------------------------------------------------------*/
3461eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3462 tPmkidCacheInfo *pPmkidCache)
3463{
3464 eHalStatus status = eHAL_STATUS_FAILURE;
3465 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3466
3467 status = sme_AcquireGlobalLock( &pMac->sme );
3468 if ( HAL_STATUS_SUCCESS( status ) )
3469 {
3470 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3471 {
3472 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3473 }
3474 else
3475 {
3476 status = eHAL_STATUS_INVALID_PARAMETER;
3477 }
3478 sme_ReleaseGlobalLock( &pMac->sme );
3479 }
3480
3481 return (status);
3482}
3483
3484
3485/* ---------------------------------------------------------------------------
3486 \fn sme_GetConfigParam
3487 \brief a wrapper function that HDD calls to get the global settings
3488 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003489 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003490 \param pParam - caller allocated memory
3491 \return eHalStatus
3492 ---------------------------------------------------------------------------*/
3493eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3494{
3495 eHalStatus status = eHAL_STATUS_FAILURE;
3496 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3497
Katya Nigambcb705f2013-12-26 14:26:22 +05303498 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003499 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003500 status = sme_AcquireGlobalLock( &pMac->sme );
3501 if ( HAL_STATUS_SUCCESS( status ) )
3502 {
3503 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3504 if (status != eHAL_STATUS_SUCCESS)
3505 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003506 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003507 sme_ReleaseGlobalLock( &pMac->sme );
3508 return status;
3509 }
3510#if defined WLAN_FEATURE_P2P_INTERNAL
3511 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3512 if (status != eHAL_STATUS_SUCCESS)
3513 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003514 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003515 sme_ReleaseGlobalLock( &pMac->sme );
3516 return status;
3517 }
3518#endif
3519 sme_ReleaseGlobalLock( &pMac->sme );
3520 }
3521
3522 return (status);
3523}
3524
3525/* ---------------------------------------------------------------------------
3526 \fn sme_CfgSetInt
3527 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003528 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003529 \param cfgId - Configuration Parameter ID (type) for STA.
3530 \param ccmValue - The information related to Configuration Parameter ID
3531 which needs to be saved in CFG
3532 \param callback - To be registered by CSR with CCM. Once the CFG done with
3533 saving the information in the database, it notifies CCM &
3534 then the callback will be invoked to notify.
3535 \param toBeSaved - To save the request for future reference
3536 \return eHalStatus
3537 ---------------------------------------------------------------------------*/
3538eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3539 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3540{
3541 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3542}
3543
3544/* ---------------------------------------------------------------------------
3545 \fn sme_CfgSetStr
3546 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003547 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003548 \param cfgId - Configuration Parameter ID (type) for STA.
3549 \param pStr - Pointer to the byte array which carries the information needs
3550 to be saved in CFG
3551 \param length - Length of the data to be saved
3552 \param callback - To be registered by CSR with CCM. Once the CFG done with
3553 saving the information in the database, it notifies CCM &
3554 then the callback will be invoked to notify.
3555 \param toBeSaved - To save the request for future reference
3556 \return eHalStatus
3557 ---------------------------------------------------------------------------*/
3558eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3559 tANI_U32 length, tCcmCfgSetCallback callback,
3560 eAniBoolean toBeSaved)
3561{
3562 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3563}
3564
3565/* ---------------------------------------------------------------------------
3566 \fn sme_GetModifyProfileFields
3567 \brief HDD or SME - QOS calls this function to get the current values of
3568 connected profile fields, changing which can cause reassoc.
3569 This function must be called after CFG is downloaded and STA is in connected
3570 state. Also, make sure to call this function to get the current profile
3571 fields before calling the reassoc. So that pModifyProfileFields will have
3572 all the latest values plus the one(s) has been updated as part of reassoc
3573 request.
3574 \param pModifyProfileFields - pointer to the connected profile fields
3575 changing which can cause reassoc
3576
3577 \return eHalStatus
3578 -------------------------------------------------------------------------------*/
3579eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3580 tCsrRoamModifyProfileFields * pModifyProfileFields)
3581{
3582 eHalStatus status = eHAL_STATUS_FAILURE;
3583 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3584
Katya Nigambcb705f2013-12-26 14:26:22 +05303585 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003586 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003587 status = sme_AcquireGlobalLock( &pMac->sme );
3588 if ( HAL_STATUS_SUCCESS( status ) )
3589 {
3590 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3591 {
3592 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3593 }
3594 else
3595 {
3596 status = eHAL_STATUS_INVALID_PARAMETER;
3597 }
3598 sme_ReleaseGlobalLock( &pMac->sme );
3599 }
3600
3601 return (status);
3602}
3603
Sandeep Puligilla332ea912014-02-04 00:16:24 +05303604/* ---------------------------------------------------------------------------
3605 \fn sme_HT40StopOBSSScan
3606 \brief HDD or SME - Command to stop the OBSS scan
3607 THis is implemented only for debugging purpose.
3608 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
3609 \param sessionId - sessionId
3610 changing which can cause reassoc
3611
3612 \return eHalStatus
3613 -------------------------------------------------------------------------------*/
3614eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
3615{
3616 eHalStatus status = eHAL_STATUS_FAILURE;
3617 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3618
3619 smsLog(pMac, LOG2, FL("enter"));
3620 status = sme_AcquireGlobalLock( &pMac->sme );
3621 if ( HAL_STATUS_SUCCESS( status ) )
3622 {
3623 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3624 {
3625 csrHT40StopOBSSScan( pMac, sessionId );
3626 }
3627 else
3628 {
3629 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3630 "%s: Invalid session sessionId %d", __func__,sessionId);
3631 status = eHAL_STATUS_INVALID_PARAMETER;
3632 }
3633 sme_ReleaseGlobalLock( &pMac->sme );
3634 }
3635 return (status);
3636}
3637
Jeff Johnson295189b2012-06-20 16:38:30 -07003638/*--------------------------------------------------------------------------
3639 \fn sme_SetConfigPowerSave
3640 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3641 For BMPS related configuration, this function also updates the CFG
3642 and sends a message to FW to pick up the new values. Note: Calling
3643 this function only updates the configuration and does not enable
3644 the specified power save mode.
3645 \param hHal - The handle returned by macOpen.
3646 \param psMode - Power Saving mode being modified
3647 \param pConfigParams - a pointer to a caller allocated object of type
3648 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3649 \return eHalStatus
3650 --------------------------------------------------------------------------*/
3651eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3652 void *pConfigParams)
3653{
3654 eHalStatus status = eHAL_STATUS_FAILURE;
3655 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3656
Katya Nigambcb705f2013-12-26 14:26:22 +05303657 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003658 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003659 if (NULL == pConfigParams ) {
3660 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3661 "nothing to update");
3662 return eHAL_STATUS_FAILURE;
3663 }
3664
3665 status = sme_AcquireGlobalLock( &pMac->sme );
3666 if ( HAL_STATUS_SUCCESS( status ) )
3667 {
3668 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3669 sme_ReleaseGlobalLock( &pMac->sme );
3670 }
3671
3672 return (status);
3673}
3674
3675/*--------------------------------------------------------------------------
3676 \fn sme_GetConfigPowerSave
3677 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3678 \param hHal - The handle returned by macOpen.
3679 \param psMode - Power Saving mode
3680 \param pConfigParams - a pointer to a caller allocated object of type
3681 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3682 \return eHalStatus
3683 --------------------------------------------------------------------------*/
3684eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3685 void *pConfigParams)
3686{
3687 eHalStatus status = eHAL_STATUS_FAILURE;
3688 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3689
Katya Nigambcb705f2013-12-26 14:26:22 +05303690 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003691 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003692 if (NULL == pConfigParams ) {
3693 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3694 "nothing to update");
3695 return eHAL_STATUS_FAILURE;
3696 }
3697
3698 status = sme_AcquireGlobalLock( &pMac->sme );
3699 if ( HAL_STATUS_SUCCESS( status ) )
3700 {
3701 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3702 sme_ReleaseGlobalLock( &pMac->sme );
3703 }
3704
3705 return (status);
3706}
3707
3708/* ---------------------------------------------------------------------------
3709 \fn sme_SignalPowerEvent
3710 \brief Signals to PMC that a power event has occurred. Used for putting
3711 the chip into deep sleep mode.
3712 \param hHal - The handle returned by macOpen.
3713 \param event - the event that has occurred
3714 \return eHalStatus
3715 ---------------------------------------------------------------------------*/
3716eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3717{
3718 eHalStatus status = eHAL_STATUS_FAILURE;
3719 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3720
3721 status = sme_AcquireGlobalLock( &pMac->sme );
3722 if ( HAL_STATUS_SUCCESS( status ) )
3723 {
3724 status = pmcSignalPowerEvent(hHal, event);
3725 sme_ReleaseGlobalLock( &pMac->sme );
3726 }
3727
3728 return (status);
3729}
3730
3731/* ---------------------------------------------------------------------------
3732 \fn sme_EnablePowerSave
3733 \brief Enables one of the power saving modes.
3734 \param hHal - The handle returned by macOpen.
3735 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3736 while the chip is operating in Full Power, PMC will start
3737 a timer that will try to put the chip in BMPS mode after
3738 expiry.
3739 \return eHalStatus
3740 ---------------------------------------------------------------------------*/
3741eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3742{
3743 eHalStatus status = eHAL_STATUS_FAILURE;
3744 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3745
Katya Nigambcb705f2013-12-26 14:26:22 +05303746 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003747 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003748 status = sme_AcquireGlobalLock( &pMac->sme );
3749 if ( HAL_STATUS_SUCCESS( status ) )
3750 {
3751 status = pmcEnablePowerSave(hHal, psMode);
3752 sme_ReleaseGlobalLock( &pMac->sme );
3753 }
3754
3755 return (status);
3756}
3757
3758/* ---------------------------------------------------------------------------
3759 \fn sme_DisablePowerSave
3760 \brief Disables one of the power saving modes.
3761 \param hHal - The handle returned by macOpen.
3762 \param psMode - The power saving mode to disable. Disabling does not imply
3763 that device will be brought out of the current PS mode. This
3764 is purely a configuration API.
3765 \return eHalStatus
3766 ---------------------------------------------------------------------------*/
3767eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3768{
3769 eHalStatus status = eHAL_STATUS_FAILURE;
3770 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3771
Katya Nigambcb705f2013-12-26 14:26:22 +05303772 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003773 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003774 status = sme_AcquireGlobalLock( &pMac->sme );
3775 if ( HAL_STATUS_SUCCESS( status ) )
3776 {
3777 status = pmcDisablePowerSave(hHal, psMode);
3778 sme_ReleaseGlobalLock( &pMac->sme );
3779 }
3780
3781 return (status);
3782 }
3783
3784/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303785+ \fn sme_SetHostPowerSave
3786+ \brief Enables BMPS logic to be controlled by User level apps
3787+ \param hHal - The handle returned by macOpen.
3788+ \param psMode - The power saving mode to disable. Disabling does not imply
3789+ that device will be brought out of the current PS mode. This
3790+ is purely a configuration API.
3791+ \return eHalStatus
3792+ ---------------------------------------------------------------------------*/
3793eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3794{
3795 eHalStatus status = eHAL_STATUS_FAILURE;
3796 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3797
3798 pMac->pmc.isHostPsEn = psMode;
3799
3800 return (status);
3801}
3802
3803/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003804 \fn sme_StartAutoBmpsTimer
3805 \brief Starts a timer that periodically polls all the registered
3806 module for entry into Bmps mode. This timer is started only if BMPS is
3807 enabled and whenever the device is in full power.
3808 \param hHal - The handle returned by macOpen.
3809 \return eHalStatus
3810 ---------------------------------------------------------------------------*/
3811eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3812{
3813 eHalStatus status = eHAL_STATUS_FAILURE;
3814 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3815
Katya Nigambcb705f2013-12-26 14:26:22 +05303816 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003817 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003818 status = sme_AcquireGlobalLock( &pMac->sme );
3819 if ( HAL_STATUS_SUCCESS( status ) )
3820 {
3821 status = pmcStartAutoBmpsTimer(hHal);
3822 sme_ReleaseGlobalLock( &pMac->sme );
3823 }
3824
3825 return (status);
3826}
3827/* ---------------------------------------------------------------------------
3828 \fn sme_StopAutoBmpsTimer
3829 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3830 Stopping the timer does not cause a device state change. Only the timer
3831 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3832 \param hHal - The handle returned by macOpen.
3833 \return eHalStatus
3834 ---------------------------------------------------------------------------*/
3835eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3836{
3837 eHalStatus status = eHAL_STATUS_FAILURE;
3838 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3839
Katya Nigambcb705f2013-12-26 14:26:22 +05303840 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003841 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003842 status = sme_AcquireGlobalLock( &pMac->sme );
3843 if ( HAL_STATUS_SUCCESS( status ) )
3844 {
3845 status = pmcStopAutoBmpsTimer(hHal);
3846 sme_ReleaseGlobalLock( &pMac->sme );
3847 }
3848
3849 return (status);
3850}
3851/* ---------------------------------------------------------------------------
3852 \fn sme_QueryPowerState
3853 \brief Returns the current power state of the device.
3854 \param hHal - The handle returned by macOpen.
3855 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3856 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3857 \return eHalStatus
3858 ---------------------------------------------------------------------------*/
3859eHalStatus sme_QueryPowerState (
3860 tHalHandle hHal,
3861 tPmcPowerState *pPowerState,
3862 tPmcSwitchState *pSwWlanSwitchState)
3863{
3864 eHalStatus status = eHAL_STATUS_FAILURE;
3865 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3866
3867 status = sme_AcquireGlobalLock( &pMac->sme );
3868 if ( HAL_STATUS_SUCCESS( status ) )
3869 {
3870 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3871 sme_ReleaseGlobalLock( &pMac->sme );
3872 }
3873
3874 return (status);
3875}
3876
3877/* ---------------------------------------------------------------------------
3878 \fn sme_IsPowerSaveEnabled
3879 \brief Checks if the device is able to enter a particular power save mode
3880 This does not imply that the device is in a particular PS mode
3881 \param hHal - The handle returned by macOpen.
3882 \param psMode - the power saving mode
3883 \return eHalStatus
3884 ---------------------------------------------------------------------------*/
3885tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
3886{
3887 eHalStatus status = eHAL_STATUS_FAILURE;
3888 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3889 tANI_BOOLEAN result = false;
3890
Katya Nigambcb705f2013-12-26 14:26:22 +05303891 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003892 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003893 status = sme_AcquireGlobalLock( &pMac->sme );
3894 if ( HAL_STATUS_SUCCESS( status ) )
3895 {
3896 result = pmcIsPowerSaveEnabled(hHal, psMode);
3897 sme_ReleaseGlobalLock( &pMac->sme );
3898 return result;
3899 }
3900
3901 return false;
3902}
3903
3904/* ---------------------------------------------------------------------------
3905 \fn sme_RequestFullPower
3906 \brief Request that the device be brought to full power state. When the
3907 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
3908 is enabled. On timer expiry PMC will attempt to put the device in
3909 BMPS mode if following holds true:
3910 - BMPS mode is enabled
3911 - Polling of all modules through the Power Save Check routine passes
3912 - STA is associated to an access point
3913 \param hHal - The handle returned by macOpen.
3914 \param - callbackRoutine Callback routine invoked in case of success/failure
3915 \return eHalStatus - status
3916 eHAL_STATUS_SUCCESS - device brought to full power state
3917 eHAL_STATUS_FAILURE - device cannot be brought to full power state
3918 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
3919 ---------------------------------------------------------------------------*/
3920eHalStatus sme_RequestFullPower (
3921 tHalHandle hHal,
3922 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3923 void *callbackContext,
3924 tRequestFullPowerReason fullPowerReason)
3925{
3926 eHalStatus status = eHAL_STATUS_FAILURE;
3927 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3928
Katya Nigambcb705f2013-12-26 14:26:22 +05303929 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003930 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003931 status = sme_AcquireGlobalLock( &pMac->sme );
3932 if ( HAL_STATUS_SUCCESS( status ) )
3933 {
3934 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
3935 sme_ReleaseGlobalLock( &pMac->sme );
3936 }
3937
3938 return (status);
3939}
3940
3941/* ---------------------------------------------------------------------------
3942 \fn sme_RequestBmps
3943 \brief Request that the device be put in BMPS state. Request will be
3944 accepted only if BMPS mode is enabled and power save check routine
3945 passes.
3946 \param hHal - The handle returned by macOpen.
3947 \param - callbackRoutine Callback routine invoked in case of success/failure
3948 \return eHalStatus
3949 eHAL_STATUS_SUCCESS - device is in BMPS state
3950 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
3951 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
3952 ---------------------------------------------------------------------------*/
3953eHalStatus sme_RequestBmps (
3954 tHalHandle hHal,
3955 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3956 void *callbackContext)
3957{
3958 eHalStatus status = eHAL_STATUS_FAILURE;
3959 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3960
Katya Nigambcb705f2013-12-26 14:26:22 +05303961 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003962 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003963 status = sme_AcquireGlobalLock( &pMac->sme );
3964 if ( HAL_STATUS_SUCCESS( status ) )
3965 {
3966 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
3967 sme_ReleaseGlobalLock( &pMac->sme );
3968 }
3969
3970 return (status);
3971}
3972
3973
3974/* ---------------------------------------------------------------------------
3975 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003976 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
3977 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07003978 \param hHal - The handle returned by macOpen.
3979 ---------------------------------------------------------------------------*/
3980void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
3981{
3982 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3983
Katya Nigambcb705f2013-12-26 14:26:22 +05303984 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003985 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07003986 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
3987 pMac->pmc.remainInPowerActiveTillDHCP = flag;
3988}
3989
3990
3991/* ---------------------------------------------------------------------------
3992 \fn sme_StartUapsd
3993 \brief Request that the device be put in UAPSD state. If the device is in
3994 Full Power it will be put in BMPS mode first and then into UAPSD
3995 mode.
3996 \param hHal - The handle returned by macOpen.
3997 \param - callbackRoutine Callback routine invoked in case of success/failure
3998 eHAL_STATUS_SUCCESS - device is in UAPSD state
3999 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4000 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4001 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4002 \return eHalStatus
4003 ---------------------------------------------------------------------------*/
4004eHalStatus sme_StartUapsd (
4005 tHalHandle hHal,
4006 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4007 void *callbackContext)
4008{
4009 eHalStatus status = eHAL_STATUS_FAILURE;
4010 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4011
4012 status = sme_AcquireGlobalLock( &pMac->sme );
4013 if ( HAL_STATUS_SUCCESS( status ) )
4014 {
4015 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4016 sme_ReleaseGlobalLock( &pMac->sme );
4017 }
4018
4019 return (status);
4020 }
4021
4022/* ---------------------------------------------------------------------------
4023 \fn sme_StopUapsd
4024 \brief Request that the device be put out of UAPSD state. Device will be
4025 put in in BMPS state after stop UAPSD completes.
4026 \param hHal - The handle returned by macOpen.
4027 \return eHalStatus
4028 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4029 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4030 ---------------------------------------------------------------------------*/
4031eHalStatus sme_StopUapsd (tHalHandle hHal)
4032{
4033 eHalStatus status = eHAL_STATUS_FAILURE;
4034 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4035
4036 status = sme_AcquireGlobalLock( &pMac->sme );
4037 if ( HAL_STATUS_SUCCESS( status ) )
4038 {
4039 status = pmcStopUapsd(hHal);
4040 sme_ReleaseGlobalLock( &pMac->sme );
4041 }
4042
4043 return (status);
4044}
4045
4046/* ---------------------------------------------------------------------------
4047 \fn sme_RequestStandby
4048 \brief Request that the device be put in standby. It is HDD's responsibility
4049 to bring the chip to full power and do a disassoc before calling
4050 this API.
4051 \param hHal - The handle returned by macOpen.
4052 \param - callbackRoutine Callback routine invoked in case of success/failure
4053 \return eHalStatus
4054 eHAL_STATUS_SUCCESS - device is in Standby mode
4055 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4056 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4057 ---------------------------------------------------------------------------*/
4058eHalStatus sme_RequestStandby (
4059 tHalHandle hHal,
4060 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4061 void *callbackContext)
4062{
4063 eHalStatus status = eHAL_STATUS_FAILURE;
4064 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4065
Katya Nigambcb705f2013-12-26 14:26:22 +05304066 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004067 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05304068 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004069 status = sme_AcquireGlobalLock( &pMac->sme );
4070 if ( HAL_STATUS_SUCCESS( status ) )
4071 {
4072 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
4073 sme_ReleaseGlobalLock( &pMac->sme );
4074 }
4075
4076 return (status);
4077}
4078
4079/* ---------------------------------------------------------------------------
4080 \fn sme_RegisterPowerSaveCheck
4081 \brief Register a power save check routine that is called whenever
4082 the device is about to enter one of the power save modes.
4083 \param hHal - The handle returned by macOpen.
4084 \param checkRoutine - Power save check routine to be registered
4085 \return eHalStatus
4086 eHAL_STATUS_SUCCESS - successfully registered
4087 eHAL_STATUS_FAILURE - not successfully registered
4088 ---------------------------------------------------------------------------*/
4089eHalStatus sme_RegisterPowerSaveCheck (
4090 tHalHandle hHal,
4091 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4092{
4093 eHalStatus status = eHAL_STATUS_FAILURE;
4094 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4095
4096 status = sme_AcquireGlobalLock( &pMac->sme );
4097 if ( HAL_STATUS_SUCCESS( status ) )
4098 {
4099 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4100 sme_ReleaseGlobalLock( &pMac->sme );
4101 }
4102
4103 return (status);
4104}
4105
4106/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05304107 \fn sme_Register11dScanDoneCallback
4108 \brief Register a routine of type csrScanCompleteCallback which is
4109 called whenever an 11d scan is done
4110 \param hHal - The handle returned by macOpen.
4111 \param callback - 11d scan complete routine to be registered
4112 \return eHalStatus
4113 ---------------------------------------------------------------------------*/
4114eHalStatus sme_Register11dScanDoneCallback (
4115 tHalHandle hHal,
4116 csrScanCompleteCallback callback)
4117{
4118 eHalStatus status = eHAL_STATUS_SUCCESS;
4119 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4120
4121 pMac->scan.callback11dScanDone = callback;
4122
4123 return (status);
4124}
4125
4126/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004127 \fn sme_DeregisterPowerSaveCheck
4128 \brief Deregister a power save check routine
4129 \param hHal - The handle returned by macOpen.
4130 \param checkRoutine - Power save check routine to be deregistered
4131 \return eHalStatus
4132 eHAL_STATUS_SUCCESS - successfully deregistered
4133 eHAL_STATUS_FAILURE - not successfully deregistered
4134 ---------------------------------------------------------------------------*/
4135eHalStatus sme_DeregisterPowerSaveCheck (
4136 tHalHandle hHal,
4137 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4138{
4139 eHalStatus status = eHAL_STATUS_FAILURE;
4140 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4141
4142 status = sme_AcquireGlobalLock( &pMac->sme );
4143 if ( HAL_STATUS_SUCCESS( status ) )
4144 {
4145 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4146 sme_ReleaseGlobalLock( &pMac->sme );
4147 }
4148
4149 return (status);
4150}
4151
4152/* ---------------------------------------------------------------------------
4153 \fn sme_RegisterDeviceStateUpdateInd
4154 \brief Register a callback routine that is called whenever
4155 the device enters a new device state (Full Power, BMPS, UAPSD)
4156 \param hHal - The handle returned by macOpen.
4157 \param callbackRoutine - Callback routine to be registered
4158 \param callbackContext - Cookie to be passed back during callback
4159 \return eHalStatus
4160 eHAL_STATUS_SUCCESS - successfully registered
4161 eHAL_STATUS_FAILURE - not successfully registered
4162 ---------------------------------------------------------------------------*/
4163eHalStatus sme_RegisterDeviceStateUpdateInd (
4164 tHalHandle hHal,
4165 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4166 void *callbackContext)
4167{
4168 eHalStatus status = eHAL_STATUS_FAILURE;
4169 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4170
4171 status = sme_AcquireGlobalLock( &pMac->sme );
4172 if ( HAL_STATUS_SUCCESS( status ) )
4173 {
4174 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4175 sme_ReleaseGlobalLock( &pMac->sme );
4176 }
4177
4178 return (status);
4179}
4180
4181/* ---------------------------------------------------------------------------
4182 \fn sme_DeregisterDeviceStateUpdateInd
4183 \brief Deregister a routine that was registered for device state changes
4184 \param hHal - The handle returned by macOpen.
4185 \param callbackRoutine - Callback routine to be deregistered
4186 \return eHalStatus
4187 eHAL_STATUS_SUCCESS - successfully deregistered
4188 eHAL_STATUS_FAILURE - not successfully deregistered
4189 ---------------------------------------------------------------------------*/
4190eHalStatus sme_DeregisterDeviceStateUpdateInd (
4191 tHalHandle hHal,
4192 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4193{
4194 eHalStatus status = eHAL_STATUS_FAILURE;
4195 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4196
4197 status = sme_AcquireGlobalLock( &pMac->sme );
4198 if ( HAL_STATUS_SUCCESS( status ) )
4199 {
4200 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4201 sme_ReleaseGlobalLock( &pMac->sme );
4202 }
4203
4204 return (status);
4205}
4206
4207/* ---------------------------------------------------------------------------
4208 \fn sme_WowlAddBcastPattern
4209 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4210 do a pattern match on these patterns when Wowl is enabled during BMPS
4211 mode. Note that Firmware performs the pattern matching only on
4212 broadcast frames and while Libra is in BMPS mode.
4213 \param hHal - The handle returned by macOpen.
4214 \param pattern - Pattern to be added
4215 \return eHalStatus
4216 eHAL_STATUS_FAILURE Cannot add pattern
4217 eHAL_STATUS_SUCCESS Request accepted.
4218 ---------------------------------------------------------------------------*/
4219eHalStatus sme_WowlAddBcastPattern (
4220 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004221 tpSirWowlAddBcastPtrn pattern,
4222 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004223{
4224 eHalStatus status = eHAL_STATUS_FAILURE;
4225 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304226 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004227 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004228 status = sme_AcquireGlobalLock( &pMac->sme );
4229 if ( HAL_STATUS_SUCCESS( status ) )
4230 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004231 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004232 sme_ReleaseGlobalLock( &pMac->sme );
4233 }
4234
4235 return (status);
4236}
4237
4238/* ---------------------------------------------------------------------------
4239 \fn sme_WowlDelBcastPattern
4240 \brief Delete a pattern that was added for Pattern Byte Matching.
4241 \param hHal - The handle returned by macOpen.
4242 \param pattern - Pattern to be deleted
4243 \return eHalStatus
4244 eHAL_STATUS_FAILURE Cannot delete pattern
4245 eHAL_STATUS_SUCCESS Request accepted.
4246 ---------------------------------------------------------------------------*/
4247eHalStatus sme_WowlDelBcastPattern (
4248 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004249 tpSirWowlDelBcastPtrn pattern,
4250 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004251{
4252 eHalStatus status = eHAL_STATUS_FAILURE;
4253 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304254 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004255 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004256 status = sme_AcquireGlobalLock( &pMac->sme );
4257 if ( HAL_STATUS_SUCCESS( status ) )
4258 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004259 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004260 sme_ReleaseGlobalLock( &pMac->sme );
4261 }
4262
4263 return (status);
4264}
4265
4266/* ---------------------------------------------------------------------------
4267 \fn sme_EnterWowl
4268 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4269 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4270 SME will will cache the information that WOWL has been enabled and
4271 attempt to put the device in BMPS. On entry into BMPS, SME will
4272 enable the WOWL mode.
4273 Note 1: If we exit BMPS mode (someone requests full power), we
4274 will NOT resume WOWL when we go back to BMPS again. Request for full
4275 power (while in WOWL mode) means disable WOWL and go to full power.
4276 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4277 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4278 are required. Currently there is no requirement or use case to support
4279 UAPSD and WOWL at the same time.
4280
4281 \param hHal - The handle returned by macOpen.
4282 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4283 Used for success/failure notification by SME
4284 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4285 at the time of callback.
4286 \param wakeReasonIndCB - Callback routine provided by HDD.
4287 Used for Wake Reason Indication by SME
4288 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4289 at the time of callback.
4290 \return eHalStatus
4291 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4292 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4293 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4294 BMPS mode is entered.
4295 ---------------------------------------------------------------------------*/
4296eHalStatus sme_EnterWowl (
4297 tHalHandle hHal,
4298 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4299 void *enterWowlCallbackContext,
4300#ifdef WLAN_WAKEUP_EVENTS
4301 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4302 void *wakeIndicationCBContext,
4303#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004304 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004305{
4306 eHalStatus status = eHAL_STATUS_FAILURE;
4307 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304308 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004309 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004310 status = sme_AcquireGlobalLock( &pMac->sme );
4311 if ( HAL_STATUS_SUCCESS( status ) )
4312 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004313 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004314#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004315 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004316#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004317 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004318 sme_ReleaseGlobalLock( &pMac->sme );
4319 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004320 return (status);
4321}
4322/* ---------------------------------------------------------------------------
4323 \fn sme_ExitWowl
4324 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4325 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4326 mode.
4327 \param hHal - The handle returned by macOpen.
4328 \return eHalStatus
4329 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4330 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4331 ---------------------------------------------------------------------------*/
4332eHalStatus sme_ExitWowl (tHalHandle hHal)
4333{
4334 eHalStatus status = eHAL_STATUS_FAILURE;
4335 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304336 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004337 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004338 status = sme_AcquireGlobalLock( &pMac->sme );
4339 if ( HAL_STATUS_SUCCESS( status ) )
4340 {
4341 status = pmcExitWowl (hHal);
4342 sme_ReleaseGlobalLock( &pMac->sme );
4343 }
4344
4345 return (status);
4346}
4347
4348/* ---------------------------------------------------------------------------
4349
4350 \fn sme_RoamSetKey
4351
4352 \brief To set encryption key. This function should be called only when connected
4353 This is an asynchronous API.
4354
4355 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4356
4357 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4358
4359 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4360
4361 FAILURE or RESOURCES The API finished and failed.
4362
4363 -------------------------------------------------------------------------------*/
4364eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4365{
4366 eHalStatus status = eHAL_STATUS_FAILURE;
4367 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4368 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004369 tANI_U32 i;
4370 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004371
Katya Nigambcb705f2013-12-26 14:26:22 +05304372 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004373 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004374 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4375 {
4376 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4377 return eHAL_STATUS_FAILURE;
4378 }
4379
Jeff Johnson295189b2012-06-20 16:38:30 -07004380 status = sme_AcquireGlobalLock( &pMac->sme );
4381 if ( HAL_STATUS_SUCCESS( status ) )
4382 {
4383 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4384 if(pRoamId)
4385 {
4386 *pRoamId = roamId;
4387 }
4388
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004389 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004390
4391 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004392 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004393
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004394 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004395
4396 pSession = CSR_GET_SESSION(pMac, sessionId);
4397
Jeff Johnson32d95a32012-09-10 13:15:23 -07004398 if(!pSession)
4399 {
4400 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004401 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004402 return eHAL_STATUS_FAILURE;
4403 }
4404
Jeff Johnson295189b2012-06-20 16:38:30 -07004405 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4406 {
4407 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4408 {
4409 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4410 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4411 {
4412 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4413 }
4414 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4415 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4416 {
4417 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4418 }
4419 }
4420 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004421
4422 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4423 sme_ReleaseGlobalLock( &pMac->sme );
4424 }
4425
4426 return (status);
4427}
4428
4429
4430/* ---------------------------------------------------------------------------
4431
4432 \fn sme_RoamRemoveKey
4433
4434 \brief To set encryption key. This is an asynchronous API.
4435
4436 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4437
4438 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4439
4440 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4441
4442 FAILURE or RESOURCES The API finished and failed.
4443
4444 -------------------------------------------------------------------------------*/
4445eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4446 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4447{
4448 eHalStatus status = eHAL_STATUS_FAILURE;
4449 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4450 tANI_U32 roamId;
4451
Katya Nigambcb705f2013-12-26 14:26:22 +05304452 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004453 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004454 status = sme_AcquireGlobalLock( &pMac->sme );
4455 if ( HAL_STATUS_SUCCESS( status ) )
4456 {
4457 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4458 if(pRoamId)
4459 {
4460 *pRoamId = roamId;
4461 }
4462 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4463 sme_ReleaseGlobalLock( &pMac->sme );
4464 }
4465
4466 return (status);
4467}
4468
4469/* ---------------------------------------------------------------------------
4470 \fn sme_GetRssi
4471 \brief a wrapper function that client calls to register a callback to get RSSI
4472
4473 \param callback - SME sends back the requested stats using the callback
4474 \param staId - The station ID for which the stats is requested for
4475 \param pContext - user context to be passed back along with the callback
4476 \param pVosContext - vos context
4477 \return eHalStatus
4478 ---------------------------------------------------------------------------*/
4479eHalStatus sme_GetRssi(tHalHandle hHal,
4480 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004481 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07004482 void *pContext, void* pVosContext)
4483{
4484 eHalStatus status = eHAL_STATUS_FAILURE;
4485 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4486
4487 status = sme_AcquireGlobalLock( &pMac->sme );
4488 if ( HAL_STATUS_SUCCESS( status ) )
4489 {
4490 status = csrGetRssi( pMac, callback,
4491 staId, bssId, pContext, pVosContext);
4492 sme_ReleaseGlobalLock( &pMac->sme );
4493 }
4494 return (status);
4495}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304496
4497/* ---------------------------------------------------------------------------
4498 \fn sme_GetSnr
4499 \brief a wrapper function that client calls to register a callback to
4500 get SNR
4501
4502 \param callback - SME sends back the requested stats using the callback
4503 \param staId - The station ID for which the stats is requested for
4504 \param pContext - user context to be passed back along with the callback
4505 \param pVosContext - vos context
4506 \return eHalStatus
4507 ---------------------------------------------------------------------------*/
4508eHalStatus sme_GetSnr(tHalHandle hHal,
4509 tCsrSnrCallback callback,
4510 tANI_U8 staId, tCsrBssid bssId,
4511 void *pContext)
4512{
4513 eHalStatus status = eHAL_STATUS_FAILURE;
4514 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4515
4516 status = sme_AcquireGlobalLock( &pMac->sme );
4517 if ( HAL_STATUS_SUCCESS( status ) )
4518 {
4519 status = csrGetSnr(pMac, callback,
4520 staId, bssId, pContext);
4521 sme_ReleaseGlobalLock( &pMac->sme );
4522 }
4523 return status;
4524}
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004525#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
4526/* ---------------------------------------------------------------------------
4527 \fn sme_GetRoamRssi
4528 \brief a wrapper function that client calls to register a callback to get Roam RSSI
4529
4530 \param callback - SME sends back the requested stats using the callback
4531 \param staId - The station ID for which the stats is requested for
4532 \param pContext - user context to be passed back along with the callback
4533 \param pVosContext - vos context
4534 \return eHalStatus
4535 ---------------------------------------------------------------------------*/
4536eHalStatus sme_GetRoamRssi(tHalHandle hHal,
4537 tCsrRssiCallback callback,
4538 tANI_U8 staId, tCsrBssid bssId,
4539 void *pContext, void* pVosContext)
4540{
4541 eHalStatus status = eHAL_STATUS_FAILURE;
4542 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4543
4544 status = sme_AcquireGlobalLock( &pMac->sme );
4545 if ( HAL_STATUS_SUCCESS( status ) )
4546 {
4547 status = csrGetRoamRssi( pMac, callback,
4548 staId, bssId, pContext, pVosContext);
4549 sme_ReleaseGlobalLock( &pMac->sme );
4550 }
4551 return (status);
4552}
4553#endif
4554
Jeff Johnson295189b2012-06-20 16:38:30 -07004555
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004556#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
4557/* ---------------------------------------------------------------------------
4558 \fn sme_GetTsmStats
4559 \brief a wrapper function that client calls to register a callback to get TSM Stats
4560
4561 \param callback - SME sends back the requested stats using the callback
4562 \param staId - The station ID for which the stats is requested for
4563 \param pContext - user context to be passed back along with the callback
4564 \param pVosContext - vos context
4565 \return eHalStatus
4566 ---------------------------------------------------------------------------*/
4567eHalStatus sme_GetTsmStats(tHalHandle hHal,
4568 tCsrTsmStatsCallback callback,
4569 tANI_U8 staId, tCsrBssid bssId,
4570 void *pContext, void* pVosContext, tANI_U8 tid)
4571{
4572 eHalStatus status = eHAL_STATUS_FAILURE;
4573 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4574
4575 status = sme_AcquireGlobalLock( &pMac->sme );
4576 if ( HAL_STATUS_SUCCESS( status ) )
4577 {
4578 status = csrGetTsmStats( pMac, callback,
4579 staId, bssId, pContext, pVosContext, tid);
4580 sme_ReleaseGlobalLock( &pMac->sme );
4581 }
4582 return (status);
4583}
4584#endif
4585
4586
Jeff Johnson295189b2012-06-20 16:38:30 -07004587/* ---------------------------------------------------------------------------
4588 \fn sme_GetStatistics
4589 \brief a wrapper function that client calls to register a callback to get
4590 different PHY level statistics from CSR.
4591
4592 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
4593 \param statsMask - The different category/categories of stats requester is looking for
4594 \param callback - SME sends back the requested stats using the callback
4595 \param periodicity - If requester needs periodic update in millisec, 0 means
4596 it's an one time request
4597 \param cache - If requester is happy with cached stats
4598 \param staId - The station ID for which the stats is requested for
4599 \param pContext - user context to be passed back along with the callback
4600 \return eHalStatus
4601 ---------------------------------------------------------------------------*/
4602eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
4603 tANI_U32 statsMask,
4604 tCsrStatsCallback callback,
4605 tANI_U32 periodicity, tANI_BOOLEAN cache,
4606 tANI_U8 staId, void *pContext)
4607{
4608 eHalStatus status = eHAL_STATUS_FAILURE;
4609 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4610
Katya Nigambcb705f2013-12-26 14:26:22 +05304611 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004612 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07004613 status = sme_AcquireGlobalLock( &pMac->sme );
4614 if ( HAL_STATUS_SUCCESS( status ) )
4615 {
4616 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
4617 periodicity, cache, staId, pContext);
4618 sme_ReleaseGlobalLock( &pMac->sme );
4619 }
4620
4621 return (status);
4622
4623}
4624
4625/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05304626 \fn smeGetTLSTAState
4627 \helper function to get the TL STA State whenever the function is called.
4628
4629 \param staId - The staID to be passed to the TL
4630 to get the relevant TL STA State
4631 \return the state as tANI_U16
4632 ---------------------------------------------------------------------------*/
4633tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
4634{
4635 tANI_U16 tlSTAState = TL_INIT_STATE;
4636 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4637 eHalStatus status = eHAL_STATUS_FAILURE;
4638
4639 status = sme_AcquireGlobalLock( &pMac->sme );
4640 if ( HAL_STATUS_SUCCESS( status ) )
4641 {
4642 tlSTAState = csrGetTLSTAState( pMac, staId);
4643 sme_ReleaseGlobalLock( &pMac->sme );
4644 }
4645
4646 return tlSTAState;
4647}
4648
4649/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004650
4651 \fn sme_GetCountryCode
4652
4653 \brief To return the current country code. If no country code is applied, default country code is
4654 used to fill the buffer.
4655 If 11d supported is turned off, an error is return and the last applied/default country code is used.
4656 This is a synchronous API.
4657
4658 \param pBuf - pointer to a caller allocated buffer for returned country code.
4659
4660 \param pbLen For input, this parameter indicates how big is the buffer.
4661 Upon return, this parameter has the number of bytes for country. If pBuf
4662 doesn't have enough space, this function returns
4663 fail status and this parameter contains the number that is needed.
4664
4665 \return eHalStatus SUCCESS.
4666
4667 FAILURE or RESOURCES The API finished and failed.
4668
4669 -------------------------------------------------------------------------------*/
4670eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
4671{
4672 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4673
Katya Nigambcb705f2013-12-26 14:26:22 +05304674 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004675 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
4676
Jeff Johnson295189b2012-06-20 16:38:30 -07004677 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
4678}
4679
4680
4681/* ---------------------------------------------------------------------------
4682
4683 \fn sme_SetCountryCode
4684
4685 \brief To change the current/default country code.
4686 If 11d supported is turned off, an error is return.
4687 This is a synchronous API.
4688
4689 \param pCountry - pointer to a caller allocated buffer for the country code.
4690
4691 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
4692 whether a reset is required.
4693
4694 \return eHalStatus SUCCESS.
4695
4696 FAILURE or RESOURCES The API finished and failed.
4697
4698 -------------------------------------------------------------------------------*/
4699eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
4700{
4701 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4702
Katya Nigambcb705f2013-12-26 14:26:22 +05304703 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004704 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004705 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4706}
4707
4708
4709/* ---------------------------------------------------------------------------
4710 \fn sme_ResetCountryCodeInformation
4711 \brief this function is to reset the country code current being used back to EEPROM default
4712 this includes channel list and power setting. This is a synchronous API.
4713 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4714 a restart is needed to apply the change
4715 \return eHalStatus
4716 -------------------------------------------------------------------------------*/
4717eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4718{
4719 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4720
4721 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4722}
4723
4724
4725/* ---------------------------------------------------------------------------
4726 \fn sme_GetSupportedCountryCode
4727 \brief this function is to get a list of the country code current being supported
4728 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4729 this has the country code list. 3 bytes for each country code. This may be NULL if
4730 caller wants to know the needed byte count.
4731 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4732 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4733 \return eHalStatus
4734 -------------------------------------------------------------------------------*/
4735eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4736{
4737 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4738
4739 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4740}
4741
4742
4743/* ---------------------------------------------------------------------------
4744 \fn sme_GetCurrentRegulatoryDomain
4745 \brief this function is to get the current regulatory domain. This is a synchronous API.
4746 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4747 SME. The function fails if 11d support is turned off.
4748 \param pDomain - Caller allocated buffer to return the current domain.
4749 \return eHalStatus SUCCESS.
4750
4751 FAILURE or RESOURCES The API finished and failed.
4752 -------------------------------------------------------------------------------*/
4753eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4754{
4755 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4756 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4757
4758 if( pDomain )
4759 {
4760 if( csrIs11dSupported( pMac ) )
4761 {
4762 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4763 status = eHAL_STATUS_SUCCESS;
4764 }
4765 else
4766 {
4767 status = eHAL_STATUS_FAILURE;
4768 }
4769 }
4770
4771 return ( status );
4772}
4773
4774
4775/* ---------------------------------------------------------------------------
4776 \fn sme_SetRegulatoryDomain
4777 \brief this function is to set the current regulatory domain.
4778 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4779 SME. This is a synchronous API.
4780 \param domainId - indicate the domain (defined in the driver) needs to set to.
4781 See v_REGDOMAIN_t for definition
4782 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4783 a restart is needed to apply the change
4784 \return eHalStatus
4785 -------------------------------------------------------------------------------*/
4786eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4787{
4788 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4789
4790 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4791}
4792
4793
4794/* ---------------------------------------------------------------------------
4795
4796 \fn sme_GetRegulatoryDomainForCountry
4797
4798 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4799
4800 \param pCountry - pointer to a caller allocated buffer for input country code.
4801
4802 \param pDomainId Upon successful return, it is the domain that country belongs to.
4803 If it is NULL, returning success means that the country code is known.
4804
4805 \return eHalStatus SUCCESS.
4806
4807 FAILURE or RESOURCES The API finished and failed.
4808
4809 -------------------------------------------------------------------------------*/
4810eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4811{
4812 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4813
Kiet Lam6c583332013-10-14 05:37:09 +05304814 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
4815 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07004816}
4817
4818
4819
4820
4821/* ---------------------------------------------------------------------------
4822
4823 \fn sme_GetSupportedRegulatoryDomains
4824
4825 \brief To return a list of supported regulatory domains. This is a synchronous API.
4826
4827 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4828
4829 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4830 Upon return, this parameter has the number for supported domains. If pDomains
4831 doesn't have enough space for all the supported domains, this function returns
4832 fail status and this parameter contains the number that is needed.
4833
4834 \return eHalStatus SUCCESS.
4835
4836 FAILURE or RESOURCES The API finished and failed.
4837
4838 -------------------------------------------------------------------------------*/
4839eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4840{
4841 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4842
4843 //We support all domains for now
4844 if( pNumDomains )
4845 {
4846 if( NUM_REG_DOMAINS <= *pNumDomains )
4847 {
4848 status = eHAL_STATUS_SUCCESS;
4849 }
4850 *pNumDomains = NUM_REG_DOMAINS;
4851 }
4852 if( HAL_STATUS_SUCCESS( status ) )
4853 {
4854 if( pDomains )
4855 {
4856 pDomains[0] = REGDOMAIN_FCC;
4857 pDomains[1] = REGDOMAIN_ETSI;
4858 pDomains[2] = REGDOMAIN_JAPAN;
4859 pDomains[3] = REGDOMAIN_WORLD;
4860 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
4861 pDomains[5] = REGDOMAIN_APAC;
4862 pDomains[6] = REGDOMAIN_KOREA;
4863 pDomains[7] = REGDOMAIN_HI_5GHZ;
4864 pDomains[8] = REGDOMAIN_NO_5GHZ;
4865 }
4866 else
4867 {
4868 status = eHAL_STATUS_INVALID_PARAMETER;
4869 }
4870 }
4871
4872 return ( status );
4873}
4874
4875
4876//some support functions
4877tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
4878{
4879 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4880
4881 return ( csrIs11dSupported( pMac ) );
4882}
4883
4884
4885tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
4886{
4887 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4888
4889 return ( csrIs11hSupported( pMac ) );
4890}
4891
4892
4893tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
4894{
4895 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4896
4897 return ( csrIsWmmSupported( pMac ) );
4898}
4899
4900//Upper layer to get the list of the base channels to scan for passively 11d info from csr
4901eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
4902{
4903 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4904
4905 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
4906}
4907
4908/* ---------------------------------------------------------------------------
4909
4910 \fn sme_ChangeCountryCode
4911
4912 \brief Change Country code from upperlayer during WLAN driver operation.
4913 This is a synchronous API.
4914
4915 \param hHal - The handle returned by macOpen.
4916
4917 \param pCountry New Country Code String
4918
Abhishek Singha306a442013-11-07 18:39:01 +05304919 \param sendRegHint If we want to send reg hint to nl80211
4920
Jeff Johnson295189b2012-06-20 16:38:30 -07004921 \return eHalStatus SUCCESS.
4922
4923 FAILURE or RESOURCES The API finished and failed.
4924
4925 -------------------------------------------------------------------------------*/
4926eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
4927 tSmeChangeCountryCallback callback,
4928 tANI_U8 *pCountry,
4929 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304930 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05304931 tAniBool countryFromUserSpace,
4932 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07004933{
4934 eHalStatus status = eHAL_STATUS_FAILURE;
4935 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4936 vos_msg_t msg;
4937 tAniChangeCountryCodeReq *pMsg;
4938
Katya Nigambcb705f2013-12-26 14:26:22 +05304939 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004940 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004941 status = sme_AcquireGlobalLock( &pMac->sme );
4942 if ( HAL_STATUS_SUCCESS( status ) )
4943 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004944 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08004945
4946 if ((csrGetInfraSessionId(pMac) != -1) &&
4947 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
4948 {
4949
4950 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
4951
4952 sme_ReleaseGlobalLock( &pMac->sme );
4953 status = eHAL_STATUS_FAILURE;
4954 return status;
4955 }
4956
Kiet Lam64c1b492013-07-12 13:56:44 +05304957 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
4958 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07004959 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004960 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004961 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05304962 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004963 }
4964
4965 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
4966 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05304967 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304968 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05304969 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07004970 pMsg->changeCCCallback = callback;
4971 pMsg->pDevContext = pContext;
4972 pMsg->pVosContext = pVosContext;
4973
4974 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
4975 msg.bodyptr = pMsg;
4976 msg.reserved = 0;
4977
4978 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
4979 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004980 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05304981 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07004982 status = eHAL_STATUS_FAILURE;
4983 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004984 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004985 sme_ReleaseGlobalLock( &pMac->sme );
4986 }
4987
4988 return (status);
4989}
Amar Singhal0d15bd52013-10-12 23:13:13 -07004990
4991/*--------------------------------------------------------------------------
4992
4993 \fn sme_GenericChangeCountryCode
4994
4995 \brief Change Country code from upperlayer during WLAN driver operation.
4996 This is a synchronous API.
4997
4998 \param hHal - The handle returned by macOpen.
4999
5000 \param pCountry New Country Code String
5001
5002 \param reg_domain regulatory domain
5003
5004 \return eHalStatus SUCCESS.
5005
5006 FAILURE or RESOURCES The API finished and failed.
5007
5008-----------------------------------------------------------------------------*/
5009eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
5010 tANI_U8 *pCountry,
5011 v_REGDOMAIN_t reg_domain)
5012{
5013 eHalStatus status = eHAL_STATUS_FAILURE;
5014 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5015 vos_msg_t msg;
5016 tAniGenericChangeCountryCodeReq *pMsg;
5017
Kiet Lamcffc5862013-10-30 16:28:45 +05305018 if (NULL == pMac)
5019 {
5020 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5021 "%s: pMac is null", __func__);
5022 return status;
5023 }
5024
Amar Singhal0d15bd52013-10-12 23:13:13 -07005025 status = sme_AcquireGlobalLock( &pMac->sme );
5026 if ( HAL_STATUS_SUCCESS( status ) )
5027 {
5028 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05305029 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
5030 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07005031 {
5032 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
5033 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05305034 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07005035 }
5036
5037 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
5038 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08005039 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005040 pMsg->domain_index = reg_domain;
5041
5042 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
5043 msg.bodyptr = pMsg;
5044 msg.reserved = 0;
5045
5046 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5047 {
5048 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05305049 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005050 status = eHAL_STATUS_FAILURE;
5051 }
5052 smsLog(pMac, LOG1, FL(" returned"));
5053 sme_ReleaseGlobalLock( &pMac->sme );
5054 }
5055
5056 return (status);
5057}
Mihir Shetee1093ba2014-01-21 20:13:32 +05305058
5059/* ---------------------------------------------------------------------------
5060
5061 \fn sme_InitChannels
5062
5063 \brief Used to initialize CSR channel lists while driver loading
5064
5065 \param hHal - global pMac structure
5066
5067 \return eHalStatus SUCCESS.
5068
5069 FAILURE or RESOURCES The API finished and failed.
5070
5071 -------------------------------------------------------------------------------*/
5072eHalStatus sme_InitChannels(tHalHandle hHal)
5073{
5074 eHalStatus status = eHAL_STATUS_FAILURE;
5075 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5076
5077 if (NULL == pMac)
5078 {
5079 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5080 "%s: pMac is null", __func__);
5081 return status;
5082 }
5083
5084 status = sme_AcquireGlobalLock(&pMac->sme);
5085 if (HAL_STATUS_SUCCESS(status))
5086 {
5087 status = csrInitChannels(pMac);
5088 sme_ReleaseGlobalLock(&pMac->sme);
5089 }
5090 return status;
5091}
5092
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305093/* ---------------------------------------------------------------------------
5094
5095 \fn sme_DHCPStartInd
5096
5097 \brief API to signal the FW about the DHCP Start event.
5098
5099 \param hHal - HAL handle for device.
5100
5101 \param device_mode - mode(AP,SAP etc) of the device.
5102
5103 \param macAddr - MAC address of the device.
5104
5105 \return eHalStatus SUCCESS.
5106
5107 FAILURE or RESOURCES The API finished and failed.
5108 --------------------------------------------------------------------------*/
5109eHalStatus sme_DHCPStartInd( tHalHandle hHal,
5110 tANI_U8 device_mode,
5111 tANI_U8 *macAddr )
5112{
5113 eHalStatus status;
5114 VOS_STATUS vosStatus;
5115 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5116 vos_msg_t vosMessage;
5117 tAniDHCPInd *pMsg;
5118
5119 status = sme_AcquireGlobalLock(&pMac->sme);
5120 if ( eHAL_STATUS_SUCCESS == status)
5121 {
5122 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5123 if (NULL == pMsg)
5124 {
5125 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5126 "%s: Not able to allocate memory for dhcp start", __func__);
5127 sme_ReleaseGlobalLock( &pMac->sme );
5128 return eHAL_STATUS_FAILURE;
5129 }
5130 pMsg->msgType = WDA_DHCP_START_IND;
5131 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5132 pMsg->device_mode = device_mode;
5133 vos_mem_copy( pMsg->macAddr, macAddr, sizeof(tSirMacAddr));
5134
5135 vosMessage.type = WDA_DHCP_START_IND;
5136 vosMessage.bodyptr = pMsg;
5137 vosMessage.reserved = 0;
5138
5139 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5140 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5141 {
5142 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5143 "%s: Post DHCP Start MSG fail", __func__);
5144 vos_mem_free(pMsg);
5145 status = eHAL_STATUS_FAILURE;
5146 }
5147 sme_ReleaseGlobalLock( &pMac->sme );
5148 }
5149 return (status);
5150}
5151/* ---------------------------------------------------------------------------
5152 \fn sme_DHCPStopInd
5153
5154 \brief API to signal the FW about the DHCP complete event.
5155
5156 \param hHal - HAL handle for device.
5157
5158 \param device_mode - mode(AP, SAP etc) of the device.
5159
5160 \param macAddr - MAC address of the device.
5161
5162 \return eHalStatus SUCCESS.
5163 FAILURE or RESOURCES The API finished and failed.
5164 --------------------------------------------------------------------------*/
5165eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5166 tANI_U8 device_mode,
5167 tANI_U8 *macAddr )
5168{
5169 eHalStatus status;
5170 VOS_STATUS vosStatus;
5171 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5172 vos_msg_t vosMessage;
5173 tAniDHCPInd *pMsg;
5174
5175 status = sme_AcquireGlobalLock(&pMac->sme);
5176 if ( eHAL_STATUS_SUCCESS == status)
5177 {
5178 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5179 if (NULL == pMsg)
5180 {
5181 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5182 "%s: Not able to allocate memory for dhcp stop", __func__);
5183 sme_ReleaseGlobalLock( &pMac->sme );
5184 return eHAL_STATUS_FAILURE;
5185 }
5186
5187 pMsg->msgType = WDA_DHCP_STOP_IND;
5188 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5189 pMsg->device_mode = device_mode;
5190 vos_mem_copy( pMsg->macAddr, macAddr, sizeof(tSirMacAddr));
5191
5192 vosMessage.type = WDA_DHCP_STOP_IND;
5193 vosMessage.bodyptr = pMsg;
5194 vosMessage.reserved = 0;
5195
5196 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5197 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5198 {
5199 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5200 "%s: Post DHCP Stop MSG fail", __func__);
5201 vos_mem_free(pMsg);
5202 status = eHAL_STATUS_FAILURE;
5203 }
5204
5205 sme_ReleaseGlobalLock( &pMac->sme );
5206 }
5207 return (status);
5208}
5209
Jeff Johnson295189b2012-06-20 16:38:30 -07005210
5211/* ---------------------------------------------------------------------------
5212 \fn sme_BtcSignalBtEvent
5213 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
5214 BT event type and the current operating mode of Libra (full power,
5215 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
5216 would be employed.
5217 \param hHal - The handle returned by macOpen.
5218 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
5219 Caller owns the memory and is responsible for freeing it.
5220 \return VOS_STATUS
5221 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
5222 if BTC execution mode is set to BTC_WLAN_ONLY
5223 or BTC_PTA_ONLY.
5224 VOS_STATUS_SUCCESS BT Event passed to HAL
5225 ---------------------------------------------------------------------------*/
5226VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
5227{
5228 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005229
Jeff Johnson295189b2012-06-20 16:38:30 -07005230#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5231 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5232
Katya Nigambcb705f2013-12-26 14:26:22 +05305233 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005234 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005235 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5236 {
5237 status = btcSignalBTEvent (hHal, pBtEvent);
5238 sme_ReleaseGlobalLock( &pMac->sme );
5239 }
5240#endif
5241 return (status);
5242}
5243
5244/* ---------------------------------------------------------------------------
5245 \fn sme_BtcSetConfig
5246 \brief API to change the current Bluetooth Coexistence (BTC) configuration
5247 This function should be invoked only after CFG download has completed.
5248 Calling it after sme_HDDReadyInd is recommended.
5249 \param hHal - The handle returned by macOpen.
5250 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
5251 Caller owns the memory and is responsible for freeing it.
5252 \return VOS_STATUS
5253 VOS_STATUS_E_FAILURE Config not passed to HAL.
5254 VOS_STATUS_SUCCESS Config passed to HAL
5255 ---------------------------------------------------------------------------*/
5256VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5257{
5258 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5259#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5260 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305261 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005262 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005263 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5264 {
5265 status = btcSetConfig (hHal, pSmeBtcConfig);
5266 sme_ReleaseGlobalLock( &pMac->sme );
5267 }
5268#endif
5269 return (status);
5270}
5271
5272/* ---------------------------------------------------------------------------
5273 \fn sme_BtcGetConfig
5274 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
5275 \param hHal - The handle returned by macOpen.
5276 \param pSmeBtcConfig - Pointer to a caller allocated object of type
5277 tSmeBtcConfig. Caller owns the memory and is responsible
5278 for freeing it.
5279 \return VOS_STATUS
5280 VOS_STATUS_E_FAILURE - failure
5281 VOS_STATUS_SUCCESS success
5282 ---------------------------------------------------------------------------*/
5283VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5284{
5285 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5286#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5287 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5288
Katya Nigambcb705f2013-12-26 14:26:22 +05305289 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005290 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005291 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5292 {
5293 status = btcGetConfig (hHal, pSmeBtcConfig);
5294 sme_ReleaseGlobalLock( &pMac->sme );
5295 }
5296#endif
5297 return (status);
5298}
5299/* ---------------------------------------------------------------------------
5300 \fn sme_SetCfgPrivacy
5301 \brief API to set configure privacy parameters
5302 \param hHal - The handle returned by macOpen.
5303 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005304 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07005305
5306 \return void
5307 ---------------------------------------------------------------------------*/
5308void sme_SetCfgPrivacy( tHalHandle hHal,
5309 tCsrRoamProfile *pProfile,
5310 tANI_BOOLEAN fPrivacy
5311 )
5312{
5313 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305314 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005315 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005316 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5317 {
5318 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5319 sme_ReleaseGlobalLock( &pMac->sme );
5320 }
5321}
5322
5323#if defined WLAN_FEATURE_VOWIFI
5324/* ---------------------------------------------------------------------------
5325 \fn sme_NeighborReportRequest
5326 \brief API to request neighbor report.
5327 \param hHal - The handle returned by macOpen.
5328 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5329 tRrmNeighborReq. Caller owns the memory and is responsible
5330 for freeing it.
5331 \return VOS_STATUS
5332 VOS_STATUS_E_FAILURE - failure
5333 VOS_STATUS_SUCCESS success
5334 ---------------------------------------------------------------------------*/
5335VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5336 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5337{
5338 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5339 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305340 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005341 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005342
5343 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5344 {
5345 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5346 sme_ReleaseGlobalLock( &pMac->sme );
5347 }
5348
5349 return (status);
5350}
5351#endif
5352
5353//The following are debug APIs to support direct read/write register/memory
5354//They are placed in SME because HW cannot be access when in LOW_POWER state
5355//AND not connected. The knowledge and synchronization is done in SME
5356
5357//sme_DbgReadRegister
5358//Caller needs to validate the input values
5359VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
5360{
5361 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5362 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005363 tPmcPowerState PowerState;
5364 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05305365 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005366 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005367
5368 /* 1) To make Quarky work in FTM mode **************************************/
5369
5370 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5371 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005372 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005373 {
5374 return VOS_STATUS_SUCCESS;
5375 }
5376 return VOS_STATUS_E_FAILURE;
5377 }
5378
5379 /* 2) NON FTM mode driver *************************************************/
5380
5381 /* Acquire SME global lock */
5382 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5383 {
5384 return VOS_STATUS_E_FAILURE;
5385 }
5386
5387 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5388 {
5389 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5390 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5391 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005392 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005393 {
5394 status = VOS_STATUS_SUCCESS;
5395 }
5396 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005397 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005398 status = VOS_STATUS_E_FAILURE;
5399 }
5400 }
5401 else
5402 {
5403 status = VOS_STATUS_E_FAILURE;
5404 }
5405 }
5406
5407 /* This is a hack for Qualky/pttWniSocket
5408 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5409 if ( VOS_STATUS_SUCCESS != status )
5410 {
5411 *pRegValue = 0xDEADBEEF;
5412 status = VOS_STATUS_SUCCESS;
5413 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005414
Jeff Johnson295189b2012-06-20 16:38:30 -07005415 /* Release SME global lock */
5416 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005417
Jeff Johnson295189b2012-06-20 16:38:30 -07005418 return (status);
5419}
5420
5421
5422//sme_DbgWriteRegister
5423//Caller needs to validate the input values
5424VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
5425{
5426 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5427 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005428 tPmcPowerState PowerState;
5429 tANI_U32 sessionId = 0;
5430
5431 /* 1) To make Quarky work in FTM mode **************************************/
5432
Katya Nigambcb705f2013-12-26 14:26:22 +05305433 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005434 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005435 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5436 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005437 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005438 {
5439 return VOS_STATUS_SUCCESS;
5440 }
5441 return VOS_STATUS_E_FAILURE;
5442 }
5443
5444 /* 2) NON FTM mode driver *************************************************/
5445
5446 /* Acquire SME global lock */
5447 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5448 {
5449 return VOS_STATUS_E_FAILURE;
5450 }
5451
5452 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5453 {
5454 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5455 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5456 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005457 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005458 {
5459 status = VOS_STATUS_SUCCESS;
5460 }
5461 else
5462 {
5463 status = VOS_STATUS_E_FAILURE;
5464 }
5465 }
5466 else
5467 {
5468 status = VOS_STATUS_E_FAILURE;
5469 }
5470 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005471
Jeff Johnson295189b2012-06-20 16:38:30 -07005472 /* Release SME global lock */
5473 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005474
Jeff Johnson295189b2012-06-20 16:38:30 -07005475 return (status);
5476}
5477
5478
5479
5480//sme_DbgReadMemory
5481//Caller needs to validate the input values
5482//pBuf caller allocated buffer has the length of nLen
5483VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5484{
5485 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5486 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07005487 tPmcPowerState PowerState;
5488 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005489 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
5490 tANI_U32 arg1 = memAddr;
5491 tANI_U32 arg2 = nLen/4;
5492 tANI_U32 arg3 = 4;
5493 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005494 /* 1) To make Quarky work in FTM mode **************************************/
5495
Katya Nigambcb705f2013-12-26 14:26:22 +05305496 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005497 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005498 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5499 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005500 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005501 {
5502 return VOS_STATUS_SUCCESS;
5503 }
5504 return VOS_STATUS_E_FAILURE;
5505 }
5506
5507 /* 2) NON FTM mode driver *************************************************/
5508
5509 /* Acquire SME global lock */
5510 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5511 {
5512 return VOS_STATUS_E_FAILURE;
5513 }
5514
5515 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5516 {
5517 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5518 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5519 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005520 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005521 {
5522 status = VOS_STATUS_SUCCESS;
5523 }
5524 else
5525 {
5526 status = VOS_STATUS_E_FAILURE;
5527 }
5528 }
5529 else
5530 {
5531 status = VOS_STATUS_E_FAILURE;
5532 }
5533 }
5534
5535 /* This is a hack for Qualky/pttWniSocket
5536 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5537 if (VOS_STATUS_SUCCESS != status)
5538 {
5539 vos_mem_set(pBuf, nLen, 0xCD);
5540 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005541 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005542 }
5543
5544 /* Release SME lock */
5545 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005546
Jeff Johnson295189b2012-06-20 16:38:30 -07005547 return (status);
5548}
5549
5550
5551//sme_DbgWriteMemory
5552//Caller needs to validate the input values
5553VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5554{
5555 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5556 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005557 tPmcPowerState PowerState;
5558 tANI_U32 sessionId = 0;
5559
5560 /* 1) To make Quarky work in FTM mode **************************************/
5561
Katya Nigambcb705f2013-12-26 14:26:22 +05305562 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005563 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005564 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5565 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005566 {
5567 return VOS_STATUS_SUCCESS;
5568 }
5569 return VOS_STATUS_E_FAILURE;
5570 }
5571
5572 /* 2) NON FTM mode driver *************************************************/
5573
5574 /* Acquire SME global lock */
5575 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5576 {
5577 return VOS_STATUS_E_FAILURE;
5578 }
5579
5580 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5581 {
5582 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5583 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5584 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005585 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07005586 {
5587 status = VOS_STATUS_SUCCESS;
5588 }
5589 else
5590 {
5591 status = VOS_STATUS_E_FAILURE;
5592 }
5593 }
5594 else
5595 {
5596 status = VOS_STATUS_E_FAILURE;
5597 }
5598 }
5599
5600 /* Release Global lock */
5601 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005602
Jeff Johnson295189b2012-06-20 16:38:30 -07005603 return (status);
5604}
5605
5606
Katya Nigam70d68332013-09-16 16:49:45 +05305607void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
5608{
5609 VOS_TRACE_LEVEL vosDebugLevel;
5610 char logBuffer[LOG_SIZE];
5611 va_list marker;
5612
5613 /* getting proper Debug level */
5614 vosDebugLevel = getVosDebugLevel(loglevel);
5615
5616 /* extracting arguments from pstring */
5617 va_start( marker, pString );
5618 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
5619
5620 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
5621 va_end( marker );
5622}
5623
5624
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005625void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07005626{
5627#ifdef WLAN_DEBUG
5628 // Verify against current log level
5629 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
5630 return;
5631 else
5632 {
5633 va_list marker;
5634
5635 va_start( marker, pString ); /* Initialize variable arguments. */
5636
5637 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
5638
5639 va_end( marker ); /* Reset variable arguments. */
5640 }
5641#endif
5642}
Jeff Johnson295189b2012-06-20 16:38:30 -07005643
Jeff Johnson295189b2012-06-20 16:38:30 -07005644/* ---------------------------------------------------------------------------
5645 \fn sme_GetWcnssWlanCompiledVersion
5646 \brief This API returns the version of the WCNSS WLAN API with
5647 which the HOST driver was built
5648 \param hHal - The handle returned by macOpen.
5649 \param pVersion - Points to the Version structure to be filled
5650 \return VOS_STATUS
5651 VOS_STATUS_E_INVAL - failure
5652 VOS_STATUS_SUCCESS success
5653 ---------------------------------------------------------------------------*/
5654VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
5655 tSirVersionType *pVersion)
5656{
5657 VOS_STATUS status = VOS_STATUS_SUCCESS;
5658 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5659 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5660
5661 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5662 {
5663 if( pVersion != NULL )
5664 {
5665 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
5666 }
5667 else
5668 {
5669 status = VOS_STATUS_E_INVAL;
5670 }
5671 sme_ReleaseGlobalLock( &pMac->sme );
5672 }
5673
5674 return (status);
5675}
5676
5677
5678/* ---------------------------------------------------------------------------
5679 \fn sme_GetWcnssWlanReportedVersion
5680 \brief This API returns the version of the WCNSS WLAN API with
5681 which the WCNSS driver reports it was built
5682 \param hHal - The handle returned by macOpen.
5683 \param pVersion - Points to the Version structure to be filled
5684 \return VOS_STATUS
5685 VOS_STATUS_E_INVAL - failure
5686 VOS_STATUS_SUCCESS success
5687 ---------------------------------------------------------------------------*/
5688VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
5689 tSirVersionType *pVersion)
5690{
5691 VOS_STATUS status = VOS_STATUS_SUCCESS;
5692 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5693 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5694
5695 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5696 {
5697 if( pVersion != NULL )
5698 {
5699 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
5700 }
5701 else
5702 {
5703 status = VOS_STATUS_E_INVAL;
5704 }
5705 sme_ReleaseGlobalLock( &pMac->sme );
5706 }
5707
5708 return (status);
5709}
5710
5711
5712/* ---------------------------------------------------------------------------
5713 \fn sme_GetWcnssSoftwareVersion
5714 \brief This API returns the version string of the WCNSS driver
5715 \param hHal - The handle returned by macOpen.
5716 \param pVersion - Points to the Version string buffer to be filled
5717 \param versionBufferSize - THe size of the Version string buffer
5718 \return VOS_STATUS
5719 VOS_STATUS_E_INVAL - failure
5720 VOS_STATUS_SUCCESS success
5721 ---------------------------------------------------------------------------*/
5722VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
5723 tANI_U8 *pVersion,
5724 tANI_U32 versionBufferSize)
5725{
5726 VOS_STATUS status = VOS_STATUS_SUCCESS;
5727 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5728 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5729
5730 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5731 {
5732 if( pVersion != NULL )
5733 {
5734 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
5735 versionBufferSize);
5736 }
5737 else
5738 {
5739 status = VOS_STATUS_E_INVAL;
5740 }
5741 sme_ReleaseGlobalLock( &pMac->sme );
5742 }
5743
5744 return (status);
5745}
5746
5747
5748/* ---------------------------------------------------------------------------
5749 \fn sme_GetWcnssHardwareVersion
5750 \brief This API returns the version string of the WCNSS hardware
5751 \param hHal - The handle returned by macOpen.
5752 \param pVersion - Points to the Version string buffer to be filled
5753 \param versionBufferSize - THe size of the Version string buffer
5754 \return VOS_STATUS
5755 VOS_STATUS_E_INVAL - failure
5756 VOS_STATUS_SUCCESS success
5757 ---------------------------------------------------------------------------*/
5758VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
5759 tANI_U8 *pVersion,
5760 tANI_U32 versionBufferSize)
5761{
5762 VOS_STATUS status = VOS_STATUS_SUCCESS;
5763 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5764 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5765
5766 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5767 {
5768 if( pVersion != NULL )
5769 {
5770 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
5771 versionBufferSize);
5772 }
5773 else
5774 {
5775 status = VOS_STATUS_E_INVAL;
5776 }
5777 sme_ReleaseGlobalLock( &pMac->sme );
5778 }
5779
5780 return (status);
5781}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08005782
Jeff Johnson295189b2012-06-20 16:38:30 -07005783
5784#ifdef FEATURE_WLAN_WAPI
5785/* ---------------------------------------------------------------------------
5786 \fn sme_RoamSetBKIDCache
5787 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
5788 candidate list.
5789 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5790 it is opened (by calling halOpen).
5791 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
5792 \param numItems - a variable that has the number of tBkidCacheInfo allocated
5793 when retruning, this is the number of items put into pBKIDCache
5794 \return eHalStatus - when fail, it usually means the buffer allocated is not
5795 big enough and pNumItems has the number of tBkidCacheInfo.
5796 ---------------------------------------------------------------------------*/
5797eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
5798 tANI_U32 numItems )
5799{
5800 eHalStatus status = eHAL_STATUS_FAILURE;
5801 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5802
5803 status = sme_AcquireGlobalLock( &pMac->sme );
5804 if ( HAL_STATUS_SUCCESS( status ) )
5805 {
5806 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
5807 sme_ReleaseGlobalLock( &pMac->sme );
5808 }
5809
5810 return (status);
5811}
5812
5813/* ---------------------------------------------------------------------------
5814 \fn sme_RoamGetBKIDCache
5815 \brief The SME API exposed to HDD to allow HDD to request SME to return its
5816 BKID cache.
5817 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5818 it is opened (by calling halOpen).
5819 \param pNum - caller allocated memory that has the space of the number of
5820 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
5821 in SME cache.
5822 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
5823 upon return
5824 \return eHalStatus - when fail, it usually means the buffer allocated is not
5825 big enough.
5826 ---------------------------------------------------------------------------*/
5827eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
5828 tBkidCacheInfo *pBkidCache)
5829{
5830 eHalStatus status = eHAL_STATUS_FAILURE;
5831 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5832
5833 status = sme_AcquireGlobalLock( &pMac->sme );
5834 if ( HAL_STATUS_SUCCESS( status ) )
5835 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005836 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005837 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
5838 sme_ReleaseGlobalLock( &pMac->sme );
5839 }
5840
5841 return (status);
5842}
5843
5844/* ---------------------------------------------------------------------------
5845 \fn sme_RoamGetNumBKIDCache
5846 \brief The SME API exposed to HDD to allow HDD to request SME to return the
5847 number of BKID cache entries.
5848 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5849 it is opened (by calling halOpen).
5850 \return tANI_U32 - the number of BKID cache entries.
5851 ---------------------------------------------------------------------------*/
5852tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
5853{
5854 eHalStatus status = eHAL_STATUS_FAILURE;
5855 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5856 tANI_U32 numBkidCache = 0;
5857
5858 status = sme_AcquireGlobalLock( &pMac->sme );
5859 if ( HAL_STATUS_SUCCESS( status ) )
5860 {
5861 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
5862 sme_ReleaseGlobalLock( &pMac->sme );
5863 }
5864
5865 return (numBkidCache);
5866}
5867
5868/* ---------------------------------------------------------------------------
5869 \fn sme_ScanGetBKIDCandidateList
5870 \brief a wrapper function to return the BKID candidate list
5871 \param pBkidList - caller allocated buffer point to an array of
5872 tBkidCandidateInfo
5873 \param pNumItems - pointer to a variable that has the number of
5874 tBkidCandidateInfo allocated when retruning, this is
5875 either the number needed or number of items put into
5876 pPmkidList
5877 \return eHalStatus - when fail, it usually means the buffer allocated is not
5878 big enough and pNumItems
5879 has the number of tBkidCandidateInfo.
5880 \Note: pNumItems is a number of tBkidCandidateInfo,
5881 not sizeof(tBkidCandidateInfo) * something
5882 ---------------------------------------------------------------------------*/
5883eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
5884 tBkidCandidateInfo *pBkidList,
5885 tANI_U32 *pNumItems )
5886{
5887 eHalStatus status = eHAL_STATUS_FAILURE;
5888 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5889
5890 status = sme_AcquireGlobalLock( &pMac->sme );
5891 if ( HAL_STATUS_SUCCESS( status ) )
5892 {
5893 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
5894 sme_ReleaseGlobalLock( &pMac->sme );
5895 }
5896
5897 return (status);
5898}
5899#endif /* FEATURE_WLAN_WAPI */
5900
Jeff Johnsone7245742012-09-05 17:12:55 -07005901#ifdef FEATURE_OEM_DATA_SUPPORT
5902
5903/*****************************************************************************
5904 OEM DATA related modifications and function additions
5905 *****************************************************************************/
5906
5907/* ---------------------------------------------------------------------------
5908 \fn sme_getOemDataRsp
5909 \brief a wrapper function to obtain the OEM DATA RSP
5910 \param pOemDataRsp - A pointer to the response object
5911 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005912 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07005913 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005914eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07005915 tOemDataRsp **pOemDataRsp)
5916{
5917 eHalStatus status = eHAL_STATUS_SUCCESS;
5918 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5919
5920 do
5921 {
5922 //acquire the lock for the sme object
5923 status = sme_AcquireGlobalLock(&pMac->sme);
5924
5925 if(!HAL_STATUS_SUCCESS(status))
5926 {
5927 break;
5928 }
5929
5930 if(pMac->oemData.pOemDataRsp != NULL)
5931 {
5932 *pOemDataRsp = pMac->oemData.pOemDataRsp;
5933 }
5934 else
5935 {
5936 status = eHAL_STATUS_FAILURE;
5937 }
5938
5939 //release the lock for the sme object
5940 sme_ReleaseGlobalLock( &pMac->sme );
5941
5942 } while(0);
5943
5944 return status;
5945}
5946
5947/* ---------------------------------------------------------------------------
5948 \fn sme_OemDataReq
5949 \brief a wrapper function for OEM DATA REQ
5950 \param sessionId - session id to be used.
5951 \param pOemDataReqId - pointer to an object to get back the request ID
5952 \param callback - a callback function that is called upon finish
5953 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005954 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07005955 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005956eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07005957 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005958 tOemDataReqConfig *pOemDataReqConfig,
5959 tANI_U32 *pOemDataReqID,
5960 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07005961 void *pContext)
5962{
5963 eHalStatus status = eHAL_STATUS_SUCCESS;
5964 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5965
5966 do
5967 {
5968 //acquire the lock for the sme object
5969 status = sme_AcquireGlobalLock(&pMac->sme);
5970 if(HAL_STATUS_SUCCESS(status))
5971 {
5972 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
5973
5974 if(pOemDataReqID)
5975 {
5976 *pOemDataReqID = lOemDataReqId;
5977 }
5978 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005979 {
5980 sme_ReleaseGlobalLock( &pMac->sme );
5981 return eHAL_STATUS_FAILURE;
5982 }
Jeff Johnsone7245742012-09-05 17:12:55 -07005983
5984 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
5985
5986 //release the lock for the sme object
5987 sme_ReleaseGlobalLock( &pMac->sme );
5988 }
5989 } while(0);
5990
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005991 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07005992
5993 return(status);
5994}
5995
5996#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07005997
5998/*--------------------------------------------------------------------------
5999
6000 \brief sme_OpenSession() - Open a session for scan/roam operation.
6001
6002 This is a synchronous API.
6003
6004
6005 \param hHal - The handle returned by macOpen.
6006 \param callback - A pointer to the function caller specifies for roam/connect status indication
6007 \param pContext - The context passed with callback
6008 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
6009 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
6010
6011 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
6012
6013 Other status means SME is failed to open the session.
6014 eHAL_STATUS_RESOURCES - no more session available.
6015 \sa
6016
6017 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006018eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
6019 void *pContext, tANI_U8 *pSelfMacAddr,
6020 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006021{
6022 eHalStatus status;
6023 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6024
6025 if( NULL == pbSessionId )
6026 {
6027 status = eHAL_STATUS_INVALID_PARAMETER;
6028 }
6029 else
6030 {
6031 status = sme_AcquireGlobalLock( &pMac->sme );
6032 if ( HAL_STATUS_SUCCESS( status ) )
6033 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006034 status = csrRoamOpenSession(pMac, callback, pContext,
6035 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006036
6037 sme_ReleaseGlobalLock( &pMac->sme );
6038 }
6039 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006040 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05306041 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006042 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006043
6044 return ( status );
6045}
6046
6047
6048/*--------------------------------------------------------------------------
6049
6050 \brief sme_CloseSession() - Open a session for scan/roam operation.
6051
6052 This is a synchronous API.
6053
6054
6055 \param hHal - The handle returned by macOpen.
6056
6057 \param sessionId - A previous opened session's ID.
6058
6059 \return eHAL_STATUS_SUCCESS - session is closed.
6060
6061 Other status means SME is failed to open the session.
6062 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
6063 \sa
6064
6065 --------------------------------------------------------------------------*/
6066eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
6067 csrRoamSessionCloseCallback callback, void *pContext)
6068{
6069 eHalStatus status;
6070 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6071
Katya Nigambcb705f2013-12-26 14:26:22 +05306072 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006073 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006074 status = sme_AcquireGlobalLock( &pMac->sme );
6075 if ( HAL_STATUS_SUCCESS( status ) )
6076 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006077 status = csrRoamCloseSession( pMac, sessionId, FALSE,
Jeff Johnson295189b2012-06-20 16:38:30 -07006078 callback, pContext );
6079
6080 sme_ReleaseGlobalLock( &pMac->sme );
6081 }
6082
6083 return ( status );
6084}
6085
Jeff Johnson295189b2012-06-20 16:38:30 -07006086/* ---------------------------------------------------------------------------
6087
6088 \fn sme_RoamUpdateAPWPSIE
6089
6090 \brief To update AP's WPS IE. This function should be called after SME AP session is created
6091 This is an asynchronous API.
6092
6093 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
6094
6095 \return eHalStatus – SUCCESS –
6096
6097 FAILURE or RESOURCES – The API finished and failed.
6098
6099 -------------------------------------------------------------------------------*/
6100eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
6101{
6102
6103 eHalStatus status = eHAL_STATUS_FAILURE;
6104 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6105
6106 status = sme_AcquireGlobalLock( &pMac->sme );
6107 if ( HAL_STATUS_SUCCESS( status ) )
6108 {
6109
6110 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
6111
6112 sme_ReleaseGlobalLock( &pMac->sme );
6113 }
6114
6115 return (status);
6116}
6117/* ---------------------------------------------------------------------------
6118
6119 \fn sme_RoamUpdateAPWPARSNIEs
6120
6121 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
6122 This is an asynchronous API.
6123
6124 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
6125
6126 \return eHalStatus – SUCCESS –
6127
6128 FAILURE or RESOURCES – The API finished and failed.
6129
6130 -------------------------------------------------------------------------------*/
6131eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
6132{
6133
6134 eHalStatus status = eHAL_STATUS_FAILURE;
6135 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6136
6137 status = sme_AcquireGlobalLock( &pMac->sme );
6138 if ( HAL_STATUS_SUCCESS( status ) )
6139 {
6140
6141 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
6142
6143 sme_ReleaseGlobalLock( &pMac->sme );
6144 }
6145
6146 return (status);
6147}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006148/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006149
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006150 \fn sme_ChangeMCCBeaconInterval
6151
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006152 \brief To update P2P-GO beaconInterval. This function should be called after
6153 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006154 This is an asynchronous API.
6155
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006156 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006157
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006158 \return eHalStatus SUCCESS
6159 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006160 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006161
6162 -------------------------------------------------------------------------------*/
6163eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
6164{
6165 eHalStatus status = eHAL_STATUS_FAILURE;
6166 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6167
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006168 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006169 status = sme_AcquireGlobalLock( &pMac->sme );
6170 if ( HAL_STATUS_SUCCESS( status ) )
6171 {
6172 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
6173 sme_ReleaseGlobalLock( &pMac->sme );
6174 }
6175 return (status);
6176}
Jeff Johnson295189b2012-06-20 16:38:30 -07006177
6178/*-------------------------------------------------------------------------------*
6179
6180 \fn sme_sendBTAmpEvent
6181
6182 \brief to receive the coex priorty request from BT-AMP PAL
6183 and send the BT_AMP link state to HAL
6184
6185 \param btAmpEvent - btAmpEvent
6186
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08006187 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07006188
6189 FAILURE: API failed
6190
6191-------------------------------------------------------------------------------*/
6192
6193eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
6194{
6195 vos_msg_t msg;
6196 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
6197 eHalStatus status = eHAL_STATUS_FAILURE;
6198
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08006199 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07006200 if (NULL == ptrSmeBtAmpEvent)
6201 {
6202 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006203 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006204 return status;
6205 }
6206
6207 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
6208 msg.type = WDA_SIGNAL_BTAMP_EVENT;
6209 msg.reserved = 0;
6210 msg.bodyptr = ptrSmeBtAmpEvent;
6211
6212 //status = halFW_SendBTAmpEventMesg(pMac, event);
6213
6214 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6215 {
6216 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006217 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006218 vos_mem_free(ptrSmeBtAmpEvent);
6219 return status;
6220 }
6221
6222 return eHAL_STATUS_SUCCESS;
6223
6224}
6225
6226/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306227 \fn smeIssueFastRoamNeighborAPEvent
6228 \brief API to trigger fast BSS roam independent of RSSI triggers
6229 \param hHal - The handle returned by macOpen.
6230 \param bssid - Pointer to the BSSID to roam to.
6231 \param fastRoamTrig - Trigger to Scan or roam
6232 \return eHalStatus
6233 ---------------------------------------------------------------------------*/
6234eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
6235 tANI_U8 *bssid,
6236 tSmeFastRoamTrigger fastRoamTrig)
6237{
6238 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6239 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
6240 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6241 eHalStatus status = eHAL_STATUS_SUCCESS;
6242
6243 status = sme_AcquireGlobalLock( &pMac->sme );
6244 if ( HAL_STATUS_SUCCESS( status ) )
6245 {
6246 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6247 "%s: invoked", __func__);
6248
6249 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
6250 {
6251 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
6252 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
6253 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6254 (void *)bssid, sizeof(tSirMacAddr));
Arif Hussaina7c8e412013-11-20 11:06:42 -08006255 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID "
6256 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306257
6258 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
6259 if (VOS_STATUS_SUCCESS != vosStatus)
6260 {
6261 smsLog(pMac, LOGE,
6262 FL("CFG Channel list scan state failed with status %d "),
6263 vosStatus);
6264 }
6265 }
6266 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
6267 {
6268 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6269 (void *)bssid, sizeof(tSirMacAddr));
6270 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08006271 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
6272 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306273
6274 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
6275 0,
6276 pMac,
6277 0);
6278
6279 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6280 {
6281 smsLog(pMac,
6282 LOGE,
6283 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
6284 vosStatus);
6285 }
6286 }
6287 sme_ReleaseGlobalLock( &pMac->sme );
6288 }
6289 return vosStatus;
6290}
6291/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006292 \fn sme_SetHostOffload
6293 \brief API to set the host offload feature.
6294 \param hHal - The handle returned by macOpen.
6295 \param pRequest - Pointer to the offload request.
6296 \return eHalStatus
6297 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006298eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006299 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006300{
6301 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07006302 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006303
Katya Nigambcb705f2013-12-26 14:26:22 +05306304 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006305 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006306 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6307 {
6308#ifdef WLAN_NS_OFFLOAD
6309 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
6310 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006311 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006312 }
6313 else
6314#endif //WLAN_NS_OFFLOAD
6315 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006316 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006317 }
6318 sme_ReleaseGlobalLock( &pMac->sme );
6319 }
6320
6321 return (status);
6322}
6323
6324#ifdef WLAN_FEATURE_GTK_OFFLOAD
6325/* ---------------------------------------------------------------------------
6326 \fn sme_SetGTKOffload
6327 \brief API to set GTK offload information.
6328 \param hHal - The handle returned by macOpen.
6329 \param pRequest - Pointer to the GTK offload request.
6330 \return eHalStatus
6331 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006332eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006333 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006334{
6335 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6336 eHalStatus status;
6337
Katya Nigambcb705f2013-12-26 14:26:22 +05306338 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006339 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006340 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6341 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006342 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006343 sme_ReleaseGlobalLock( &pMac->sme );
6344 }
6345
6346 return (status);
6347}
6348
6349/* ---------------------------------------------------------------------------
6350 \fn sme_GetGTKOffload
6351 \brief API to get GTK offload information.
6352 \param hHal - The handle returned by macOpen.
6353 \param pRequest - Pointer to the GTK offload response.
6354 \return eHalStatus
6355 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006356eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006357 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07006358{
6359 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6360 eHalStatus status;
6361
Katya Nigambcb705f2013-12-26 14:26:22 +05306362 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006363 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006364 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6365 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006366 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006367 sme_ReleaseGlobalLock( &pMac->sme );
6368 }
6369
6370 return (status);
6371}
6372#endif // WLAN_FEATURE_GTK_OFFLOAD
6373
6374/* ---------------------------------------------------------------------------
6375 \fn sme_SetKeepAlive
6376 \brief API to set the Keep Alive feature.
6377 \param hHal - The handle returned by macOpen.
6378 \param pRequest - Pointer to the Keep Alive request.
6379 \return eHalStatus
6380 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006381eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006382 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006383{
6384 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6385 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07006386 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6387 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006388 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006389 sme_ReleaseGlobalLock( &pMac->sme );
6390 }
6391
6392 return (status);
6393}
6394
6395#ifdef FEATURE_WLAN_SCAN_PNO
6396/* ---------------------------------------------------------------------------
6397 \fn sme_SetPreferredNetworkList
6398 \brief API to set the Preferred Network List Offload feature.
6399 \param hHal - The handle returned by macOpen.
6400 \param pRequest - Pointer to the offload request.
6401 \return eHalStatus
6402 ---------------------------------------------------------------------------*/
6403eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
6404{
6405 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6406 eHalStatus status;
6407
6408 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6409 {
6410 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
6411 sme_ReleaseGlobalLock( &pMac->sme );
6412 }
6413
6414 return (status);
6415}
6416
6417eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
6418{
6419 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6420 eHalStatus status;
6421
6422 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6423 {
6424 pmcSetRssiFilter(hHal, rssiThreshold);
6425 sme_ReleaseGlobalLock( &pMac->sme );
6426 }
6427
6428 return (status);
6429}
6430
6431#endif // FEATURE_WLAN_SCAN_PNO
6432
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006433eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07006434{
6435 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6436 eHalStatus status;
6437
Katya Nigambcb705f2013-12-26 14:26:22 +05306438 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006439 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006440 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6441 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006442 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07006443 sme_ReleaseGlobalLock( &pMac->sme );
6444 }
6445
6446 return (status);
6447}
6448
6449/* ---------------------------------------------------------------------------
6450 \fn sme_AbortMacScan
6451 \brief API to cancel MAC scan.
6452 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306453 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306454 \param reason - Reason to abort the scan.
Jeff Johnson295189b2012-06-20 16:38:30 -07006455 \return VOS_STATUS
6456 VOS_STATUS_E_FAILURE - failure
6457 VOS_STATUS_SUCCESS success
6458 ---------------------------------------------------------------------------*/
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306459eHalStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
6460 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07006461{
6462 eHalStatus status;
6463 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6464
Katya Nigambcb705f2013-12-26 14:26:22 +05306465 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006466 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006467 status = sme_AcquireGlobalLock( &pMac->sme );
6468 if ( HAL_STATUS_SUCCESS( status ) )
6469 {
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306470 status = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006471
Jeff Johnson295189b2012-06-20 16:38:30 -07006472 sme_ReleaseGlobalLock( &pMac->sme );
6473 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006474
Jeff Johnson295189b2012-06-20 16:38:30 -07006475 return ( status );
6476}
6477
6478/* ----------------------------------------------------------------------------
6479 \fn sme_GetOperationChannel
6480 \brief API to get current channel on which STA is parked
6481 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006482 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07006483 \returns eHAL_STATUS_SUCCESS
6484 eHAL_STATUS_FAILURE
6485-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006486eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006487{
Jeff Johnson295189b2012-06-20 16:38:30 -07006488 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6489 tCsrRoamSession *pSession;
6490
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006491 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07006492 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006493 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006494
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006495 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006496 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006497 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006498 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
6499 {
6500 *pChannel =pSession->connectedProfile.operationChannel;
6501 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006502 }
6503 }
6504 return eHAL_STATUS_FAILURE;
6505}// sme_GetOperationChannel ends here
6506
Jeff Johnson295189b2012-06-20 16:38:30 -07006507/* ---------------------------------------------------------------------------
6508
6509 \fn sme_RegisterMgtFrame
6510
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006511 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006512 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006513 \param matchData - data which needs to be matched before passing frame
6514 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006515 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006516 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006517 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006518eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006519 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6520{
6521 eHalStatus status = eHAL_STATUS_SUCCESS;
6522 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6523
Katya Nigambcb705f2013-12-26 14:26:22 +05306524 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006525 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006526 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6527 {
6528 tSirRegisterMgmtFrame *pMsg;
6529 tANI_U16 len;
6530 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006531
6532 if(!pSession)
6533 {
6534 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006535 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006536 return eHAL_STATUS_FAILURE;
6537 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006538
Jeff Johnson295189b2012-06-20 16:38:30 -07006539 if( !pSession->sessionActive )
6540 {
6541 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006542 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006543 sme_ReleaseGlobalLock( &pMac->sme );
6544 return eHAL_STATUS_FAILURE;
6545 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006546
Jeff Johnson295189b2012-06-20 16:38:30 -07006547 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6548
Kiet Lam64c1b492013-07-12 13:56:44 +05306549 pMsg = vos_mem_malloc(len);
6550 if ( NULL == pMsg )
6551 status = eHAL_STATUS_FAILURE;
6552 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006553 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306554 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006555 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
6556 pMsg->length = len;
6557 pMsg->sessionId = sessionId;
6558 pMsg->registerFrame = VOS_TRUE;
6559 pMsg->frameType = frameType;
6560 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306561 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006562 status = palSendMBMessage(pMac->hHdd, pMsg);
6563 }
6564 sme_ReleaseGlobalLock( &pMac->sme );
6565 }
6566 return status;
6567}
6568
6569/* ---------------------------------------------------------------------------
6570
6571 \fn sme_DeregisterMgtFrame
6572
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006573 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006574 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006575 \param matchData - data which needs to be matched before passing frame
6576 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006577 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006578 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006579 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006580eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006581 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6582{
6583 eHalStatus status = eHAL_STATUS_SUCCESS;
6584 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6585
Katya Nigambcb705f2013-12-26 14:26:22 +05306586 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006587 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006588 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6589 {
6590 tSirRegisterMgmtFrame *pMsg;
6591 tANI_U16 len;
6592 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006593
6594 if(!pSession)
6595 {
6596 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006597 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006598 return eHAL_STATUS_FAILURE;
6599 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006600
6601 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07006602 {
6603 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006604 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006605 sme_ReleaseGlobalLock( &pMac->sme );
6606 return eHAL_STATUS_FAILURE;
6607 }
6608
6609 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6610
Kiet Lam64c1b492013-07-12 13:56:44 +05306611 pMsg = vos_mem_malloc(len);
6612 if ( NULL == pMsg )
6613 status = eHAL_STATUS_FAILURE;
6614 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006615 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306616 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006617 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006618 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07006619 pMsg->registerFrame = VOS_FALSE;
6620 pMsg->frameType = frameType;
6621 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306622 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006623 status = palSendMBMessage(pMac->hHdd, pMsg);
6624 }
6625 sme_ReleaseGlobalLock( &pMac->sme );
6626 }
6627 return status;
6628}
6629
6630/* ---------------------------------------------------------------------------
6631 \fn sme_RemainOnChannel
6632 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
6633 \param hHal - The handle returned by macOpen.
6634 \param pRequest - channel
6635 \param duration - duration in ms
6636 \param callback - HDD registered callback to process reaminOnChannelRsp
6637 \param context - HDD Callback param
6638 \return eHalStatus
6639 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006640eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
6641 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306642 remainOnChanCallback callback,
6643 void *pContext,
6644 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07006645{
6646 eHalStatus status = eHAL_STATUS_SUCCESS;
6647 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6648
Katya Nigambcb705f2013-12-26 14:26:22 +05306649 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006650 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006651 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6652 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306653 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
6654 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07006655#ifdef WLAN_FEATURE_P2P_INTERNAL
6656 , eP2PRemainOnChnReasonUnknown
6657#endif
6658 );
6659 sme_ReleaseGlobalLock( &pMac->sme );
6660 }
6661 return(status);
6662}
6663
6664/* ---------------------------------------------------------------------------
6665 \fn sme_ReportProbeReq
6666 \brief API to enable/disable forwarding of probeReq to apps in p2p.
6667 \param hHal - The handle returned by macOpen.
6668 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
6669 \return eHalStatus
6670 ---------------------------------------------------------------------------*/
6671
6672#ifndef WLAN_FEATURE_CONCURRENT_P2P
6673eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
6674{
6675 eHalStatus status = eHAL_STATUS_SUCCESS;
6676 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6677
6678 do
6679 {
6680 //acquire the lock for the sme object
6681 status = sme_AcquireGlobalLock(&pMac->sme);
6682 if(HAL_STATUS_SUCCESS(status))
6683 {
6684 /* call set in context */
6685 pMac->p2pContext.probeReqForwarding = flag;
6686 //release the lock for the sme object
6687 sme_ReleaseGlobalLock( &pMac->sme );
6688 }
6689 } while(0);
6690
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006691 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006692
6693 return(status);
6694}
6695
6696/* ---------------------------------------------------------------------------
6697 \fn sme_updateP2pIe
6698 \brief API to set the P2p Ie in p2p context
6699 \param hHal - The handle returned by macOpen.
6700 \param p2pIe - Ptr to p2pIe from HDD.
6701 \param p2pIeLength: length of p2pIe
6702 \return eHalStatus
6703 ---------------------------------------------------------------------------*/
6704
6705eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
6706{
6707 eHalStatus status = eHAL_STATUS_SUCCESS;
6708 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6709
6710 //acquire the lock for the sme object
6711 status = sme_AcquireGlobalLock(&pMac->sme);
6712 if(HAL_STATUS_SUCCESS(status))
6713 {
6714 if(NULL != pMac->p2pContext.probeRspIe){
6715 vos_mem_free(pMac->p2pContext.probeRspIe);
6716 pMac->p2pContext.probeRspIeLength = 0;
6717 }
6718
6719 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
6720 if (NULL == pMac->p2pContext.probeRspIe)
6721 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006722 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006723 pMac->p2pContext.probeRspIeLength = 0;
6724 status = eHAL_STATUS_FAILURE;
6725 }
6726 else
6727 {
6728 pMac->p2pContext.probeRspIeLength = p2pIeLength;
6729
6730 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
6731 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006732 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07006733 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
6734 p2pIeLength);
6735 }
6736
6737 //release the lock for the sme object
6738 sme_ReleaseGlobalLock( &pMac->sme );
6739 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006740
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006741 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006742
6743 return(status);
6744}
6745#endif
6746
6747/* ---------------------------------------------------------------------------
6748 \fn sme_sendAction
6749 \brief API to send action frame from supplicant.
6750 \param hHal - The handle returned by macOpen.
6751 \return eHalStatus
6752 ---------------------------------------------------------------------------*/
6753
6754eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006755 const tANI_U8 *pBuf, tANI_U32 len,
6756 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07006757{
6758 eHalStatus status = eHAL_STATUS_SUCCESS;
6759 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6760
Katya Nigambcb705f2013-12-26 14:26:22 +05306761 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006762 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006763 //acquire the lock for the sme object
6764 status = sme_AcquireGlobalLock(&pMac->sme);
6765 if(HAL_STATUS_SUCCESS(status))
6766 {
Jeff Johnsone7245742012-09-05 17:12:55 -07006767 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07006768 //release the lock for the sme object
6769 sme_ReleaseGlobalLock( &pMac->sme );
6770 }
6771
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006772 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006773
6774 return(status);
6775}
6776
6777eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
6778{
6779 eHalStatus status = eHAL_STATUS_SUCCESS;
6780 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6781
Katya Nigambcb705f2013-12-26 14:26:22 +05306782 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006783 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006784 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6785 {
6786 status = p2pCancelRemainOnChannel (hHal, sessionId);
6787 sme_ReleaseGlobalLock( &pMac->sme );
6788 }
6789 return(status);
6790}
6791
6792//Power Save Related
6793eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
6794{
6795 eHalStatus status = eHAL_STATUS_SUCCESS;
6796 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6797
6798 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6799 {
6800 status = p2pSetPs (hHal, data);
6801 sme_ReleaseGlobalLock( &pMac->sme );
6802 }
6803 return(status);
6804}
6805
Jeff Johnson295189b2012-06-20 16:38:30 -07006806
6807/* ---------------------------------------------------------------------------
6808
6809 \fn sme_ConfigureRxpFilter
6810
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006811 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07006812 SME will pass this request to lower mac to set/reset the filter on RXP for
6813 multicast & broadcast traffic.
6814
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006815 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07006816
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006817 hHal - The handle returned by macOpen.
6818
Jeff Johnson295189b2012-06-20 16:38:30 -07006819 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
6820 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
6821 on this param. In future we can use this as a mask to set various types of
6822 filters as suggested below:
6823 FILTER_ALL_MULTICAST:
6824 FILTER_ALL_BROADCAST:
6825 FILTER_ALL_MULTICAST_BROADCAST:
6826
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006827
6828 \return eHalStatus
6829
6830
Jeff Johnson295189b2012-06-20 16:38:30 -07006831--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006832eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07006833 tpSirWlanSetRxpFilters wlanRxpFilterParam)
6834{
6835 eHalStatus status = eHAL_STATUS_SUCCESS;
6836 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6837 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6838 vos_msg_t vosMessage;
6839
Katya Nigambcb705f2013-12-26 14:26:22 +05306840 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006841 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006842 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6843 {
6844 /* serialize the req through MC thread */
6845 vosMessage.bodyptr = wlanRxpFilterParam;
6846 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
6847 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6848 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6849 {
6850 status = eHAL_STATUS_FAILURE;
6851 }
6852 sme_ReleaseGlobalLock( &pMac->sme );
6853 }
6854 return(status);
6855}
6856
Jeff Johnson295189b2012-06-20 16:38:30 -07006857/* ---------------------------------------------------------------------------
6858
6859 \fn sme_ConfigureSuspendInd
6860
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006861 \brief
6862 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07006863 be suspended
6864
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006865 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07006866
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006867 hHal - The handle returned by macOpen.
6868
Jeff Johnson295189b2012-06-20 16:38:30 -07006869 wlanSuspendParam- Depicts the wlan suspend params
6870
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006871
6872 \return eHalStatus
6873
6874
Jeff Johnson295189b2012-06-20 16:38:30 -07006875--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006876eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07006877 tpSirWlanSuspendParam wlanSuspendParam)
6878{
6879 eHalStatus status = eHAL_STATUS_SUCCESS;
6880 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6881 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6882 vos_msg_t vosMessage;
6883
Katya Nigambcb705f2013-12-26 14:26:22 +05306884 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006885 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006886 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6887 {
6888 /* serialize the req through MC thread */
6889 vosMessage.bodyptr = wlanSuspendParam;
6890 vosMessage.type = WDA_WLAN_SUSPEND_IND;
6891 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6892 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6893 {
6894 status = eHAL_STATUS_FAILURE;
6895 }
6896 sme_ReleaseGlobalLock( &pMac->sme );
6897 }
6898 return(status);
6899}
6900
6901/* ---------------------------------------------------------------------------
6902
6903 \fn sme_ConfigureResumeReq
6904
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006905 \brief
6906 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07006907 be Resumed
6908
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006909 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07006910
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006911 hHal - The handle returned by macOpen.
6912
Jeff Johnson295189b2012-06-20 16:38:30 -07006913 wlanResumeParam- Depicts the wlan resume params
6914
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006915
6916 \return eHalStatus
6917
6918
Jeff Johnson295189b2012-06-20 16:38:30 -07006919--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006920eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07006921 tpSirWlanResumeParam wlanResumeParam)
6922{
6923 eHalStatus status = eHAL_STATUS_SUCCESS;
6924 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6925 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6926 vos_msg_t vosMessage;
6927
Katya Nigambcb705f2013-12-26 14:26:22 +05306928 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006929 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006930 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6931 {
6932 /* serialize the req through MC thread */
6933 vosMessage.bodyptr = wlanResumeParam;
6934 vosMessage.type = WDA_WLAN_RESUME_REQ;
6935 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6936 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6937 {
6938 status = eHAL_STATUS_FAILURE;
6939 }
6940 sme_ReleaseGlobalLock( &pMac->sme );
6941 }
6942 return(status);
6943}
6944
Jeff Johnson295189b2012-06-20 16:38:30 -07006945/* ---------------------------------------------------------------------------
6946
6947 \fn sme_GetInfraSessionId
6948
6949 \brief To get the session ID for infra session, if connected
6950 This is a synchronous API.
6951
6952 \param hHal - The handle returned by macOpen.
6953
6954 \return sessionid, -1 if infra session is not connected
6955
6956 -------------------------------------------------------------------------------*/
6957tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
6958{
6959 eHalStatus status = eHAL_STATUS_FAILURE;
6960 tANI_S8 sessionid = -1;
6961 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006962
Jeff Johnson295189b2012-06-20 16:38:30 -07006963 status = sme_AcquireGlobalLock( &pMac->sme );
6964 if ( HAL_STATUS_SUCCESS( status ) )
6965 {
6966
6967 sessionid = csrGetInfraSessionId( pMac);
6968
6969 sme_ReleaseGlobalLock( &pMac->sme );
6970 }
6971
6972 return (sessionid);
6973}
6974
6975/* ---------------------------------------------------------------------------
6976
6977 \fn sme_GetInfraOperationChannel
6978
6979 \brief To get the operating channel for infra session, if connected
6980 This is a synchronous API.
6981
6982 \param hHal - The handle returned by macOpen.
6983 \param sessionId - the sessionId returned by sme_OpenSession.
6984
6985 \return operating channel, 0 if infra session is not connected
6986
6987 -------------------------------------------------------------------------------*/
6988tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
6989{
6990 eHalStatus status = eHAL_STATUS_FAILURE;
6991 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6992 tANI_U8 channel = 0;
6993 status = sme_AcquireGlobalLock( &pMac->sme );
6994 if ( HAL_STATUS_SUCCESS( status ) )
6995 {
6996
6997 channel = csrGetInfraOperationChannel( pMac, sessionId);
6998
6999 sme_ReleaseGlobalLock( &pMac->sme );
7000 }
7001
7002 return (channel);
7003}
7004
7005//This routine will return poerating channel on which other BSS is operating to be used for concurrency mode.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007006//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07007007tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
7008{
7009 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007010 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07007011 tANI_U8 channel = 0;
7012 status = sme_AcquireGlobalLock( &pMac->sme );
7013 if ( HAL_STATUS_SUCCESS( status ) )
7014 {
7015
7016 channel = csrGetConcurrentOperationChannel( pMac );
7017 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007018 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07007019 sme_ReleaseGlobalLock( &pMac->sme );
7020 }
7021
7022 return (channel);
7023}
7024
7025#ifdef FEATURE_WLAN_SCAN_PNO
7026/******************************************************************************
7027*
7028* Name: sme_PreferredNetworkFoundInd
7029*
7030* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007031* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07007032*
7033* Parameters:
7034* hHal - HAL handle for device
7035* pMsg - found network description
7036*
7037* Returns: eHalStatus
7038*
7039******************************************************************************/
7040eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
7041{
7042 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7043 eHalStatus status = eHAL_STATUS_SUCCESS;
7044 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07007045 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
7046 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007047
7048 if (NULL == pMsg)
7049 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007050 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007051 status = eHAL_STATUS_FAILURE;
7052 }
7053 else
7054 {
7055 if (pPrefNetworkFoundInd->ssId.length > 0)
7056 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07007057 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
7058 pPrefNetworkFoundInd->ssId.length);
7059 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
7060 dumpSsId[ssIdLength] = 0;
7061 smsLog(pMac, LOG2, "%s:SSID=%s frame length %d",
7062 __func__, dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07007063
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05307064 /* Flush scan results, So as to avoid indication/updation of
7065 * stale entries, which may not have aged out during APPS collapse
7066 */
7067 sme_ScanFlushResult(hHal,0);
7068
Srikant Kuppa066904f2013-05-07 13:56:02 -07007069 //Save the frame to scan result
7070 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
7071 {
7072 //we may have a frame
7073 status = csrScanSavePreferredNetworkFound(pMac,
7074 pPrefNetworkFoundInd);
7075 if (!HAL_STATUS_SUCCESS(status))
7076 {
7077 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
7078 }
7079 }
7080 else
7081 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08007082 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07007083 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07007084 }
7085
Srikant Kuppa066904f2013-05-07 13:56:02 -07007086 /* Call Preferred Netowrk Found Indication callback routine. */
7087 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
7088 {
7089 pMac->pmc.prefNetwFoundCB(
7090 pMac->pmc.preferredNetworkFoundIndCallbackContext,
7091 pPrefNetworkFoundInd);
7092 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007093 }
7094 else
7095 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007096 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007097 status = eHAL_STATUS_FAILURE;
7098 }
7099 }
7100
7101
7102 return(status);
7103}
7104
7105#endif // FEATURE_WLAN_SCAN_PNO
7106
7107
7108eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
7109{
7110 eHalStatus status = eHAL_STATUS_FAILURE;
7111 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007112
Jeff Johnson295189b2012-06-20 16:38:30 -07007113 status = sme_AcquireGlobalLock( &pMac->sme );
7114 if ( HAL_STATUS_SUCCESS( status ) )
7115 {
7116 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
7117 sme_ReleaseGlobalLock( &pMac->sme );
7118 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007119
Jeff Johnson295189b2012-06-20 16:38:30 -07007120 return (status);
7121}
7122
7123
7124/* ---------------------------------------------------------------------------
7125
7126 \fn sme_SetTxPerTracking
7127
7128 \brief Set Tx PER tracking configuration parameters
7129
7130 \param hHal - The handle returned by macOpen.
7131 \param pTxPerTrackingConf - Tx PER configuration parameters
7132
7133 \return eHalStatus
7134
7135 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007136eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
7137 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07007138 void *pCallbackContext,
7139 tpSirTxPerTrackingParam pTxPerTrackingParam)
7140{
7141 vos_msg_t msg;
7142 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
7143 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7144
7145 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7146 {
7147 pMac->sme.pTxPerHitCallback = pCallbackfn;
7148 pMac->sme.pTxPerHitCbContext = pCallbackContext;
7149 sme_ReleaseGlobalLock( &pMac->sme );
7150 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007151
Jeff Johnson295189b2012-06-20 16:38:30 -07007152 // free this memory in failure case or WDA request callback function
7153 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
7154 if (NULL == pTxPerTrackingParamReq)
7155 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007156 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 -07007157 return eHAL_STATUS_FAILURE;
7158 }
7159
Kiet Lam64c1b492013-07-12 13:56:44 +05307160 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
7161 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07007162 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
7163 msg.reserved = 0;
7164 msg.bodyptr = pTxPerTrackingParamReq;
7165
7166 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7167 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007168 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 -07007169 vos_mem_free(pTxPerTrackingParamReq);
7170 return eHAL_STATUS_FAILURE;
7171 }
7172
7173 return eHAL_STATUS_SUCCESS;
7174}
7175
7176/* ---------------------------------------------------------------------------
7177
7178 \fn sme_HandleChangeCountryCode
7179
7180 \brief Change Country code, Reg Domain and channel list
7181
7182 \details Country Code Priority
7183 0 = 11D > Configured Country > NV
7184 1 = Configured Country > 11D > NV
7185 If Supplicant country code is priority than 11d is disabled.
7186 If 11D is enabled, we update the country code after every scan.
7187 Hence when Supplicant country code is priority, we don't need 11D info.
7188 Country code from Supplicant is set as current courtry code.
7189 User can send reset command XX (instead of country code) to reset the
7190 country code to default values which is read from NV.
7191 In case of reset, 11D is enabled and default NV code is Set as current country code
7192 If 11D is priority,
7193 Than Supplicant country code code is set to default code. But 11D code is set as current country code
7194
7195 \param pMac - The handle returned by macOpen.
7196 \param pMsgBuf - MSG Buffer
7197
7198 \return eHalStatus
7199
7200 -------------------------------------------------------------------------------*/
7201eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7202{
7203 eHalStatus status = eHAL_STATUS_SUCCESS;
7204 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007205 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07007206 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7207 static uNvTables nvTables;
7208 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
7209
7210
7211 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
7212 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
7213 {
7214 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7215
7216 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
7217
7218 /* read the country code from NV and use it */
7219 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
7220 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307221 vos_mem_copy(pMsg->countryCode,
7222 nvTables.defaultCountryTable.countryCode,
7223 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007224 }
7225 else
7226 {
7227 status = eHAL_STATUS_FAILURE;
7228 return status;
7229 }
7230 }
7231 else
7232 {
7233 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05307234 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
7235 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07007236 {
7237 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7238 }
7239 }
7240
7241 /* WEXT set country code means
7242 * 11D should be supported?
7243 * 11D Channel should be enforced?
7244 * 11D Country code should be matched?
7245 * 11D Reg Domian should be matched?
7246 * Country string changed */
7247 if(pMac->roam.configParam.Is11dSupportEnabled &&
7248 pMac->roam.configParam.fEnforce11dChannels &&
7249 pMac->roam.configParam.fEnforceCountryCodeMatch &&
7250 pMac->roam.configParam.fEnforceDefaultDomain &&
7251 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
7252 {
7253 /* All 11D related options are already enabled
7254 * Country string is not changed
7255 * Do not need do anything for country code change request */
7256 return eHAL_STATUS_SUCCESS;
7257 }
7258
7259 /* Set Current Country code and Current Regulatory domain */
7260 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
7261 if(eHAL_STATUS_SUCCESS != status)
7262 {
7263 /* Supplicant country code failed. So give 11D priority */
7264 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7265 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007266 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007267 }
7268
Jeff Johnson295189b2012-06-20 16:38:30 -07007269 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05307270 vos_mem_copy(pMac->scan.countryCodeDefault,
7271 pMac->scan.countryCodeCurrent,
7272 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007273
7274 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05307275 status = csrGetRegulatoryDomainForCountry(pMac,
7276 pMac->scan.countryCodeCurrent,
7277 (v_REGDOMAIN_t *) &domainIdIoctl,
7278 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07007279 if ( status != eHAL_STATUS_SUCCESS )
7280 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007281 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007282 return status;
7283 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08007284 else if (REGDOMAIN_WORLD == domainIdIoctl)
7285 {
7286 /* Supplicant country code is invalid, so we are on world mode now. So
7287 give 11D chance to update */
7288 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7289 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
7290 }
7291
Jeff Johnson295189b2012-06-20 16:38:30 -07007292
Abhishek Singha306a442013-11-07 18:39:01 +05307293 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07007294
7295 if ( status != eHAL_STATUS_SUCCESS )
7296 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007297 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007298 return status;
7299 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007300 else
7301 {
7302 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7303 //set again if we find AP with 11d info during scan
7304 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
7305 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007306 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007307 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7308 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7309 }
7310 }
Kiet Lam6c583332013-10-14 05:37:09 +05307311#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07007312 /* set to default domain ID */
7313 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7314
7315 /* get the channels based on new cc */
7316 status = csrInitGetChannels( pMac );
7317
7318 if ( status != eHAL_STATUS_SUCCESS )
7319 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007320 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007321 return status;
7322 }
7323
7324 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08007325 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307326 /* Country code Changed, Purge Only scan result
7327 * which does not have channel number belong to 11d
7328 * channel list
7329 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307330 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307331
Kiet Lam6c583332013-10-14 05:37:09 +05307332#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007333 if( pMsg->changeCCCallback )
7334 {
7335 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
7336 }
7337
7338 return eHAL_STATUS_SUCCESS;
7339}
7340
Amar Singhal0d15bd52013-10-12 23:13:13 -07007341/* ---------------------------------------------------------------------------
7342
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007343 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07007344
7345 \brief Change Country code, Reg Domain and channel list
7346
7347 If Supplicant country code is priority than 11d is disabled.
7348 If 11D is enabled, we update the country code after every scan.
7349 Hence when Supplicant country code is priority, we don't need 11D info.
7350 Country code from Supplicant is set as current country code.
7351
7352 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007353 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07007354
7355 \return eHalStatus
7356
7357 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007358eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
7359 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007360{
7361 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007362 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05307363 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007364
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007365 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007366 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7367
Kiet Lam6c583332013-10-14 05:37:09 +05307368 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
7369 VOS_COUNTRY_CODE_LEN) == 0)
7370 {
7371 is11dCountry = VOS_TRUE;
7372 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007373
Amar Singhal97a2d992013-11-19 10:58:07 -08007374 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7375 (csrGetInfraSessionId(pMac) != -1 ))
7376 {
7377
7378 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
7379
7380 /* we have got a request for a country that should not have been added since the
7381 STA is associated; nullify this request */
7382 status = csrGetRegulatoryDomainForCountry(pMac,
7383 pMac->scan.countryCode11d,
7384 (v_REGDOMAIN_t *) &reg_domain_id,
7385 COUNTRY_IE);
7386
7387 return eHAL_STATUS_FAILURE;
7388 }
7389
Amar Singhal0d15bd52013-10-12 23:13:13 -07007390 /* if Supplicant country code has priority, disable 11d */
Kiet Lam6c583332013-10-14 05:37:09 +05307391 if (!is11dCountry && pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007392 {
7393 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7394 }
7395
Kiet Lamf2f201e2013-11-16 21:24:16 +05307396 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07007397 WNI_CFG_COUNTRY_CODE_LEN);
7398
Abhishek Singha306a442013-11-07 18:39:01 +05307399 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07007400
Kiet Lam6c583332013-10-14 05:37:09 +05307401 if (VOS_FALSE == is11dCountry )
7402 {
7403 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05307404 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05307405 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
7406 /* set to default domain ID */
7407 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7408 }
7409
Amar Singhal0d15bd52013-10-12 23:13:13 -07007410 if ( status != eHAL_STATUS_SUCCESS )
7411 {
7412 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05307413 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007414 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007415 else
7416 {
7417 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7418 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007419 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7420 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007421 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007422 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007423 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7424 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7425 }
7426 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007427
Amar Singhal0d15bd52013-10-12 23:13:13 -07007428 /* get the channels based on new cc */
7429 status = csrInitGetChannels(pMac);
7430
7431 if ( status != eHAL_STATUS_SUCCESS )
7432 {
7433 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7434 return status;
7435 }
7436
7437 /* reset info based on new cc, and we are done */
7438 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05307439 if (VOS_TRUE == is11dCountry)
7440 {
Kiet Lam6c583332013-10-14 05:37:09 +05307441 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
7442 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
7443 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307444 /* Country code Changed, Purge Only scan result
7445 * which does not have channel number belong to 11d
7446 * channel list
7447 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307448 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05307449 // Do active scans after the country is set by User hints or Country IE
7450 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
7451
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007452 smsLog(pMac, LOG1, FL(" returned"));
7453 return eHAL_STATUS_SUCCESS;
7454}
7455
7456/* ---------------------------------------------------------------------------
7457
Kiet Lamcffc5862013-10-30 16:28:45 +05307458 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007459
7460 \brief Update Country code in the driver if set by kernel as world
7461
7462 If 11D is enabled, we update the country code after every scan & notify kernel.
7463 This is to make sure kernel & driver are in sync in case of CC found in
7464 driver but not in kernel database
7465
7466 \param pMac - The handle returned by macOpen.
7467 \param pMsg - Carrying new CC set in kernel
7468
7469 \return eHalStatus
7470
7471 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05307472eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007473{
Kiet Lamcffc5862013-10-30 16:28:45 +05307474 eHalStatus status;
7475
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007476 smsLog(pMac, LOG1, FL(" called"));
7477
7478 //this is to make sure kernel & driver are in sync in case of CC found in
7479 //driver but not in kernel database
7480 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
7481 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007482 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05307483 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007484 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05307485 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007486 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007487 }
Kiet Lamcffc5862013-10-30 16:28:45 +05307488
Abhishek Singha306a442013-11-07 18:39:01 +05307489 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05307490
7491 if ( status != eHAL_STATUS_SUCCESS )
7492 {
7493 smsLog( pMac, LOGE, FL(" fail to set regId") );
7494 return status;
7495 }
7496 else
7497 {
7498 status = csrInitGetChannels(pMac);
7499 if ( status != eHAL_STATUS_SUCCESS )
7500 {
7501 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7502 }
7503 else
7504 {
7505 csrInitChannelList(pMac);
7506 }
7507 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307508 /* Country code Changed, Purge Only scan result
7509 * which does not have channel number belong to 11d
7510 * channel list
7511 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307512 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007513 smsLog(pMac, LOG1, FL(" returned"));
7514 return eHAL_STATUS_SUCCESS;
7515}
7516
7517/* ---------------------------------------------------------------------------
7518
7519 \fn sme_HandleGenericChangeCountryCode
7520
7521 \brief Change Country code, Reg Domain and channel list
7522
7523 If Supplicant country code is priority than 11d is disabled.
7524 If 11D is enabled, we update the country code after every scan.
7525 Hence when Supplicant country code is priority, we don't need 11D info.
7526 Country code from kernel is set as current country code.
7527
7528 \param pMac - The handle returned by macOpen.
7529 \param pMsgBuf - message buffer
7530
7531 \return eHalStatus
7532
7533 -------------------------------------------------------------------------------*/
7534eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7535{
7536 tAniGenericChangeCountryCodeReq *pMsg;
7537 v_REGDOMAIN_t reg_domain_id;
7538
7539 smsLog(pMac, LOG1, FL(" called"));
7540 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
7541 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7542
7543 if (REGDOMAIN_COUNT == reg_domain_id)
7544 {
Kiet Lamcffc5862013-10-30 16:28:45 +05307545 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007546 }
7547 else
7548 {
7549 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
7550 }
7551 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007552 return eHAL_STATUS_SUCCESS;
7553}
7554
Jeff Johnson295189b2012-06-20 16:38:30 -07007555#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08007556eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07007557{
7558 tpSirRcvFltMcAddrList pRequestBuf;
7559 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007560 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07007561 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007562
7563 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05307564 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007565 pMulticastAddrs->ulMulticastAddrCnt,
7566 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07007567
7568 /*
7569 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08007570 */
7571 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
7572 csrIsConnStateInfra(pMac, sessionId))
7573 {
7574 pSession = CSR_GET_SESSION( pMac, sessionId );
7575 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007576
7577 if(pSession == NULL )
7578 {
7579 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007580 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07007581 return eHAL_STATUS_FAILURE;
7582 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007583
Jeff Johnson295189b2012-06-20 16:38:30 -07007584 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
7585 if (NULL == pRequestBuf)
7586 {
7587 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007588 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007589 return eHAL_STATUS_FAILED_ALLOC;
7590 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007591
7592 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
7593 {
7594 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
7595 "indication as we are not connected", __func__);
7596 vos_mem_free(pRequestBuf);
7597 return eHAL_STATUS_FAILURE;
7598 }
7599
Jeff Johnson295189b2012-06-20 16:38:30 -07007600 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
7601
Kiet Lam64c1b492013-07-12 13:56:44 +05307602 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
7603 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007604 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
7605 sizeof(tSirMacAddr));
7606
Jeff Johnson295189b2012-06-20 16:38:30 -07007607 msg.type = WDA_8023_MULTICAST_LIST_REQ;
7608 msg.reserved = 0;
7609 msg.bodyptr = pRequestBuf;
7610 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7611 {
7612 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007613 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007614 vos_mem_free(pRequestBuf);
7615 return eHAL_STATUS_FAILURE;
7616 }
7617
7618 return eHAL_STATUS_SUCCESS;
7619}
7620
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007621eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07007622 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007623{
7624 tpSirRcvPktFilterCfgType pRequestBuf;
7625 v_SINT_t allocSize;
7626 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007627 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7628 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007629 v_U8_t idx=0;
7630
7631 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007632 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007633 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007634
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07007635 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007636
Jeff Johnson295189b2012-06-20 16:38:30 -07007637 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007638
7639 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007640 {
7641 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007642 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007643 return eHAL_STATUS_FAILED_ALLOC;
7644 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007645
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007646 if( NULL == pSession )
7647 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007648 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007649 vos_mem_free(pRequestBuf);
7650 return eHAL_STATUS_FAILURE;
7651 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007652
Kiet Lam64c1b492013-07-12 13:56:44 +05307653 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
7654 sizeof(tSirMacAddr));
7655 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
7656 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007657 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
7658
Jeff Johnson295189b2012-06-20 16:38:30 -07007659 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
7660 msg.reserved = 0;
7661 msg.bodyptr = pRequestBuf;
7662
7663 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007664 "FT %d FID %d ",
7665 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007666
7667 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007668 "params %d CT %d",
7669 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07007670
7671 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
7672 {
7673
7674 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007675 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07007676 pRequestBuf->paramsData[idx].protocolLayer,
7677 pRequestBuf->paramsData[idx].cmpFlag);
7678
7679 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007680 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007681 pRequestBuf->paramsData[idx].dataOffset,
7682 pRequestBuf->paramsData[idx].dataLength);
7683
7684 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007685 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007686 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007687 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07007688 pRequestBuf->paramsData[idx].compareData[2],
7689 pRequestBuf->paramsData[idx].compareData[3],
7690 pRequestBuf->paramsData[idx].compareData[4],
7691 pRequestBuf->paramsData[idx].compareData[5]);
7692
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007693 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007694 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007695 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007696 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07007697 pRequestBuf->paramsData[idx].dataMask[2],
7698 pRequestBuf->paramsData[idx].dataMask[3],
7699 pRequestBuf->paramsData[idx].dataMask[4],
7700 pRequestBuf->paramsData[idx].dataMask[5]);
7701
7702 }
7703
7704 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7705 {
7706 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007707 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007708 vos_mem_free(pRequestBuf);
7709 return eHAL_STATUS_FAILURE;
7710 }
7711
7712 return eHAL_STATUS_SUCCESS;
7713}
7714
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007715eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007716 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007717 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007718 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007719{
7720 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7721 eHalStatus status;
7722
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007723 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007724
7725 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
7726 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007727 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007728 sme_ReleaseGlobalLock( &pMac->sme );
7729 }
7730
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007731 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007732
7733 return (status);
7734}
7735
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007736eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07007737 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007738{
7739 tpSirRcvFltPktClearParam pRequestBuf;
7740 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007741 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7742 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007743
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007744 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007745 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007746
Jeff Johnson295189b2012-06-20 16:38:30 -07007747 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007748 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007749 {
7750 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
7751 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007752 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007753 return eHAL_STATUS_FAILED_ALLOC;
7754 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007755 if( NULL == pSession )
7756 {
7757 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007758 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007759 vos_mem_free(pRequestBuf);
7760 return eHAL_STATUS_FAILURE;
7761 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007762
Kiet Lam64c1b492013-07-12 13:56:44 +05307763 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
7764 sizeof(tSirMacAddr));
7765 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
7766 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007767
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007768 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
7769
Jeff Johnson295189b2012-06-20 16:38:30 -07007770 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
7771 msg.reserved = 0;
7772 msg.bodyptr = pRequestBuf;
7773 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7774 {
7775 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007776 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007777 vos_mem_free(pRequestBuf);
7778 return eHAL_STATUS_FAILURE;
7779 }
7780
7781 return eHAL_STATUS_SUCCESS;
7782}
7783#endif // WLAN_FEATURE_PACKET_FILTERING
7784
7785/* ---------------------------------------------------------------------------
7786 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007787 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07007788 channel switch.
7789 \param callbackContext
7790 \param status
7791 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007792void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07007793 eHalStatus status)
7794{
7795 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
7796 tSirMbMsg *pMsg;
7797 tANI_U16 msgLen;
7798
7799 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05307800 pMsg = vos_mem_malloc(msgLen);
7801 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07007802 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307803 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007804 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
7805 pMsg->msgLen = pal_cpu_to_be16(msgLen);
7806 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007807 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007808
7809 return;
7810}
7811
7812/* ---------------------------------------------------------------------------
7813 \fn sme_HandlePreChannelSwitchInd
7814 \brief Processes the indcation from PE for pre-channel switch.
7815 \param hHal
7816 \- The handle returned by macOpen. return eHalStatus
7817 ---------------------------------------------------------------------------*/
7818eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
7819{
7820 eHalStatus status = eHAL_STATUS_FAILURE;
7821 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7822 status = sme_AcquireGlobalLock( &pMac->sme );
7823 if ( HAL_STATUS_SUCCESS( status ) )
7824 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007825 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
7826 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07007827 sme_ReleaseGlobalLock( &pMac->sme );
7828 }
7829
7830 return (status);
7831}
7832
7833/* ---------------------------------------------------------------------------
7834 \fn sme_HandlePostChannelSwitchInd
7835 \brief Processes the indcation from PE for post-channel switch.
7836 \param hHal
7837 \- The handle returned by macOpen. return eHalStatus
7838 ---------------------------------------------------------------------------*/
7839eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
7840{
7841 eHalStatus status = eHAL_STATUS_FAILURE;
7842 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7843
7844 status = sme_AcquireGlobalLock( &pMac->sme );
7845 if ( HAL_STATUS_SUCCESS( status ) )
7846 {
7847 status = pmcRequestBmps(hHal, NULL, NULL);
7848 sme_ReleaseGlobalLock( &pMac->sme );
7849 }
7850
7851 return (status);
7852}
7853
7854/* ---------------------------------------------------------------------------
7855
7856 \fn sme_IsChannelValid
7857
7858 \brief To check if the channel is valid for currently established domain
7859 This is a synchronous API.
7860
7861 \param hHal - The handle returned by macOpen.
7862 \param channel - channel to verify
7863
7864 \return TRUE/FALSE, TRUE if channel is valid
7865
7866 -------------------------------------------------------------------------------*/
7867tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
7868{
7869 eHalStatus status = eHAL_STATUS_FAILURE;
7870 tANI_BOOLEAN valid = FALSE;
7871 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007872
Jeff Johnson295189b2012-06-20 16:38:30 -07007873 status = sme_AcquireGlobalLock( &pMac->sme );
7874 if ( HAL_STATUS_SUCCESS( status ) )
7875 {
7876
7877 valid = csrRoamIsChannelValid( pMac, channel);
7878
7879 sme_ReleaseGlobalLock( &pMac->sme );
7880 }
7881
7882 return (valid);
7883}
7884
7885/* ---------------------------------------------------------------------------
7886 \fn sme_SetFreqBand
7887 \brief Used to set frequency band.
7888 \param hHal
7889 \eBand band value to be configured
7890 \- return eHalStatus
7891 -------------------------------------------------------------------------*/
7892eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
7893{
7894 eHalStatus status = eHAL_STATUS_FAILURE;
7895 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7896
7897 status = sme_AcquireGlobalLock( &pMac->sme );
7898 if ( HAL_STATUS_SUCCESS( status ) )
7899 {
7900 status = csrSetBand(hHal, eBand);
7901 sme_ReleaseGlobalLock( &pMac->sme );
7902 }
7903 return status;
7904}
7905
7906/* ---------------------------------------------------------------------------
7907 \fn sme_GetFreqBand
7908 \brief Used to get the current band settings.
7909 \param hHal
7910 \pBand pointer to hold band value
7911 \- return eHalStatus
7912 -------------------------------------------------------------------------*/
7913eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
7914{
7915 eHalStatus status = eHAL_STATUS_FAILURE;
7916 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7917
7918 status = sme_AcquireGlobalLock( &pMac->sme );
7919 if ( HAL_STATUS_SUCCESS( status ) )
7920 {
7921 *pBand = csrGetCurrentBand( hHal );
7922 sme_ReleaseGlobalLock( &pMac->sme );
7923 }
7924 return status;
7925}
7926
7927#ifdef WLAN_WAKEUP_EVENTS
7928/******************************************************************************
7929 \fn sme_WakeReasonIndCallback
7930
7931 \brief
7932 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
7933
7934 \param hHal - HAL handle for device
7935 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
7936
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007937 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007938******************************************************************************/
7939eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
7940{
7941 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7942 eHalStatus status = eHAL_STATUS_SUCCESS;
7943 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
7944
7945 if (NULL == pMsg)
7946 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007947 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007948 status = eHAL_STATUS_FAILURE;
7949 }
7950 else
7951 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007952 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07007953
7954 /* Call Wake Reason Indication callback routine. */
7955 if (pMac->pmc.wakeReasonIndCB != NULL)
7956 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007957
Jeff Johnson295189b2012-06-20 16:38:30 -07007958 pMac->pmc.wakeReasonIndCB = NULL;
7959 pMac->pmc.wakeReasonIndCBContext = NULL;
7960
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007961 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07007962 }
7963
7964 return(status);
7965}
7966#endif // WLAN_WAKEUP_EVENTS
7967
7968
7969/* ---------------------------------------------------------------------------
7970
7971 \fn sme_SetMaxTxPower
7972
7973 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
7974 not persist over reboots.
7975
7976 \param hHal
7977 \param pBssid BSSID to set the power cap for
7978 \param pBssid pSelfMacAddress self MAC Address
7979 \param pBssid power to set in dB
7980 \- return eHalStatus
7981
7982 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007983eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07007984 tSirMacAddr pSelfMacAddress, v_S7_t dB)
7985{
7986 vos_msg_t msg;
7987 tpMaxTxPowerParams pMaxTxParams = NULL;
Katya Nigambcb705f2013-12-26 14:26:22 +05307988 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007989 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007990 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
7991 if (NULL == pMaxTxParams)
7992 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007993 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 -07007994 return eHAL_STATUS_FAILURE;
7995 }
7996
7997 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05307998 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07007999 SIR_MAC_ADDR_LENGTH);
8000 pMaxTxParams->power = dB;
8001
8002 msg.type = WDA_SET_MAX_TX_POWER_REQ;
8003 msg.reserved = 0;
8004 msg.bodyptr = pMaxTxParams;
8005
8006 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8007 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008008 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 -07008009 vos_mem_free(pMaxTxParams);
8010 return eHAL_STATUS_FAILURE;
8011 }
8012
8013 return eHAL_STATUS_SUCCESS;
8014}
8015
Jeff Johnson295189b2012-06-20 16:38:30 -07008016/* ---------------------------------------------------------------------------
8017
Arif Hussaina5ebce02013-08-09 15:09:58 -07008018 \fn sme_SetMaxTxPowerPerBand
8019
8020 \brief Set the Maximum Transmit Power specific to band dynamically.
8021 Note: this setting will not persist over reboots.
8022
8023 \param band
8024 \param power to set in dB
8025 \- return eHalStatus
8026
8027 ----------------------------------------------------------------------------*/
8028eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
8029{
8030 vos_msg_t msg;
8031 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
8032
8033 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
8034 if (NULL == pMaxTxPowerPerBandParams)
8035 {
8036 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8037 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
8038 __func__);
8039 return eHAL_STATUS_FAILURE;
8040 }
8041
8042 pMaxTxPowerPerBandParams->power = dB;
8043 pMaxTxPowerPerBandParams->bandInfo = band;
8044
8045 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
8046 msg.reserved = 0;
8047 msg.bodyptr = pMaxTxPowerPerBandParams;
8048
8049 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8050 {
8051 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8052 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
8053 __func__);
8054 vos_mem_free(pMaxTxPowerPerBandParams);
8055 return eHAL_STATUS_FAILURE;
8056 }
8057
8058 return eHAL_STATUS_SUCCESS;
8059}
8060
8061/* ---------------------------------------------------------------------------
8062
schang86c22c42013-03-13 18:41:24 -07008063 \fn sme_SetTxPower
8064
8065 \brief Set Transmit Power dynamically. Note: this setting will
8066 not persist over reboots.
8067
8068 \param hHal
8069 \param sessionId Target Session ID
8070 \param mW power to set in mW
8071 \- return eHalStatus
8072
8073 -------------------------------------------------------------------------------*/
8074eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
8075{
8076
8077 eHalStatus status = eHAL_STATUS_FAILURE;
8078 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8079
Katya Nigambcb705f2013-12-26 14:26:22 +05308080 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008081 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07008082 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
8083 status = sme_AcquireGlobalLock(&pMac->sme);
8084 if (HAL_STATUS_SUCCESS(status))
8085 {
8086 status = csrSetTxPower(pMac, sessionId, mW);
8087 sme_ReleaseGlobalLock(&pMac->sme);
8088 }
8089 return status;
8090}
8091
8092/* ---------------------------------------------------------------------------
8093
Jeff Johnson295189b2012-06-20 16:38:30 -07008094 \fn sme_HideSSID
8095
8096 \brief hide/show SSID dynamically. Note: this setting will
8097 not persist over reboots.
8098
8099 \param hHal
8100 \param sessionId
8101 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
8102 \- return eHalStatus
8103
8104 -------------------------------------------------------------------------------*/
8105eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
8106{
8107 eHalStatus status = eHAL_STATUS_SUCCESS;
8108 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8109 tANI_U16 len;
8110
8111 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8112 {
8113 tpSirUpdateParams pMsg;
8114 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008115
8116 if(!pSession)
8117 {
8118 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008119 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008120 return eHAL_STATUS_FAILURE;
8121 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008122
8123 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07008124 VOS_ASSERT(0);
8125
8126 /* Create the message and send to lim */
8127 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05308128 pMsg = vos_mem_malloc(len);
8129 if ( NULL == pMsg )
8130 status = eHAL_STATUS_FAILURE;
8131 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008132 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308133 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008134 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
8135 pMsg->length = len;
8136 /* Data starts from here */
8137 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008138 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07008139 status = palSendMBMessage(pMac->hHdd, pMsg);
8140 }
8141 sme_ReleaseGlobalLock( &pMac->sme );
8142 }
8143 return status;
8144}
Jeff Johnson295189b2012-06-20 16:38:30 -07008145
8146/* ---------------------------------------------------------------------------
8147
8148 \fn sme_SetTmLevel
8149 \brief Set Thermal Mitigation Level to RIVA
8150 \param hHal - The handle returned by macOpen.
8151 \param newTMLevel - new Thermal Mitigation Level
8152 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008153 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008154 ---------------------------------------------------------------------------*/
8155eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
8156{
8157 eHalStatus status = eHAL_STATUS_SUCCESS;
8158 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8159 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8160 vos_msg_t vosMessage;
8161 tAniSetTmLevelReq *setTmLevelReq = NULL;
8162
Katya Nigambcb705f2013-12-26 14:26:22 +05308163 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008164 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008165 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8166 {
8167 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05308168 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07008169 {
8170 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008171 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008172 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07008173 return eHAL_STATUS_FAILURE;
8174 }
8175
8176 setTmLevelReq->tmMode = tmMode;
8177 setTmLevelReq->newTmLevel = newTMLevel;
8178
8179 /* serialize the req through MC thread */
8180 vosMessage.bodyptr = setTmLevelReq;
8181 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
8182 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8183 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8184 {
8185 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008186 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008187 vos_mem_free(setTmLevelReq);
8188 status = eHAL_STATUS_FAILURE;
8189 }
8190 sme_ReleaseGlobalLock( &pMac->sme );
8191 }
8192 return(status);
8193}
8194
8195/*---------------------------------------------------------------------------
8196
8197 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
8198 Host and FW.
8199
8200 \param hHal - HAL handle for device
8201
8202 \return NONE
8203
8204---------------------------------------------------------------------------*/
8205void sme_featureCapsExchange( tHalHandle hHal)
8206{
8207 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05308208 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008209 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008210 WDA_featureCapsExchange(vosContext);
8211}
Jeff Johnsond13512a2012-07-17 11:42:19 -07008212
Yathish9f22e662012-12-10 14:21:35 -08008213/*---------------------------------------------------------------------------
8214
8215 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
8216 in Host.
8217
8218 \param hHal - HAL handle for device
8219
8220 \return NONE
8221
8222---------------------------------------------------------------------------*/
8223void sme_disableFeatureCapablity(tANI_U8 feature_index)
8224{
8225 WDA_disableCapablityFeature(feature_index);
8226}
8227
Jeff Johnsond13512a2012-07-17 11:42:19 -07008228/* ---------------------------------------------------------------------------
8229
8230 \fn sme_GetDefaultCountryCode
8231
8232 \brief Get the default country code from NV
8233
8234 \param hHal
8235 \param pCountry
8236 \- return eHalStatus
8237
8238 -------------------------------------------------------------------------------*/
8239eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
8240{
8241 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308242 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008243 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008244 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
8245}
8246
8247/* ---------------------------------------------------------------------------
8248
8249 \fn sme_GetCurrentCountryCode
8250
8251 \brief Get the current country code
8252
8253 \param hHal
8254 \param pCountry
8255 \- return eHalStatus
8256
8257 -------------------------------------------------------------------------------*/
8258eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
8259{
8260 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308261 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008262 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008263 return csrGetCurrentCountryCode(pMac, pCountry);
8264}
8265
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008266/* ---------------------------------------------------------------------------
8267 \fn sme_transportDebug
8268 \brief Dynamically monitoring Transport channels
8269 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07008270 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08008271 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008272 \param toggleStallDetect Enable stall detect feature
8273 This feature will take effect to data performance
8274 Not integrate till fully verification
8275 \- return NONE
8276 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07008277void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008278{
schang6295e542013-03-12 15:31:23 -07008279 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8280
8281 if (NULL == pMac)
8282 {
8283 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8284 "%s: invalid context", __func__);
8285 return;
8286 }
8287 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07008288}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008289
Kiran4a17ebe2013-01-31 10:43:43 -08008290/* ---------------------------------------------------------------------------
8291 \fn sme_ResetPowerValuesFor5G
8292 \brief Reset the power values for 5G band with NV power values.
8293 \param hHal - HAL handle for device
8294 \- return NONE
8295 -------------------------------------------------------------------------*/
8296void sme_ResetPowerValuesFor5G (tHalHandle hHal)
8297{
8298 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +05308299 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008300 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08008301 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
8302 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
8303}
8304
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008305#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
8306/* ---------------------------------------------------------------------------
8307 \fn sme_UpdateRoamPrefer5GHz
8308 \brief enable/disable Roam prefer 5G runtime option
8309 This function is called through dynamic setConfig callback function
8310 to configure the Roam prefer 5G runtime option
8311 \param hHal - HAL handle for device
8312 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
8313 \- return Success or failure
8314 -------------------------------------------------------------------------*/
8315
8316eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
8317{
8318 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008319 eHalStatus status = eHAL_STATUS_SUCCESS;
8320
Katya Nigambcb705f2013-12-26 14:26:22 +05308321 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008322 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008323 status = sme_AcquireGlobalLock( &pMac->sme );
8324 if ( HAL_STATUS_SUCCESS( status ) )
8325 {
8326 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8327 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
8328 pMac->roam.configParam.nRoamPrefer5GHz,
8329 nRoamPrefer5GHz);
8330 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
8331 sme_ReleaseGlobalLock( &pMac->sme );
8332 }
8333
8334 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008335}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008336
8337/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008338 \fn sme_setRoamIntraBand
8339 \brief enable/disable Intra band roaming
8340 This function is called through dynamic setConfig callback function
8341 to configure the intra band roaming
8342 \param hHal - HAL handle for device
8343 \param nRoamIntraBand Enable/Disable Intra band roaming
8344 \- return Success or failure
8345 -------------------------------------------------------------------------*/
8346eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
8347{
8348 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8349 eHalStatus status = eHAL_STATUS_SUCCESS;
8350
Katya Nigambcb705f2013-12-26 14:26:22 +05308351 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008352 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008353 status = sme_AcquireGlobalLock( &pMac->sme );
8354 if ( HAL_STATUS_SUCCESS( status ) )
8355 {
8356 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8357 "%s: gRoamIntraBand is changed from %d to %d", __func__,
8358 pMac->roam.configParam.nRoamIntraBand,
8359 nRoamIntraBand);
8360 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
8361 sme_ReleaseGlobalLock( &pMac->sme );
8362 }
8363
8364 return status ;
8365}
8366
8367/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008368 \fn sme_UpdateRoamScanNProbes
8369 \brief function to update roam scan N probes
8370 This function is called through dynamic setConfig callback function
8371 to update roam scan N probes
8372 \param hHal - HAL handle for device
8373 \param nProbes number of probe requests to be sent out
8374 \- return Success or failure
8375 -------------------------------------------------------------------------*/
8376eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
8377{
8378 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8379 eHalStatus status = eHAL_STATUS_SUCCESS;
8380
8381 status = sme_AcquireGlobalLock( &pMac->sme );
8382 if ( HAL_STATUS_SUCCESS( status ) )
8383 {
8384 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8385 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
8386 pMac->roam.configParam.nProbes,
8387 nProbes);
8388 pMac->roam.configParam.nProbes = nProbes;
8389 sme_ReleaseGlobalLock( &pMac->sme );
8390 }
8391#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8392 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8393 {
8394 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8395 REASON_NPROBES_CHANGED);
8396 }
8397#endif
8398 return status ;
8399}
8400
8401/* ---------------------------------------------------------------------------
8402 \fn sme_UpdateRoamScanHomeAwayTime
8403 \brief function to update roam scan Home away time
8404 This function is called through dynamic setConfig callback function
8405 to update roam scan home away time
8406 \param hHal - HAL handle for device
8407 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008408 \param bSendOffloadCmd If TRUE then send offload command to firmware
8409 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008410 \- return Success or failure
8411 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008412eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
8413 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008414{
8415 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8416 eHalStatus status = eHAL_STATUS_SUCCESS;
8417
8418 status = sme_AcquireGlobalLock( &pMac->sme );
8419 if ( HAL_STATUS_SUCCESS( status ) )
8420 {
8421 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8422 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
8423 pMac->roam.configParam.nRoamScanHomeAwayTime,
8424 nRoamScanHomeAwayTime);
8425 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
8426 sme_ReleaseGlobalLock( &pMac->sme );
8427 }
8428
8429#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008430 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008431 {
8432 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8433 REASON_HOME_AWAY_TIME_CHANGED);
8434 }
8435#endif
8436 return status;
8437}
8438
8439
8440/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008441 \fn sme_getRoamIntraBand
8442 \brief get Intra band roaming
8443 \param hHal - HAL handle for device
8444 \- return Success or failure
8445 -------------------------------------------------------------------------*/
8446v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
8447{
8448 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308449 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008450 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008451 return pMac->roam.configParam.nRoamIntraBand;
8452}
8453
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008454/* ---------------------------------------------------------------------------
8455 \fn sme_getRoamScanNProbes
8456 \brief get N Probes
8457 \param hHal - HAL handle for device
8458 \- return Success or failure
8459 -------------------------------------------------------------------------*/
8460v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
8461{
8462 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8463 return pMac->roam.configParam.nProbes;
8464}
8465
8466/* ---------------------------------------------------------------------------
8467 \fn sme_getRoamScanHomeAwayTime
8468 \brief get Roam scan home away time
8469 \param hHal - HAL handle for device
8470 \- return Success or failure
8471 -------------------------------------------------------------------------*/
8472v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
8473{
8474 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8475 return pMac->roam.configParam.nRoamScanHomeAwayTime;
8476}
8477
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008478
8479/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008480 \fn sme_UpdateImmediateRoamRssiDiff
8481 \brief Update nImmediateRoamRssiDiff
8482 This function is called through dynamic setConfig callback function
8483 to configure nImmediateRoamRssiDiff
8484 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
8485 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008486 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008487 candidate and current AP.
8488 \- return Success or failure
8489 -------------------------------------------------------------------------*/
8490
8491eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
8492{
8493 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008494 eHalStatus status = eHAL_STATUS_SUCCESS;
8495
Katya Nigambcb705f2013-12-26 14:26:22 +05308496 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008497 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008498 status = sme_AcquireGlobalLock( &pMac->sme );
8499 if ( HAL_STATUS_SUCCESS( status ) )
8500 {
8501 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8502 "LFR runtime successfully set immediate roam rssi diff to %d - old value is %d - roam state is %d",
8503 nImmediateRoamRssiDiff,
8504 pMac->roam.configParam.nImmediateRoamRssiDiff,
8505 pMac->roam.neighborRoamInfo.neighborRoamState);
8506 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
8507 sme_ReleaseGlobalLock( &pMac->sme );
8508 }
8509
8510 return status ;
8511}
8512
8513/* ---------------------------------------------------------------------------
8514 \fn sme_UpdateRoamRssiDiff
8515 \brief Update RoamRssiDiff
8516 This function is called through dynamic setConfig callback function
8517 to configure RoamRssiDiff
8518 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
8519 \param hHal - HAL handle for device
8520 \param RoamRssiDiff - minimum rssi difference between potential
8521 candidate and current AP.
8522 \- return Success or failure
8523 -------------------------------------------------------------------------*/
8524
8525eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
8526{
8527 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8528 eHalStatus status = eHAL_STATUS_SUCCESS;
8529
8530 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +05308531 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008532 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008533 if ( HAL_STATUS_SUCCESS( status ) )
8534 {
8535 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8536 "LFR runtime successfully set roam rssi diff to %d - old value is %d - roam state is %d",
8537 RoamRssiDiff,
8538 pMac->roam.configParam.RoamRssiDiff,
8539 pMac->roam.neighborRoamInfo.neighborRoamState);
8540 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
8541 sme_ReleaseGlobalLock( &pMac->sme );
8542 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008543#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8544 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8545 {
8546 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
8547 }
8548#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008549 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008550}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008551
8552/*--------------------------------------------------------------------------
8553 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008554 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008555 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008556 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008557 \param hHal - The handle returned by macOpen.
8558 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
8559 Other status means SME is failed to update isFastTransitionEnabled.
8560 \sa
8561 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008562eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008563 v_BOOL_t isFastTransitionEnabled)
8564{
8565 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008566 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008567
Katya Nigambcb705f2013-12-26 14:26:22 +05308568 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008569 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008570 status = sme_AcquireGlobalLock( &pMac->sme );
8571 if ( HAL_STATUS_SUCCESS( status ) )
8572 {
8573 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8574 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
8575 pMac->roam.configParam.isFastTransitionEnabled,
8576 isFastTransitionEnabled);
8577 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
8578 sme_ReleaseGlobalLock( &pMac->sme );
8579 }
8580
8581 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008582}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008583
8584/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008585 \fn sme_UpdateWESMode
8586 \brief Update WES Mode
8587 This function is called through dynamic setConfig callback function
8588 to configure isWESModeEnabled
8589 \param hHal - HAL handle for device
8590 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
8591 Other status means SME is failed to update isWESModeEnabled.
8592 -------------------------------------------------------------------------*/
8593
8594eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
8595{
8596 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8597 eHalStatus status = eHAL_STATUS_SUCCESS;
8598
8599 status = sme_AcquireGlobalLock( &pMac->sme );
8600 if ( HAL_STATUS_SUCCESS( status ) )
8601 {
8602 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8603 "LFR runtime successfully set WES Mode to %d - old value is %d - roam state is %d",
8604 isWESModeEnabled,
8605 pMac->roam.configParam.isWESModeEnabled,
8606 pMac->roam.neighborRoamInfo.neighborRoamState);
8607 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
8608 sme_ReleaseGlobalLock( &pMac->sme );
8609 }
8610
8611 return status ;
8612}
8613
8614/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008615 \fn sme_SetRoamScanControl
8616 \brief Set roam scan control
8617 This function is called to set roam scan control
8618 if roam scan control is set to 0, roaming scan cache is cleared
8619 any value other than 0 is treated as invalid value
8620 \param hHal - HAL handle for device
8621 \return eHAL_STATUS_SUCCESS - SME update config successfully.
8622 Other status means SME failure to update
8623 -------------------------------------------------------------------------*/
8624eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
8625{
8626 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8627 eHalStatus status = eHAL_STATUS_SUCCESS;
8628
Katya Nigambcb705f2013-12-26 14:26:22 +05308629 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008630 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008631 status = sme_AcquireGlobalLock( &pMac->sme );
8632 if ( HAL_STATUS_SUCCESS( status ) )
8633 {
8634 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8635 "LFR runtime successfully set roam scan control to %d - old value is %d - roam state is %d",
8636 roamScanControl,
8637 pMac->roam.configParam.nRoamScanControl,
8638 pMac->roam.neighborRoamInfo.neighborRoamState);
8639 pMac->roam.configParam.nRoamScanControl = roamScanControl;
8640 if ( 0 == roamScanControl)
8641 {
8642 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8643 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008644 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008645#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8646 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8647 {
8648 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
8649 }
8650#endif
8651 }
8652 sme_ReleaseGlobalLock( &pMac->sme );
8653 }
8654 return status ;
8655}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008656#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */
8657
8658#ifdef FEATURE_WLAN_LFR
8659/*--------------------------------------------------------------------------
8660 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008661 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008662 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008663 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008664 \param hHal - The handle returned by macOpen.
8665 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
8666 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
8667 \sa
8668 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008669eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008670 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008671{
8672 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8673
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008674 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
8675 {
8676 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8677 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8678 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8679 isFastRoamIniFeatureEnabled);
8680 return eHAL_STATUS_SUCCESS;
8681 }
8682
Srinivas Girigowdade697412013-02-14 16:31:48 -08008683 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8684 "%s: FastRoamEnabled is changed from %d to %d", __func__,
8685 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8686 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008687 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008688 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008689
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008690 return eHAL_STATUS_SUCCESS;
8691}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008692
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08008693/*--------------------------------------------------------------------------
8694 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
8695 Enable/disable LFR MAWC support at runtime
8696 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8697 isMAWCIniFeatureEnabled.
8698 This is a synchronous call
8699 \param hHal - The handle returned by macOpen.
8700 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
8701 Other status means SME is failed to update MAWCEnabled.
8702 \sa
8703 --------------------------------------------------------------------------*/
8704eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
8705 const v_BOOL_t MAWCEnabled)
8706{
8707 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8708 eHalStatus status = eHAL_STATUS_SUCCESS;
8709
8710 status = sme_AcquireGlobalLock( &pMac->sme );
8711 if ( HAL_STATUS_SUCCESS( status ) )
8712 {
8713 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8714 "%s: MAWCEnabled is changed from %d to %d", __func__,
8715 pMac->roam.configParam.MAWCEnabled,
8716 MAWCEnabled);
8717 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
8718 sme_ReleaseGlobalLock( &pMac->sme );
8719 }
8720
8721 return status ;
8722
8723}
8724
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008725#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8726/*--------------------------------------------------------------------------
8727 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
8728 This is a synchronuous call
8729 \param hHal - The handle returned by macOpen.
8730 \return eHAL_STATUS_SUCCESS
8731 Other status means SME is failed
8732 \sa
8733 --------------------------------------------------------------------------*/
8734
8735eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
8736 v_BOOL_t bFastRoamInConIniFeatureEnabled)
8737{
8738
8739 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8740 eHalStatus status = eHAL_STATUS_SUCCESS;
8741
8742 status = sme_AcquireGlobalLock( &pMac->sme );
8743 if ( HAL_STATUS_SUCCESS( status ) )
8744 {
8745 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
8746 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
8747 {
8748 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
8749 }
8750 sme_ReleaseGlobalLock( &pMac->sme );
8751 }
8752
8753 return status;
8754}
8755#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008756#endif /* FEATURE_WLAN_LFR */
8757
8758#ifdef FEATURE_WLAN_CCX
8759/*--------------------------------------------------------------------------
8760 \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime
8761 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8762 isCcxIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008763 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008764 \param hHal - The handle returned by macOpen.
8765 \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully.
8766 Other status means SME is failed to update isCcxIniFeatureEnabled.
8767 \sa
8768 --------------------------------------------------------------------------*/
8769
8770eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008771 const v_BOOL_t isCcxIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008772{
8773 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8774
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008775 if (pMac->roam.configParam.isCcxIniFeatureEnabled == isCcxIniFeatureEnabled)
8776 {
8777 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8778 "%s: CCX Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8779 pMac->roam.configParam.isCcxIniFeatureEnabled,
8780 isCcxIniFeatureEnabled);
8781 return eHAL_STATUS_SUCCESS;
8782 }
8783
Srinivas Girigowdade697412013-02-14 16:31:48 -08008784 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8785 "%s: CcxEnabled is changed from %d to %d", __func__,
8786 pMac->roam.configParam.isCcxIniFeatureEnabled,
8787 isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008788 pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008789 csrNeighborRoamUpdateCcxModeEnabled(pMac, isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008790
8791 if(TRUE == isCcxIniFeatureEnabled)
8792 {
8793 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008794 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07008795
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008796#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8797 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8798 {
8799 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CCX_INI_CFG_CHANGED);
8800 }
8801#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008802 return eHAL_STATUS_SUCCESS;
8803}
8804#endif /* FEATURE_WLAN_CCX */
8805
8806/*--------------------------------------------------------------------------
8807 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
8808 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8809 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008810 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008811 \param hHal - The handle returned by macOpen.
8812 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
8813 Other status means SME is failed to update fEnableFwRssiMonitoring.
8814 \sa
8815 --------------------------------------------------------------------------*/
8816
8817eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
8818 v_BOOL_t fEnableFwRssiMonitoring)
8819{
8820 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
8821
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008822 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
8823 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
8824 {
8825 halStatus = eHAL_STATUS_FAILURE;
8826 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008827 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008828 }
8829
8830 return (halStatus);
8831}
8832
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008833#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08008834/*--------------------------------------------------------------------------
8835 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
8836 This is a synchronous call
8837 \param hHal - The handle returned by macOpen.
8838 \return eHAL_STATUS_SUCCESS - SME update config successful.
8839 Other status means SME is failed to update
8840 \sa
8841 --------------------------------------------------------------------------*/
8842eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
8843 v_U8_t neighborLookupRssiThreshold)
8844{
8845 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8846 eHalStatus status = eHAL_STATUS_SUCCESS;
8847
8848 status = sme_AcquireGlobalLock( &pMac->sme );
8849 if ( HAL_STATUS_SUCCESS( status ) )
8850 {
8851 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
8852 if (HAL_STATUS_SUCCESS(status))
8853 {
8854 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8855 "LFR runtime successfully set Lookup threshold to %d - old value is %d - roam state is %d",
8856 neighborLookupRssiThreshold,
8857 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
8858 pMac->roam.neighborRoamInfo.neighborRoamState);
8859 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
8860 neighborLookupRssiThreshold;
8861 }
8862 sme_ReleaseGlobalLock( &pMac->sme );
8863 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008864 return status;
8865}
8866
8867/*--------------------------------------------------------------------------
8868 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
8869 This is a synchronous call
8870 \param hHal - The handle returned by macOpen.
8871 \return eHAL_STATUS_SUCCESS - SME update config successful.
8872 Other status means SME is failed to update
8873 \sa
8874 --------------------------------------------------------------------------*/
8875eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
8876 v_U8_t neighborReassocRssiThreshold)
8877{
8878 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8879 eHalStatus status = eHAL_STATUS_SUCCESS;
8880
8881 status = sme_AcquireGlobalLock( &pMac->sme );
8882 if ( HAL_STATUS_SUCCESS( status ) )
8883 {
8884 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8885 "LFR runtime successfully set Reassoc threshold to %d - old value is %d - roam state is %d",
8886 neighborReassocRssiThreshold,
8887 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
8888 pMac->roam.neighborRoamInfo.neighborRoamState);
8889 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
8890 neighborReassocRssiThreshold;
8891 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
8892 neighborReassocRssiThreshold;
8893 sme_ReleaseGlobalLock( &pMac->sme );
8894 }
8895
8896 return status ;
8897}
8898
8899
8900/*--------------------------------------------------------------------------
8901 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
8902 This is a synchronous call
8903 \param hHal - The handle returned by macOpen.
8904 \return eHAL_STATUS_SUCCESS - SME update config successful.
8905 Other status means SME is failed to update
8906 \sa
8907 --------------------------------------------------------------------------*/
8908v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
8909{
8910 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8911 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
8912}
8913
8914/*--------------------------------------------------------------------------
8915 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
8916 This is a synchronous call
8917 \param hHal - The handle returned by macOpen.
8918 \return eHAL_STATUS_SUCCESS - SME update config successful.
8919 Other status means SME is failed to update
8920 \sa
8921 --------------------------------------------------------------------------*/
8922eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
8923 v_U16_t neighborScanResultsRefreshPeriod)
8924{
8925 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8926 eHalStatus status = eHAL_STATUS_SUCCESS;
8927
8928 status = sme_AcquireGlobalLock( &pMac->sme );
8929 if ( HAL_STATUS_SUCCESS( status ) )
8930 {
8931 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8932 "LFR runtime successfully set roam scan refresh period to %d - old value is %d - roam state is %d",
8933 neighborScanResultsRefreshPeriod,
8934 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
8935 pMac->roam.neighborRoamInfo.neighborRoamState);
8936 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
8937 neighborScanResultsRefreshPeriod;
8938 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
8939 neighborScanResultsRefreshPeriod;
8940
8941 sme_ReleaseGlobalLock( &pMac->sme );
8942 }
8943
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008944#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8945 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8946 {
8947 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8948 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
8949 }
8950#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008951 return status ;
8952}
8953
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008954#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8955/*--------------------------------------------------------------------------
8956 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
8957 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8958 gRoamScanOffloadEnabled.
8959 This is a synchronous call
8960 \param hHal - The handle returned by macOpen.
8961 \return eHAL_STATUS_SUCCESS - SME update config successfully.
8962 Other status means SME is failed to update.
8963 \sa
8964 --------------------------------------------------------------------------*/
8965
8966eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
8967 v_BOOL_t nRoamScanOffloadEnabled)
8968{
8969 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8970 eHalStatus status = eHAL_STATUS_SUCCESS;
8971
8972 status = sme_AcquireGlobalLock( &pMac->sme );
8973 if ( HAL_STATUS_SUCCESS( status ) )
8974 {
8975 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8976 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
8977 pMac->roam.configParam.isRoamOffloadScanEnabled,
8978 nRoamScanOffloadEnabled);
8979 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
8980 sme_ReleaseGlobalLock( &pMac->sme );
8981 }
8982
8983 return status ;
8984}
8985#endif
8986
Srinivas Girigowdade697412013-02-14 16:31:48 -08008987/*--------------------------------------------------------------------------
8988 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
8989 This is a synchronous call
8990 \param hHal - The handle returned by macOpen.
8991 \return v_U16_t - Neighbor scan results refresh period value
8992 \sa
8993 --------------------------------------------------------------------------*/
8994v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
8995{
8996 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8997 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
8998}
8999
9000/*--------------------------------------------------------------------------
9001 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
9002 This is a synchronuous call
9003 \param hHal - The handle returned by macOpen.
9004 \return eHAL_STATUS_SUCCESS - SME update config successful.
9005 Other status means SME is failed to update
9006 \sa
9007 --------------------------------------------------------------------------*/
9008v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
9009{
9010 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9011 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
9012}
9013
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009014/* ---------------------------------------------------------------------------
9015 \fn sme_UpdateEmptyScanRefreshPeriod
9016 \brief Update nEmptyScanRefreshPeriod
9017 This function is called through dynamic setConfig callback function
9018 to configure nEmptyScanRefreshPeriod
9019 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
9020 \param hHal - HAL handle for device
9021 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
9022 \- return Success or failure
9023 -------------------------------------------------------------------------*/
9024
9025eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
9026{
9027 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9028 eHalStatus status = eHAL_STATUS_SUCCESS;
9029
9030 status = sme_AcquireGlobalLock( &pMac->sme );
9031 if ( HAL_STATUS_SUCCESS( status ) )
9032 {
9033 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9034 "LFR runtime successfully set roam scan period to %d - old value is %d - roam state is %d",
9035 nEmptyScanRefreshPeriod,
9036 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
9037 pMac->roam.neighborRoamInfo.neighborRoamState);
9038 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9039 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9040 sme_ReleaseGlobalLock( &pMac->sme );
9041 }
9042
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009043#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9044 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9045 {
9046 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9047 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
9048 }
9049#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009050 return status ;
9051}
9052
9053/* ---------------------------------------------------------------------------
9054 \fn sme_setNeighborScanMinChanTime
9055 \brief Update nNeighborScanMinChanTime
9056 This function is called through dynamic setConfig callback function
9057 to configure gNeighborScanChannelMinTime
9058 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
9059 \param hHal - HAL handle for device
9060 \param nNeighborScanMinChanTime - Channel minimum dwell time
9061 \- return Success or failure
9062 -------------------------------------------------------------------------*/
9063eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
9064{
9065 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9066 eHalStatus status = eHAL_STATUS_SUCCESS;
9067
9068 status = sme_AcquireGlobalLock( &pMac->sme );
9069 if ( HAL_STATUS_SUCCESS( status ) )
9070 {
9071 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9072 "LFR runtime successfully set channel min dwell time to %d - old value is %d - roam state is %d",
9073 nNeighborScanMinChanTime,
9074 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
9075 pMac->roam.neighborRoamInfo.neighborRoamState);
9076 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
9077 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
9078 sme_ReleaseGlobalLock( &pMac->sme );
9079 }
9080
9081 return status ;
9082}
9083
9084/* ---------------------------------------------------------------------------
9085 \fn sme_setNeighborScanMaxChanTime
9086 \brief Update nNeighborScanMaxChanTime
9087 This function is called through dynamic setConfig callback function
9088 to configure gNeighborScanChannelMaxTime
9089 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
9090 \param hHal - HAL handle for device
9091 \param nNeighborScanMinChanTime - Channel maximum dwell time
9092 \- return Success or failure
9093 -------------------------------------------------------------------------*/
9094eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
9095{
9096 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9097 eHalStatus status = eHAL_STATUS_SUCCESS;
9098
9099 status = sme_AcquireGlobalLock( &pMac->sme );
9100 if ( HAL_STATUS_SUCCESS( status ) )
9101 {
9102 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9103 "LFR runtime successfully set channel max dwell time to %d - old value is %d - roam state is %d",
9104 nNeighborScanMaxChanTime,
9105 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
9106 pMac->roam.neighborRoamInfo.neighborRoamState);
9107 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
9108 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
9109 sme_ReleaseGlobalLock( &pMac->sme );
9110 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009111#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9112 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9113 {
9114 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9115 REASON_SCAN_CH_TIME_CHANGED);
9116 }
9117#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009118
9119 return status ;
9120}
9121
9122/* ---------------------------------------------------------------------------
9123 \fn sme_getNeighborScanMinChanTime
9124 \brief get neighbor scan min channel time
9125 \param hHal - The handle returned by macOpen.
9126 \return v_U16_t - channel min time value
9127 -------------------------------------------------------------------------*/
9128v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
9129{
9130 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9131 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
9132}
9133
9134/* ---------------------------------------------------------------------------
9135 \fn sme_getNeighborScanMaxChanTime
9136 \brief get neighbor scan max channel time
9137 \param hHal - The handle returned by macOpen.
9138 \return v_U16_t - channel max time value
9139 -------------------------------------------------------------------------*/
9140v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
9141{
9142 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9143 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
9144}
9145
9146/* ---------------------------------------------------------------------------
9147 \fn sme_setNeighborScanPeriod
9148 \brief Update nNeighborScanPeriod
9149 This function is called through dynamic setConfig callback function
9150 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009151 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009152 \param hHal - HAL handle for device
9153 \param nNeighborScanPeriod - neighbor scan period
9154 \- return Success or failure
9155 -------------------------------------------------------------------------*/
9156eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
9157{
9158 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9159 eHalStatus status = eHAL_STATUS_SUCCESS;
9160
9161 status = sme_AcquireGlobalLock( &pMac->sme );
9162 if ( HAL_STATUS_SUCCESS( status ) )
9163 {
9164 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9165 "LFR runtime successfully set neighbor scan period to %d - old value is %d - roam state is %d",
9166 nNeighborScanPeriod,
9167 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
9168 pMac->roam.neighborRoamInfo.neighborRoamState);
9169 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
9170 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
9171 sme_ReleaseGlobalLock( &pMac->sme );
9172 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009173#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9174 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9175 {
9176 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9177 REASON_SCAN_HOME_TIME_CHANGED);
9178 }
9179#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009180
9181 return status ;
9182}
9183
9184/* ---------------------------------------------------------------------------
9185 \fn sme_getNeighborScanPeriod
9186 \brief get neighbor scan period
9187 \param hHal - The handle returned by macOpen.
9188 \return v_U16_t - neighbor scan period
9189 -------------------------------------------------------------------------*/
9190v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
9191{
9192 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9193 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
9194}
9195
9196#endif
9197
Srinivas Girigowdade697412013-02-14 16:31:48 -08009198#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009199
Srinivas Girigowdade697412013-02-14 16:31:48 -08009200/*--------------------------------------------------------------------------
9201 \brief sme_getRoamRssiDiff() - get Roam rssi diff
9202 This is a synchronous call
9203 \param hHal - The handle returned by macOpen.
9204 \return v_U16_t - Rssi diff value
9205 \sa
9206 --------------------------------------------------------------------------*/
9207v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
9208{
9209 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9210 return pMac->roam.configParam.RoamRssiDiff;
9211}
9212
9213/*--------------------------------------------------------------------------
9214 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
9215 This is a synchronous call
9216 \param hHal - The handle returned by macOpen.
9217 \return eHAL_STATUS_SUCCESS - SME update config successful.
9218 Other status means SME is failed to update
9219 \sa
9220 --------------------------------------------------------------------------*/
9221eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9222 tANI_U8 numChannels)
9223{
9224 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9225 eHalStatus status = eHAL_STATUS_SUCCESS;
9226 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009227 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +05309228 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08009229 tANI_U8 i = 0, j = 0;
9230
9231 status = sme_AcquireGlobalLock( &pMac->sme );
9232 if ( HAL_STATUS_SUCCESS( status ) )
9233 {
9234 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9235 {
9236 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
9237 {
9238 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9239 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9240 }
9241 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009242 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009243 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009244 sme_SetRoamScanControl(hHal, 1);
9245 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009246 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009247 j = 0;
9248 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009249 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009250 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9251 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
Srinivas Girigowdade697412013-02-14 16:31:48 -08009252 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009253 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009254
9255 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9256 "LFR runtime successfully set roam scan channels to %s - old value is %s - roam state is %d",
9257 newChannelList, oldChannelList,
9258 pMac->roam.neighborRoamInfo.neighborRoamState);
Srinivas Girigowdade697412013-02-14 16:31:48 -08009259 sme_ReleaseGlobalLock( &pMac->sme );
9260 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009261#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9262 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9263 {
9264 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9265 }
9266#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009267
9268 return status ;
9269}
9270
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009271
9272#ifdef FEATURE_WLAN_CCX_UPLOAD
9273/*--------------------------------------------------------------------------
9274 \brief sme_SetCcxRoamScanChannelList() - set ccx roam scan channel list
9275 This is a synchronuous call
9276 \param hHal - The handle returned by macOpen.
9277 \return eHAL_STATUS_SUCCESS - SME update config successful.
9278 Other status means SME is failed to update
9279 \sa
9280 --------------------------------------------------------------------------*/
9281eHalStatus sme_SetCcxRoamScanChannelList(tHalHandle hHal,
9282 tANI_U8 *pChannelList,
9283 tANI_U8 numChannels)
9284{
9285 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9286 eHalStatus status = eHAL_STATUS_SUCCESS;
9287 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9288 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
9289 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
9290 tANI_U8 newChannelList[128] = {0};
9291 tANI_U8 i = 0, j = 0;
9292
9293 status = sme_AcquireGlobalLock( &pMac->sme );
9294 if ( HAL_STATUS_SUCCESS( status ) )
9295 {
9296 if (NULL != currChannelListInfo->ChannelList)
9297 {
9298 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9299 {
9300 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9301 currChannelListInfo->ChannelList[i]);
9302 }
9303 }
9304 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
9305
9306 if ( HAL_STATUS_SUCCESS( status ))
9307 {
9308 if (NULL != currChannelListInfo->ChannelList)
9309 {
9310 j = 0;
9311 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9312 {
9313 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9314 currChannelListInfo->ChannelList[i]);
9315 }
9316 }
9317
9318 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9319 "CCX roam scan channel list successfully set to %s - old value is %s - roam state is %d",
9320 newChannelList, oldChannelList,
9321 pMac->roam.neighborRoamInfo.neighborRoamState);
9322 }
9323 sme_ReleaseGlobalLock( &pMac->sme );
9324 }
9325#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9326 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9327 {
9328 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9329 }
9330#endif
9331
9332 return status ;
9333}
9334#endif
9335
Srinivas Girigowdade697412013-02-14 16:31:48 -08009336/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -08009337 \brief sme_getRoamScanChannelList() - get roam scan channel list
9338 This is a synchronous call
9339 \param hHal - The handle returned by macOpen.
9340 \return eHAL_STATUS_SUCCESS - SME update config successful.
9341 Other status means SME is failed to update
9342 \sa
9343 --------------------------------------------------------------------------*/
9344eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9345 tANI_U8 *pNumChannels)
9346{
9347 int i = 0;
9348 tANI_U8 *pOutPtr = pChannelList;
9349 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9350 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9351 eHalStatus status = eHAL_STATUS_SUCCESS;
9352
9353 status = sme_AcquireGlobalLock( &pMac->sme );
9354 if ( HAL_STATUS_SUCCESS( status ) )
9355 {
9356 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9357 {
9358 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
9359 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009360 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009361 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009362 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009363 }
9364
9365 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
9366 for (i = 0; i < (*pNumChannels); i++)
9367 {
9368 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
9369 }
9370 pOutPtr[i] = '\0';
9371 sme_ReleaseGlobalLock( &pMac->sme );
9372 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009373 return status ;
9374}
9375
9376/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009377 \brief sme_getIsCcxFeatureEnabled() - get CCX feature enabled or not
9378 This is a synchronuous call
9379 \param hHal - The handle returned by macOpen.
9380 \return TRUE (1) - if the CCX feature is enabled
9381 FALSE (0) - if feature is disabled (compile or runtime)
9382 \sa
9383 --------------------------------------------------------------------------*/
9384tANI_BOOLEAN sme_getIsCcxFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009385{
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009386#ifdef FEATURE_WLAN_CCX
Srinivas Girigowdade697412013-02-14 16:31:48 -08009387 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009388 return csrRoamIsCcxIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009389#else
9390 return eANI_BOOLEAN_FALSE;
9391#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009392}
9393
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009394/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009395 \brief sme_GetWESMode() - get WES Mode
9396 This is a synchronous call
9397 \param hHal - The handle returned by macOpen
9398 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
9399 \sa
9400 --------------------------------------------------------------------------*/
9401v_BOOL_t sme_GetWESMode(tHalHandle hHal)
9402{
9403 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9404 return pMac->roam.configParam.isWESModeEnabled;
9405}
9406
9407/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009408 \brief sme_GetRoamScanControl() - get scan control
9409 This is a synchronous call
9410 \param hHal - The handle returned by macOpen.
9411 \return v_BOOL_t - Enabled(1)/Disabled(0)
9412 \sa
9413 --------------------------------------------------------------------------*/
9414v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
9415{
9416 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9417 return pMac->roam.configParam.nRoamScanControl;
9418}
9419#endif
9420
9421/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009422 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
9423 This is a synchronuous call
9424 \param hHal - The handle returned by macOpen.
9425 \return TRUE (1) - if the feature is enabled
9426 FALSE (0) - if feature is disabled (compile or runtime)
9427 \sa
9428 --------------------------------------------------------------------------*/
9429tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
9430{
9431#ifdef FEATURE_WLAN_LFR
9432 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9433 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
9434#else
9435 return eANI_BOOLEAN_FALSE;
9436#endif
9437}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009438
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009439/*--------------------------------------------------------------------------
9440 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
9441 This is a synchronuous call
9442 \param hHal - The handle returned by macOpen.
9443 \return TRUE (1) - if the feature is enabled
9444 FALSE (0) - if feature is disabled (compile or runtime)
9445 \sa
9446 --------------------------------------------------------------------------*/
9447tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
9448{
9449#ifdef WLAN_FEATURE_VOWIFI_11R
9450 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9451 return pMac->roam.configParam.isFastTransitionEnabled;
9452#else
9453 return eANI_BOOLEAN_FALSE;
9454#endif
9455}
9456
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009457/* ---------------------------------------------------------------------------
9458 \fn sme_IsFeatureSupportedByFW
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009459
Kiet Lam0f320422013-11-21 19:29:17 +05309460 \brief Check if a feature is enabled by FW
9461
9462 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009463
Kiet Lam0f320422013-11-21 19:29:17 +05309464 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009465 -------------------------------------------------------------------------*/
9466tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
9467{
9468 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
9469}
Kiet Lam0f320422013-11-21 19:29:17 +05309470
9471/* ---------------------------------------------------------------------------
9472 \fn sme_IsFeatureSupportedByDriver
9473 \brief Check if a feature is enabled by Driver
9474
9475 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
9476 \- return 1/0 (TRUE/FALSE)
9477 -------------------------------------------------------------------------*/
9478
9479tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
9480{
9481 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
9482}
9483
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009484#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05309485
9486/* ---------------------------------------------------------------------------
9487 \fn sme_SendTdlsMgmtFrame
9488 \brief API to send TDLS management frames.
9489
9490 \param peerMac - peer's Mac Adress.
9491 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
9492 \- return VOS_STATUS_SUCCES
9493 -------------------------------------------------------------------------*/
9494VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
9495 tANI_U8 sessionId,
9496 tSirMacAddr peerMac,
9497 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
9498{
9499 eHalStatus status = eHAL_STATUS_SUCCESS;
9500 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9501
9502 status = sme_AcquireGlobalLock( &pMac->sme );
9503
9504 if ( HAL_STATUS_SUCCESS( status ) )
9505 {
9506 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
9507 sme_ReleaseGlobalLock( &pMac->sme );
9508 }
9509 return status ;
9510}
9511
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009512/* ---------------------------------------------------------------------------
9513 \fn sme_SendTdlsMgmtFrame
9514 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009515
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009516 \param peerMac - peer's Mac Adress.
9517 \param frame_type - Type of TDLS mgmt frame to be sent.
9518 \param dialog - dialog token used in the frame.
9519 \param status - status to be incuded in the frame.
9520 \param buf - additional IEs to be included
9521 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08009522 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009523 \- return VOS_STATUS_SUCCES
9524 -------------------------------------------------------------------------*/
9525VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Hoonki Leea34dd892013-02-05 22:56:02 -08009526 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 -08009527{
9528 eHalStatus status = eHAL_STATUS_SUCCESS;
9529 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
9530 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9531
9532 status = sme_AcquireGlobalLock( &pMac->sme );
9533 if ( HAL_STATUS_SUCCESS( status ) )
9534 {
9535 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9536 sendTdlsReq.frameType = frame_type;
9537 sendTdlsReq.buf = buf;
9538 sendTdlsReq.len = len;
9539 sendTdlsReq.dialog = dialog;
9540 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08009541 sendTdlsReq.responder = responder;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009542
9543 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
9544
9545 sme_ReleaseGlobalLock( &pMac->sme );
9546 }
9547
9548 return status ;
9549
9550}
9551/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08009552 \fn sme_ChangeTdlsPeerSta
9553 \brief API to Update TDLS peer sta parameters.
9554
9555 \param peerMac - peer's Mac Adress.
9556 \param staParams - Peer Station Parameters
9557 \- return VOS_STATUS_SUCCES
9558 -------------------------------------------------------------------------*/
9559VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
9560 tCsrStaParams *pstaParams)
9561{
9562 eHalStatus status = eHAL_STATUS_SUCCESS;
9563 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9564
9565 status = sme_AcquireGlobalLock( &pMac->sme );
9566 if ( HAL_STATUS_SUCCESS( status ) )
9567 {
9568 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
9569
9570 sme_ReleaseGlobalLock( &pMac->sme );
9571 }
9572
9573 return status ;
9574
9575}
9576
9577/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009578 \fn sme_AddTdlsPeerSta
9579 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009580
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009581 \param peerMac - peer's Mac Adress.
9582 \- return VOS_STATUS_SUCCES
9583 -------------------------------------------------------------------------*/
9584VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9585{
9586 eHalStatus status = eHAL_STATUS_SUCCESS;
9587 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9588
9589 status = sme_AcquireGlobalLock( &pMac->sme );
9590 if ( HAL_STATUS_SUCCESS( status ) )
9591 {
9592 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
9593
9594 sme_ReleaseGlobalLock( &pMac->sme );
9595 }
9596
9597 return status ;
9598
9599}
9600/* ---------------------------------------------------------------------------
9601 \fn sme_DeleteTdlsPeerSta
9602 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009603
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009604 \param peerMac - peer's Mac Adress.
9605 \- return VOS_STATUS_SUCCES
9606 -------------------------------------------------------------------------*/
9607VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9608{
9609 eHalStatus status = eHAL_STATUS_SUCCESS;
9610 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9611
9612 status = sme_AcquireGlobalLock( &pMac->sme );
9613 if ( HAL_STATUS_SUCCESS( status ) )
9614 {
9615 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
9616
9617 sme_ReleaseGlobalLock( &pMac->sme );
9618 }
9619
9620 return status ;
9621
9622}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07009623/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07009624 \fn sme_SetTdlsPowerSaveProhibited
9625 \API to set/reset the isTdlsPowerSaveProhibited.
9626
9627 \- return void
9628 -------------------------------------------------------------------------*/
9629void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
9630{
9631 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9632
9633 pMac->isTdlsPowerSaveProhibited = val;
9634 return;
9635}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009636#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +05309637/* ---------------------------------------------------------------------------
9638 \fn sme_IsPmcBmps
9639 \API to Check if PMC state is BMPS.
9640
9641 \- return v_BOOL_t
9642 -------------------------------------------------------------------------*/
9643v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
9644{
9645 return (BMPS == pmcGetPmcState(hHal));
9646}
9647
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009648#ifdef FEATURE_WLAN_TDLS_INTERNAL
9649/*
9650 * SME API to start TDLS discovery Procedure
9651 */
9652VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9653{
9654 VOS_STATUS status = VOS_STATUS_SUCCESS;
9655 tCsrTdlsDisRequest disReq = {{0}} ;
9656 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9657 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
9658
9659 return status ;
9660
9661}
9662
9663/*
9664 * Process TDLS discovery results
9665 */
9666v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
9667 tSmeTdlsDisResult *disResult, v_U8_t listType)
9668{
9669 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
9670 tSirTdlsPeerInfo *peerInfo = NULL ;
9671 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9672 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
9673 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
9674 tListElem *pEntry = NULL ;
9675 v_U8_t peerCnt = 0 ;
9676
9677 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009678 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009679 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
9680 while(pEntry)
9681 {
9682 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
9683 tdlsPeerStaLink) ;
9684 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
9685
9686 switch(listType)
9687 {
9688 case TDLS_SETUP_LIST:
9689 {
9690 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
9691 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309692 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9693 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009694 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9695 peerCnt++ ;
9696 }
9697 break ;
9698 }
9699 case TDLS_DIS_LIST:
9700 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309701 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9702 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009703 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9704 peerCnt++ ;
9705 break ;
9706 }
9707 default:
9708 {
9709 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009710 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009711 break ;
9712 }
9713 }
9714
9715 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
9716 }
9717
9718 return peerCnt ;
9719
9720}
9721
9722/*
9723 * SME API to start TDLS link setup Procedure.
9724 */
9725VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9726{
9727 VOS_STATUS status = VOS_STATUS_SUCCESS;
9728 tCsrTdlsSetupRequest setupReq = {{0}} ;
9729 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9730 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
9731 return status ;
9732
9733}
9734
9735/*
9736 * SME API to start TDLS link Teardown Procedure.
9737 */
9738VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9739{
9740 VOS_STATUS status = VOS_STATUS_SUCCESS;
9741 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
9742 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9743 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
9744 return status ;
9745
9746}
9747
9748#endif /* FEATURE_WLAN_TDLS */
9749
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -07009750eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
9751{
9752 eHalStatus status = eHAL_STATUS_FAILURE;
9753 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9754
9755 smsLog(pMac, LOG2, FL("enter"));
9756 status = sme_AcquireGlobalLock( &pMac->sme );
9757 if ( HAL_STATUS_SUCCESS( status ) )
9758 {
9759 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
9760 sme_ReleaseGlobalLock( &pMac->sme );
9761 }
9762 smsLog(pMac, LOG2, FL("exit status %d"), status);
9763
9764 return (status);
9765}
9766
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -07009767/*
9768 * SME API to enable/disable WLAN driver initiated SSR
9769 */
9770void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
9771{
9772 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9773 eHalStatus status = eHAL_STATUS_SUCCESS;
9774
9775 status = sme_AcquireGlobalLock(&pMac->sme);
9776 if (HAL_STATUS_SUCCESS(status))
9777 {
9778 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9779 "SSR level is changed %d", enableSSR);
9780 /* not serializing this messsage, as this is only going
9781 * to set a variable in WDA/WDI
9782 */
9783 WDA_SetEnableSSR(enableSSR);
9784 sme_ReleaseGlobalLock(&pMac->sme);
9785 }
9786 return;
9787}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009788
9789/*
9790 * SME API to determine the channel bonding mode
9791 */
9792VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
9793{
9794 tSmeConfigParams smeConfig;
9795 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9796
9797 if (
9798#ifdef WLAN_FEATURE_11AC
9799 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
9800 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
9801#endif
9802 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
9803 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode
9804 )
9805 {
9806 return VOS_STATUS_SUCCESS;
9807 }
9808
9809 /* If channel bonding mode is not required */
9810 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
9811 return VOS_STATUS_SUCCESS;
9812 }
9813
9814 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
9815 sme_GetConfigParam(pMac, &smeConfig);
9816
9817#ifdef WLAN_FEATURE_11AC
9818 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
9819 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
9820 {
9821 if ( channel== 36 || channel == 52 || channel == 100 ||
9822 channel == 116 || channel == 149 )
9823 {
9824 smeConfig.csrConfig.channelBondingMode5GHz =
9825 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
9826 }
9827 else if ( channel == 40 || channel == 56 || channel == 104 ||
9828 channel == 120 || channel == 153 )
9829 {
9830 smeConfig.csrConfig.channelBondingMode5GHz =
9831 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
9832 }
9833 else if ( channel == 44 || channel == 60 || channel == 108 ||
9834 channel == 124 || channel == 157 )
9835 {
9836 smeConfig.csrConfig.channelBondingMode5GHz =
9837 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1;
9838 }
9839 else if ( channel == 48 || channel == 64 || channel == 112 ||
Leo Changd0a49842013-12-30 11:41:04 -08009840 channel == 128 || channel == 144 || channel == 161 )
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009841 {
9842 smeConfig.csrConfig.channelBondingMode5GHz =
9843 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
9844 }
9845 else if ( channel == 165 )
9846 {
9847 smeConfig.csrConfig.channelBondingMode5GHz = 0;
9848 }
9849 }
9850#endif
9851
9852 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
9853 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
9854 {
9855 if ( channel== 40 || channel == 48 || channel == 56 ||
9856 channel == 64 || channel == 104 || channel == 112 ||
9857 channel == 120 || channel == 128 || channel == 136 ||
9858 channel == 144 || channel == 153 || channel == 161 )
9859 {
9860 smeConfig.csrConfig.channelBondingMode5GHz = 1;
9861 }
9862 else if ( channel== 36 || channel == 44 || channel == 52 ||
9863 channel == 60 || channel == 100 || channel == 108 ||
9864 channel == 116 || channel == 124 || channel == 132 ||
9865 channel == 140 || channel == 149 || channel == 157 )
9866 {
9867 smeConfig.csrConfig.channelBondingMode5GHz = 2;
9868 }
9869 else if ( channel == 165 )
9870 {
9871 smeConfig.csrConfig.channelBondingMode5GHz = 0;
9872 }
9873 }
9874 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Jeff Johnsonce8ad512013-10-30 12:34:42 -07009875 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009876
9877 sme_UpdateConfig (pMac, &smeConfig);
9878 return VOS_STATUS_SUCCESS;
9879}
9880
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07009881/*--------------------------------------------------------------------------
9882
9883 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
9884 \param hHal - The handle returned by macOpen.
9885 \param currDeviceMode - Current operating device mode.
9886 --------------------------------------------------------------------------*/
9887
9888void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
9889{
9890 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9891 pMac->sme.currDeviceMode = currDeviceMode;
9892 return;
9893}
9894
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07009895#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9896/*--------------------------------------------------------------------------
9897 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
9898 from CSR.
9899 This is a synchronous call
9900 \param hHal - The handle returned by macOpen
9901 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
9902 BSSID, channel etc.)
9903 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
9904 Other status means SME is failed to send the request.
9905 \sa
9906 --------------------------------------------------------------------------*/
9907
9908eHalStatus sme_HandoffRequest(tHalHandle hHal,
9909 tCsrHandoffRequest *pHandoffInfo)
9910{
9911 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9912 eHalStatus status = eHAL_STATUS_SUCCESS;
9913
9914 status = sme_AcquireGlobalLock( &pMac->sme );
9915 if ( HAL_STATUS_SUCCESS( status ) )
9916 {
9917 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9918 "%s: invoked", __func__);
9919 status = csrHandoffRequest(pMac, pHandoffInfo);
9920 sme_ReleaseGlobalLock( &pMac->sme );
9921 }
9922
9923 return status ;
9924}
9925#endif
9926
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -07009927/*
9928 * SME API to check if there is any infra station or
9929 * P2P client is connected
9930 */
9931VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
9932{
9933 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9934 if(csrIsInfraConnected(pMac))
9935 {
9936 return VOS_STATUS_SUCCESS;
9937 }
9938 return VOS_STATUS_E_FAILURE;
9939}
9940
Leo Chang9056f462013-08-01 19:21:11 -07009941
9942#ifdef FEATURE_WLAN_LPHB
9943/* ---------------------------------------------------------------------------
9944 \fn sme_LPHBConfigReq
9945 \API to make configuration LPHB within FW.
9946 \param hHal - The handle returned by macOpen
9947 \param lphdReq - LPHB request argument by client
9948 \param pCallbackfn - LPHB timeout notification callback function pointer
9949 \- return Configuration message posting status, SUCCESS or Fail
9950 -------------------------------------------------------------------------*/
9951eHalStatus sme_LPHBConfigReq
9952(
9953 tHalHandle hHal,
9954 tSirLPHBReq *lphdReq,
9955 void (*pCallbackfn)(void *pAdapter, void *indParam)
9956)
9957{
9958 eHalStatus status = eHAL_STATUS_SUCCESS;
9959 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
9960 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9961 vos_msg_t vosMessage;
9962
9963 status = sme_AcquireGlobalLock(&pMac->sme);
9964 if (eHAL_STATUS_SUCCESS == status)
9965 {
9966 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
9967 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -07009968 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -07009969 {
9970 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9971 "%s: Indication Call back did not registered", __func__);
9972 sme_ReleaseGlobalLock(&pMac->sme);
9973 return eHAL_STATUS_FAILURE;
9974 }
9975 else if (NULL != pCallbackfn)
9976 {
Leo Changd9df8aa2013-09-26 13:32:26 -07009977 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -07009978 }
9979
9980 /* serialize the req through MC thread */
9981 vosMessage.bodyptr = lphdReq;
9982 vosMessage.type = WDA_LPHB_CONF_REQ;
9983 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
9984 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
9985 {
9986 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
9987 "%s: Post Config LPHB MSG fail", __func__);
9988 status = eHAL_STATUS_FAILURE;
9989 }
9990 sme_ReleaseGlobalLock(&pMac->sme);
9991 }
9992
9993 return(status);
9994}
9995#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -07009996/*--------------------------------------------------------------------------
9997 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
9998 scan parameter.
9999 This is a synchronous call
10000 \param hHal - The handle returned by macOpen
10001 \return NONE.
10002 \sa
10003 --------------------------------------------------------------------------*/
10004void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
10005 tANI_U8 nNumP2PChan)
10006{
10007 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10008
10009 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
10010 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
10011
10012 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10013 "%s: SCAN nNumStaChanCombinedConc : %d,"
10014 "nNumP2PChanCombinedConc : %d ",
10015 __func__, nNumStaChan, nNumP2PChan);
10016
10017 return;
10018
10019}
Leo Chang9056f462013-08-01 19:21:11 -070010020
Yue Mab9c86f42013-08-14 15:59:08 -070010021/* ---------------------------------------------------------------------------
10022 \fn sme_AddPeriodicTxPtrn
10023 \brief API to Periodic TX Pattern Offload feature
10024 \param hHal - The handle returned by macOpen
10025 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
10026 \return eHalStatus
10027 ---------------------------------------------------------------------------*/
10028eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
10029 *addPeriodicTxPtrnParams)
10030{
10031 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10032 eHalStatus status;
10033 vos_msg_t msg;
10034
10035 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10036 {
10037 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
10038 msg.bodyptr = addPeriodicTxPtrnParams;
10039
10040 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10041 {
10042 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10043 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
10044 __func__);
10045
10046 sme_ReleaseGlobalLock(&pMac->sme);
10047 return eHAL_STATUS_FAILURE;
10048 }
10049
10050 sme_ReleaseGlobalLock(&pMac->sme);
10051 return eHAL_STATUS_SUCCESS;
10052 }
10053
10054 return status;
10055}
10056
10057/* ---------------------------------------------------------------------------
10058 \fn sme_DelPeriodicTxPtrn
10059 \brief API to Periodic TX Pattern Offload feature
10060 \param hHal - The handle returned by macOpen
10061 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
10062 \return eHalStatus
10063 ---------------------------------------------------------------------------*/
10064eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
10065 *delPeriodicTxPtrnParams)
10066{
10067 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10068 eHalStatus status;
10069 vos_msg_t msg;
10070
10071 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10072 {
10073 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
10074 msg.bodyptr = delPeriodicTxPtrnParams;
10075
10076 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10077 {
10078 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10079 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
10080 __func__);
10081
10082 sme_ReleaseGlobalLock(&pMac->sme);
10083 return eHAL_STATUS_FAILURE;
10084 }
10085
10086 sme_ReleaseGlobalLock(&pMac->sme);
10087 return eHAL_STATUS_SUCCESS;
10088 }
10089
10090 return status;
10091}
10092
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010093void smeGetCommandQStatus( tHalHandle hHal )
10094{
10095 tSmeCmd *pTempCmd = NULL;
10096 tListElem *pEntry;
10097 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10098
10099 if (NULL == pMac)
10100 {
Kiet Lamcffc5862013-10-30 16:28:45 +053010101 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
10102 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010103 return;
10104 }
10105
10106 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
10107 if( pEntry )
10108 {
10109 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
10110 }
10111 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
10112 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
10113 if(pTempCmd)
10114 {
10115 if( eSmeCsrCommandMask & pTempCmd->command )
10116 {
10117 //CSR command is stuck. See what the reason code is for that command
10118 dumpCsrCommandInfo(pMac, pTempCmd);
10119 }
10120 } //if(pTempCmd)
10121
10122 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
10123 csrLLCount(&pMac->sme.smeCmdPendingList));
10124
10125 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
10126 csrLLCount(&pMac->roam.roamCmdPendingList));
10127
10128 return;
10129}
Rajeev79dbe4c2013-10-05 11:03:42 +053010130
10131#ifdef FEATURE_WLAN_BATCH_SCAN
10132/* ---------------------------------------------------------------------------
10133 \fn sme_SetBatchScanReq
10134 \brief API to set batch scan request in FW
10135 \param hHal - The handle returned by macOpen.
10136 \param pRequest - Pointer to the batch request.
10137 \param sessionId - session ID
10138 \param callbackRoutine - HDD callback which needs to be invoked after
10139 getting set batch scan response from FW
10140 \param callbackContext - pAdapter context
10141 \return eHalStatus
10142 ---------------------------------------------------------------------------*/
10143eHalStatus sme_SetBatchScanReq
10144(
10145 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
10146 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
10147 void *callbackContext
10148)
10149{
10150 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10151 eHalStatus status;
10152
10153 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10154 {
10155 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
10156 callbackContext);
10157 sme_ReleaseGlobalLock( &pMac->sme );
10158 }
10159
10160 return status;
10161}
10162
10163/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -070010164 \fn sme_SendRateUpdateInd
10165 \brief API to Update rate
10166 \param hHal - The handle returned by macOpen
10167 \param rateUpdateParams - Pointer to rate update params
10168 \return eHalStatus
10169 ---------------------------------------------------------------------------*/
10170eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
10171{
10172 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10173 eHalStatus status;
10174 vos_msg_t msg;
10175
10176 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10177 {
10178 msg.type = WDA_RATE_UPDATE_IND;
10179 msg.bodyptr = rateUpdateParams;
10180
10181 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10182 {
10183 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10184 "to post WDA_SET_RMC_RATE_IND to WDA!",
10185 __func__);
10186
10187 sme_ReleaseGlobalLock(&pMac->sme);
10188 return eHAL_STATUS_FAILURE;
10189 }
10190
10191 sme_ReleaseGlobalLock(&pMac->sme);
10192 return eHAL_STATUS_SUCCESS;
10193 }
10194
10195 return status;
10196}
10197
10198/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053010199 \fn sme_TriggerBatchScanResultInd
10200 \brief API to trigger batch scan result indications from FW
10201 \param hHal - The handle returned by macOpen.
10202 \param pRequest - Pointer to get batch request.
10203 \param sessionId - session ID
10204 \param callbackRoutine - HDD callback which needs to be invoked after
10205 getting batch scan result indication from FW
10206 \param callbackContext - pAdapter context
10207 \return eHalStatus
10208 ---------------------------------------------------------------------------*/
10209eHalStatus sme_TriggerBatchScanResultInd
10210(
10211 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
10212 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
10213 void *callbackContext
10214)
10215{
10216 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10217 eHalStatus status;
10218
10219 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10220 {
10221 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
10222 callbackRoutine, callbackContext);
10223 sme_ReleaseGlobalLock( &pMac->sme );
10224 }
10225
10226 return status;
10227}
10228
10229
10230/* ---------------------------------------------------------------------------
10231 \fn sme_StopBatchScanInd
10232 \brief API to stop batch scan request in FW
10233 \param hHal - The handle returned by macOpen.
10234 \param pRequest - Pointer to the batch request.
10235 \param sessionId - session ID
10236 \return eHalStatus
10237 ---------------------------------------------------------------------------*/
10238eHalStatus sme_StopBatchScanInd
10239(
10240 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
10241)
10242{
10243 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10244 eHalStatus status;
10245
10246 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10247 {
10248 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
10249 sme_ReleaseGlobalLock( &pMac->sme );
10250 }
10251
10252 return status;
10253}
10254
10255#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080010256
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010257
Leo Chang0b0e45a2013-12-15 15:18:55 -080010258#ifdef FEATURE_WLAN_CH_AVOID
10259/* ---------------------------------------------------------------------------
10260 \fn sme_AddChAvoidCallback
10261 \brief Used to plug in callback function
10262 Which notify channel may not be used with SAP or P2PGO mode.
10263 Notification come from FW.
10264 \param hHal
10265 \param pCallbackfn : callback function pointer should be plugged in
10266 \- return eHalStatus
10267 -------------------------------------------------------------------------*/
10268eHalStatus sme_AddChAvoidCallback
10269(
10270 tHalHandle hHal,
10271 void (*pCallbackfn)(void *pAdapter, void *indParam)
10272)
10273{
10274 eHalStatus status = eHAL_STATUS_SUCCESS;
10275 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10276
10277 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10278 "%s: Plug in CH AVOID CB", __func__);
10279
10280 status = sme_AcquireGlobalLock(&pMac->sme);
10281 if (eHAL_STATUS_SUCCESS == status)
10282 {
10283 if (NULL != pCallbackfn)
10284 {
10285 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
10286 }
10287 sme_ReleaseGlobalLock(&pMac->sme);
10288 }
10289
10290 return(status);
10291}
10292#endif /* FEATURE_WLAN_CH_AVOID */
10293
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010294
10295void activeListCmdTimeoutHandle(void *userData)
10296{
10297 if (NULL == userData)
10298 return;
10299 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10300 "%s: Active List command timeout Cmd List Count %d", __func__,
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010301 csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010302 smeGetCommandQStatus((tHalHandle) userData);
10303}
10304
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010305eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
10306{
10307 eHalStatus status = eHAL_STATUS_SUCCESS;
10308 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10309 pMac->fEnableDebugLog = set_value;
10310 return (status);
10311}
10312