blob: 1148579c5fdb2194e37a0136f06dc7ca01112f1f [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam0fb93dd2014-02-19 00:32:59 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -080023 * Copyright (c) 2012-2014 Qualcomm Atheros, Inc.
24 * All Rights Reserved.
25 * Qualcomm Atheros Confidential and Proprietary.
Kiet Lam0fb93dd2014-02-19 00:32:59 -080026 *
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080027 */
Kiet Lam0fb93dd2014-02-19 00:32:59 -080028
29
Jeff Johnson295189b2012-06-20 16:38:30 -070030/**=========================================================================
31
32 \file smeApi.c
33
34 \brief Definitions for SME APIs
35
Kiet Lamaa8e15a2014-02-11 23:30:06 -080036 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
37
38 Qualcomm Confidential and Proprietary.
39
Jeff Johnson295189b2012-06-20 16:38:30 -070040 ========================================================================*/
41
42/*===========================================================================
43
44 EDIT HISTORY FOR FILE
45
46
47 This section contains comments describing changes made to the module.
48 Notice that changes are listed in reverse chronological order.
49
50
51
52 when who what, where, why
53---------- --- --------------------------------------------------------
5406/03/10 js Added support to hostapd driven
55 * deauth/disassoc/mic failure
56
57===========================================================================*/
58
59/*--------------------------------------------------------------------------
60 Include Files
61 ------------------------------------------------------------------------*/
62
Jeff Johnson295189b2012-06-20 16:38:30 -070063
64#include "smsDebug.h"
65#include "sme_Api.h"
66#include "csrInsideApi.h"
67#include "smeInside.h"
68#include "csrInternal.h"
69#include "wlan_qct_wda.h"
70#include "halMsgApi.h"
Katya Nigam70d68332013-09-16 16:49:45 +053071#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070072#include "sme_Trace.h"
Katya Nigambcb705f2013-12-26 14:26:22 +053073#include "vos_types.h"
74#include "vos_trace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070075#include "sapApi.h"
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053076#include "macTrace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070077
78
79
Jeff Johnson295189b2012-06-20 16:38:30 -070080extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
81
82#include <wlan_qct_pal_api.h>
Katya Nigam70d68332013-09-16 16:49:45 +053083#define LOG_SIZE 256
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080084#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053085#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080086
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070087
88#define CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE 1000*30 //30s
89
Jeff Johnson295189b2012-06-20 16:38:30 -070090// TxMB Functions
91extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
92 tANI_U32 size, tSmeCmd **ppCmd );
93extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
94extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Jeff Johnson295189b2012-06-20 16:38:30 -070095extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
96extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
97extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
98extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
99extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
100extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -0700101
102static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
103static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
104
105eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
106
107eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
108
Amar Singhal0d15bd52013-10-12 23:13:13 -0700109eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
110
Jeff Johnson295189b2012-06-20 16:38:30 -0700111eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
112
113eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
114
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700115#ifdef FEATURE_WLAN_LFR
116tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
117#endif
118
Chet Lanctot186b5732013-03-18 10:26:30 -0700119#ifdef WLAN_FEATURE_11W
120eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
121 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
122#endif
123
Jeff Johnson295189b2012-06-20 16:38:30 -0700124//Internal SME APIs
125eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
126{
127 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
128
129 if(psSme)
130 {
131 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
132 {
133 status = eHAL_STATUS_SUCCESS;
134 }
135 }
136
137 return (status);
138}
139
140
141eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
142{
143 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
144
145 if(psSme)
146 {
147 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
148 {
149 status = eHAL_STATUS_SUCCESS;
150 }
151 }
152
153 return (status);
154}
155
156
157
158static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
159{
160 eHalStatus status;
161 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530162 tANI_U32 cmd_idx;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700163 VOS_STATUS vosStatus;
164 vos_timer_t* cmdTimeoutTimer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700165
166 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530167 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
168 &pMac->sme.smeCmdActiveList)))
169 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700170
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530171 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
172 &pMac->sme.smeCmdPendingList)))
173 goto end;
174
175 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
176 &pMac->sme.smeScanCmdActiveList)))
177 goto end;
178
179 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
180 &pMac->sme.smeScanCmdPendingList)))
181 goto end;
182
183 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
184 &pMac->sme.smeCmdFreeList)))
185 goto end;
186
Kiet Lam64c1b492013-07-12 13:56:44 +0530187 pCmd = vos_mem_malloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
188 if ( NULL == pCmd )
189 status = eHAL_STATUS_FAILURE;
190 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530191 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530192 status = eHAL_STATUS_SUCCESS;
193
194 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
195 pMac->sme.pSmeCmdBufAddr = pCmd;
196
197 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
198 {
199 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530200 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530201 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700202 }
203
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700204 /* This timer is only to debug the active list command timeout */
205
206 cmdTimeoutTimer = (vos_timer_t*)vos_mem_malloc(sizeof(vos_timer_t));
207 if (cmdTimeoutTimer)
208 {
209 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = cmdTimeoutTimer;
210 vosStatus =
211 vos_timer_init( pMac->sme.smeCmdActiveList.cmdTimeoutTimer,
212 VOS_TIMER_TYPE_SW,
213 activeListCmdTimeoutHandle,
214 (void*) pMac);
215
216 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
217 {
218 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
219 "Init Timer fail for active list command process time out");
220 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
221 }
222 else
223 {
224 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
225 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
226 }
227 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530228end:
229 if (!HAL_STATUS_SUCCESS(status))
230 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
231 status);
232
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 return (status);
234}
235
236
237void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
238{
239 pCmd->command = eSmeNoCommand;
240 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
241}
242
243
244
245static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
246{
247 tListElem *pEntry;
248 tSmeCmd *pCommand;
249
250 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
251 {
252 //TODO: base on command type to call release functions
253 //reinitialize different command types so they can be reused
254 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
255 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
256 }
257}
258
259static void purgeSmeCmdList(tpAniSirGlobal pMac)
260{
261 //release any out standing commands back to free command list
262 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
263 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530264 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
265 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700266}
267
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530268void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
269 tDblLinkList *pList)
Jeff Johnson295189b2012-06-20 16:38:30 -0700270{
271 //release any out standing commands back to free command list
272 tListElem *pEntry, *pNext;
273 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 tDblLinkList localList;
275
276 vos_mem_zero(&localList, sizeof(tDblLinkList));
277 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
278 {
279 smsLog(pMac, LOGE, FL(" failed to open list"));
280 return;
281 }
282
283 csrLLLock(pList);
284 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
285 while(pEntry != NULL)
286 {
287 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
288 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
289 if(pCommand->sessionId == sessionId)
290 {
291 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
292 {
293 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
294 }
295 }
296 pEntry = pNext;
297 }
298 csrLLUnlock(pList);
299
300 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
301 {
302 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
303 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
304 }
305 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700306}
307
308
309static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
310{
311 eHalStatus status = eHAL_STATUS_SUCCESS;
312
313 purgeSmeCmdList(pMac);
314 csrLLClose(&pMac->sme.smeCmdPendingList);
315 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530316 csrLLClose(&pMac->sme.smeScanCmdPendingList);
317 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 csrLLClose(&pMac->sme.smeCmdFreeList);
319
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700320 /*destroy active list command time out timer */
321 vos_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
322 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
323 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL;
324
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800325 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
326 if(status != eHAL_STATUS_SUCCESS)
327 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800328 smsLog(pMac, LOGE,
329 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800330 goto done;
331 }
332
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 if(NULL != pMac->sme.pSmeCmdBufAddr)
334 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530335 vos_mem_free(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700336 pMac->sme.pSmeCmdBufAddr = NULL;
337 }
338
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800339 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
340 if(status != eHAL_STATUS_SUCCESS)
341 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800342 smsLog(pMac, LOGE,
343 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800344 }
345done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 return (status);
347}
348
349
350void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
351{
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 switch( pCmd->command )
353 {
354 case eSmeCommandScan:
355 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
356 break;
357
358 case eSmeCommandRoam:
359 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
360 break;
361
362 case eSmeCommandWmStatusChange:
363 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
364 break;
365
366 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800367 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
369 break;
370
371 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800372 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
374 break;
375
376 default:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700377 smsLog( pMac, LOGE, " default: Unhandled command %d",
378 pCmd->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 break;
380 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700381}
382
383tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
384{
385 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
386 tListElem *pEntry;
387
388 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
389
390 // If we can get another MS Msg buffer, then we are ok. Just link
391 // the entry onto the linked list. (We are using the linked list
392 // to keep track of tfhe message buffers).
393 if ( pEntry )
394 {
395 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
396 }
397 else {
398 int idx = 1;
399
400 //Cannot change pRetCmd here since it needs to return later.
401 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
402 if( pEntry )
403 {
404 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
405 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800406 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700407 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
408 if(pTempCmd)
409 {
410 if( eSmeCsrCommandMask & pTempCmd->command )
411 {
412 //CSR command is stuck. See what the reason code is for that command
413 dumpCsrCommandInfo(pMac, pTempCmd);
414 }
415 } //if(pTempCmd)
416
417 //dump what is in the pending queue
418 csrLLLock(&pMac->sme.smeCmdPendingList);
419 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
420 while(pEntry)
421 {
422 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800423 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700424 idx++, pTempCmd->command );
425 if( eSmeCsrCommandMask & pTempCmd->command )
426 {
427 //CSR command is stuck. See what the reason code is for that command
428 dumpCsrCommandInfo(pMac, pTempCmd);
429 }
430 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
431 }
432 csrLLUnlock(&pMac->sme.smeCmdPendingList);
433
434 //There may be some more command in CSR's own pending queue
435 csrLLLock(&pMac->roam.roamCmdPendingList);
436 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
437 while(pEntry)
438 {
439 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800440 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 idx++, pTempCmd->command );
442 dumpCsrCommandInfo(pMac, pTempCmd);
443 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
444 }
445 csrLLUnlock(&pMac->roam.roamCmdPendingList);
446 }
447
448 return( pRetCmd );
449}
450
451
452void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
453{
454 if ( fHighPriority )
455 {
456 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
457 }
458 else
459 {
460 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
461 }
462
463 // process the command queue...
464 smeProcessPendingQueue( pMac );
465
466 return;
467}
468
469
470static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
471{
472 eSmeCommandType pmcCommand = eSmeNoCommand;
473 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
474 tPmcState pmcState;
475 eHalStatus status;
476
477 do
478 {
479 pmcState = pmcGetPmcState(pMac);
480
481 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
482 if( !HAL_STATUS_SUCCESS(status) )
483 {
484 //PMC state is not right for the command, drop it
485 return ( eSmeDropCommand );
486 }
487 if( fFullPowerNeeded ) break;
488 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
489 ( eSmeCommandDelTs == pCommand->command ) );
490 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700491#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700492 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700493 eSmeCommandOemDataReq == pCommand->command);
494 if(fFullPowerNeeded) break;
495#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700496 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 eSmeCommandRemainOnChannel == pCommand->command);
498 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 } while(0);
500
501 if( fFullPowerNeeded )
502 {
503 switch( pmcState )
504 {
505 case IMPS:
506 case STANDBY:
507 pmcCommand = eSmeCommandExitImps;
508 break;
509
510 case BMPS:
511 pmcCommand = eSmeCommandExitBmps;
512 break;
513
514 case UAPSD:
515 pmcCommand = eSmeCommandExitUapsd;
516 break;
517
518 case WOWL:
519 pmcCommand = eSmeCommandExitWowl;
520 break;
521
522 default:
523 break;
524 }
525 }
526
527 return ( pmcCommand );
528}
529
530
531//For commands that need to do extra cleanup.
532static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
533{
534 if( eSmePmcCommandMask & pCommand->command )
535 {
536 pmcAbortCommand( pMac, pCommand, fStopping );
537 }
538 else if ( eSmeCsrCommandMask & pCommand->command )
539 {
540 csrAbortCommand( pMac, pCommand, fStopping );
541 }
542 else
543 {
544 switch( pCommand->command )
545 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 case eSmeCommandRemainOnChannel:
547 if (NULL != pCommand->u.remainChlCmd.callback)
548 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700549 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 pCommand->u.remainChlCmd.callback;
551 /* process the msg */
552 if( callback )
553 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700554 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 eCSR_SCAN_ABORT );
556 }
557 }
558 smeReleaseCommand( pMac, pCommand );
559 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 default:
561 smeReleaseCommand( pMac, pCommand );
562 break;
563 }
564 }
565}
566
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530567tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
568 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
569{
570 tListElem *pCurEntry = NULL;
571 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700572
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530573 /* Go through the list and return the command whose session id is not
574 * matching with the current ongoing scan cmd sessionId */
575 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
576 while (pCurEntry)
577 {
578 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
579 if (pCommand->sessionId != sessionId)
580 {
581 smsLog(pMac, LOG1, "selected the command with different sessionId");
582 return pCurEntry;
583 }
584
585 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
586 }
587
588 smsLog(pMac, LOG1, "No command pending with different sessionId");
589 return NULL;
590}
591
592tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
593{
594 tListElem *pEntry;
595 tSmeCmd *pCommand;
596 tListElem *pSmeEntry;
597 tSmeCmd *pSmeCommand;
598 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
599
600 csrLLLock( &pMac->sme.smeScanCmdActiveList );
601 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
602 LL_ACCESS_NOLOCK ))
603 {
604 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
605 LL_ACCESS_LOCK))
606 {
607 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
608 LL_ACCESS_LOCK );
609 if (pEntry)
610 {
611 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
612 //We cannot execute any command in wait-for-key state until setKey is through.
613 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
614 {
615 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
616 {
617 smsLog(pMac, LOGE,
618 " Cannot process command(%d) while waiting for key",
619 pCommand->command);
620 status = eANI_BOOLEAN_FALSE;
621 goto end;
622 }
623 }
624
625 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
626 LL_ACCESS_LOCK )))
627 {
628 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
629 LL_ACCESS_LOCK);
630 if (pEntry)
631 {
632 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
633 Link) ;
634
635 /* if scan is running on one interface and SME recei
636 ves the next command on the same interface then
637 dont the allow the command to be queued to
638 smeCmdPendingList. If next scan is allowed on
639 the same interface the CSR state machine will
640 get screwed up. */
641 if (pSmeCommand->sessionId == pCommand->sessionId)
642 {
643 status = eANI_BOOLEAN_FALSE;
644 goto end;
645 }
646 }
647 }
648 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
649 pEntry, LL_ACCESS_LOCK ) )
650 {
651 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
652 &pCommand->Link, LL_ACCESS_NOLOCK );
653
654 switch (pCommand->command)
655 {
656 case eSmeCommandScan:
657 smsLog(pMac, LOG1,
658 " Processing scan offload command ");
659 csrProcessScanCommand( pMac, pCommand );
660 break;
661 default:
662 smsLog(pMac, LOGE,
663 " Something wrong, wrong command enqueued"
664 " to smeScanCmdPendingList");
665 pEntry = csrLLRemoveHead(
666 &pMac->sme.smeScanCmdActiveList,
667 LL_ACCESS_NOLOCK );
668 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
669 smeReleaseCommand( pMac, pCommand );
670 break;
671 }
672 }
673 }
674 }
675 }
676end:
677 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
678 return status;
679}
Jeff Johnson295189b2012-06-20 16:38:30 -0700680
681tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
682{
683 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
684 eHalStatus status = eHAL_STATUS_SUCCESS;
685 tListElem *pEntry;
686 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530687 tListElem *pSmeEntry;
688 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 eSmeCommandType pmcCommand = eSmeNoCommand;
690
691 // if the ActiveList is empty, then nothing is active so we can process a
692 // pending command...
693 //alwasy lock active list before locking pending list
694 csrLLLock( &pMac->sme.smeCmdActiveList );
695 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
696 {
697 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
698 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530699 /* If scan command is pending in the smeScanCmdActive list
700 * then pick the command from smeCmdPendingList which is
701 * not matching with the scan command session id.
702 * At any point of time only one command will be allowed
703 * on a single session. */
704 if ((pMac->fScanOffload) &&
705 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
706 LL_ACCESS_LOCK)))
707 {
708 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
709 LL_ACCESS_LOCK);
710 if (pSmeEntry)
711 {
712 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
713
714 pEntry = csrGetCmdToProcess(pMac,
715 &pMac->sme.smeCmdPendingList,
716 pSmeCommand->sessionId,
717 LL_ACCESS_LOCK);
718 goto sme_process_cmd;
719 }
720 }
721
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 //Peek the command
723 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530724sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 if( pEntry )
726 {
727 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530728
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 //We cannot execute any command in wait-for-key state until setKey is through.
730 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) )
731 {
732 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
733 {
734 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800735 smsLog(pMac, LOGE, " Cannot process command(%d) while waiting for key", pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530736 fContinue = eANI_BOOLEAN_FALSE;
737 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 }
739 }
740 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
741 if( eSmeDropCommand == pmcCommand )
742 {
743 //This command is not ok for current PMC state
744 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
745 {
746 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
747 }
748 csrLLUnlock( &pMac->sme.smeCmdActiveList );
749 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530750 fContinue = eANI_BOOLEAN_TRUE;
751 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700752 }
753 else if( eSmeNoCommand != pmcCommand )
754 {
755 tExitBmpsInfo exitBmpsInfo;
756 void *pv = NULL;
757 tANI_U32 size = 0;
758 tSmeCmd *pPmcCmd = NULL;
759
760 if( eSmeCommandExitBmps == pmcCommand )
761 {
762 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
763 pv = (void *)&exitBmpsInfo;
764 size = sizeof(tExitBmpsInfo);
765 }
766 //pmcCommand has to be one of the exit power save command
767 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
768 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
769 {
770 //Force this command to wake up the chip
771 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
772 csrLLUnlock( &pMac->sme.smeCmdActiveList );
773 fContinue = pmcProcessCommand( pMac, pPmcCmd );
774 if( fContinue )
775 {
776 //The command failed, remove it
777 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
778 {
779 pmcReleaseCommand( pMac, pPmcCmd );
780 }
781 }
782 }
783 else
784 {
785 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800786 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 -0700787 //Let it retry
788 fContinue = eANI_BOOLEAN_TRUE;
789 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530790 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 }
792 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
793 {
794 // we can reuse the pCommand
795
796 // Insert the command onto the ActiveList...
797 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
798
799 // .... and process the command.
800
Katya Nigambcb705f2013-12-26 14:26:22 +0530801 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -0700802 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 switch ( pCommand->command )
804 {
805
806 case eSmeCommandScan:
807 csrLLUnlock( &pMac->sme.smeCmdActiveList );
808 status = csrProcessScanCommand( pMac, pCommand );
809 break;
810
811 case eSmeCommandRoam:
812 csrLLUnlock( &pMac->sme.smeCmdActiveList );
813 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800814 if(!HAL_STATUS_SUCCESS(status))
815 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700816 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800817 &pCommand->Link, LL_ACCESS_LOCK ) )
818 {
819 csrReleaseCommandRoam( pMac, pCommand );
820 }
821 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 break;
823
824 case eSmeCommandWmStatusChange:
825 csrLLUnlock( &pMac->sme.smeCmdActiveList );
826 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
827 break;
828
829 case eSmeCommandSetKey:
830 csrLLUnlock( &pMac->sme.smeCmdActiveList );
831 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
832 if(!HAL_STATUS_SUCCESS(status))
833 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700834 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 &pCommand->Link, LL_ACCESS_LOCK ) )
836 {
837 csrReleaseCommandSetKey( pMac, pCommand );
838 }
839 }
840 break;
841
842 case eSmeCommandRemoveKey:
843 csrLLUnlock( &pMac->sme.smeCmdActiveList );
844 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
845 if(!HAL_STATUS_SUCCESS(status))
846 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700847 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 &pCommand->Link, LL_ACCESS_LOCK ) )
849 {
850 csrReleaseCommandRemoveKey( pMac, pCommand );
851 }
852 }
853 break;
854
855 case eSmeCommandAddStaSession:
856 csrLLUnlock( &pMac->sme.smeCmdActiveList );
857 csrProcessAddStaSessionCommand( pMac, pCommand );
858 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700859 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 csrLLUnlock( &pMac->sme.smeCmdActiveList );
861 csrProcessDelStaSessionCommand( pMac, pCommand );
862 break;
863
Jeff Johnsone7245742012-09-05 17:12:55 -0700864#ifdef FEATURE_OEM_DATA_SUPPORT
865 case eSmeCommandOemDataReq:
866 csrLLUnlock(&pMac->sme.smeCmdActiveList);
867 oemData_ProcessOemDataReqCommand(pMac, pCommand);
868 break;
869#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700870 case eSmeCommandRemainOnChannel:
871 csrLLUnlock(&pMac->sme.smeCmdActiveList);
872 p2pProcessRemainOnChannelCmd(pMac, pCommand);
873 break;
874 case eSmeCommandNoAUpdate:
875 csrLLUnlock( &pMac->sme.smeCmdActiveList );
876 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700877 case eSmeCommandEnterImps:
878 case eSmeCommandExitImps:
879 case eSmeCommandEnterBmps:
880 case eSmeCommandExitBmps:
881 case eSmeCommandEnterUapsd:
882 case eSmeCommandExitUapsd:
883 case eSmeCommandEnterWowl:
884 case eSmeCommandExitWowl:
885 csrLLUnlock( &pMac->sme.smeCmdActiveList );
886 fContinue = pmcProcessCommand( pMac, pCommand );
887 if( fContinue )
888 {
889 //The command failed, remove it
890 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
891 &pCommand->Link, LL_ACCESS_LOCK ) )
892 {
893 pmcReleaseCommand( pMac, pCommand );
894 }
895 }
896 break;
897
898 //Treat standby differently here because caller may not be able to handle
899 //the failure so we do our best here
900 case eSmeCommandEnterStandby:
901 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
902 {
903 //It can continue
904 csrLLUnlock( &pMac->sme.smeCmdActiveList );
905 fContinue = pmcProcessCommand( pMac, pCommand );
906 if( fContinue )
907 {
908 //The command failed, remove it
909 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
910 &pCommand->Link, LL_ACCESS_LOCK ) )
911 {
912 pmcReleaseCommand( pMac, pCommand );
913 }
914 }
915 }
916 else
917 {
918 //Need to issue a disconnect first before processing this command
919 tSmeCmd *pNewCmd;
920
921 //We need to re-run the command
922 fContinue = eANI_BOOLEAN_TRUE;
923 //Pull off the standby command first
924 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
925 &pCommand->Link, LL_ACCESS_NOLOCK ) )
926 {
927 csrLLUnlock( &pMac->sme.smeCmdActiveList );
928 //Need to call CSR function here because the disconnect command
929 //is handled by CSR
930 pNewCmd = csrGetCommandBuffer( pMac );
931 if( NULL != pNewCmd )
932 {
933 //Put the standby command to the head of the pending list first
934 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
935 LL_ACCESS_LOCK );
936 pNewCmd->command = eSmeCommandRoam;
937 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
938 //Put the disassoc command before the standby command
939 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
940 LL_ACCESS_LOCK );
941 }
942 else
943 {
944 //Continue the command here
945 fContinue = pmcProcessCommand( pMac, pCommand );
946 if( fContinue )
947 {
948 //The command failed, remove it
949 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
950 &pCommand->Link, LL_ACCESS_LOCK ) )
951 {
952 pmcReleaseCommand( pMac, pCommand );
953 }
954 }
955 }
956 }
957 else
958 {
959 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800960 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700961 VOS_ASSERT(0);
962 }
963 }
964 break;
965
966 case eSmeCommandAddTs:
967 case eSmeCommandDelTs:
968 csrLLUnlock( &pMac->sme.smeCmdActiveList );
969#ifndef WLAN_MDM_CODE_REDUCTION_OPT
970 fContinue = qosProcessCommand( pMac, pCommand );
971 if( fContinue )
972 {
973 //The command failed, remove it
974 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
975 &pCommand->Link, LL_ACCESS_NOLOCK ) )
976 {
977//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
978 qosReleaseCommand( pMac, pCommand );
979//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
980 }
981 }
982#endif
983 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800984#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700985 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800986 case eSmeCommandTdlsAddPeer:
987 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +0530988 case eSmeCommandTdlsLinkEstablish:
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800989#ifdef FEATURE_WLAN_TDLS_INTERNAL
990 case eSmeCommandTdlsDiscovery:
991 case eSmeCommandTdlsLinkSetup:
992 case eSmeCommandTdlsLinkTear:
993 case eSmeCommandTdlsEnterUapsd:
994 case eSmeCommandTdlsExitUapsd:
995#endif
996 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -0800997 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800998 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800999
1000 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1001 status = csrTdlsProcessCmd( pMac, pCommand );
1002 }
1003 break ;
1004#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001005
1006 default:
1007 //something is wrong
1008 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001009 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1011 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1012 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1013 smeReleaseCommand( pMac, pCommand );
1014 status = eHAL_STATUS_FAILURE;
1015 break;
1016 }
1017 if(!HAL_STATUS_SUCCESS(status))
1018 {
1019 fContinue = eANI_BOOLEAN_TRUE;
1020 }
1021 }//if(pEntry)
1022 else
1023 {
1024 //This is odd. Some one else pull off the command.
1025 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1026 }
1027 }
1028 else
1029 {
1030 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1031 }
1032 }
1033 else
1034 {
1035 //No command waiting
1036 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1037 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1038 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1039 {
1040 tANI_U32 nTime = 0;
1041
1042 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1043 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1044 {
1045 csrScanStartIdleScanTimer(pMac, nTime);
1046 }
1047 }
1048 }
1049 }
1050 else {
1051 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1052 }
1053
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301054sme_process_scan_queue:
1055 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1056 fContinue = eANI_BOOLEAN_FALSE;
1057
Jeff Johnson295189b2012-06-20 16:38:30 -07001058 return ( fContinue );
1059}
1060
1061void smeProcessPendingQueue( tpAniSirGlobal pMac )
1062{
1063 while( smeProcessCommand( pMac ) );
1064}
1065
1066
1067tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1068{
1069 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1070 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1071}
1072
1073
1074
1075//Global APIs
1076
1077/*--------------------------------------------------------------------------
1078
1079 \brief sme_Open() - Initialze all SME modules and put them at idle state
1080
1081 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1082 successfully return, all modules are at idle state ready to start.
1083
1084 smeOpen must be called before any other SME APIs can be involved.
1085 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001086 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001087 \param hHal - The handle returned by macOpen.
1088
1089 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1090
1091 Other status means SME is failed to be initialized
1092 \sa
1093
1094 --------------------------------------------------------------------------*/
1095eHalStatus sme_Open(tHalHandle hHal)
1096{
1097 eHalStatus status = eHAL_STATUS_FAILURE;
1098 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1099
1100 do {
1101 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001102 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001103 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1104 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001105 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001106 status = eHAL_STATUS_FAILURE;
1107 break;
1108 }
1109
1110 status = ccmOpen(hHal);
1111 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1112 smsLog( pMac, LOGE,
1113 "ccmOpen failed during initialization with status=%d", status );
1114 break;
1115 }
1116
1117 status = csrOpen(pMac);
1118 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1119 smsLog( pMac, LOGE,
1120 "csrOpen failed during initialization with status=%d", status );
1121 break;
1122 }
1123
1124 status = pmcOpen(hHal);
1125 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1126 smsLog( pMac, LOGE,
1127 "pmcOpen failed during initialization with status=%d", status );
1128 break;
1129 }
1130
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001131#ifdef FEATURE_WLAN_TDLS
1132 pMac->isTdlsPowerSaveProhibited = 0;
1133#endif
1134
Jeff Johnson295189b2012-06-20 16:38:30 -07001135#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1136 status = sme_QosOpen(pMac);
1137 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1138 smsLog( pMac, LOGE,
1139 "Qos open failed during initialization with status=%d", status );
1140 break;
1141 }
1142
1143 status = btcOpen(pMac);
1144 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1145 smsLog( pMac, LOGE,
1146 "btcOpen open failed during initialization with status=%d", status );
1147 break;
1148 }
1149#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001150#ifdef FEATURE_OEM_DATA_SUPPORT
1151 status = oemData_OemDataReqOpen(pMac);
1152 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1153 smsLog(pMac, LOGE,
1154 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1155 break;
1156 }
1157#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001158
1159 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1160 break;
1161
Jeff Johnson295189b2012-06-20 16:38:30 -07001162 {
1163 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1164 if ( NULL == pvosGCtx ){
1165 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1166 status = eHAL_STATUS_FAILURE;
1167 break;
1168 }
1169
1170 status = WLANSAP_Open( pvosGCtx );
1171 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1172 smsLog( pMac, LOGE,
1173 "WLANSAP_Open open failed during initialization with status=%d", status );
1174 break;
1175 }
1176 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001177#if defined WLAN_FEATURE_VOWIFI
1178 status = rrmOpen(pMac);
1179 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1180 smsLog( pMac, LOGE,
1181 "rrmOpen open failed during initialization with status=%d", status );
1182 break;
1183 }
1184#endif
1185
1186#if defined WLAN_FEATURE_VOWIFI_11R
1187 sme_FTOpen(pMac);
1188#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001189 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001190 smeTraceInit(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001191
1192 }while (0);
1193
1194 return status;
1195}
1196
Jeff Johnson295189b2012-06-20 16:38:30 -07001197/*--------------------------------------------------------------------------
1198
1199 \brief sme_set11dinfo() - Set the 11d information about valid channels
1200 and there power using information from nvRAM
1201 This function is called only for AP.
1202
Srinivas Girigowdade697412013-02-14 16:31:48 -08001203 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001204
1205 \param hHal - The handle returned by macOpen.
1206 \Param pSmeConfigParams - a pointer to a caller allocated object of
1207 typedef struct _smeConfigParams.
1208
1209 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1210
1211 Other status means SME is failed to update the config parameters.
1212 \sa
1213--------------------------------------------------------------------------*/
1214
1215eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1216{
1217 eHalStatus status = eHAL_STATUS_FAILURE;
1218 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1219
Katya Nigambcb705f2013-12-26 14:26:22 +05301220 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001221 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001222 if (NULL == pSmeConfigParams ) {
1223 smsLog( pMac, LOGE,
1224 "Empty config param structure for SME, nothing to update");
1225 return status;
1226 }
1227
1228 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1229 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001230 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001231 status );
1232 }
1233 return status;
1234}
1235
1236/*--------------------------------------------------------------------------
1237
1238 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1239
Srinivas Girigowdade697412013-02-14 16:31:48 -08001240 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001241
1242 \param hHal - The handle returned by HostapdAdapter.
1243 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1244
1245 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1246
1247 Other status means, failed to get the current regulatory domain.
1248 \sa
1249--------------------------------------------------------------------------*/
1250
1251eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1252{
1253 eHalStatus status = eHAL_STATUS_FAILURE;
1254 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1255
Katya Nigambcb705f2013-12-26 14:26:22 +05301256 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001257 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001258 if (NULL == domainIdSoftAp ) {
1259 smsLog( pMac, LOGE, "Uninitialized domain Id");
1260 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001261 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001262
1263 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1264 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001265
Jeff Johnson295189b2012-06-20 16:38:30 -07001266 return status;
1267}
1268
1269
1270eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1271{
1272 eHalStatus status = eHAL_STATUS_FAILURE;
1273 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1274
Katya Nigambcb705f2013-12-26 14:26:22 +05301275 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001276 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001277 if (NULL == apCntryCode ) {
1278 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1279 return status;
1280 }
1281
1282 status = csrSetRegInfo(hHal, apCntryCode );
1283 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001284 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001285 status );
1286 }
1287 return status;
1288}
1289
Jeff Johnson295189b2012-06-20 16:38:30 -07001290#ifdef FEATURE_WLAN_SCAN_PNO
1291/*--------------------------------------------------------------------------
1292
1293 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001294
1295 It is used at driver start up to inform RIVA of the default channel
1296 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001297
Srinivas Girigowdade697412013-02-14 16:31:48 -08001298 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001299
1300 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001301
Jeff Johnson295189b2012-06-20 16:38:30 -07001302 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1303
1304 Other status means SME is failed to update the channel config.
1305 \sa
1306
1307 --------------------------------------------------------------------------*/
1308eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1309{
1310 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1311
Katya Nigambcb705f2013-12-26 14:26:22 +05301312 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001313 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1314 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001315 &pMac->scan.base20MHzChannels, FALSE);
1316 return eHAL_STATUS_SUCCESS;
1317}
1318#endif // FEATURE_WLAN_SCAN_PNLO
1319
1320/*--------------------------------------------------------------------------
1321
1322 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1323
1324 The function updates some configuration for modules in SME, CCM, CSR, etc
1325 during SMEs close open sequence.
1326
1327 Modules inside SME apply the new configuration at the next transaction.
1328
Srinivas Girigowdade697412013-02-14 16:31:48 -08001329 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001330
1331 \param hHal - The handle returned by macOpen.
1332 \Param pSmeConfigParams - a pointer to a caller allocated object of
1333 typedef struct _smeConfigParams.
1334
1335 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1336
1337 Other status means SME is failed to update the config parameters.
1338 \sa
1339
1340 --------------------------------------------------------------------------*/
1341eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1342{
1343 eHalStatus status = eHAL_STATUS_FAILURE;
1344 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1345
Katya Nigambcb705f2013-12-26 14:26:22 +05301346 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001347 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 if (NULL == pSmeConfigParams ) {
1349 smsLog( pMac, LOGE,
1350 "Empty config param structure for SME, nothing to update");
1351 return status;
1352 }
1353
1354 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1355
1356 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001357 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001358 status );
1359 }
1360#if defined WLAN_FEATURE_P2P_INTERNAL
1361 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1362
1363 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001364 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001365 status );
1366 }
1367#endif
1368#if defined WLAN_FEATURE_VOWIFI
1369 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1370
1371 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001372 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001373 status );
1374 }
1375#endif
1376 //For SOC, CFG is set before start
1377 //We don't want to apply global CFG in connect state because that may cause some side affect
1378 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001379 csrIsAllSessionDisconnected( pMac) )
1380 {
1381 csrSetGlobalCfgs(pMac);
1382 }
1383
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301384 /* update the directed scan offload setting */
1385 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1386
Sandeep Puligilla60342762014-01-30 21:05:37 +05301387 /* Enable channel bonding mode in 2.4GHz */
1388 if ((pSmeConfigParams->csrConfig.channelBondingMode24GHz == TRUE) &&
1389 (IS_HT40_OBSS_SCAN_FEATURE_ENABLE))
1390 {
1391 ccmCfgSetInt(hHal,WNI_CFG_CHANNEL_BONDING_24G,
1392 eANI_BOOLEAN_TRUE, NULL,eANI_BOOLEAN_FALSE);
1393 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH,
1394 "Setting channelBondingMode24GHz:%d " ,
1395 pSmeConfigParams->csrConfig.channelBondingMode24GHz);
1396 }
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301397 if (pMac->fScanOffload)
1398 {
1399 /* If scan offload is enabled then lim has allow the sending of
1400 scan request to firmware even in powersave mode. The firmware has
1401 to take care of exiting from power save mode */
1402 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1403 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1404
1405 if (eHAL_STATUS_SUCCESS != status)
1406 {
1407 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1408 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1409 }
1410 }
krunal sonie9002db2013-11-25 14:24:17 -08001411 pMac->isCoalesingInIBSSAllowed =
1412 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001413 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Jeff Johnson295189b2012-06-20 16:38:30 -07001414 return status;
1415}
1416
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301417#ifdef WLAN_FEATURE_GTK_OFFLOAD
1418void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1419 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1420{
1421 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1422
1423 if (NULL == pMac)
1424 {
1425 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1426 "%s: pMac is null", __func__);
1427 return ;
1428 }
1429 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1430 {
1431 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1432 "%s: HDD callback is null", __func__);
1433 return ;
1434 }
1435 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1436 pGtkOffloadGetInfoRsp);
1437}
1438#endif
1439
Jeff Johnson295189b2012-06-20 16:38:30 -07001440/* ---------------------------------------------------------------------------
1441 \fn sme_ChangeConfigParams
1442 \brief The SME API exposed for HDD to provide config params to SME during
1443 SMEs stop -> start sequence.
1444
1445 If HDD changed the domain that will cause a reset. This function will
1446 provide the new set of 11d information for the new domain. Currrently this
1447 API provides info regarding 11d only at reset but we can extend this for
1448 other params (PMC, QoS) which needs to be initialized again at reset.
1449
Srinivas Girigowdade697412013-02-14 16:31:48 -08001450 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001451
1452 \param hHal - The handle returned by macOpen.
1453
1454 \Param
1455 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1456 currently provides 11d related information like Country code,
1457 Regulatory domain, valid channel list, Tx power per channel, a
1458 list with active/passive scan allowed per valid channel.
1459
1460 \return eHalStatus
1461 ---------------------------------------------------------------------------*/
1462eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1463 tCsrUpdateConfigParam *pUpdateConfigParam)
1464{
1465 eHalStatus status = eHAL_STATUS_FAILURE;
1466 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1467
1468 if (NULL == pUpdateConfigParam ) {
1469 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001470 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001471 return status;
1472 }
1473
1474 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1475
1476 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001477 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001478 status );
1479 }
1480
1481 return status;
1482
1483}
1484
1485/*--------------------------------------------------------------------------
1486
1487 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1488 that the NIC is ready tio run.
1489
1490 The function is called by HDD at the end of initialization stage so PE/HAL can
1491 enable the NIC to running state.
1492
Srinivas Girigowdade697412013-02-14 16:31:48 -08001493 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001494 \param hHal - The handle returned by macOpen.
1495
1496 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1497 successfully.
1498
1499 Other status means SME failed to send the message to PE.
1500 \sa
1501
1502 --------------------------------------------------------------------------*/
1503eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1504{
1505 tSirSmeReadyReq Msg;
1506 eHalStatus status = eHAL_STATUS_FAILURE;
1507 tPmcPowerState powerState;
1508 tPmcSwitchState hwWlanSwitchState;
1509 tPmcSwitchState swWlanSwitchState;
1510 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1511
Katya Nigambcb705f2013-12-26 14:26:22 +05301512 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001513 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001514 do
1515 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001516
1517 Msg.messageType = eWNI_SME_SYS_READY_IND;
1518 Msg.length = sizeof( tSirSmeReadyReq );
1519
1520 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1521 {
1522 status = eHAL_STATUS_SUCCESS;
1523 }
1524 else
1525 {
1526 smsLog( pMac, LOGE,
1527 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1528 break;
1529 }
1530
1531 status = pmcQueryPowerState( hHal, &powerState,
1532 &hwWlanSwitchState, &swWlanSwitchState );
1533 if ( ! HAL_STATUS_SUCCESS( status ) )
1534 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001535 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001536 status );
1537 break;
1538 }
1539
1540 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1541 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1542 {
1543 status = csrReady(pMac);
1544 if ( ! HAL_STATUS_SUCCESS( status ) )
1545 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001546 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001547 break;
1548 }
1549 status = pmcReady(hHal);
1550 if ( ! HAL_STATUS_SUCCESS( status ) )
1551 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001552 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001553 break;
1554 }
1555#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1556 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1557 {
1558 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001559 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001560 break;
1561 }
1562#endif
1563
1564#if defined WLAN_FEATURE_VOWIFI
1565 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1566 {
1567 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001568 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001569 break;
1570 }
1571#endif
1572 }
1573 pMac->sme.state = SME_STATE_READY;
1574 } while( 0 );
1575
1576 return status;
1577}
1578
1579/*--------------------------------------------------------------------------
1580
1581 \brief sme_Start() - Put all SME modules at ready state.
1582
1583 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1584 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001585 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001586 \param hHal - The handle returned by macOpen.
1587
1588 \return eHAL_STATUS_SUCCESS - SME is ready.
1589
1590 Other status means SME is failed to start
1591 \sa
1592
1593 --------------------------------------------------------------------------*/
1594eHalStatus sme_Start(tHalHandle hHal)
1595{
1596 eHalStatus status = eHAL_STATUS_FAILURE;
1597 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1598
1599 do
1600 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001601 status = csrStart(pMac);
1602 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001603 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001604 status );
1605 break;
1606 }
1607
1608 status = pmcStart(hHal);
1609 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001610 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001611 status );
1612 break;
1613 }
1614
Jeff Johnson295189b2012-06-20 16:38:30 -07001615 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1616 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001617 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001618 status );
1619 break;
1620 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001621 pMac->sme.state = SME_STATE_START;
1622 }while (0);
1623
1624 return status;
1625}
1626
1627
1628#ifdef WLAN_FEATURE_PACKET_FILTERING
1629/******************************************************************************
1630*
1631* Name: sme_PCFilterMatchCountResponseHandler
1632*
1633* Description:
1634* Invoke Packet Coalescing Filter Match Count callback routine
1635*
1636* Parameters:
1637* hHal - HAL handle for device
1638* pMsg - Pointer to tRcvFltPktMatchRsp structure
1639*
1640* Returns: eHalStatus
1641*
1642******************************************************************************/
1643eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1644{
1645 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1646 eHalStatus status = eHAL_STATUS_SUCCESS;
1647 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1648
1649 if (NULL == pMsg)
1650 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001651 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001652 status = eHAL_STATUS_FAILURE;
1653 }
1654 else
1655 {
1656 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001657 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001658
1659 /* Call Packet Coalescing Filter Match Count callback routine. */
1660 if (pMac->pmc.FilterMatchCountCB != NULL)
1661 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1662 pRcvFltPktMatchRsp);
1663
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001664 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001665 pRcvFltPktMatchRsp->status);
1666
1667 pMac->pmc.FilterMatchCountCB = NULL;
1668 pMac->pmc.FilterMatchCountCBContext = NULL;
1669 }
1670
1671 return(status);
1672}
1673#endif // WLAN_FEATURE_PACKET_FILTERING
1674
1675
Chet Lanctot186b5732013-03-18 10:26:30 -07001676#ifdef WLAN_FEATURE_11W
1677/*------------------------------------------------------------------
1678 *
1679 * Handle the unprotected management frame indication from LIM and
1680 * forward it to HDD.
1681 *
1682 *------------------------------------------------------------------*/
1683
1684eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1685 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1686{
1687 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1688 eHalStatus status = eHAL_STATUS_SUCCESS;
1689 tCsrRoamInfo pRoamInfo = {0};
1690 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1691
1692 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1693 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1694 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1695
1696 /* forward the mgmt frame to HDD */
1697 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1698
1699 return status;
1700}
1701#endif
1702
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001703#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
1704/*------------------------------------------------------------------
1705 *
1706 * Handle the tsm ie indication from LIM and forward it to HDD.
1707 *
1708 *------------------------------------------------------------------*/
1709
1710eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1711{
1712 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1713 eHalStatus status = eHAL_STATUS_SUCCESS;
1714 tCsrRoamInfo pRoamInfo = {0};
1715 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1716
1717 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1718 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1719 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1720
1721 /* forward the tsm ie information to HDD */
1722 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1723
1724 return status;
1725}
1726
1727/* ---------------------------------------------------------------------------
1728 \fn sme_SetCCKMIe
1729 \brief function to store the CCKM IE passed from supplicant and use it while packing
1730 reassociation request
1731 \param hHal - HAL handle for device
1732 \param pCckmIe - pointer to CCKM IE data
1733 \param pCckmIeLen - length of the CCKM IE
1734 \- return Success or failure
1735 -------------------------------------------------------------------------*/
1736eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1737 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1738{
1739 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1740 eHalStatus status = eHAL_STATUS_SUCCESS;
1741
1742 status = sme_AcquireGlobalLock( &pMac->sme );
1743 if ( HAL_STATUS_SUCCESS( status ) )
1744 {
1745 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1746 sme_ReleaseGlobalLock( &pMac->sme );
1747 }
1748 return status;
1749}
1750
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001751/* ---------------------------------------------------------------------------
1752 \fn sme_SetCcxBeaconRequest
1753 \brief function to set CCX beacon request parameters
1754 \param hHal - HAL handle for device
1755 \param sessionId - Session id
1756 \param pCcxBcnReq - pointer to CCX beacon request
1757 \- return Success or failure
1758 -------------------------------------------------------------------------*/
1759eHalStatus sme_SetCcxBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
1760 const tCsrCcxBeaconReq* pCcxBcnReq)
1761{
1762 eHalStatus status = eSIR_SUCCESS;
1763 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1764 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
1765 tCsrCcxBeaconReqParams *pBeaconReq = NULL;
1766 tANI_U8 counter = 0;
1767 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
1768 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
1769
1770 /* Store the info in RRM context */
1771 vos_mem_copy(&pSmeRrmContext->ccxBcnReqInfo, pCcxBcnReq, sizeof(tCsrCcxBeaconReq));
1772
1773 //Prepare the request to send to SME.
1774 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
1775 if(NULL == pSmeBcnReportReq)
1776 {
1777 smsLog(pMac, LOGP, "Memory Allocation Failure!!! CCX BcnReq Ind to SME");
1778 return eSIR_FAILURE;
1779 }
1780
1781 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
1782 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
1783
1784 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
1785 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
1786 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
1787 pSmeBcnReportReq->channelInfo.channelNum = 255;
1788 pSmeBcnReportReq->channelList.numChannels = pCcxBcnReq->numBcnReqIe;
Srinivas Girigowda6d1f9062014-02-03 18:15:54 -08001789 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_CCX_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001790
1791 for (counter = 0; counter < pCcxBcnReq->numBcnReqIe; counter++)
1792 {
1793 pBeaconReq = (tCsrCcxBeaconReqParams *)&pCcxBcnReq->bcnReq[counter];
1794 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
1795 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
1796 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
1797 }
1798
1799 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
1800 return status;
1801}
1802
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001803#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
1804
Chet Lanctot186b5732013-03-18 10:26:30 -07001805
Jeff Johnson295189b2012-06-20 16:38:30 -07001806/*--------------------------------------------------------------------------
1807
1808 \brief sme_ProcessMsg() - The main message processor for SME.
1809
1810 The function is called by a message dispatcher when to process a message
1811 targeted for SME.
1812
Srinivas Girigowdade697412013-02-14 16:31:48 -08001813 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001814 \param hHal - The handle returned by macOpen.
1815 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
1816
1817 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
1818
1819 Other status means SME failed to process the message to HAL.
1820 \sa
1821
1822 --------------------------------------------------------------------------*/
1823eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
1824{
1825 eHalStatus status = eHAL_STATUS_FAILURE;
1826 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1827
1828 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001829 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001830 return status;
1831 }
1832
1833 status = sme_AcquireGlobalLock( &pMac->sme );
1834 if ( HAL_STATUS_SUCCESS( status ) )
1835 {
1836 if( SME_IS_START(pMac) )
1837 {
1838 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
1839 case eWNI_PMC_ENTER_BMPS_RSP:
1840 case eWNI_PMC_EXIT_BMPS_RSP:
1841 case eWNI_PMC_EXIT_BMPS_IND:
1842 case eWNI_PMC_ENTER_IMPS_RSP:
1843 case eWNI_PMC_EXIT_IMPS_RSP:
1844 case eWNI_PMC_SMPS_STATE_IND:
1845 case eWNI_PMC_ENTER_UAPSD_RSP:
1846 case eWNI_PMC_EXIT_UAPSD_RSP:
1847 case eWNI_PMC_ENTER_WOWL_RSP:
1848 case eWNI_PMC_EXIT_WOWL_RSP:
1849 //PMC
1850 if (pMsg->bodyptr)
1851 {
1852 pmcMessageProcessor(hHal, pMsg->bodyptr);
1853 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301854 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001855 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001856 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001857 }
1858 break;
1859
1860 case WNI_CFG_SET_CNF:
1861 case WNI_CFG_DNLD_CNF:
1862 case WNI_CFG_GET_RSP:
1863 case WNI_CFG_ADD_GRP_ADDR_CNF:
1864 case WNI_CFG_DEL_GRP_ADDR_CNF:
1865 //CCM
1866 if (pMsg->bodyptr)
1867 {
1868 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
1869 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05301870 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001871 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001872 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001873 }
1874 break;
1875
1876 case eWNI_SME_ADDTS_RSP:
1877 case eWNI_SME_DELTS_RSP:
1878 case eWNI_SME_DELTS_IND:
1879#ifdef WLAN_FEATURE_VOWIFI_11R
1880 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001881#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001882 //QoS
1883 if (pMsg->bodyptr)
1884 {
1885#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1886 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05301887 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001888#endif
1889 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001890 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001891 }
1892 break;
1893#if defined WLAN_FEATURE_VOWIFI
1894 case eWNI_SME_NEIGHBOR_REPORT_IND:
1895 case eWNI_SME_BEACON_REPORT_REQ_IND:
1896#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001897 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07001898#endif
1899 if ( pMsg->bodyptr )
1900 {
1901 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05301902 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001903 }
1904 else
1905 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001906 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001907 }
1908 break;
1909#endif
1910
Jeff Johnsone7245742012-09-05 17:12:55 -07001911#ifdef FEATURE_OEM_DATA_SUPPORT
1912 //Handle the eWNI_SME_OEM_DATA_RSP:
1913 case eWNI_SME_OEM_DATA_RSP:
1914 if(pMsg->bodyptr)
1915 {
1916 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
1917 vos_mem_free(pMsg->bodyptr);
1918 }
1919 else
1920 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001921 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07001922 }
1923 smeProcessPendingQueue( pMac );
1924 break;
1925#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001926
1927 case eWNI_SME_ADD_STA_SELF_RSP:
1928 if(pMsg->bodyptr)
1929 {
1930 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
1931 vos_mem_free(pMsg->bodyptr);
1932 }
1933 else
1934 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001935 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001936 }
1937 break;
1938 case eWNI_SME_DEL_STA_SELF_RSP:
1939 if(pMsg->bodyptr)
1940 {
1941 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
1942 vos_mem_free(pMsg->bodyptr);
1943 }
1944 else
1945 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001946 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001947 }
1948 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001949 case eWNI_SME_REMAIN_ON_CHN_RSP:
1950 if(pMsg->bodyptr)
1951 {
1952 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
1953 vos_mem_free(pMsg->bodyptr);
1954 }
1955 else
1956 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001957 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001958 }
1959 break;
1960 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
1961 if(pMsg->bodyptr)
1962 {
1963 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
1964 vos_mem_free(pMsg->bodyptr);
1965 }
1966 else
1967 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001968 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 -07001969 }
1970 break;
1971 case eWNI_SME_MGMT_FRM_IND:
1972 if(pMsg->bodyptr)
1973 {
1974 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
1975 vos_mem_free(pMsg->bodyptr);
1976 }
1977 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001978 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001979 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001980 }
1981 break;
1982 case eWNI_SME_ACTION_FRAME_SEND_CNF:
1983 if(pMsg->bodyptr)
1984 {
1985 status = sme_sendActionCnf(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_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07001991 }
1992 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001993 case eWNI_SME_COEX_IND:
1994 if(pMsg->bodyptr)
1995 {
1996 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
1997 vos_mem_free(pMsg->bodyptr);
1998 }
1999 else
2000 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002001 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002002 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002003 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002004
2005#ifdef FEATURE_WLAN_SCAN_PNO
2006 case eWNI_SME_PREF_NETWORK_FOUND_IND:
2007 if(pMsg->bodyptr)
2008 {
2009 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2010 vos_mem_free(pMsg->bodyptr);
2011 }
2012 else
2013 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002014 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002015 }
2016 break;
2017#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002018
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 case eWNI_SME_TX_PER_HIT_IND:
2020 if (pMac->sme.pTxPerHitCallback)
2021 {
2022 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2023 }
2024 break;
2025
2026 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002027 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002028 {
2029 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2030 vos_mem_free(pMsg->bodyptr);
2031 }
2032 else
2033 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002034 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2035 }
2036 break;
2037
2038 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2039 if (pMsg->bodyptr)
2040 {
2041 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2042 vos_mem_free(pMsg->bodyptr);
2043 }
2044 else
2045 {
2046 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002047 }
2048 break;
2049
2050#ifdef WLAN_FEATURE_PACKET_FILTERING
2051 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2052 if(pMsg->bodyptr)
2053 {
2054 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2055 vos_mem_free(pMsg->bodyptr);
2056 }
2057 else
2058 {
2059 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002060 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002061 }
2062 break;
2063#endif // WLAN_FEATURE_PACKET_FILTERING
2064 case eWNI_SME_PRE_SWITCH_CHL_IND:
2065 {
2066 status = sme_HandlePreChannelSwitchInd(pMac);
2067 break;
2068 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002069
Jeff Johnson295189b2012-06-20 16:38:30 -07002070 case eWNI_SME_POST_SWITCH_CHL_IND:
2071 {
2072 status = sme_HandlePostChannelSwitchInd(pMac);
2073 break;
2074 }
2075
2076#ifdef WLAN_WAKEUP_EVENTS
2077 case eWNI_SME_WAKE_REASON_IND:
2078 if(pMsg->bodyptr)
2079 {
2080 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2081 vos_mem_free(pMsg->bodyptr);
2082 }
2083 else
2084 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002085 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002086 }
2087 break;
2088#endif // WLAN_WAKEUP_EVENTS
2089
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002090#ifdef FEATURE_WLAN_TDLS
2091 /*
2092 * command rescived from PE, SME tdls msg processor shall be called
2093 * to process commands recieved from PE
2094 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002095 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2096 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002097 case eWNI_SME_TDLS_DEL_STA_RSP:
2098 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002099 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002100 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302101 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002102#ifdef FEATURE_WLAN_TDLS_INTERNAL
2103 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
2104 case eWNI_SME_TDLS_DISCOVERY_START_IND:
2105 case eWNI_SME_TDLS_LINK_START_RSP:
2106 case eWNI_SME_TDLS_LINK_START_IND:
2107 case eWNI_SME_TDLS_TEARDOWN_RSP:
2108 case eWNI_SME_TDLS_TEARDOWN_IND:
2109 case eWNI_SME_ADD_TDLS_PEER_IND:
2110 case eWNI_SME_DELETE_TDLS_PEER_IND:
2111#endif
2112 {
2113 if (pMsg->bodyptr)
2114 {
2115 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302116 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002117 }
2118 else
2119 {
2120 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002121 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002122 }
2123 break;
2124 }
2125#endif
2126
Chet Lanctot186b5732013-03-18 10:26:30 -07002127#ifdef WLAN_FEATURE_11W
2128 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2129 if (pMsg->bodyptr)
2130 {
2131 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2132 vos_mem_free(pMsg->bodyptr);
2133 }
2134 else
2135 {
2136 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2137 }
2138 break;
2139#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002140#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
2141 case eWNI_SME_TSM_IE_IND:
2142 {
2143 if (pMsg->bodyptr)
2144 {
2145 sme_TsmIeInd(pMac, pMsg->bodyptr);
2146 vos_mem_free(pMsg->bodyptr);
2147 }
2148 else
2149 {
2150 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2151 }
2152 break;
2153 }
2154#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002155#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2156 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2157 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2158 break;
2159#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002160
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302161#ifdef WLAN_FEATURE_GTK_OFFLOAD
2162 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2163 if (pMsg->bodyptr)
2164 {
2165 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
2166 vos_mem_free(pMsg->bodyptr);
2167 }
2168 else
2169 {
2170 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2171 }
2172 break ;
2173#endif
Leo Chang9056f462013-08-01 19:21:11 -07002174
2175#ifdef FEATURE_WLAN_LPHB
2176 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002177 case eWNI_SME_LPHB_IND:
2178 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002179 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002180 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002181 }
2182 vos_mem_free(pMsg->bodyptr);
2183
2184 break;
2185#endif /* FEATURE_WLAN_LPHB */
2186
Leo Chang0b0e45a2013-12-15 15:18:55 -08002187#ifdef FEATURE_WLAN_CH_AVOID
2188 /* LPHB timeout indication arrived, send IND to client */
2189 case eWNI_SME_CH_AVOID_IND:
2190 if (pMac->sme.pChAvoidNotificationCb)
2191 {
2192 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2193 "%s: CH avoid notification", __func__);
2194 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2195 }
2196 vos_mem_free(pMsg->bodyptr);
2197
2198 break;
2199#endif /* FEATURE_WLAN_CH_AVOID */
2200
Jeff Johnson295189b2012-06-20 16:38:30 -07002201 default:
2202
2203 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2204 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2205 {
2206 //CSR
2207 if (pMsg->bodyptr)
2208 {
2209 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302210 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002211 }
2212 else
2213 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002214 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 }
2216 }
2217 else
2218 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002219 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 pMsg->type);
2221 if (pMsg->bodyptr)
2222 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302223 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002224 }
2225 }
2226 }//switch
2227 } //SME_IS_START
2228 else
2229 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002230 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 if (pMsg->bodyptr)
2232 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302233 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002234 }
2235 }
2236 sme_ReleaseGlobalLock( &pMac->sme );
2237 }
2238 else
2239 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002240 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 if (pMsg->bodyptr)
2242 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302243 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002244 }
2245 }
2246
2247 return status;
2248}
2249
2250
2251//No need to hold the global lock here because this function can only be called
2252//after sme_Stop.
2253v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2254{
2255 if( pMsg )
2256 {
2257 if (pMsg->bodyptr)
2258 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302259 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002260 }
2261 }
2262
2263}
2264
2265
2266/*--------------------------------------------------------------------------
2267
2268 \brief sme_Stop() - Stop all SME modules and put them at idle state
2269
2270 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2271 return, all modules are at idle state ready to start.
2272
Srinivas Girigowdade697412013-02-14 16:31:48 -08002273 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002274 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302275 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002276
2277 \return eHAL_STATUS_SUCCESS - SME is stopped.
2278
2279 Other status means SME is failed to stop but caller should still
2280 consider SME is stopped.
2281 \sa
2282
2283 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302284eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002285{
2286 eHalStatus status = eHAL_STATUS_FAILURE;
2287 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2288 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2289
Jeff Johnson295189b2012-06-20 16:38:30 -07002290 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2291 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002292 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002293 status );
2294 fail_status = status;
2295 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002296
2297 p2pStop(hHal);
2298
Kiet Lama72a2322013-11-15 11:18:11 +05302299 status = pmcStop(hHal);
2300 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2301 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2302 status );
2303 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002304 }
2305
Kiet Lama72a2322013-11-15 11:18:11 +05302306 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002308 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002309 status );
2310 fail_status = status;
2311 }
2312
2313 ccmStop(hHal);
2314
2315 purgeSmeCmdList(pMac);
2316
2317 if (!HAL_STATUS_SUCCESS( fail_status )) {
2318 status = fail_status;
2319 }
2320
2321 pMac->sme.state = SME_STATE_STOP;
2322
2323 return status;
2324}
2325
2326/*--------------------------------------------------------------------------
2327
2328 \brief sme_Close() - Release all SME modules and their resources.
2329
2330 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2331 return, all modules are at closed state.
2332
2333 No SME APIs can be involved after smeClose except smeOpen.
2334 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002335 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002336 \param hHal - The handle returned by macOpen
2337
2338 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2339
2340 Other status means SME is failed to be closed but caller still cannot
2341 call any other SME functions except smeOpen.
2342 \sa
2343
2344 --------------------------------------------------------------------------*/
2345eHalStatus sme_Close(tHalHandle hHal)
2346{
2347 eHalStatus status = eHAL_STATUS_FAILURE;
2348 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2349 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2350
2351 status = csrClose(pMac);
2352 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002353 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002354 status );
2355 fail_status = status;
2356 }
2357
Jeff Johnson295189b2012-06-20 16:38:30 -07002358 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2359 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002360 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002361 status );
2362 fail_status = status;
2363 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002364
2365#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2366 status = btcClose(hHal);
2367 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002368 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002369 status );
2370 fail_status = status;
2371 }
2372
2373 status = sme_QosClose(pMac);
2374 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002375 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002376 status );
2377 fail_status = status;
2378 }
2379#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002380#ifdef FEATURE_OEM_DATA_SUPPORT
2381 status = oemData_OemDataReqClose(hHal);
2382 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002383 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002384 status );
2385 fail_status = status;
2386 }
2387#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002388
2389 status = ccmClose(hHal);
2390 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002391 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002392 status );
2393 fail_status = status;
2394 }
2395
2396 status = pmcClose(hHal);
2397 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002398 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002399 status );
2400 fail_status = status;
2401 }
2402#if defined WLAN_FEATURE_VOWIFI
2403 status = rrmClose(hHal);
2404 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002405 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002406 status );
2407 fail_status = status;
2408 }
2409#endif
2410
2411#if defined WLAN_FEATURE_VOWIFI_11R
2412 sme_FTClose(hHal);
2413#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002414 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002415
2416 freeSmeCmdList(pMac);
2417
2418 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2419 {
2420 fail_status = eHAL_STATUS_FAILURE;
2421 }
2422
2423 if (!HAL_STATUS_SUCCESS( fail_status )) {
2424 status = fail_status;
2425 }
2426
2427 pMac->sme.state = SME_STATE_STOP;
2428
2429 return status;
2430}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002431#ifdef FEATURE_WLAN_LFR
2432tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2433{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002434#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002435 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2436 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2437 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2438 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2439 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2440 return eANI_BOOLEAN_FALSE;
2441 default:
2442 return eANI_BOOLEAN_TRUE;
2443 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002444#else
2445 /*
2446 * TODO: always return TRUE for now until
2447 * we figure out why we could be stuck in
2448 * one of the roaming states forever.
2449 */
2450 return eANI_BOOLEAN_TRUE;
2451#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002452}
2453#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002454/* ---------------------------------------------------------------------------
2455 \fn sme_ScanRequest
2456 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002457 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002458 \param pScanRequestID - pointer to an object to get back the request ID
2459 \param callback - a callback function that scan calls upon finish, will not
2460 be called if csrScanRequest returns error
2461 \param pContext - a pointer passed in for the callback
2462 \return eHalStatus
2463 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002464eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2465 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002466 csrScanCompleteCallback callback, void *pContext)
2467{
2468 eHalStatus status = eHAL_STATUS_FAILURE;
2469 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05302470 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002471 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002472 smsLog(pMac, LOG2, FL("enter"));
2473 do
2474 {
2475 if(pMac->scan.fScanEnable)
2476 {
2477 status = sme_AcquireGlobalLock( &pMac->sme );
2478 if ( HAL_STATUS_SUCCESS( status ) )
2479 {
2480 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002481#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002482 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002483 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002484#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002485 status = csrScanRequest( hHal, sessionId, pscanReq,
2486 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05302487 if ( !HAL_STATUS_SUCCESS( status ) )
2488 {
2489 smsLog(pMac, LOGE, FL("csrScanRequest failed"
2490 " SId=%d"), sessionId);
2491 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002492#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002493 }
2494 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002495 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302496 smsLog(pMac, LOGE, FL("Scan denied in state %s"
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302497 "(sub-state %s)"),
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302498 macTraceGetNeighbourRoamState(
2499 pMac->roam.neighborRoamInfo.neighborRoamState),
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302500 macTraceGetcsrRoamSubState(
2501 pMac->roam.curSubState[sessionId]));
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002502 /*HandOff is in progress. So schedule this scan later*/
2503 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002504 }
2505#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002506 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002507
Jeff Johnson295189b2012-06-20 16:38:30 -07002508 sme_ReleaseGlobalLock( &pMac->sme );
2509 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002510 else
2511 {
2512 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2513 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002514 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002515 else
2516 {
2517 smsLog(pMac, LOGE, FL("fScanEnable FALSE"));
2518 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002519 } while( 0 );
2520
2521 return (status);
2522
2523
2524}
2525
2526/* ---------------------------------------------------------------------------
2527 \fn sme_ScanGetResult
2528 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002529 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002530 \param pFilter - If pFilter is NULL, all cached results are returned
2531 \param phResult - an object for the result.
2532 \return eHalStatus
2533 ---------------------------------------------------------------------------*/
2534eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2535 tScanResultHandle *phResult)
2536{
2537 eHalStatus status = eHAL_STATUS_FAILURE;
2538 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2539
Katya Nigambcb705f2013-12-26 14:26:22 +05302540 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002541 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002542 smsLog(pMac, LOG2, FL("enter"));
2543 status = sme_AcquireGlobalLock( &pMac->sme );
2544 if ( HAL_STATUS_SUCCESS( status ) )
2545 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002546 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002547 sme_ReleaseGlobalLock( &pMac->sme );
2548 }
2549 smsLog(pMac, LOG2, FL("exit status %d"), status);
2550
2551 return (status);
2552}
2553
2554
2555/* ---------------------------------------------------------------------------
2556 \fn sme_ScanFlushResult
2557 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002558 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002559 \return eHalStatus
2560 ---------------------------------------------------------------------------*/
2561eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2562{
2563 eHalStatus status = eHAL_STATUS_FAILURE;
2564 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2565
Katya Nigambcb705f2013-12-26 14:26:22 +05302566 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002567 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002568 status = sme_AcquireGlobalLock( &pMac->sme );
2569 if ( HAL_STATUS_SUCCESS( status ) )
2570 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002571 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002572 sme_ReleaseGlobalLock( &pMac->sme );
2573 }
2574
2575 return (status);
2576}
2577
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05302578/* ---------------------------------------------------------------------------
2579 \fn sme_FilterScanResults
2580 \brief a wrapper function to request CSR to clear scan results.
2581 This is a synchronous call
2582 \return eHalStatus
2583 ---------------------------------------------------------------------------*/
2584eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
2585{
2586 eHalStatus status = eHAL_STATUS_SUCCESS;
2587 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2588
2589 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2590 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
2591 status = sme_AcquireGlobalLock( &pMac->sme );
2592 if ( HAL_STATUS_SUCCESS( status ) )
2593 {
2594 csrScanFilterResults(pMac);
2595 sme_ReleaseGlobalLock( &pMac->sme );
2596 }
2597
2598 return (status);
2599}
2600
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002601eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2602{
2603 eHalStatus status = eHAL_STATUS_FAILURE;
2604 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
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_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002608 status = sme_AcquireGlobalLock( &pMac->sme );
2609 if ( HAL_STATUS_SUCCESS( status ) )
2610 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302611 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002612 sme_ReleaseGlobalLock( &pMac->sme );
2613 }
2614
2615 return (status);
2616}
Jeff Johnson295189b2012-06-20 16:38:30 -07002617
2618/* ---------------------------------------------------------------------------
2619 \fn sme_ScanResultGetFirst
2620 \brief a wrapper function to request CSR to returns the first element of
2621 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002622 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002623 \param hScanResult - returned from csrScanGetResult
2624 \return tCsrScanResultInfo * - NULL if no result
2625 ---------------------------------------------------------------------------*/
2626tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2627 tScanResultHandle hScanResult)
2628{
2629 eHalStatus status = eHAL_STATUS_FAILURE;
2630 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2631 tCsrScanResultInfo *pRet = NULL;
2632
Katya Nigambcb705f2013-12-26 14:26:22 +05302633 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002634 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002635 status = sme_AcquireGlobalLock( &pMac->sme );
2636 if ( HAL_STATUS_SUCCESS( status ) )
2637 {
2638 pRet = csrScanResultGetFirst( pMac, hScanResult );
2639 sme_ReleaseGlobalLock( &pMac->sme );
2640 }
2641
2642 return (pRet);
2643}
2644
2645
2646/* ---------------------------------------------------------------------------
2647 \fn sme_ScanResultGetNext
2648 \brief a wrapper function to request CSR to returns the next element of
2649 scan result. It can be called without calling csrScanResultGetFirst
2650 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002651 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002652 \param hScanResult - returned from csrScanGetResult
2653 \return Null if no result or reach the end
2654 ---------------------------------------------------------------------------*/
2655tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2656 tScanResultHandle hScanResult)
2657{
2658 eHalStatus status = eHAL_STATUS_FAILURE;
2659 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2660 tCsrScanResultInfo *pRet = NULL;
2661
Katya Nigambcb705f2013-12-26 14:26:22 +05302662 MTRACE(vos_trace(VOS_MODULE_ID_SME ,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002663 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002664 status = sme_AcquireGlobalLock( &pMac->sme );
2665 if ( HAL_STATUS_SUCCESS( status ) )
2666 {
2667 pRet = csrScanResultGetNext( pMac, hScanResult );
2668 sme_ReleaseGlobalLock( &pMac->sme );
2669 }
2670
2671 return (pRet);
2672}
2673
2674
2675/* ---------------------------------------------------------------------------
2676 \fn sme_ScanSetBGScanparams
2677 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002678 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002679 \param pScanReq - BG scan request structure
2680 \return eHalStatus
2681 ---------------------------------------------------------------------------*/
2682eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2683{
2684 eHalStatus status = eHAL_STATUS_FAILURE;
2685 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2686
2687 if( NULL != pScanReq )
2688 {
2689 status = sme_AcquireGlobalLock( &pMac->sme );
2690 if ( HAL_STATUS_SUCCESS( status ) )
2691 {
2692 status = csrScanSetBGScanparams( hHal, pScanReq );
2693 sme_ReleaseGlobalLock( &pMac->sme );
2694 }
2695 }
2696
2697 return (status);
2698}
2699
2700
2701/* ---------------------------------------------------------------------------
2702 \fn sme_ScanResultPurge
2703 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2704 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002705 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002706 \param hScanResult - returned from csrScanGetResult. hScanResult is
2707 considered gone by
2708 calling this function and even before this function reutrns.
2709 \return eHalStatus
2710 ---------------------------------------------------------------------------*/
2711eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
2712{
2713 eHalStatus status = eHAL_STATUS_FAILURE;
2714 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2715
Katya Nigambcb705f2013-12-26 14:26:22 +05302716 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002717 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002718 status = sme_AcquireGlobalLock( &pMac->sme );
2719 if ( HAL_STATUS_SUCCESS( status ) )
2720 {
2721 status = csrScanResultPurge( hHal, hScanResult );
2722 sme_ReleaseGlobalLock( &pMac->sme );
2723 }
2724
2725 return (status);
2726}
2727
2728/* ---------------------------------------------------------------------------
2729 \fn sme_ScanGetPMKIDCandidateList
2730 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08002731 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002732 \param pPmkidList - caller allocated buffer point to an array of
2733 tPmkidCandidateInfo
2734 \param pNumItems - pointer to a variable that has the number of
2735 tPmkidCandidateInfo allocated when retruning, this is
2736 either the number needed or number of items put into
2737 pPmkidList
2738 \return eHalStatus - when fail, it usually means the buffer allocated is not
2739 big enough and pNumItems
2740 has the number of tPmkidCandidateInfo.
2741 \Note: pNumItems is a number of tPmkidCandidateInfo,
2742 not sizeof(tPmkidCandidateInfo) * something
2743 ---------------------------------------------------------------------------*/
2744eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002745 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07002746 tANI_U32 *pNumItems )
2747{
2748 eHalStatus status = eHAL_STATUS_FAILURE;
2749 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2750
2751 status = sme_AcquireGlobalLock( &pMac->sme );
2752 if ( HAL_STATUS_SUCCESS( status ) )
2753 {
2754 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
2755 sme_ReleaseGlobalLock( &pMac->sme );
2756 }
2757
2758 return (status);
2759}
2760
2761/*----------------------------------------------------------------------------
2762 \fn sme_RoamRegisterLinkQualityIndCallback
2763
2764 \brief
2765 a wrapper function to allow HDD to register a callback handler with CSR for
2766 link quality indications.
2767
2768 Only one callback may be registered at any time.
2769 In order to deregister the callback, a NULL cback may be provided.
2770
2771 Registration happens in the task context of the caller.
2772
2773 \param callback - Call back being registered
2774 \param pContext - user data
2775
2776 DEPENDENCIES: After CSR open
2777
2778 \return eHalStatus
2779-----------------------------------------------------------------------------*/
2780eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
2781 csrRoamLinkQualityIndCallback callback,
2782 void *pContext)
2783{
2784 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
2785}
2786
2787/* ---------------------------------------------------------------------------
2788 \fn sme_RoamRegisterCallback
2789 \brief a wrapper function to allow HDD to register a callback with CSR.
2790 Unlike scan, roam has one callback for all the roam requests
2791 \param callback - a callback function that roam calls upon when state changes
2792 \param pContext - a pointer passed in for the callback
2793 \return eHalStatus
2794 ---------------------------------------------------------------------------*/
2795eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
2796 csrRoamCompleteCallback callback,
2797 void *pContext)
2798{
2799 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
2800}
2801
2802eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
2803{
2804 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
2805 return pMac->roam.configParam.phyMode;
2806}
2807
2808/* ---------------------------------------------------------------------------
2809 \fn sme_RoamConnect
2810 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08002811 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002812 \param sessionId - the sessionId returned by sme_OpenSession.
2813 \param pProfile - description of the network to which to connect
2814 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
2815 from csrScanGetResult
2816 \param pRoamId - to get back the request ID
2817 \return eHalStatus
2818 ---------------------------------------------------------------------------*/
2819eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2820 tANI_U32 *pRoamId)
2821{
2822 eHalStatus status = eHAL_STATUS_FAILURE;
2823 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2824
Katya Nigambcb705f2013-12-26 14:26:22 +05302825 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002826 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002827 smsLog(pMac, LOG2, FL("enter"));
2828 status = sme_AcquireGlobalLock( &pMac->sme );
2829 if ( HAL_STATUS_SUCCESS( status ) )
2830 {
2831 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2832 {
2833 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
2834 }
2835 else
2836 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002837 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002838 status = eHAL_STATUS_INVALID_PARAMETER;
2839 }
2840 sme_ReleaseGlobalLock( &pMac->sme );
2841 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002842 else
2843 {
2844 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2845 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002846
2847 return (status);
2848}
2849
2850/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05302851
2852 \fn sme_SetPhyMode
2853
2854 \brief Changes the PhyMode.
2855
2856 \param hHal - The handle returned by macOpen.
2857
2858 \param phyMode new phyMode which is to set
2859
2860 \return eHalStatus SUCCESS.
2861
2862 -------------------------------------------------------------------------------*/
2863eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
2864{
2865 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2866
2867 if (NULL == pMac)
2868 {
2869 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2870 "%s: invalid context", __func__);
2871 return eHAL_STATUS_FAILURE;
2872 }
2873
2874 pMac->roam.configParam.phyMode = phyMode;
2875 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
2876 pMac->roam.configParam.phyMode,
2877 pMac->roam.configParam.ProprietaryRatesEnabled);
2878
2879 return eHAL_STATUS_SUCCESS;
2880}
2881
2882/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07002883 \fn sme_RoamReassoc
2884 \brief a wrapper function to request CSR to inititiate a re-association
2885 \param pProfile - can be NULL to join the currently connected AP. In that
2886 case modProfileFields should carry the modified field(s) which could trigger
2887 reassoc
2888 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
2889 that might need modification dynamically once STA is up & running and this
2890 could trigger a reassoc
2891 \param pRoamId - to get back the request ID
2892 \return eHalStatus
2893 -------------------------------------------------------------------------------*/
2894eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
2895 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002896 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07002897{
2898 eHalStatus status = eHAL_STATUS_FAILURE;
2899 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2900
Katya Nigambcb705f2013-12-26 14:26:22 +05302901 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002902 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07002903 smsLog(pMac, LOG2, FL("enter"));
2904 status = sme_AcquireGlobalLock( &pMac->sme );
2905 if ( HAL_STATUS_SUCCESS( status ) )
2906 {
2907 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2908 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002909 if((NULL == pProfile) && (fForce == 1))
2910 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07002911 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
2912 /* to force the AP initiate fresh 802.1x authentication need to clear
2913 * the PMKID cache for that set the following boolean. this is needed
2914 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
2915 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07002916 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
2917 }
2918 else
2919 {
2920 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002921 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002922 }
2923 else
2924 {
2925 status = eHAL_STATUS_INVALID_PARAMETER;
2926 }
2927 sme_ReleaseGlobalLock( &pMac->sme );
2928 }
2929
2930 return (status);
2931}
2932
2933/* ---------------------------------------------------------------------------
2934 \fn sme_RoamConnectToLastProfile
2935 \brief a wrapper function to request CSR to disconnect and reconnect with
2936 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08002937 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002938 \return eHalStatus. It returns fail if currently connected
2939 ---------------------------------------------------------------------------*/
2940eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
2941{
2942 eHalStatus status = eHAL_STATUS_FAILURE;
2943 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2944
2945 status = sme_AcquireGlobalLock( &pMac->sme );
2946 if ( HAL_STATUS_SUCCESS( status ) )
2947 {
2948 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2949 {
2950 status = csrRoamConnectToLastProfile( pMac, sessionId );
2951 }
2952 else
2953 {
2954 status = eHAL_STATUS_INVALID_PARAMETER;
2955 }
2956 sme_ReleaseGlobalLock( &pMac->sme );
2957 }
2958
2959 return (status);
2960}
2961
2962/* ---------------------------------------------------------------------------
2963 \fn sme_RoamDisconnect
2964 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08002965 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07002966 \param reason -- To indicate the reason for disconnecting. Currently, only
2967 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
2968 \return eHalStatus
2969 ---------------------------------------------------------------------------*/
2970eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
2971{
2972 eHalStatus status = eHAL_STATUS_FAILURE;
2973 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2974
Katya Nigambcb705f2013-12-26 14:26:22 +05302975 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002976 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07002977 smsLog(pMac, LOG2, FL("enter"));
2978 status = sme_AcquireGlobalLock( &pMac->sme );
2979 if ( HAL_STATUS_SUCCESS( status ) )
2980 {
2981 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
2982 {
2983 status = csrRoamDisconnect( pMac, sessionId, reason );
2984 }
2985 else
2986 {
2987 status = eHAL_STATUS_INVALID_PARAMETER;
2988 }
2989 sme_ReleaseGlobalLock( &pMac->sme );
2990 }
2991
2992 return (status);
2993}
2994
Jeff Johnson295189b2012-06-20 16:38:30 -07002995/* ---------------------------------------------------------------------------
2996 \fn sme_RoamStopBss
2997 \brief To stop BSS for Soft AP. This is an asynchronous API.
2998 \param hHal - Global structure
2999 \param sessionId - sessionId of SoftAP
3000 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3001 -------------------------------------------------------------------------------*/
3002eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3003{
3004 eHalStatus status = eHAL_STATUS_FAILURE;
3005 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3006
3007 smsLog(pMac, LOG2, FL("enter"));
3008 status = sme_AcquireGlobalLock( &pMac->sme );
3009 if ( HAL_STATUS_SUCCESS( status ) )
3010 {
3011 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3012 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303013 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003014 }
3015 else
3016 {
3017 status = eHAL_STATUS_INVALID_PARAMETER;
3018 }
3019 sme_ReleaseGlobalLock( &pMac->sme );
3020 }
3021
3022 return (status);
3023}
3024
3025/* ---------------------------------------------------------------------------
3026 \fn sme_RoamDisconnectSta
3027 \brief To disassociate a station. This is an asynchronous API.
3028 \param hHal - Global structure
3029 \param sessionId - sessionId of SoftAP
3030 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3031 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3032 -------------------------------------------------------------------------------*/
3033eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
3034 tANI_U8 *pPeerMacAddr)
3035{
3036 eHalStatus status = eHAL_STATUS_FAILURE;
3037 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3038
3039 if ( NULL == pMac )
3040 {
3041 VOS_ASSERT(0);
3042 return status;
3043 }
3044
3045 status = sme_AcquireGlobalLock( &pMac->sme );
3046 if ( HAL_STATUS_SUCCESS( status ) )
3047 {
3048 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3049 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003050 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303051 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003052 }
3053 else
3054 {
3055 status = eHAL_STATUS_INVALID_PARAMETER;
3056 }
3057 sme_ReleaseGlobalLock( &pMac->sme );
3058 }
3059
3060 return (status);
3061}
3062
3063/* ---------------------------------------------------------------------------
3064 \fn sme_RoamDeauthSta
3065 \brief To disassociate a station. This is an asynchronous API.
3066 \param hHal - Global structure
3067 \param sessionId - sessionId of SoftAP
3068 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3069 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3070 -------------------------------------------------------------------------------*/
3071eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
3072 tANI_U8 *pPeerMacAddr)
3073{
3074 eHalStatus status = eHAL_STATUS_FAILURE;
3075 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3076
3077 if ( NULL == pMac )
3078 {
3079 VOS_ASSERT(0);
3080 return status;
3081 }
3082
3083 status = sme_AcquireGlobalLock( &pMac->sme );
3084 if ( HAL_STATUS_SUCCESS( status ) )
3085 {
3086 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3087 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003088 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303089 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003090 }
3091 else
3092 {
3093 status = eHAL_STATUS_INVALID_PARAMETER;
3094 }
3095 sme_ReleaseGlobalLock( &pMac->sme );
3096 }
3097
3098 return (status);
3099}
3100
3101/* ---------------------------------------------------------------------------
3102 \fn sme_RoamTKIPCounterMeasures
3103 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3104 \param sessionId - sessionId of SoftAP
3105 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3106 \return eHalStatus
3107 -------------------------------------------------------------------------------*/
3108eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3109 tANI_BOOLEAN bEnable)
3110{
3111 eHalStatus status = eHAL_STATUS_FAILURE;
3112 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3113
3114 if ( NULL == pMac )
3115 {
3116 VOS_ASSERT(0);
3117 return status;
3118 }
3119
3120 status = sme_AcquireGlobalLock( &pMac->sme );
3121 if ( HAL_STATUS_SUCCESS( status ) )
3122 {
3123 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3124 {
3125 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3126 }
3127 else
3128 {
3129 status = eHAL_STATUS_INVALID_PARAMETER;
3130 }
3131 sme_ReleaseGlobalLock( &pMac->sme );
3132 }
3133
3134 return (status);
3135}
3136
3137/* ---------------------------------------------------------------------------
3138 \fn sme_RoamGetAssociatedStas
3139 \brief To probe the list of associated stations from various modules of CORE stack.
3140 \This is an asynchronous API.
3141 \param sessionId - sessionId of SoftAP
3142 \param modId - Module from whom list of associtated stations is to be probed.
3143 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3144 \param pUsrContext - Opaque HDD context
3145 \param pfnSapEventCallback - Sap event callback in HDD
3146 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3147 \return eHalStatus
3148 -------------------------------------------------------------------------------*/
3149eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3150 VOS_MODULE_ID modId, void *pUsrContext,
3151 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3152{
3153 eHalStatus status = eHAL_STATUS_FAILURE;
3154 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3155
3156 if ( NULL == pMac )
3157 {
3158 VOS_ASSERT(0);
3159 return status;
3160 }
3161
3162 status = sme_AcquireGlobalLock( &pMac->sme );
3163 if ( HAL_STATUS_SUCCESS( status ) )
3164 {
3165 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3166 {
3167 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3168 }
3169 else
3170 {
3171 status = eHAL_STATUS_INVALID_PARAMETER;
3172 }
3173 sme_ReleaseGlobalLock( &pMac->sme );
3174 }
3175
3176 return (status);
3177}
3178
3179/* ---------------------------------------------------------------------------
3180 \fn sme_RoamGetWpsSessionOverlap
3181 \brief To get the WPS PBC session overlap information.
3182 \This is an asynchronous API.
3183 \param sessionId - sessionId of SoftAP
3184 \param pUsrContext - Opaque HDD context
3185 \param pfnSapEventCallback - Sap event callback in HDD
3186 \pRemoveMac - pointer to Mac address which needs to be removed from session
3187 \return eHalStatus
3188 -------------------------------------------------------------------------------*/
3189eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003190 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07003191 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3192{
3193 eHalStatus status = eHAL_STATUS_FAILURE;
3194 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3195
3196 if ( NULL == pMac )
3197 {
3198 VOS_ASSERT(0);
3199 return status;
3200 }
3201
3202 status = sme_AcquireGlobalLock( &pMac->sme );
3203 if ( HAL_STATUS_SUCCESS( status ) )
3204 {
3205 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3206 {
3207 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3208 }
3209 else
3210 {
3211 status = eHAL_STATUS_INVALID_PARAMETER;
3212 }
3213 sme_ReleaseGlobalLock( &pMac->sme );
3214 }
3215
3216 return (status);
3217}
3218
Jeff Johnson295189b2012-06-20 16:38:30 -07003219
3220/* ---------------------------------------------------------------------------
3221 \fn sme_RoamGetConnectState
3222 \brief a wrapper function to request CSR to return the current connect state
3223 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003224 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003225 \return eHalStatus
3226 ---------------------------------------------------------------------------*/
3227eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3228{
3229 eHalStatus status = eHAL_STATUS_FAILURE;
3230 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3231
3232 status = sme_AcquireGlobalLock( &pMac->sme );
3233 if ( HAL_STATUS_SUCCESS( status ) )
3234 {
3235 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3236 {
3237 status = csrRoamGetConnectState( pMac, sessionId, pState );
3238 }
3239 else
3240 {
3241 status = eHAL_STATUS_INVALID_PARAMETER;
3242 }
3243 sme_ReleaseGlobalLock( &pMac->sme );
3244 }
3245
3246 return (status);
3247}
3248
3249/* ---------------------------------------------------------------------------
3250 \fn sme_RoamGetConnectProfile
3251 \brief a wrapper function to request CSR to return the current connect
3252 profile. Caller must call csrRoamFreeConnectProfile after it is done
3253 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003254 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003255 \param pProfile - pointer to a caller allocated structure
3256 tCsrRoamConnectedProfile
3257 \return eHalStatus. Failure if not connected
3258 ---------------------------------------------------------------------------*/
3259eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3260 tCsrRoamConnectedProfile *pProfile)
3261{
3262 eHalStatus status = eHAL_STATUS_FAILURE;
3263 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3264
Katya Nigambcb705f2013-12-26 14:26:22 +05303265 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003266 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003267 status = sme_AcquireGlobalLock( &pMac->sme );
3268 if ( HAL_STATUS_SUCCESS( status ) )
3269 {
3270 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3271 {
3272 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3273 }
3274 else
3275 {
3276 status = eHAL_STATUS_INVALID_PARAMETER;
3277 }
3278 sme_ReleaseGlobalLock( &pMac->sme );
3279 }
3280
3281 return (status);
3282}
3283
3284/* ---------------------------------------------------------------------------
3285 \fn sme_RoamFreeConnectProfile
3286 \brief a wrapper function to request CSR to free and reinitialize the
3287 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003288 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003289 \param pProfile - pointer to a caller allocated structure
3290 tCsrRoamConnectedProfile
3291 \return eHalStatus.
3292 ---------------------------------------------------------------------------*/
3293eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3294 tCsrRoamConnectedProfile *pProfile)
3295{
3296 eHalStatus status = eHAL_STATUS_FAILURE;
3297 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3298
Katya Nigambcb705f2013-12-26 14:26:22 +05303299 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003300 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003301 status = sme_AcquireGlobalLock( &pMac->sme );
3302 if ( HAL_STATUS_SUCCESS( status ) )
3303 {
3304 status = csrRoamFreeConnectProfile( pMac, pProfile );
3305 sme_ReleaseGlobalLock( &pMac->sme );
3306 }
3307
3308 return (status);
3309}
3310
3311/* ---------------------------------------------------------------------------
3312 \fn sme_RoamSetPMKIDCache
3313 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003314 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003315 \param pPMKIDCache - caller allocated buffer point to an array of
3316 tPmkidCacheInfo
3317 \param numItems - a variable that has the number of tPmkidCacheInfo
3318 allocated when retruning, this is either the number needed
3319 or number of items put into pPMKIDCache
3320 \return eHalStatus - when fail, it usually means the buffer allocated is not
3321 big enough and pNumItems has the number of
3322 tPmkidCacheInfo.
3323 \Note: pNumItems is a number of tPmkidCacheInfo,
3324 not sizeof(tPmkidCacheInfo) * something
3325 ---------------------------------------------------------------------------*/
3326eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId, tPmkidCacheInfo *pPMKIDCache,
3327 tANI_U32 numItems )
3328{
3329 eHalStatus status = eHAL_STATUS_FAILURE;
3330 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3331
Katya Nigambcb705f2013-12-26 14:26:22 +05303332 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003333 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003334 status = sme_AcquireGlobalLock( &pMac->sme );
3335 if ( HAL_STATUS_SUCCESS( status ) )
3336 {
3337 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3338 {
3339 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache, numItems );
3340 }
3341 else
3342 {
3343 status = eHAL_STATUS_INVALID_PARAMETER;
3344 }
3345 sme_ReleaseGlobalLock( &pMac->sme );
3346 }
3347
3348 return (status);
3349}
3350
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003351eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId, tANI_U8 *pBSSId )
3352{
3353 eHalStatus status = eHAL_STATUS_FAILURE;
3354 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3355 status = sme_AcquireGlobalLock( &pMac->sme );
3356 if ( HAL_STATUS_SUCCESS( status ) )
3357 {
3358 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3359 {
3360 status = csrRoamDelPMKIDfromCache( pMac, sessionId, pBSSId );
3361 }
3362 else
3363 {
3364 status = eHAL_STATUS_INVALID_PARAMETER;
3365 }
3366 sme_ReleaseGlobalLock( &pMac->sme );
3367 }
3368 return (status);
3369}
Wilson Yang47b58192013-12-11 11:40:19 -08003370
Jeff Johnson295189b2012-06-20 16:38:30 -07003371/* ---------------------------------------------------------------------------
3372 \fn sme_RoamGetSecurityReqIE
3373 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3374 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003375 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003376 \param pLen - caller allocated memory that has the length of pBuf as input.
3377 Upon returned, *pLen has the needed or IE length in pBuf.
3378 \param pBuf - Caller allocated memory that contain the IE field, if any,
3379 upon return
3380 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3381 \return eHalStatus - when fail, it usually means the buffer allocated is not
3382 big enough
3383 ---------------------------------------------------------------------------*/
3384eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3385 tANI_U8 *pBuf, eCsrSecurityType secType)
3386{
3387 eHalStatus status = eHAL_STATUS_FAILURE;
3388 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3389
3390 status = sme_AcquireGlobalLock( &pMac->sme );
3391 if ( HAL_STATUS_SUCCESS( status ) )
3392 {
3393 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3394 {
3395 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3396 }
3397 else
3398 {
3399 status = eHAL_STATUS_INVALID_PARAMETER;
3400 }
3401 sme_ReleaseGlobalLock( &pMac->sme );
3402 }
3403
3404 return (status);
3405}
3406
3407/* ---------------------------------------------------------------------------
3408 \fn sme_RoamGetSecurityRspIE
3409 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3410 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003411 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 \param pLen - caller allocated memory that has the length of pBuf as input.
3413 Upon returned, *pLen has the needed or IE length in pBuf.
3414 \param pBuf - Caller allocated memory that contain the IE field, if any,
3415 upon return
3416 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3417 \return eHalStatus - when fail, it usually means the buffer allocated is not
3418 big enough
3419 ---------------------------------------------------------------------------*/
3420eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3421 tANI_U8 *pBuf, eCsrSecurityType secType)
3422{
3423 eHalStatus status = eHAL_STATUS_FAILURE;
3424 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3425
3426 status = sme_AcquireGlobalLock( &pMac->sme );
3427 if ( HAL_STATUS_SUCCESS( status ) )
3428 {
3429 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3430 {
3431 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3432 }
3433 else
3434 {
3435 status = eHAL_STATUS_INVALID_PARAMETER;
3436 }
3437 sme_ReleaseGlobalLock( &pMac->sme );
3438 }
3439
3440 return (status);
3441
3442}
3443
3444
3445/* ---------------------------------------------------------------------------
3446 \fn sme_RoamGetNumPMKIDCache
3447 \brief a wrapper function to request CSR to return number of PMKID cache
3448 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003449 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003450 \return tANI_U32 - the number of PMKID cache entries
3451 ---------------------------------------------------------------------------*/
3452tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3453{
3454 eHalStatus status = eHAL_STATUS_FAILURE;
3455 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3456 tANI_U32 numPmkidCache = 0;
3457
3458 status = sme_AcquireGlobalLock( &pMac->sme );
3459 if ( HAL_STATUS_SUCCESS( status ) )
3460 {
3461 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3462 {
3463 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3464 status = eHAL_STATUS_SUCCESS;
3465 }
3466 else
3467 {
3468 status = eHAL_STATUS_INVALID_PARAMETER;
3469 }
3470 sme_ReleaseGlobalLock( &pMac->sme );
3471 }
3472
3473 return (numPmkidCache);
3474}
3475
3476/* ---------------------------------------------------------------------------
3477 \fn sme_RoamGetPMKIDCache
3478 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003479 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003480 \param pNum - caller allocated memory that has the space of the number of
3481 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3482 needed or actually number in tPmkidCacheInfo.
3483 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3484 any, upon return
3485 \return eHalStatus - when fail, it usually means the buffer allocated is not
3486 big enough
3487 ---------------------------------------------------------------------------*/
3488eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3489 tPmkidCacheInfo *pPmkidCache)
3490{
3491 eHalStatus status = eHAL_STATUS_FAILURE;
3492 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3493
3494 status = sme_AcquireGlobalLock( &pMac->sme );
3495 if ( HAL_STATUS_SUCCESS( status ) )
3496 {
3497 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3498 {
3499 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3500 }
3501 else
3502 {
3503 status = eHAL_STATUS_INVALID_PARAMETER;
3504 }
3505 sme_ReleaseGlobalLock( &pMac->sme );
3506 }
3507
3508 return (status);
3509}
3510
3511
3512/* ---------------------------------------------------------------------------
3513 \fn sme_GetConfigParam
3514 \brief a wrapper function that HDD calls to get the global settings
3515 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003516 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003517 \param pParam - caller allocated memory
3518 \return eHalStatus
3519 ---------------------------------------------------------------------------*/
3520eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3521{
3522 eHalStatus status = eHAL_STATUS_FAILURE;
3523 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3524
Katya Nigambcb705f2013-12-26 14:26:22 +05303525 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003526 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003527 status = sme_AcquireGlobalLock( &pMac->sme );
3528 if ( HAL_STATUS_SUCCESS( status ) )
3529 {
3530 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3531 if (status != eHAL_STATUS_SUCCESS)
3532 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003533 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003534 sme_ReleaseGlobalLock( &pMac->sme );
3535 return status;
3536 }
3537#if defined WLAN_FEATURE_P2P_INTERNAL
3538 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3539 if (status != eHAL_STATUS_SUCCESS)
3540 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003541 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003542 sme_ReleaseGlobalLock( &pMac->sme );
3543 return status;
3544 }
3545#endif
3546 sme_ReleaseGlobalLock( &pMac->sme );
3547 }
3548
3549 return (status);
3550}
3551
3552/* ---------------------------------------------------------------------------
3553 \fn sme_CfgSetInt
3554 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003555 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003556 \param cfgId - Configuration Parameter ID (type) for STA.
3557 \param ccmValue - The information related to Configuration Parameter ID
3558 which needs to be saved in CFG
3559 \param callback - To be registered by CSR with CCM. Once the CFG done with
3560 saving the information in the database, it notifies CCM &
3561 then the callback will be invoked to notify.
3562 \param toBeSaved - To save the request for future reference
3563 \return eHalStatus
3564 ---------------------------------------------------------------------------*/
3565eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3566 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3567{
3568 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3569}
3570
3571/* ---------------------------------------------------------------------------
3572 \fn sme_CfgSetStr
3573 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003574 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003575 \param cfgId - Configuration Parameter ID (type) for STA.
3576 \param pStr - Pointer to the byte array which carries the information needs
3577 to be saved in CFG
3578 \param length - Length of the data to be saved
3579 \param callback - To be registered by CSR with CCM. Once the CFG done with
3580 saving the information in the database, it notifies CCM &
3581 then the callback will be invoked to notify.
3582 \param toBeSaved - To save the request for future reference
3583 \return eHalStatus
3584 ---------------------------------------------------------------------------*/
3585eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3586 tANI_U32 length, tCcmCfgSetCallback callback,
3587 eAniBoolean toBeSaved)
3588{
3589 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3590}
3591
3592/* ---------------------------------------------------------------------------
3593 \fn sme_GetModifyProfileFields
3594 \brief HDD or SME - QOS calls this function to get the current values of
3595 connected profile fields, changing which can cause reassoc.
3596 This function must be called after CFG is downloaded and STA is in connected
3597 state. Also, make sure to call this function to get the current profile
3598 fields before calling the reassoc. So that pModifyProfileFields will have
3599 all the latest values plus the one(s) has been updated as part of reassoc
3600 request.
3601 \param pModifyProfileFields - pointer to the connected profile fields
3602 changing which can cause reassoc
3603
3604 \return eHalStatus
3605 -------------------------------------------------------------------------------*/
3606eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
3607 tCsrRoamModifyProfileFields * pModifyProfileFields)
3608{
3609 eHalStatus status = eHAL_STATUS_FAILURE;
3610 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3611
Katya Nigambcb705f2013-12-26 14:26:22 +05303612 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003613 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003614 status = sme_AcquireGlobalLock( &pMac->sme );
3615 if ( HAL_STATUS_SUCCESS( status ) )
3616 {
3617 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3618 {
3619 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
3620 }
3621 else
3622 {
3623 status = eHAL_STATUS_INVALID_PARAMETER;
3624 }
3625 sme_ReleaseGlobalLock( &pMac->sme );
3626 }
3627
3628 return (status);
3629}
3630
Sandeep Puligilla332ea912014-02-04 00:16:24 +05303631/* ---------------------------------------------------------------------------
3632 \fn sme_HT40StopOBSSScan
3633 \brief HDD or SME - Command to stop the OBSS scan
3634 THis is implemented only for debugging purpose.
3635 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
3636 \param sessionId - sessionId
3637 changing which can cause reassoc
3638
3639 \return eHalStatus
3640 -------------------------------------------------------------------------------*/
3641eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
3642{
3643 eHalStatus status = eHAL_STATUS_FAILURE;
3644 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3645
3646 smsLog(pMac, LOG2, FL("enter"));
3647 status = sme_AcquireGlobalLock( &pMac->sme );
3648 if ( HAL_STATUS_SUCCESS( status ) )
3649 {
3650 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3651 {
3652 csrHT40StopOBSSScan( pMac, sessionId );
3653 }
3654 else
3655 {
3656 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3657 "%s: Invalid session sessionId %d", __func__,sessionId);
3658 status = eHAL_STATUS_INVALID_PARAMETER;
3659 }
3660 sme_ReleaseGlobalLock( &pMac->sme );
3661 }
3662 return (status);
3663}
3664
Jeff Johnson295189b2012-06-20 16:38:30 -07003665/*--------------------------------------------------------------------------
3666 \fn sme_SetConfigPowerSave
3667 \brief Wrapper fn to change power save configuration in SME (PMC) module.
3668 For BMPS related configuration, this function also updates the CFG
3669 and sends a message to FW to pick up the new values. Note: Calling
3670 this function only updates the configuration and does not enable
3671 the specified power save mode.
3672 \param hHal - The handle returned by macOpen.
3673 \param psMode - Power Saving mode being modified
3674 \param pConfigParams - a pointer to a caller allocated object of type
3675 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3676 \return eHalStatus
3677 --------------------------------------------------------------------------*/
3678eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3679 void *pConfigParams)
3680{
3681 eHalStatus status = eHAL_STATUS_FAILURE;
3682 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3683
Katya Nigambcb705f2013-12-26 14:26:22 +05303684 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003685 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003686 if (NULL == pConfigParams ) {
3687 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3688 "nothing to update");
3689 return eHAL_STATUS_FAILURE;
3690 }
3691
3692 status = sme_AcquireGlobalLock( &pMac->sme );
3693 if ( HAL_STATUS_SUCCESS( status ) )
3694 {
3695 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
3696 sme_ReleaseGlobalLock( &pMac->sme );
3697 }
3698
3699 return (status);
3700}
3701
3702/*--------------------------------------------------------------------------
3703 \fn sme_GetConfigPowerSave
3704 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
3705 \param hHal - The handle returned by macOpen.
3706 \param psMode - Power Saving mode
3707 \param pConfigParams - a pointer to a caller allocated object of type
3708 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
3709 \return eHalStatus
3710 --------------------------------------------------------------------------*/
3711eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
3712 void *pConfigParams)
3713{
3714 eHalStatus status = eHAL_STATUS_FAILURE;
3715 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3716
Katya Nigambcb705f2013-12-26 14:26:22 +05303717 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003718 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003719 if (NULL == pConfigParams ) {
3720 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
3721 "nothing to update");
3722 return eHAL_STATUS_FAILURE;
3723 }
3724
3725 status = sme_AcquireGlobalLock( &pMac->sme );
3726 if ( HAL_STATUS_SUCCESS( status ) )
3727 {
3728 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
3729 sme_ReleaseGlobalLock( &pMac->sme );
3730 }
3731
3732 return (status);
3733}
3734
3735/* ---------------------------------------------------------------------------
3736 \fn sme_SignalPowerEvent
3737 \brief Signals to PMC that a power event has occurred. Used for putting
3738 the chip into deep sleep mode.
3739 \param hHal - The handle returned by macOpen.
3740 \param event - the event that has occurred
3741 \return eHalStatus
3742 ---------------------------------------------------------------------------*/
3743eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
3744{
3745 eHalStatus status = eHAL_STATUS_FAILURE;
3746 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3747
3748 status = sme_AcquireGlobalLock( &pMac->sme );
3749 if ( HAL_STATUS_SUCCESS( status ) )
3750 {
3751 status = pmcSignalPowerEvent(hHal, event);
3752 sme_ReleaseGlobalLock( &pMac->sme );
3753 }
3754
3755 return (status);
3756}
3757
3758/* ---------------------------------------------------------------------------
3759 \fn sme_EnablePowerSave
3760 \brief Enables one of the power saving modes.
3761 \param hHal - The handle returned by macOpen.
3762 \param psMode - The power saving mode to enable. If BMPS mode is enabled
3763 while the chip is operating in Full Power, PMC will start
3764 a timer that will try to put the chip in BMPS mode after
3765 expiry.
3766 \return eHalStatus
3767 ---------------------------------------------------------------------------*/
3768eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3769{
3770 eHalStatus status = eHAL_STATUS_FAILURE;
3771 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3772
Katya Nigambcb705f2013-12-26 14:26:22 +05303773 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003774 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003775 status = sme_AcquireGlobalLock( &pMac->sme );
3776 if ( HAL_STATUS_SUCCESS( status ) )
3777 {
3778 status = pmcEnablePowerSave(hHal, psMode);
3779 sme_ReleaseGlobalLock( &pMac->sme );
3780 }
3781
3782 return (status);
3783}
3784
3785/* ---------------------------------------------------------------------------
3786 \fn sme_DisablePowerSave
3787 \brief Disables one of the power saving modes.
3788 \param hHal - The handle returned by macOpen.
3789 \param psMode - The power saving mode to disable. Disabling does not imply
3790 that device will be brought out of the current PS mode. This
3791 is purely a configuration API.
3792 \return eHalStatus
3793 ---------------------------------------------------------------------------*/
3794eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
3795{
3796 eHalStatus status = eHAL_STATUS_FAILURE;
3797 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3798
Katya Nigambcb705f2013-12-26 14:26:22 +05303799 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003800 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003801 status = sme_AcquireGlobalLock( &pMac->sme );
3802 if ( HAL_STATUS_SUCCESS( status ) )
3803 {
3804 status = pmcDisablePowerSave(hHal, psMode);
3805 sme_ReleaseGlobalLock( &pMac->sme );
3806 }
3807
3808 return (status);
3809 }
3810
3811/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05303812+ \fn sme_SetHostPowerSave
3813+ \brief Enables BMPS logic to be controlled by User level apps
3814+ \param hHal - The handle returned by macOpen.
3815+ \param psMode - The power saving mode to disable. Disabling does not imply
3816+ that device will be brought out of the current PS mode. This
3817+ is purely a configuration API.
3818+ \return eHalStatus
3819+ ---------------------------------------------------------------------------*/
3820eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
3821{
3822 eHalStatus status = eHAL_STATUS_FAILURE;
3823 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3824
3825 pMac->pmc.isHostPsEn = psMode;
3826
3827 return (status);
3828}
3829
3830/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003831 \fn sme_StartAutoBmpsTimer
3832 \brief Starts a timer that periodically polls all the registered
3833 module for entry into Bmps mode. This timer is started only if BMPS is
3834 enabled and whenever the device is in full power.
3835 \param hHal - The handle returned by macOpen.
3836 \return eHalStatus
3837 ---------------------------------------------------------------------------*/
3838eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
3839{
3840 eHalStatus status = eHAL_STATUS_FAILURE;
3841 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3842
Katya Nigambcb705f2013-12-26 14:26:22 +05303843 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003844 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003845 status = sme_AcquireGlobalLock( &pMac->sme );
3846 if ( HAL_STATUS_SUCCESS( status ) )
3847 {
3848 status = pmcStartAutoBmpsTimer(hHal);
3849 sme_ReleaseGlobalLock( &pMac->sme );
3850 }
3851
3852 return (status);
3853}
3854/* ---------------------------------------------------------------------------
3855 \fn sme_StopAutoBmpsTimer
3856 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
3857 Stopping the timer does not cause a device state change. Only the timer
3858 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
3859 \param hHal - The handle returned by macOpen.
3860 \return eHalStatus
3861 ---------------------------------------------------------------------------*/
3862eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
3863{
3864 eHalStatus status = eHAL_STATUS_FAILURE;
3865 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3866
Katya Nigambcb705f2013-12-26 14:26:22 +05303867 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003868 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003869 status = sme_AcquireGlobalLock( &pMac->sme );
3870 if ( HAL_STATUS_SUCCESS( status ) )
3871 {
3872 status = pmcStopAutoBmpsTimer(hHal);
3873 sme_ReleaseGlobalLock( &pMac->sme );
3874 }
3875
3876 return (status);
3877}
3878/* ---------------------------------------------------------------------------
3879 \fn sme_QueryPowerState
3880 \brief Returns the current power state of the device.
3881 \param hHal - The handle returned by macOpen.
3882 \param pPowerState - pointer to location to return power state (LOW or HIGH)
3883 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
3884 \return eHalStatus
3885 ---------------------------------------------------------------------------*/
3886eHalStatus sme_QueryPowerState (
3887 tHalHandle hHal,
3888 tPmcPowerState *pPowerState,
3889 tPmcSwitchState *pSwWlanSwitchState)
3890{
3891 eHalStatus status = eHAL_STATUS_FAILURE;
3892 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3893
3894 status = sme_AcquireGlobalLock( &pMac->sme );
3895 if ( HAL_STATUS_SUCCESS( status ) )
3896 {
3897 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
3898 sme_ReleaseGlobalLock( &pMac->sme );
3899 }
3900
3901 return (status);
3902}
3903
3904/* ---------------------------------------------------------------------------
3905 \fn sme_IsPowerSaveEnabled
3906 \brief Checks if the device is able to enter a particular power save mode
3907 This does not imply that the device is in a particular PS mode
3908 \param hHal - The handle returned by macOpen.
3909 \param psMode - the power saving mode
3910 \return eHalStatus
3911 ---------------------------------------------------------------------------*/
3912tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
3913{
3914 eHalStatus status = eHAL_STATUS_FAILURE;
3915 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3916 tANI_BOOLEAN result = false;
3917
Katya Nigambcb705f2013-12-26 14:26:22 +05303918 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003919 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07003920 status = sme_AcquireGlobalLock( &pMac->sme );
3921 if ( HAL_STATUS_SUCCESS( status ) )
3922 {
3923 result = pmcIsPowerSaveEnabled(hHal, psMode);
3924 sme_ReleaseGlobalLock( &pMac->sme );
3925 return result;
3926 }
3927
3928 return false;
3929}
3930
3931/* ---------------------------------------------------------------------------
3932 \fn sme_RequestFullPower
3933 \brief Request that the device be brought to full power state. When the
3934 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
3935 is enabled. On timer expiry PMC will attempt to put the device in
3936 BMPS mode if following holds true:
3937 - BMPS mode is enabled
3938 - Polling of all modules through the Power Save Check routine passes
3939 - STA is associated to an access point
3940 \param hHal - The handle returned by macOpen.
3941 \param - callbackRoutine Callback routine invoked in case of success/failure
3942 \return eHalStatus - status
3943 eHAL_STATUS_SUCCESS - device brought to full power state
3944 eHAL_STATUS_FAILURE - device cannot be brought to full power state
3945 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
3946 ---------------------------------------------------------------------------*/
3947eHalStatus sme_RequestFullPower (
3948 tHalHandle hHal,
3949 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3950 void *callbackContext,
3951 tRequestFullPowerReason fullPowerReason)
3952{
3953 eHalStatus status = eHAL_STATUS_FAILURE;
3954 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3955
Katya Nigambcb705f2013-12-26 14:26:22 +05303956 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003957 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003958 status = sme_AcquireGlobalLock( &pMac->sme );
3959 if ( HAL_STATUS_SUCCESS( status ) )
3960 {
3961 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
3962 sme_ReleaseGlobalLock( &pMac->sme );
3963 }
3964
3965 return (status);
3966}
3967
3968/* ---------------------------------------------------------------------------
3969 \fn sme_RequestBmps
3970 \brief Request that the device be put in BMPS state. Request will be
3971 accepted only if BMPS mode is enabled and power save check routine
3972 passes.
3973 \param hHal - The handle returned by macOpen.
3974 \param - callbackRoutine Callback routine invoked in case of success/failure
3975 \return eHalStatus
3976 eHAL_STATUS_SUCCESS - device is in BMPS state
3977 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
3978 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
3979 ---------------------------------------------------------------------------*/
3980eHalStatus sme_RequestBmps (
3981 tHalHandle hHal,
3982 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
3983 void *callbackContext)
3984{
3985 eHalStatus status = eHAL_STATUS_FAILURE;
3986 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3987
Katya Nigambcb705f2013-12-26 14:26:22 +05303988 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003989 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003990 status = sme_AcquireGlobalLock( &pMac->sme );
3991 if ( HAL_STATUS_SUCCESS( status ) )
3992 {
3993 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
3994 sme_ReleaseGlobalLock( &pMac->sme );
3995 }
3996
3997 return (status);
3998}
3999
4000
4001/* ---------------------------------------------------------------------------
4002 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004003 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4004 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004005 \param hHal - The handle returned by macOpen.
4006 ---------------------------------------------------------------------------*/
4007void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4008{
4009 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4010
Katya Nigambcb705f2013-12-26 14:26:22 +05304011 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004012 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004013 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4014 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4015}
4016
4017
4018/* ---------------------------------------------------------------------------
4019 \fn sme_StartUapsd
4020 \brief Request that the device be put in UAPSD state. If the device is in
4021 Full Power it will be put in BMPS mode first and then into UAPSD
4022 mode.
4023 \param hHal - The handle returned by macOpen.
4024 \param - callbackRoutine Callback routine invoked in case of success/failure
4025 eHAL_STATUS_SUCCESS - device is in UAPSD state
4026 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4027 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4028 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4029 \return eHalStatus
4030 ---------------------------------------------------------------------------*/
4031eHalStatus sme_StartUapsd (
4032 tHalHandle hHal,
4033 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4034 void *callbackContext)
4035{
4036 eHalStatus status = eHAL_STATUS_FAILURE;
4037 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4038
4039 status = sme_AcquireGlobalLock( &pMac->sme );
4040 if ( HAL_STATUS_SUCCESS( status ) )
4041 {
4042 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4043 sme_ReleaseGlobalLock( &pMac->sme );
4044 }
4045
4046 return (status);
4047 }
4048
4049/* ---------------------------------------------------------------------------
4050 \fn sme_StopUapsd
4051 \brief Request that the device be put out of UAPSD state. Device will be
4052 put in in BMPS state after stop UAPSD completes.
4053 \param hHal - The handle returned by macOpen.
4054 \return eHalStatus
4055 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4056 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4057 ---------------------------------------------------------------------------*/
4058eHalStatus sme_StopUapsd (tHalHandle hHal)
4059{
4060 eHalStatus status = eHAL_STATUS_FAILURE;
4061 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4062
4063 status = sme_AcquireGlobalLock( &pMac->sme );
4064 if ( HAL_STATUS_SUCCESS( status ) )
4065 {
4066 status = pmcStopUapsd(hHal);
4067 sme_ReleaseGlobalLock( &pMac->sme );
4068 }
4069
4070 return (status);
4071}
4072
4073/* ---------------------------------------------------------------------------
4074 \fn sme_RequestStandby
4075 \brief Request that the device be put in standby. It is HDD's responsibility
4076 to bring the chip to full power and do a disassoc before calling
4077 this API.
4078 \param hHal - The handle returned by macOpen.
4079 \param - callbackRoutine Callback routine invoked in case of success/failure
4080 \return eHalStatus
4081 eHAL_STATUS_SUCCESS - device is in Standby mode
4082 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4083 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4084 ---------------------------------------------------------------------------*/
4085eHalStatus sme_RequestStandby (
4086 tHalHandle hHal,
4087 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4088 void *callbackContext)
4089{
4090 eHalStatus status = eHAL_STATUS_FAILURE;
4091 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4092
Katya Nigambcb705f2013-12-26 14:26:22 +05304093 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004094 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05304095 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004096 status = sme_AcquireGlobalLock( &pMac->sme );
4097 if ( HAL_STATUS_SUCCESS( status ) )
4098 {
4099 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
4100 sme_ReleaseGlobalLock( &pMac->sme );
4101 }
4102
4103 return (status);
4104}
4105
4106/* ---------------------------------------------------------------------------
4107 \fn sme_RegisterPowerSaveCheck
4108 \brief Register a power save check routine that is called whenever
4109 the device is about to enter one of the power save modes.
4110 \param hHal - The handle returned by macOpen.
4111 \param checkRoutine - Power save check routine to be registered
4112 \return eHalStatus
4113 eHAL_STATUS_SUCCESS - successfully registered
4114 eHAL_STATUS_FAILURE - not successfully registered
4115 ---------------------------------------------------------------------------*/
4116eHalStatus sme_RegisterPowerSaveCheck (
4117 tHalHandle hHal,
4118 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4119{
4120 eHalStatus status = eHAL_STATUS_FAILURE;
4121 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4122
4123 status = sme_AcquireGlobalLock( &pMac->sme );
4124 if ( HAL_STATUS_SUCCESS( status ) )
4125 {
4126 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4127 sme_ReleaseGlobalLock( &pMac->sme );
4128 }
4129
4130 return (status);
4131}
4132
4133/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05304134 \fn sme_Register11dScanDoneCallback
4135 \brief Register a routine of type csrScanCompleteCallback which is
4136 called whenever an 11d scan is done
4137 \param hHal - The handle returned by macOpen.
4138 \param callback - 11d scan complete routine to be registered
4139 \return eHalStatus
4140 ---------------------------------------------------------------------------*/
4141eHalStatus sme_Register11dScanDoneCallback (
4142 tHalHandle hHal,
4143 csrScanCompleteCallback callback)
4144{
4145 eHalStatus status = eHAL_STATUS_SUCCESS;
4146 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4147
4148 pMac->scan.callback11dScanDone = callback;
4149
4150 return (status);
4151}
4152
4153/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004154 \fn sme_DeregisterPowerSaveCheck
4155 \brief Deregister a power save check routine
4156 \param hHal - The handle returned by macOpen.
4157 \param checkRoutine - Power save check routine to be deregistered
4158 \return eHalStatus
4159 eHAL_STATUS_SUCCESS - successfully deregistered
4160 eHAL_STATUS_FAILURE - not successfully deregistered
4161 ---------------------------------------------------------------------------*/
4162eHalStatus sme_DeregisterPowerSaveCheck (
4163 tHalHandle hHal,
4164 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4165{
4166 eHalStatus status = eHAL_STATUS_FAILURE;
4167 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4168
4169 status = sme_AcquireGlobalLock( &pMac->sme );
4170 if ( HAL_STATUS_SUCCESS( status ) )
4171 {
4172 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4173 sme_ReleaseGlobalLock( &pMac->sme );
4174 }
4175
4176 return (status);
4177}
4178
4179/* ---------------------------------------------------------------------------
4180 \fn sme_RegisterDeviceStateUpdateInd
4181 \brief Register a callback routine that is called whenever
4182 the device enters a new device state (Full Power, BMPS, UAPSD)
4183 \param hHal - The handle returned by macOpen.
4184 \param callbackRoutine - Callback routine to be registered
4185 \param callbackContext - Cookie to be passed back during callback
4186 \return eHalStatus
4187 eHAL_STATUS_SUCCESS - successfully registered
4188 eHAL_STATUS_FAILURE - not successfully registered
4189 ---------------------------------------------------------------------------*/
4190eHalStatus sme_RegisterDeviceStateUpdateInd (
4191 tHalHandle hHal,
4192 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4193 void *callbackContext)
4194{
4195 eHalStatus status = eHAL_STATUS_FAILURE;
4196 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4197
4198 status = sme_AcquireGlobalLock( &pMac->sme );
4199 if ( HAL_STATUS_SUCCESS( status ) )
4200 {
4201 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4202 sme_ReleaseGlobalLock( &pMac->sme );
4203 }
4204
4205 return (status);
4206}
4207
4208/* ---------------------------------------------------------------------------
4209 \fn sme_DeregisterDeviceStateUpdateInd
4210 \brief Deregister a routine that was registered for device state changes
4211 \param hHal - The handle returned by macOpen.
4212 \param callbackRoutine - Callback routine to be deregistered
4213 \return eHalStatus
4214 eHAL_STATUS_SUCCESS - successfully deregistered
4215 eHAL_STATUS_FAILURE - not successfully deregistered
4216 ---------------------------------------------------------------------------*/
4217eHalStatus sme_DeregisterDeviceStateUpdateInd (
4218 tHalHandle hHal,
4219 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4220{
4221 eHalStatus status = eHAL_STATUS_FAILURE;
4222 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4223
4224 status = sme_AcquireGlobalLock( &pMac->sme );
4225 if ( HAL_STATUS_SUCCESS( status ) )
4226 {
4227 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4228 sme_ReleaseGlobalLock( &pMac->sme );
4229 }
4230
4231 return (status);
4232}
4233
4234/* ---------------------------------------------------------------------------
4235 \fn sme_WowlAddBcastPattern
4236 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4237 do a pattern match on these patterns when Wowl is enabled during BMPS
4238 mode. Note that Firmware performs the pattern matching only on
4239 broadcast frames and while Libra is in BMPS mode.
4240 \param hHal - The handle returned by macOpen.
4241 \param pattern - Pattern to be added
4242 \return eHalStatus
4243 eHAL_STATUS_FAILURE Cannot add pattern
4244 eHAL_STATUS_SUCCESS Request accepted.
4245 ---------------------------------------------------------------------------*/
4246eHalStatus sme_WowlAddBcastPattern (
4247 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004248 tpSirWowlAddBcastPtrn pattern,
4249 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004250{
4251 eHalStatus status = eHAL_STATUS_FAILURE;
4252 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304253 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004254 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004255 status = sme_AcquireGlobalLock( &pMac->sme );
4256 if ( HAL_STATUS_SUCCESS( status ) )
4257 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004258 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004259 sme_ReleaseGlobalLock( &pMac->sme );
4260 }
4261
4262 return (status);
4263}
4264
4265/* ---------------------------------------------------------------------------
4266 \fn sme_WowlDelBcastPattern
4267 \brief Delete a pattern that was added for Pattern Byte Matching.
4268 \param hHal - The handle returned by macOpen.
4269 \param pattern - Pattern to be deleted
4270 \return eHalStatus
4271 eHAL_STATUS_FAILURE Cannot delete pattern
4272 eHAL_STATUS_SUCCESS Request accepted.
4273 ---------------------------------------------------------------------------*/
4274eHalStatus sme_WowlDelBcastPattern (
4275 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004276 tpSirWowlDelBcastPtrn pattern,
4277 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004278{
4279 eHalStatus status = eHAL_STATUS_FAILURE;
4280 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304281 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004282 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004283 status = sme_AcquireGlobalLock( &pMac->sme );
4284 if ( HAL_STATUS_SUCCESS( status ) )
4285 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004286 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004287 sme_ReleaseGlobalLock( &pMac->sme );
4288 }
4289
4290 return (status);
4291}
4292
4293/* ---------------------------------------------------------------------------
4294 \fn sme_EnterWowl
4295 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4296 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4297 SME will will cache the information that WOWL has been enabled and
4298 attempt to put the device in BMPS. On entry into BMPS, SME will
4299 enable the WOWL mode.
4300 Note 1: If we exit BMPS mode (someone requests full power), we
4301 will NOT resume WOWL when we go back to BMPS again. Request for full
4302 power (while in WOWL mode) means disable WOWL and go to full power.
4303 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4304 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4305 are required. Currently there is no requirement or use case to support
4306 UAPSD and WOWL at the same time.
4307
4308 \param hHal - The handle returned by macOpen.
4309 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4310 Used for success/failure notification by SME
4311 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4312 at the time of callback.
4313 \param wakeReasonIndCB - Callback routine provided by HDD.
4314 Used for Wake Reason Indication by SME
4315 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4316 at the time of callback.
4317 \return eHalStatus
4318 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4319 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4320 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4321 BMPS mode is entered.
4322 ---------------------------------------------------------------------------*/
4323eHalStatus sme_EnterWowl (
4324 tHalHandle hHal,
4325 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4326 void *enterWowlCallbackContext,
4327#ifdef WLAN_WAKEUP_EVENTS
4328 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4329 void *wakeIndicationCBContext,
4330#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004331 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004332{
4333 eHalStatus status = eHAL_STATUS_FAILURE;
4334 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304335 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004336 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004337 status = sme_AcquireGlobalLock( &pMac->sme );
4338 if ( HAL_STATUS_SUCCESS( status ) )
4339 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004340 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004341#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004342 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004343#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004344 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004345 sme_ReleaseGlobalLock( &pMac->sme );
4346 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004347 return (status);
4348}
4349/* ---------------------------------------------------------------------------
4350 \fn sme_ExitWowl
4351 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4352 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4353 mode.
4354 \param hHal - The handle returned by macOpen.
4355 \return eHalStatus
4356 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4357 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4358 ---------------------------------------------------------------------------*/
4359eHalStatus sme_ExitWowl (tHalHandle hHal)
4360{
4361 eHalStatus status = eHAL_STATUS_FAILURE;
4362 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304363 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004364 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004365 status = sme_AcquireGlobalLock( &pMac->sme );
4366 if ( HAL_STATUS_SUCCESS( status ) )
4367 {
4368 status = pmcExitWowl (hHal);
4369 sme_ReleaseGlobalLock( &pMac->sme );
4370 }
4371
4372 return (status);
4373}
4374
4375/* ---------------------------------------------------------------------------
4376
4377 \fn sme_RoamSetKey
4378
4379 \brief To set encryption key. This function should be called only when connected
4380 This is an asynchronous API.
4381
4382 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4383
4384 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4385
4386 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4387
4388 FAILURE or RESOURCES The API finished and failed.
4389
4390 -------------------------------------------------------------------------------*/
4391eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4392{
4393 eHalStatus status = eHAL_STATUS_FAILURE;
4394 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4395 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004396 tANI_U32 i;
4397 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004398
Katya Nigambcb705f2013-12-26 14:26:22 +05304399 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004400 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004401 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4402 {
4403 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4404 return eHAL_STATUS_FAILURE;
4405 }
4406
Jeff Johnson295189b2012-06-20 16:38:30 -07004407 status = sme_AcquireGlobalLock( &pMac->sme );
4408 if ( HAL_STATUS_SUCCESS( status ) )
4409 {
4410 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4411 if(pRoamId)
4412 {
4413 *pRoamId = roamId;
4414 }
4415
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004416 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004417
4418 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004419 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004420
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004421 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004422
4423 pSession = CSR_GET_SESSION(pMac, sessionId);
4424
Jeff Johnson32d95a32012-09-10 13:15:23 -07004425 if(!pSession)
4426 {
4427 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004428 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004429 return eHAL_STATUS_FAILURE;
4430 }
4431
Jeff Johnson295189b2012-06-20 16:38:30 -07004432 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4433 {
4434 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4435 {
4436 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4437 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4438 {
4439 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4440 }
4441 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4442 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4443 {
4444 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4445 }
4446 }
4447 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004448
4449 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4450 sme_ReleaseGlobalLock( &pMac->sme );
4451 }
4452
4453 return (status);
4454}
4455
4456
4457/* ---------------------------------------------------------------------------
4458
4459 \fn sme_RoamRemoveKey
4460
4461 \brief To set encryption key. This is an asynchronous API.
4462
4463 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4464
4465 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4466
4467 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4468
4469 FAILURE or RESOURCES The API finished and failed.
4470
4471 -------------------------------------------------------------------------------*/
4472eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4473 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4474{
4475 eHalStatus status = eHAL_STATUS_FAILURE;
4476 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4477 tANI_U32 roamId;
4478
Katya Nigambcb705f2013-12-26 14:26:22 +05304479 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004480 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004481 status = sme_AcquireGlobalLock( &pMac->sme );
4482 if ( HAL_STATUS_SUCCESS( status ) )
4483 {
4484 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4485 if(pRoamId)
4486 {
4487 *pRoamId = roamId;
4488 }
4489 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4490 sme_ReleaseGlobalLock( &pMac->sme );
4491 }
4492
4493 return (status);
4494}
4495
4496/* ---------------------------------------------------------------------------
4497 \fn sme_GetRssi
4498 \brief a wrapper function that client calls to register a callback to get RSSI
4499
4500 \param callback - SME sends back the requested stats using the callback
4501 \param staId - The station ID for which the stats is requested for
4502 \param pContext - user context to be passed back along with the callback
4503 \param pVosContext - vos context
4504 \return eHalStatus
4505 ---------------------------------------------------------------------------*/
4506eHalStatus sme_GetRssi(tHalHandle hHal,
4507 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004508 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07004509 void *pContext, void* pVosContext)
4510{
4511 eHalStatus status = eHAL_STATUS_FAILURE;
4512 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4513
4514 status = sme_AcquireGlobalLock( &pMac->sme );
4515 if ( HAL_STATUS_SUCCESS( status ) )
4516 {
4517 status = csrGetRssi( pMac, callback,
4518 staId, bssId, pContext, pVosContext);
4519 sme_ReleaseGlobalLock( &pMac->sme );
4520 }
4521 return (status);
4522}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304523
4524/* ---------------------------------------------------------------------------
4525 \fn sme_GetSnr
4526 \brief a wrapper function that client calls to register a callback to
4527 get SNR
4528
4529 \param callback - SME sends back the requested stats using the callback
4530 \param staId - The station ID for which the stats is requested for
4531 \param pContext - user context to be passed back along with the callback
4532 \param pVosContext - vos context
4533 \return eHalStatus
4534 ---------------------------------------------------------------------------*/
4535eHalStatus sme_GetSnr(tHalHandle hHal,
4536 tCsrSnrCallback callback,
4537 tANI_U8 staId, tCsrBssid bssId,
4538 void *pContext)
4539{
4540 eHalStatus status = eHAL_STATUS_FAILURE;
4541 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4542
4543 status = sme_AcquireGlobalLock( &pMac->sme );
4544 if ( HAL_STATUS_SUCCESS( status ) )
4545 {
4546 status = csrGetSnr(pMac, callback,
4547 staId, bssId, pContext);
4548 sme_ReleaseGlobalLock( &pMac->sme );
4549 }
4550 return status;
4551}
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004552#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
4553/* ---------------------------------------------------------------------------
4554 \fn sme_GetRoamRssi
4555 \brief a wrapper function that client calls to register a callback to get Roam RSSI
4556
4557 \param callback - SME sends back the requested stats using the callback
4558 \param staId - The station ID for which the stats is requested for
4559 \param pContext - user context to be passed back along with the callback
4560 \param pVosContext - vos context
4561 \return eHalStatus
4562 ---------------------------------------------------------------------------*/
4563eHalStatus sme_GetRoamRssi(tHalHandle hHal,
4564 tCsrRssiCallback callback,
4565 tANI_U8 staId, tCsrBssid bssId,
4566 void *pContext, void* pVosContext)
4567{
4568 eHalStatus status = eHAL_STATUS_FAILURE;
4569 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4570
4571 status = sme_AcquireGlobalLock( &pMac->sme );
4572 if ( HAL_STATUS_SUCCESS( status ) )
4573 {
4574 status = csrGetRoamRssi( pMac, callback,
4575 staId, bssId, pContext, pVosContext);
4576 sme_ReleaseGlobalLock( &pMac->sme );
4577 }
4578 return (status);
4579}
4580#endif
4581
Jeff Johnson295189b2012-06-20 16:38:30 -07004582
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004583#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
4584/* ---------------------------------------------------------------------------
4585 \fn sme_GetTsmStats
4586 \brief a wrapper function that client calls to register a callback to get TSM Stats
4587
4588 \param callback - SME sends back the requested stats using the callback
4589 \param staId - The station ID for which the stats is requested for
4590 \param pContext - user context to be passed back along with the callback
4591 \param pVosContext - vos context
4592 \return eHalStatus
4593 ---------------------------------------------------------------------------*/
4594eHalStatus sme_GetTsmStats(tHalHandle hHal,
4595 tCsrTsmStatsCallback callback,
4596 tANI_U8 staId, tCsrBssid bssId,
4597 void *pContext, void* pVosContext, tANI_U8 tid)
4598{
4599 eHalStatus status = eHAL_STATUS_FAILURE;
4600 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4601
4602 status = sme_AcquireGlobalLock( &pMac->sme );
4603 if ( HAL_STATUS_SUCCESS( status ) )
4604 {
4605 status = csrGetTsmStats( pMac, callback,
4606 staId, bssId, pContext, pVosContext, tid);
4607 sme_ReleaseGlobalLock( &pMac->sme );
4608 }
4609 return (status);
4610}
4611#endif
4612
4613
Jeff Johnson295189b2012-06-20 16:38:30 -07004614/* ---------------------------------------------------------------------------
4615 \fn sme_GetStatistics
4616 \brief a wrapper function that client calls to register a callback to get
4617 different PHY level statistics from CSR.
4618
4619 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
4620 \param statsMask - The different category/categories of stats requester is looking for
4621 \param callback - SME sends back the requested stats using the callback
4622 \param periodicity - If requester needs periodic update in millisec, 0 means
4623 it's an one time request
4624 \param cache - If requester is happy with cached stats
4625 \param staId - The station ID for which the stats is requested for
4626 \param pContext - user context to be passed back along with the callback
4627 \return eHalStatus
4628 ---------------------------------------------------------------------------*/
4629eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
4630 tANI_U32 statsMask,
4631 tCsrStatsCallback callback,
4632 tANI_U32 periodicity, tANI_BOOLEAN cache,
4633 tANI_U8 staId, void *pContext)
4634{
4635 eHalStatus status = eHAL_STATUS_FAILURE;
4636 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4637
Katya Nigambcb705f2013-12-26 14:26:22 +05304638 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004639 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07004640 status = sme_AcquireGlobalLock( &pMac->sme );
4641 if ( HAL_STATUS_SUCCESS( status ) )
4642 {
4643 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
4644 periodicity, cache, staId, pContext);
4645 sme_ReleaseGlobalLock( &pMac->sme );
4646 }
4647
4648 return (status);
4649
4650}
4651
4652/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05304653 \fn smeGetTLSTAState
4654 \helper function to get the TL STA State whenever the function is called.
4655
4656 \param staId - The staID to be passed to the TL
4657 to get the relevant TL STA State
4658 \return the state as tANI_U16
4659 ---------------------------------------------------------------------------*/
4660tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
4661{
4662 tANI_U16 tlSTAState = TL_INIT_STATE;
4663 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4664 eHalStatus status = eHAL_STATUS_FAILURE;
4665
4666 status = sme_AcquireGlobalLock( &pMac->sme );
4667 if ( HAL_STATUS_SUCCESS( status ) )
4668 {
4669 tlSTAState = csrGetTLSTAState( pMac, staId);
4670 sme_ReleaseGlobalLock( &pMac->sme );
4671 }
4672
4673 return tlSTAState;
4674}
4675
4676/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004677
4678 \fn sme_GetCountryCode
4679
4680 \brief To return the current country code. If no country code is applied, default country code is
4681 used to fill the buffer.
4682 If 11d supported is turned off, an error is return and the last applied/default country code is used.
4683 This is a synchronous API.
4684
4685 \param pBuf - pointer to a caller allocated buffer for returned country code.
4686
4687 \param pbLen For input, this parameter indicates how big is the buffer.
4688 Upon return, this parameter has the number of bytes for country. If pBuf
4689 doesn't have enough space, this function returns
4690 fail status and this parameter contains the number that is needed.
4691
4692 \return eHalStatus SUCCESS.
4693
4694 FAILURE or RESOURCES The API finished and failed.
4695
4696 -------------------------------------------------------------------------------*/
4697eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
4698{
4699 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4700
Katya Nigambcb705f2013-12-26 14:26:22 +05304701 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004702 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
4703
Jeff Johnson295189b2012-06-20 16:38:30 -07004704 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
4705}
4706
4707
4708/* ---------------------------------------------------------------------------
4709
4710 \fn sme_SetCountryCode
4711
4712 \brief To change the current/default country code.
4713 If 11d supported is turned off, an error is return.
4714 This is a synchronous API.
4715
4716 \param pCountry - pointer to a caller allocated buffer for the country code.
4717
4718 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
4719 whether a reset is required.
4720
4721 \return eHalStatus SUCCESS.
4722
4723 FAILURE or RESOURCES The API finished and failed.
4724
4725 -------------------------------------------------------------------------------*/
4726eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
4727{
4728 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4729
Katya Nigambcb705f2013-12-26 14:26:22 +05304730 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004731 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004732 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
4733}
4734
4735
4736/* ---------------------------------------------------------------------------
4737 \fn sme_ResetCountryCodeInformation
4738 \brief this function is to reset the country code current being used back to EEPROM default
4739 this includes channel list and power setting. This is a synchronous API.
4740 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4741 a restart is needed to apply the change
4742 \return eHalStatus
4743 -------------------------------------------------------------------------------*/
4744eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
4745{
4746 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4747
4748 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
4749}
4750
4751
4752/* ---------------------------------------------------------------------------
4753 \fn sme_GetSupportedCountryCode
4754 \brief this function is to get a list of the country code current being supported
4755 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
4756 this has the country code list. 3 bytes for each country code. This may be NULL if
4757 caller wants to know the needed byte count.
4758 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
4759 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
4760 \return eHalStatus
4761 -------------------------------------------------------------------------------*/
4762eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
4763{
4764 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4765
4766 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
4767}
4768
4769
4770/* ---------------------------------------------------------------------------
4771 \fn sme_GetCurrentRegulatoryDomain
4772 \brief this function is to get the current regulatory domain. This is a synchronous API.
4773 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4774 SME. The function fails if 11d support is turned off.
4775 \param pDomain - Caller allocated buffer to return the current domain.
4776 \return eHalStatus SUCCESS.
4777
4778 FAILURE or RESOURCES The API finished and failed.
4779 -------------------------------------------------------------------------------*/
4780eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
4781{
4782 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4783 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4784
4785 if( pDomain )
4786 {
4787 if( csrIs11dSupported( pMac ) )
4788 {
4789 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
4790 status = eHAL_STATUS_SUCCESS;
4791 }
4792 else
4793 {
4794 status = eHAL_STATUS_FAILURE;
4795 }
4796 }
4797
4798 return ( status );
4799}
4800
4801
4802/* ---------------------------------------------------------------------------
4803 \fn sme_SetRegulatoryDomain
4804 \brief this function is to set the current regulatory domain.
4805 This function must be called after CFG is downloaded and all the band/mode setting already passed into
4806 SME. This is a synchronous API.
4807 \param domainId - indicate the domain (defined in the driver) needs to set to.
4808 See v_REGDOMAIN_t for definition
4809 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
4810 a restart is needed to apply the change
4811 \return eHalStatus
4812 -------------------------------------------------------------------------------*/
4813eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
4814{
4815 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4816
4817 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
4818}
4819
4820
4821/* ---------------------------------------------------------------------------
4822
4823 \fn sme_GetRegulatoryDomainForCountry
4824
4825 \brief To return a regulatory domain base on a country code. This is a synchronous API.
4826
4827 \param pCountry - pointer to a caller allocated buffer for input country code.
4828
4829 \param pDomainId Upon successful return, it is the domain that country belongs to.
4830 If it is NULL, returning success means that the country code is known.
4831
4832 \return eHalStatus SUCCESS.
4833
4834 FAILURE or RESOURCES The API finished and failed.
4835
4836 -------------------------------------------------------------------------------*/
4837eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
4838{
4839 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4840
Kiet Lam6c583332013-10-14 05:37:09 +05304841 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
4842 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07004843}
4844
4845
4846
4847
4848/* ---------------------------------------------------------------------------
4849
4850 \fn sme_GetSupportedRegulatoryDomains
4851
4852 \brief To return a list of supported regulatory domains. This is a synchronous API.
4853
4854 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
4855
4856 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
4857 Upon return, this parameter has the number for supported domains. If pDomains
4858 doesn't have enough space for all the supported domains, this function returns
4859 fail status and this parameter contains the number that is needed.
4860
4861 \return eHalStatus SUCCESS.
4862
4863 FAILURE or RESOURCES The API finished and failed.
4864
4865 -------------------------------------------------------------------------------*/
4866eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
4867{
4868 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
4869
4870 //We support all domains for now
4871 if( pNumDomains )
4872 {
4873 if( NUM_REG_DOMAINS <= *pNumDomains )
4874 {
4875 status = eHAL_STATUS_SUCCESS;
4876 }
4877 *pNumDomains = NUM_REG_DOMAINS;
4878 }
4879 if( HAL_STATUS_SUCCESS( status ) )
4880 {
4881 if( pDomains )
4882 {
4883 pDomains[0] = REGDOMAIN_FCC;
4884 pDomains[1] = REGDOMAIN_ETSI;
4885 pDomains[2] = REGDOMAIN_JAPAN;
4886 pDomains[3] = REGDOMAIN_WORLD;
4887 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
4888 pDomains[5] = REGDOMAIN_APAC;
4889 pDomains[6] = REGDOMAIN_KOREA;
4890 pDomains[7] = REGDOMAIN_HI_5GHZ;
4891 pDomains[8] = REGDOMAIN_NO_5GHZ;
4892 }
4893 else
4894 {
4895 status = eHAL_STATUS_INVALID_PARAMETER;
4896 }
4897 }
4898
4899 return ( status );
4900}
4901
4902
4903//some support functions
4904tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
4905{
4906 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4907
4908 return ( csrIs11dSupported( pMac ) );
4909}
4910
4911
4912tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
4913{
4914 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4915
4916 return ( csrIs11hSupported( pMac ) );
4917}
4918
4919
4920tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
4921{
4922 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4923
4924 return ( csrIsWmmSupported( pMac ) );
4925}
4926
4927//Upper layer to get the list of the base channels to scan for passively 11d info from csr
4928eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
4929{
4930 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4931
4932 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
4933}
4934
4935/* ---------------------------------------------------------------------------
4936
4937 \fn sme_ChangeCountryCode
4938
4939 \brief Change Country code from upperlayer during WLAN driver operation.
4940 This is a synchronous API.
4941
4942 \param hHal - The handle returned by macOpen.
4943
4944 \param pCountry New Country Code String
4945
Abhishek Singha306a442013-11-07 18:39:01 +05304946 \param sendRegHint If we want to send reg hint to nl80211
4947
Jeff Johnson295189b2012-06-20 16:38:30 -07004948 \return eHalStatus SUCCESS.
4949
4950 FAILURE or RESOURCES The API finished and failed.
4951
4952 -------------------------------------------------------------------------------*/
4953eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
4954 tSmeChangeCountryCallback callback,
4955 tANI_U8 *pCountry,
4956 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304957 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05304958 tAniBool countryFromUserSpace,
4959 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07004960{
4961 eHalStatus status = eHAL_STATUS_FAILURE;
4962 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4963 vos_msg_t msg;
4964 tAniChangeCountryCodeReq *pMsg;
4965
Katya Nigambcb705f2013-12-26 14:26:22 +05304966 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004967 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004968 status = sme_AcquireGlobalLock( &pMac->sme );
4969 if ( HAL_STATUS_SUCCESS( status ) )
4970 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004971 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08004972
4973 if ((csrGetInfraSessionId(pMac) != -1) &&
4974 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
4975 {
4976
4977 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
4978
4979 sme_ReleaseGlobalLock( &pMac->sme );
4980 status = eHAL_STATUS_FAILURE;
4981 return status;
4982 }
4983
Kiet Lam64c1b492013-07-12 13:56:44 +05304984 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
4985 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07004986 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004987 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004988 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05304989 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004990 }
4991
4992 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
4993 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05304994 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05304995 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05304996 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07004997 pMsg->changeCCCallback = callback;
4998 pMsg->pDevContext = pContext;
4999 pMsg->pVosContext = pVosContext;
5000
5001 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
5002 msg.bodyptr = pMsg;
5003 msg.reserved = 0;
5004
5005 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5006 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005007 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305008 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005009 status = eHAL_STATUS_FAILURE;
5010 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005011 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005012 sme_ReleaseGlobalLock( &pMac->sme );
5013 }
5014
5015 return (status);
5016}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005017
5018/*--------------------------------------------------------------------------
5019
5020 \fn sme_GenericChangeCountryCode
5021
5022 \brief Change Country code from upperlayer during WLAN driver operation.
5023 This is a synchronous API.
5024
5025 \param hHal - The handle returned by macOpen.
5026
5027 \param pCountry New Country Code String
5028
5029 \param reg_domain regulatory domain
5030
5031 \return eHalStatus SUCCESS.
5032
5033 FAILURE or RESOURCES The API finished and failed.
5034
5035-----------------------------------------------------------------------------*/
5036eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
5037 tANI_U8 *pCountry,
5038 v_REGDOMAIN_t reg_domain)
5039{
5040 eHalStatus status = eHAL_STATUS_FAILURE;
5041 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5042 vos_msg_t msg;
5043 tAniGenericChangeCountryCodeReq *pMsg;
5044
Kiet Lamcffc5862013-10-30 16:28:45 +05305045 if (NULL == pMac)
5046 {
5047 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5048 "%s: pMac is null", __func__);
5049 return status;
5050 }
5051
Amar Singhal0d15bd52013-10-12 23:13:13 -07005052 status = sme_AcquireGlobalLock( &pMac->sme );
5053 if ( HAL_STATUS_SUCCESS( status ) )
5054 {
5055 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05305056 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
5057 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07005058 {
5059 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
5060 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05305061 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07005062 }
5063
5064 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
5065 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08005066 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005067 pMsg->domain_index = reg_domain;
5068
5069 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
5070 msg.bodyptr = pMsg;
5071 msg.reserved = 0;
5072
5073 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5074 {
5075 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05305076 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005077 status = eHAL_STATUS_FAILURE;
5078 }
5079 smsLog(pMac, LOG1, FL(" returned"));
5080 sme_ReleaseGlobalLock( &pMac->sme );
5081 }
5082
5083 return (status);
5084}
Mihir Shetee1093ba2014-01-21 20:13:32 +05305085
5086/* ---------------------------------------------------------------------------
5087
5088 \fn sme_InitChannels
5089
5090 \brief Used to initialize CSR channel lists while driver loading
5091
5092 \param hHal - global pMac structure
5093
5094 \return eHalStatus SUCCESS.
5095
5096 FAILURE or RESOURCES The API finished and failed.
5097
5098 -------------------------------------------------------------------------------*/
5099eHalStatus sme_InitChannels(tHalHandle hHal)
5100{
5101 eHalStatus status = eHAL_STATUS_FAILURE;
5102 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5103
5104 if (NULL == pMac)
5105 {
5106 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5107 "%s: pMac is null", __func__);
5108 return status;
5109 }
5110
5111 status = sme_AcquireGlobalLock(&pMac->sme);
5112 if (HAL_STATUS_SUCCESS(status))
5113 {
5114 status = csrInitChannels(pMac);
5115 sme_ReleaseGlobalLock(&pMac->sme);
5116 }
5117 return status;
5118}
5119
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305120/* ---------------------------------------------------------------------------
5121
5122 \fn sme_DHCPStartInd
5123
5124 \brief API to signal the FW about the DHCP Start event.
5125
5126 \param hHal - HAL handle for device.
5127
5128 \param device_mode - mode(AP,SAP etc) of the device.
5129
5130 \param macAddr - MAC address of the device.
5131
5132 \return eHalStatus SUCCESS.
5133
5134 FAILURE or RESOURCES The API finished and failed.
5135 --------------------------------------------------------------------------*/
5136eHalStatus sme_DHCPStartInd( tHalHandle hHal,
5137 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305138 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305139{
5140 eHalStatus status;
5141 VOS_STATUS vosStatus;
5142 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5143 vos_msg_t vosMessage;
5144 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305145 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305146
5147 status = sme_AcquireGlobalLock(&pMac->sme);
5148 if ( eHAL_STATUS_SUCCESS == status)
5149 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305150 pSession = CSR_GET_SESSION( pMac, sessionId );
5151
5152 if (!pSession)
5153 {
5154 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5155 sme_ReleaseGlobalLock( &pMac->sme );
5156 return eHAL_STATUS_FAILURE;
5157 }
5158
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305159 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5160 if (NULL == pMsg)
5161 {
5162 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5163 "%s: Not able to allocate memory for dhcp start", __func__);
5164 sme_ReleaseGlobalLock( &pMac->sme );
5165 return eHAL_STATUS_FAILURE;
5166 }
5167 pMsg->msgType = WDA_DHCP_START_IND;
5168 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5169 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305170 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5171 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305172 vosMessage.type = WDA_DHCP_START_IND;
5173 vosMessage.bodyptr = pMsg;
5174 vosMessage.reserved = 0;
5175
5176 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5177 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5178 {
5179 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5180 "%s: Post DHCP Start MSG fail", __func__);
5181 vos_mem_free(pMsg);
5182 status = eHAL_STATUS_FAILURE;
5183 }
5184 sme_ReleaseGlobalLock( &pMac->sme );
5185 }
5186 return (status);
5187}
5188/* ---------------------------------------------------------------------------
5189 \fn sme_DHCPStopInd
5190
5191 \brief API to signal the FW about the DHCP complete event.
5192
5193 \param hHal - HAL handle for device.
5194
5195 \param device_mode - mode(AP, SAP etc) of the device.
5196
5197 \param macAddr - MAC address of the device.
5198
5199 \return eHalStatus SUCCESS.
5200 FAILURE or RESOURCES The API finished and failed.
5201 --------------------------------------------------------------------------*/
5202eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5203 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305204 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305205{
5206 eHalStatus status;
5207 VOS_STATUS vosStatus;
5208 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5209 vos_msg_t vosMessage;
5210 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305211 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305212
5213 status = sme_AcquireGlobalLock(&pMac->sme);
5214 if ( eHAL_STATUS_SUCCESS == status)
5215 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305216 pSession = CSR_GET_SESSION( pMac, sessionId );
5217
5218 if (!pSession)
5219 {
5220 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5221 sme_ReleaseGlobalLock( &pMac->sme );
5222 return eHAL_STATUS_FAILURE;
5223 }
5224
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305225 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5226 if (NULL == pMsg)
5227 {
5228 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5229 "%s: Not able to allocate memory for dhcp stop", __func__);
5230 sme_ReleaseGlobalLock( &pMac->sme );
5231 return eHAL_STATUS_FAILURE;
5232 }
5233
5234 pMsg->msgType = WDA_DHCP_STOP_IND;
5235 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5236 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305237 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5238 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305239
5240 vosMessage.type = WDA_DHCP_STOP_IND;
5241 vosMessage.bodyptr = pMsg;
5242 vosMessage.reserved = 0;
5243
5244 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5245 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5246 {
5247 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5248 "%s: Post DHCP Stop MSG fail", __func__);
5249 vos_mem_free(pMsg);
5250 status = eHAL_STATUS_FAILURE;
5251 }
5252
5253 sme_ReleaseGlobalLock( &pMac->sme );
5254 }
5255 return (status);
5256}
5257
Jeff Johnson295189b2012-06-20 16:38:30 -07005258
5259/* ---------------------------------------------------------------------------
5260 \fn sme_BtcSignalBtEvent
5261 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
5262 BT event type and the current operating mode of Libra (full power,
5263 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
5264 would be employed.
5265 \param hHal - The handle returned by macOpen.
5266 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
5267 Caller owns the memory and is responsible for freeing it.
5268 \return VOS_STATUS
5269 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
5270 if BTC execution mode is set to BTC_WLAN_ONLY
5271 or BTC_PTA_ONLY.
5272 VOS_STATUS_SUCCESS BT Event passed to HAL
5273 ---------------------------------------------------------------------------*/
5274VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
5275{
5276 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005277
Jeff Johnson295189b2012-06-20 16:38:30 -07005278#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5279 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5280
Katya Nigambcb705f2013-12-26 14:26:22 +05305281 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005282 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005283 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5284 {
5285 status = btcSignalBTEvent (hHal, pBtEvent);
5286 sme_ReleaseGlobalLock( &pMac->sme );
5287 }
5288#endif
5289 return (status);
5290}
5291
5292/* ---------------------------------------------------------------------------
5293 \fn sme_BtcSetConfig
5294 \brief API to change the current Bluetooth Coexistence (BTC) configuration
5295 This function should be invoked only after CFG download has completed.
5296 Calling it after sme_HDDReadyInd is recommended.
5297 \param hHal - The handle returned by macOpen.
5298 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
5299 Caller owns the memory and is responsible for freeing it.
5300 \return VOS_STATUS
5301 VOS_STATUS_E_FAILURE Config not passed to HAL.
5302 VOS_STATUS_SUCCESS Config passed to HAL
5303 ---------------------------------------------------------------------------*/
5304VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5305{
5306 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5307#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5308 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305309 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005310 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005311 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5312 {
5313 status = btcSetConfig (hHal, pSmeBtcConfig);
5314 sme_ReleaseGlobalLock( &pMac->sme );
5315 }
5316#endif
5317 return (status);
5318}
5319
5320/* ---------------------------------------------------------------------------
5321 \fn sme_BtcGetConfig
5322 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
5323 \param hHal - The handle returned by macOpen.
5324 \param pSmeBtcConfig - Pointer to a caller allocated object of type
5325 tSmeBtcConfig. Caller owns the memory and is responsible
5326 for freeing it.
5327 \return VOS_STATUS
5328 VOS_STATUS_E_FAILURE - failure
5329 VOS_STATUS_SUCCESS success
5330 ---------------------------------------------------------------------------*/
5331VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5332{
5333 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5334#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5335 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5336
Katya Nigambcb705f2013-12-26 14:26:22 +05305337 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005338 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005339 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5340 {
5341 status = btcGetConfig (hHal, pSmeBtcConfig);
5342 sme_ReleaseGlobalLock( &pMac->sme );
5343 }
5344#endif
5345 return (status);
5346}
5347/* ---------------------------------------------------------------------------
5348 \fn sme_SetCfgPrivacy
5349 \brief API to set configure privacy parameters
5350 \param hHal - The handle returned by macOpen.
5351 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005352 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07005353
5354 \return void
5355 ---------------------------------------------------------------------------*/
5356void sme_SetCfgPrivacy( tHalHandle hHal,
5357 tCsrRoamProfile *pProfile,
5358 tANI_BOOLEAN fPrivacy
5359 )
5360{
5361 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305362 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005363 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005364 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5365 {
5366 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5367 sme_ReleaseGlobalLock( &pMac->sme );
5368 }
5369}
5370
5371#if defined WLAN_FEATURE_VOWIFI
5372/* ---------------------------------------------------------------------------
5373 \fn sme_NeighborReportRequest
5374 \brief API to request neighbor report.
5375 \param hHal - The handle returned by macOpen.
5376 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5377 tRrmNeighborReq. Caller owns the memory and is responsible
5378 for freeing it.
5379 \return VOS_STATUS
5380 VOS_STATUS_E_FAILURE - failure
5381 VOS_STATUS_SUCCESS success
5382 ---------------------------------------------------------------------------*/
5383VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5384 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5385{
5386 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5387 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305388 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005389 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005390
5391 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5392 {
5393 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5394 sme_ReleaseGlobalLock( &pMac->sme );
5395 }
5396
5397 return (status);
5398}
5399#endif
5400
5401//The following are debug APIs to support direct read/write register/memory
5402//They are placed in SME because HW cannot be access when in LOW_POWER state
5403//AND not connected. The knowledge and synchronization is done in SME
5404
5405//sme_DbgReadRegister
5406//Caller needs to validate the input values
5407VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
5408{
5409 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5410 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005411 tPmcPowerState PowerState;
5412 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05305413 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005414 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005415
5416 /* 1) To make Quarky work in FTM mode **************************************/
5417
5418 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5419 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005420 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005421 {
5422 return VOS_STATUS_SUCCESS;
5423 }
5424 return VOS_STATUS_E_FAILURE;
5425 }
5426
5427 /* 2) NON FTM mode driver *************************************************/
5428
5429 /* Acquire SME global lock */
5430 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5431 {
5432 return VOS_STATUS_E_FAILURE;
5433 }
5434
5435 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5436 {
5437 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5438 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5439 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005440 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005441 {
5442 status = VOS_STATUS_SUCCESS;
5443 }
5444 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005445 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005446 status = VOS_STATUS_E_FAILURE;
5447 }
5448 }
5449 else
5450 {
5451 status = VOS_STATUS_E_FAILURE;
5452 }
5453 }
5454
5455 /* This is a hack for Qualky/pttWniSocket
5456 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5457 if ( VOS_STATUS_SUCCESS != status )
5458 {
5459 *pRegValue = 0xDEADBEEF;
5460 status = VOS_STATUS_SUCCESS;
5461 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005462
Jeff Johnson295189b2012-06-20 16:38:30 -07005463 /* Release SME global lock */
5464 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005465
Jeff Johnson295189b2012-06-20 16:38:30 -07005466 return (status);
5467}
5468
5469
5470//sme_DbgWriteRegister
5471//Caller needs to validate the input values
5472VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
5473{
5474 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5475 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005476 tPmcPowerState PowerState;
5477 tANI_U32 sessionId = 0;
5478
5479 /* 1) To make Quarky work in FTM mode **************************************/
5480
Katya Nigambcb705f2013-12-26 14:26:22 +05305481 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005482 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005483 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5484 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005485 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005486 {
5487 return VOS_STATUS_SUCCESS;
5488 }
5489 return VOS_STATUS_E_FAILURE;
5490 }
5491
5492 /* 2) NON FTM mode driver *************************************************/
5493
5494 /* Acquire SME global lock */
5495 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5496 {
5497 return VOS_STATUS_E_FAILURE;
5498 }
5499
5500 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5501 {
5502 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5503 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5504 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005505 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005506 {
5507 status = VOS_STATUS_SUCCESS;
5508 }
5509 else
5510 {
5511 status = VOS_STATUS_E_FAILURE;
5512 }
5513 }
5514 else
5515 {
5516 status = VOS_STATUS_E_FAILURE;
5517 }
5518 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005519
Jeff Johnson295189b2012-06-20 16:38:30 -07005520 /* Release SME global lock */
5521 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005522
Jeff Johnson295189b2012-06-20 16:38:30 -07005523 return (status);
5524}
5525
5526
5527
5528//sme_DbgReadMemory
5529//Caller needs to validate the input values
5530//pBuf caller allocated buffer has the length of nLen
5531VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5532{
5533 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5534 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07005535 tPmcPowerState PowerState;
5536 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005537 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
5538 tANI_U32 arg1 = memAddr;
5539 tANI_U32 arg2 = nLen/4;
5540 tANI_U32 arg3 = 4;
5541 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07005542 /* 1) To make Quarky work in FTM mode **************************************/
5543
Katya Nigambcb705f2013-12-26 14:26:22 +05305544 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005545 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005546 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5547 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005548 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005549 {
5550 return VOS_STATUS_SUCCESS;
5551 }
5552 return VOS_STATUS_E_FAILURE;
5553 }
5554
5555 /* 2) NON FTM mode driver *************************************************/
5556
5557 /* Acquire SME global lock */
5558 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5559 {
5560 return VOS_STATUS_E_FAILURE;
5561 }
5562
5563 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5564 {
5565 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5566 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5567 {
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08005568 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf))
Jeff Johnson295189b2012-06-20 16:38:30 -07005569 {
5570 status = VOS_STATUS_SUCCESS;
5571 }
5572 else
5573 {
5574 status = VOS_STATUS_E_FAILURE;
5575 }
5576 }
5577 else
5578 {
5579 status = VOS_STATUS_E_FAILURE;
5580 }
5581 }
5582
5583 /* This is a hack for Qualky/pttWniSocket
5584 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5585 if (VOS_STATUS_SUCCESS != status)
5586 {
5587 vos_mem_set(pBuf, nLen, 0xCD);
5588 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005589 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005590 }
5591
5592 /* Release SME lock */
5593 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005594
Jeff Johnson295189b2012-06-20 16:38:30 -07005595 return (status);
5596}
5597
5598
5599//sme_DbgWriteMemory
5600//Caller needs to validate the input values
5601VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
5602{
5603 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5604 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005605 tPmcPowerState PowerState;
5606 tANI_U32 sessionId = 0;
5607
5608 /* 1) To make Quarky work in FTM mode **************************************/
5609
Katya Nigambcb705f2013-12-26 14:26:22 +05305610 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005611 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005612 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5613 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005614 {
5615 return VOS_STATUS_SUCCESS;
5616 }
5617 return VOS_STATUS_E_FAILURE;
5618 }
5619
5620 /* 2) NON FTM mode driver *************************************************/
5621
5622 /* Acquire SME global lock */
5623 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5624 {
5625 return VOS_STATUS_E_FAILURE;
5626 }
5627
5628 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5629 {
5630 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5631 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5632 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005633 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07005634 {
5635 status = VOS_STATUS_SUCCESS;
5636 }
5637 else
5638 {
5639 status = VOS_STATUS_E_FAILURE;
5640 }
5641 }
5642 else
5643 {
5644 status = VOS_STATUS_E_FAILURE;
5645 }
5646 }
5647
5648 /* Release Global lock */
5649 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005650
Jeff Johnson295189b2012-06-20 16:38:30 -07005651 return (status);
5652}
5653
5654
Katya Nigam70d68332013-09-16 16:49:45 +05305655void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
5656{
5657 VOS_TRACE_LEVEL vosDebugLevel;
5658 char logBuffer[LOG_SIZE];
5659 va_list marker;
5660
5661 /* getting proper Debug level */
5662 vosDebugLevel = getVosDebugLevel(loglevel);
5663
5664 /* extracting arguments from pstring */
5665 va_start( marker, pString );
5666 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
5667
5668 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
5669 va_end( marker );
5670}
5671
5672
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005673void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07005674{
5675#ifdef WLAN_DEBUG
5676 // Verify against current log level
5677 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
5678 return;
5679 else
5680 {
5681 va_list marker;
5682
5683 va_start( marker, pString ); /* Initialize variable arguments. */
5684
5685 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
5686
5687 va_end( marker ); /* Reset variable arguments. */
5688 }
5689#endif
5690}
Jeff Johnson295189b2012-06-20 16:38:30 -07005691
Jeff Johnson295189b2012-06-20 16:38:30 -07005692/* ---------------------------------------------------------------------------
5693 \fn sme_GetWcnssWlanCompiledVersion
5694 \brief This API returns the version of the WCNSS WLAN API with
5695 which the HOST driver was built
5696 \param hHal - The handle returned by macOpen.
5697 \param pVersion - Points to the Version structure to be filled
5698 \return VOS_STATUS
5699 VOS_STATUS_E_INVAL - failure
5700 VOS_STATUS_SUCCESS success
5701 ---------------------------------------------------------------------------*/
5702VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
5703 tSirVersionType *pVersion)
5704{
5705 VOS_STATUS status = VOS_STATUS_SUCCESS;
5706 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5707 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5708
5709 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5710 {
5711 if( pVersion != NULL )
5712 {
5713 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
5714 }
5715 else
5716 {
5717 status = VOS_STATUS_E_INVAL;
5718 }
5719 sme_ReleaseGlobalLock( &pMac->sme );
5720 }
5721
5722 return (status);
5723}
5724
5725
5726/* ---------------------------------------------------------------------------
5727 \fn sme_GetWcnssWlanReportedVersion
5728 \brief This API returns the version of the WCNSS WLAN API with
5729 which the WCNSS driver reports it was built
5730 \param hHal - The handle returned by macOpen.
5731 \param pVersion - Points to the Version structure to be filled
5732 \return VOS_STATUS
5733 VOS_STATUS_E_INVAL - failure
5734 VOS_STATUS_SUCCESS success
5735 ---------------------------------------------------------------------------*/
5736VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
5737 tSirVersionType *pVersion)
5738{
5739 VOS_STATUS status = VOS_STATUS_SUCCESS;
5740 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5741 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5742
5743 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5744 {
5745 if( pVersion != NULL )
5746 {
5747 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
5748 }
5749 else
5750 {
5751 status = VOS_STATUS_E_INVAL;
5752 }
5753 sme_ReleaseGlobalLock( &pMac->sme );
5754 }
5755
5756 return (status);
5757}
5758
5759
5760/* ---------------------------------------------------------------------------
5761 \fn sme_GetWcnssSoftwareVersion
5762 \brief This API returns the version string of the WCNSS driver
5763 \param hHal - The handle returned by macOpen.
5764 \param pVersion - Points to the Version string buffer to be filled
5765 \param versionBufferSize - THe size of the Version string buffer
5766 \return VOS_STATUS
5767 VOS_STATUS_E_INVAL - failure
5768 VOS_STATUS_SUCCESS success
5769 ---------------------------------------------------------------------------*/
5770VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
5771 tANI_U8 *pVersion,
5772 tANI_U32 versionBufferSize)
5773{
5774 VOS_STATUS status = VOS_STATUS_SUCCESS;
5775 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5776 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5777
5778 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5779 {
5780 if( pVersion != NULL )
5781 {
5782 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
5783 versionBufferSize);
5784 }
5785 else
5786 {
5787 status = VOS_STATUS_E_INVAL;
5788 }
5789 sme_ReleaseGlobalLock( &pMac->sme );
5790 }
5791
5792 return (status);
5793}
5794
5795
5796/* ---------------------------------------------------------------------------
5797 \fn sme_GetWcnssHardwareVersion
5798 \brief This API returns the version string of the WCNSS hardware
5799 \param hHal - The handle returned by macOpen.
5800 \param pVersion - Points to the Version string buffer to be filled
5801 \param versionBufferSize - THe size of the Version string buffer
5802 \return VOS_STATUS
5803 VOS_STATUS_E_INVAL - failure
5804 VOS_STATUS_SUCCESS success
5805 ---------------------------------------------------------------------------*/
5806VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
5807 tANI_U8 *pVersion,
5808 tANI_U32 versionBufferSize)
5809{
5810 VOS_STATUS status = VOS_STATUS_SUCCESS;
5811 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5812 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
5813
5814 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5815 {
5816 if( pVersion != NULL )
5817 {
5818 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
5819 versionBufferSize);
5820 }
5821 else
5822 {
5823 status = VOS_STATUS_E_INVAL;
5824 }
5825 sme_ReleaseGlobalLock( &pMac->sme );
5826 }
5827
5828 return (status);
5829}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08005830
Jeff Johnson295189b2012-06-20 16:38:30 -07005831
5832#ifdef FEATURE_WLAN_WAPI
5833/* ---------------------------------------------------------------------------
5834 \fn sme_RoamSetBKIDCache
5835 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
5836 candidate list.
5837 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5838 it is opened (by calling halOpen).
5839 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
5840 \param numItems - a variable that has the number of tBkidCacheInfo allocated
5841 when retruning, this is the number of items put into pBKIDCache
5842 \return eHalStatus - when fail, it usually means the buffer allocated is not
5843 big enough and pNumItems has the number of tBkidCacheInfo.
5844 ---------------------------------------------------------------------------*/
5845eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
5846 tANI_U32 numItems )
5847{
5848 eHalStatus status = eHAL_STATUS_FAILURE;
5849 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5850
5851 status = sme_AcquireGlobalLock( &pMac->sme );
5852 if ( HAL_STATUS_SUCCESS( status ) )
5853 {
5854 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
5855 sme_ReleaseGlobalLock( &pMac->sme );
5856 }
5857
5858 return (status);
5859}
5860
5861/* ---------------------------------------------------------------------------
5862 \fn sme_RoamGetBKIDCache
5863 \brief The SME API exposed to HDD to allow HDD to request SME to return its
5864 BKID cache.
5865 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5866 it is opened (by calling halOpen).
5867 \param pNum - caller allocated memory that has the space of the number of
5868 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
5869 in SME cache.
5870 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
5871 upon return
5872 \return eHalStatus - when fail, it usually means the buffer allocated is not
5873 big enough.
5874 ---------------------------------------------------------------------------*/
5875eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
5876 tBkidCacheInfo *pBkidCache)
5877{
5878 eHalStatus status = eHAL_STATUS_FAILURE;
5879 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5880
5881 status = sme_AcquireGlobalLock( &pMac->sme );
5882 if ( HAL_STATUS_SUCCESS( status ) )
5883 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005884 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005885 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
5886 sme_ReleaseGlobalLock( &pMac->sme );
5887 }
5888
5889 return (status);
5890}
5891
5892/* ---------------------------------------------------------------------------
5893 \fn sme_RoamGetNumBKIDCache
5894 \brief The SME API exposed to HDD to allow HDD to request SME to return the
5895 number of BKID cache entries.
5896 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
5897 it is opened (by calling halOpen).
5898 \return tANI_U32 - the number of BKID cache entries.
5899 ---------------------------------------------------------------------------*/
5900tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
5901{
5902 eHalStatus status = eHAL_STATUS_FAILURE;
5903 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5904 tANI_U32 numBkidCache = 0;
5905
5906 status = sme_AcquireGlobalLock( &pMac->sme );
5907 if ( HAL_STATUS_SUCCESS( status ) )
5908 {
5909 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
5910 sme_ReleaseGlobalLock( &pMac->sme );
5911 }
5912
5913 return (numBkidCache);
5914}
5915
5916/* ---------------------------------------------------------------------------
5917 \fn sme_ScanGetBKIDCandidateList
5918 \brief a wrapper function to return the BKID candidate list
5919 \param pBkidList - caller allocated buffer point to an array of
5920 tBkidCandidateInfo
5921 \param pNumItems - pointer to a variable that has the number of
5922 tBkidCandidateInfo allocated when retruning, this is
5923 either the number needed or number of items put into
5924 pPmkidList
5925 \return eHalStatus - when fail, it usually means the buffer allocated is not
5926 big enough and pNumItems
5927 has the number of tBkidCandidateInfo.
5928 \Note: pNumItems is a number of tBkidCandidateInfo,
5929 not sizeof(tBkidCandidateInfo) * something
5930 ---------------------------------------------------------------------------*/
5931eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
5932 tBkidCandidateInfo *pBkidList,
5933 tANI_U32 *pNumItems )
5934{
5935 eHalStatus status = eHAL_STATUS_FAILURE;
5936 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5937
5938 status = sme_AcquireGlobalLock( &pMac->sme );
5939 if ( HAL_STATUS_SUCCESS( status ) )
5940 {
5941 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
5942 sme_ReleaseGlobalLock( &pMac->sme );
5943 }
5944
5945 return (status);
5946}
5947#endif /* FEATURE_WLAN_WAPI */
5948
Jeff Johnsone7245742012-09-05 17:12:55 -07005949#ifdef FEATURE_OEM_DATA_SUPPORT
5950
5951/*****************************************************************************
5952 OEM DATA related modifications and function additions
5953 *****************************************************************************/
5954
5955/* ---------------------------------------------------------------------------
5956 \fn sme_getOemDataRsp
5957 \brief a wrapper function to obtain the OEM DATA RSP
5958 \param pOemDataRsp - A pointer to the response object
5959 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005960 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07005961 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005962eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07005963 tOemDataRsp **pOemDataRsp)
5964{
5965 eHalStatus status = eHAL_STATUS_SUCCESS;
5966 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5967
5968 do
5969 {
5970 //acquire the lock for the sme object
5971 status = sme_AcquireGlobalLock(&pMac->sme);
5972
5973 if(!HAL_STATUS_SUCCESS(status))
5974 {
5975 break;
5976 }
5977
5978 if(pMac->oemData.pOemDataRsp != NULL)
5979 {
5980 *pOemDataRsp = pMac->oemData.pOemDataRsp;
5981 }
5982 else
5983 {
5984 status = eHAL_STATUS_FAILURE;
5985 }
5986
5987 //release the lock for the sme object
5988 sme_ReleaseGlobalLock( &pMac->sme );
5989
5990 } while(0);
5991
5992 return status;
5993}
5994
5995/* ---------------------------------------------------------------------------
5996 \fn sme_OemDataReq
5997 \brief a wrapper function for OEM DATA REQ
5998 \param sessionId - session id to be used.
5999 \param pOemDataReqId - pointer to an object to get back the request ID
6000 \param callback - a callback function that is called upon finish
6001 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006002 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006003 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006004eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006005 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006006 tOemDataReqConfig *pOemDataReqConfig,
6007 tANI_U32 *pOemDataReqID,
6008 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07006009 void *pContext)
6010{
6011 eHalStatus status = eHAL_STATUS_SUCCESS;
6012 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6013
6014 do
6015 {
6016 //acquire the lock for the sme object
6017 status = sme_AcquireGlobalLock(&pMac->sme);
6018 if(HAL_STATUS_SUCCESS(status))
6019 {
6020 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
6021
6022 if(pOemDataReqID)
6023 {
6024 *pOemDataReqID = lOemDataReqId;
6025 }
6026 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006027 {
6028 sme_ReleaseGlobalLock( &pMac->sme );
6029 return eHAL_STATUS_FAILURE;
6030 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006031
6032 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
6033
6034 //release the lock for the sme object
6035 sme_ReleaseGlobalLock( &pMac->sme );
6036 }
6037 } while(0);
6038
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006039 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006040
6041 return(status);
6042}
6043
6044#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006045
6046/*--------------------------------------------------------------------------
6047
6048 \brief sme_OpenSession() - Open a session for scan/roam operation.
6049
6050 This is a synchronous API.
6051
6052
6053 \param hHal - The handle returned by macOpen.
6054 \param callback - A pointer to the function caller specifies for roam/connect status indication
6055 \param pContext - The context passed with callback
6056 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
6057 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
6058
6059 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
6060
6061 Other status means SME is failed to open the session.
6062 eHAL_STATUS_RESOURCES - no more session available.
6063 \sa
6064
6065 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006066eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
6067 void *pContext, tANI_U8 *pSelfMacAddr,
6068 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006069{
6070 eHalStatus status;
6071 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6072
6073 if( NULL == pbSessionId )
6074 {
6075 status = eHAL_STATUS_INVALID_PARAMETER;
6076 }
6077 else
6078 {
6079 status = sme_AcquireGlobalLock( &pMac->sme );
6080 if ( HAL_STATUS_SUCCESS( status ) )
6081 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006082 status = csrRoamOpenSession(pMac, callback, pContext,
6083 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006084
6085 sme_ReleaseGlobalLock( &pMac->sme );
6086 }
6087 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006088 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05306089 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006090 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006091
6092 return ( status );
6093}
6094
6095
6096/*--------------------------------------------------------------------------
6097
6098 \brief sme_CloseSession() - Open a session for scan/roam operation.
6099
6100 This is a synchronous API.
6101
6102
6103 \param hHal - The handle returned by macOpen.
6104
6105 \param sessionId - A previous opened session's ID.
6106
6107 \return eHAL_STATUS_SUCCESS - session is closed.
6108
6109 Other status means SME is failed to open the session.
6110 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
6111 \sa
6112
6113 --------------------------------------------------------------------------*/
6114eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
6115 csrRoamSessionCloseCallback callback, void *pContext)
6116{
6117 eHalStatus status;
6118 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6119
Katya Nigambcb705f2013-12-26 14:26:22 +05306120 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006121 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006122 status = sme_AcquireGlobalLock( &pMac->sme );
6123 if ( HAL_STATUS_SUCCESS( status ) )
6124 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006125 status = csrRoamCloseSession( pMac, sessionId, FALSE,
Jeff Johnson295189b2012-06-20 16:38:30 -07006126 callback, pContext );
6127
6128 sme_ReleaseGlobalLock( &pMac->sme );
6129 }
6130
6131 return ( status );
6132}
6133
Jeff Johnson295189b2012-06-20 16:38:30 -07006134/* ---------------------------------------------------------------------------
6135
6136 \fn sme_RoamUpdateAPWPSIE
6137
6138 \brief To update AP's WPS IE. This function should be called after SME AP session is created
6139 This is an asynchronous API.
6140
6141 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
6142
6143 \return eHalStatus – SUCCESS –
6144
6145 FAILURE or RESOURCES – The API finished and failed.
6146
6147 -------------------------------------------------------------------------------*/
6148eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
6149{
6150
6151 eHalStatus status = eHAL_STATUS_FAILURE;
6152 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6153
6154 status = sme_AcquireGlobalLock( &pMac->sme );
6155 if ( HAL_STATUS_SUCCESS( status ) )
6156 {
6157
6158 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
6159
6160 sme_ReleaseGlobalLock( &pMac->sme );
6161 }
6162
6163 return (status);
6164}
6165/* ---------------------------------------------------------------------------
6166
6167 \fn sme_RoamUpdateAPWPARSNIEs
6168
6169 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
6170 This is an asynchronous API.
6171
6172 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
6173
6174 \return eHalStatus – SUCCESS –
6175
6176 FAILURE or RESOURCES – The API finished and failed.
6177
6178 -------------------------------------------------------------------------------*/
6179eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
6180{
6181
6182 eHalStatus status = eHAL_STATUS_FAILURE;
6183 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6184
6185 status = sme_AcquireGlobalLock( &pMac->sme );
6186 if ( HAL_STATUS_SUCCESS( status ) )
6187 {
6188
6189 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
6190
6191 sme_ReleaseGlobalLock( &pMac->sme );
6192 }
6193
6194 return (status);
6195}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006196/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006197
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006198 \fn sme_ChangeMCCBeaconInterval
6199
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006200 \brief To update P2P-GO beaconInterval. This function should be called after
6201 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006202 This is an asynchronous API.
6203
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006204 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006205
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006206 \return eHalStatus SUCCESS
6207 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006208 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006209
6210 -------------------------------------------------------------------------------*/
6211eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
6212{
6213 eHalStatus status = eHAL_STATUS_FAILURE;
6214 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6215
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006216 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006217 status = sme_AcquireGlobalLock( &pMac->sme );
6218 if ( HAL_STATUS_SUCCESS( status ) )
6219 {
6220 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
6221 sme_ReleaseGlobalLock( &pMac->sme );
6222 }
6223 return (status);
6224}
Jeff Johnson295189b2012-06-20 16:38:30 -07006225
6226/*-------------------------------------------------------------------------------*
6227
6228 \fn sme_sendBTAmpEvent
6229
6230 \brief to receive the coex priorty request from BT-AMP PAL
6231 and send the BT_AMP link state to HAL
6232
6233 \param btAmpEvent - btAmpEvent
6234
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08006235 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07006236
6237 FAILURE: API failed
6238
6239-------------------------------------------------------------------------------*/
6240
6241eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
6242{
6243 vos_msg_t msg;
6244 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
6245 eHalStatus status = eHAL_STATUS_FAILURE;
6246
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08006247 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07006248 if (NULL == ptrSmeBtAmpEvent)
6249 {
6250 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006251 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006252 return status;
6253 }
6254
6255 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
6256 msg.type = WDA_SIGNAL_BTAMP_EVENT;
6257 msg.reserved = 0;
6258 msg.bodyptr = ptrSmeBtAmpEvent;
6259
6260 //status = halFW_SendBTAmpEventMesg(pMac, event);
6261
6262 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6263 {
6264 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006265 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006266 vos_mem_free(ptrSmeBtAmpEvent);
6267 return status;
6268 }
6269
6270 return eHAL_STATUS_SUCCESS;
6271
6272}
6273
6274/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306275 \fn smeIssueFastRoamNeighborAPEvent
6276 \brief API to trigger fast BSS roam independent of RSSI triggers
6277 \param hHal - The handle returned by macOpen.
6278 \param bssid - Pointer to the BSSID to roam to.
6279 \param fastRoamTrig - Trigger to Scan or roam
6280 \return eHalStatus
6281 ---------------------------------------------------------------------------*/
6282eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
6283 tANI_U8 *bssid,
6284 tSmeFastRoamTrigger fastRoamTrig)
6285{
6286 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6287 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
6288 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6289 eHalStatus status = eHAL_STATUS_SUCCESS;
6290
6291 status = sme_AcquireGlobalLock( &pMac->sme );
6292 if ( HAL_STATUS_SUCCESS( status ) )
6293 {
6294 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6295 "%s: invoked", __func__);
6296
6297 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
6298 {
6299 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
6300 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
6301 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6302 (void *)bssid, sizeof(tSirMacAddr));
Arif Hussaina7c8e412013-11-20 11:06:42 -08006303 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID "
6304 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306305
6306 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
6307 if (VOS_STATUS_SUCCESS != vosStatus)
6308 {
6309 smsLog(pMac, LOGE,
6310 FL("CFG Channel list scan state failed with status %d "),
6311 vosStatus);
6312 }
6313 }
6314 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
6315 {
6316 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6317 (void *)bssid, sizeof(tSirMacAddr));
6318 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08006319 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
6320 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306321
6322 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
6323 0,
6324 pMac,
6325 0);
6326
6327 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6328 {
6329 smsLog(pMac,
6330 LOGE,
6331 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
6332 vosStatus);
6333 }
6334 }
6335 sme_ReleaseGlobalLock( &pMac->sme );
6336 }
6337 return vosStatus;
6338}
6339/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006340 \fn sme_SetHostOffload
6341 \brief API to set the host offload feature.
6342 \param hHal - The handle returned by macOpen.
6343 \param pRequest - Pointer to the offload request.
6344 \return eHalStatus
6345 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006346eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006347 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006348{
6349 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07006350 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006351
Katya Nigambcb705f2013-12-26 14:26:22 +05306352 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006353 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006354 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6355 {
6356#ifdef WLAN_NS_OFFLOAD
6357 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
6358 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006359 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006360 }
6361 else
6362#endif //WLAN_NS_OFFLOAD
6363 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006364 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006365 }
6366 sme_ReleaseGlobalLock( &pMac->sme );
6367 }
6368
6369 return (status);
6370}
6371
6372#ifdef WLAN_FEATURE_GTK_OFFLOAD
6373/* ---------------------------------------------------------------------------
6374 \fn sme_SetGTKOffload
6375 \brief API to set GTK offload information.
6376 \param hHal - The handle returned by macOpen.
6377 \param pRequest - Pointer to the GTK offload request.
6378 \return eHalStatus
6379 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006380eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006381 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006382{
6383 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6384 eHalStatus status;
6385
Katya Nigambcb705f2013-12-26 14:26:22 +05306386 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006387 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006388 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6389 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006390 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006391 sme_ReleaseGlobalLock( &pMac->sme );
6392 }
6393
6394 return (status);
6395}
6396
6397/* ---------------------------------------------------------------------------
6398 \fn sme_GetGTKOffload
6399 \brief API to get GTK offload information.
6400 \param hHal - The handle returned by macOpen.
6401 \param pRequest - Pointer to the GTK offload response.
6402 \return eHalStatus
6403 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006404eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006405 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07006406{
6407 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6408 eHalStatus status;
6409
Katya Nigambcb705f2013-12-26 14:26:22 +05306410 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006411 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006412 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6413 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006414 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006415 sme_ReleaseGlobalLock( &pMac->sme );
6416 }
6417
6418 return (status);
6419}
6420#endif // WLAN_FEATURE_GTK_OFFLOAD
6421
6422/* ---------------------------------------------------------------------------
6423 \fn sme_SetKeepAlive
6424 \brief API to set the Keep Alive feature.
6425 \param hHal - The handle returned by macOpen.
6426 \param pRequest - Pointer to the Keep Alive request.
6427 \return eHalStatus
6428 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006429eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006430 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006431{
6432 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6433 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07006434 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6435 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006436 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006437 sme_ReleaseGlobalLock( &pMac->sme );
6438 }
6439
6440 return (status);
6441}
6442
6443#ifdef FEATURE_WLAN_SCAN_PNO
6444/* ---------------------------------------------------------------------------
6445 \fn sme_SetPreferredNetworkList
6446 \brief API to set the Preferred Network List Offload feature.
6447 \param hHal - The handle returned by macOpen.
6448 \param pRequest - Pointer to the offload request.
6449 \return eHalStatus
6450 ---------------------------------------------------------------------------*/
6451eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
6452{
6453 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6454 eHalStatus status;
6455
6456 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6457 {
6458 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
6459 sme_ReleaseGlobalLock( &pMac->sme );
6460 }
6461
6462 return (status);
6463}
6464
6465eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
6466{
6467 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6468 eHalStatus status;
6469
6470 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6471 {
6472 pmcSetRssiFilter(hHal, rssiThreshold);
6473 sme_ReleaseGlobalLock( &pMac->sme );
6474 }
6475
6476 return (status);
6477}
6478
6479#endif // FEATURE_WLAN_SCAN_PNO
6480
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006481eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07006482{
6483 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6484 eHalStatus status;
6485
Katya Nigambcb705f2013-12-26 14:26:22 +05306486 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006487 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006488 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6489 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006490 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07006491 sme_ReleaseGlobalLock( &pMac->sme );
6492 }
6493
6494 return (status);
6495}
6496
6497/* ---------------------------------------------------------------------------
6498 \fn sme_AbortMacScan
6499 \brief API to cancel MAC scan.
6500 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306501 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306502 \param reason - Reason to abort the scan.
Jeff Johnson295189b2012-06-20 16:38:30 -07006503 \return VOS_STATUS
6504 VOS_STATUS_E_FAILURE - failure
6505 VOS_STATUS_SUCCESS success
6506 ---------------------------------------------------------------------------*/
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306507eHalStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
6508 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07006509{
6510 eHalStatus status;
6511 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6512
Katya Nigambcb705f2013-12-26 14:26:22 +05306513 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006514 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006515 status = sme_AcquireGlobalLock( &pMac->sme );
6516 if ( HAL_STATUS_SUCCESS( status ) )
6517 {
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306518 status = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006519
Jeff Johnson295189b2012-06-20 16:38:30 -07006520 sme_ReleaseGlobalLock( &pMac->sme );
6521 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006522
Jeff Johnson295189b2012-06-20 16:38:30 -07006523 return ( status );
6524}
6525
6526/* ----------------------------------------------------------------------------
6527 \fn sme_GetOperationChannel
6528 \brief API to get current channel on which STA is parked
6529 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006530 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07006531 \returns eHAL_STATUS_SUCCESS
6532 eHAL_STATUS_FAILURE
6533-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006534eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006535{
Jeff Johnson295189b2012-06-20 16:38:30 -07006536 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6537 tCsrRoamSession *pSession;
6538
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006539 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07006540 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006541 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006542
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006543 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006544 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006545 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07006546 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
6547 {
6548 *pChannel =pSession->connectedProfile.operationChannel;
6549 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07006550 }
6551 }
6552 return eHAL_STATUS_FAILURE;
6553}// sme_GetOperationChannel ends here
6554
Jeff Johnson295189b2012-06-20 16:38:30 -07006555/* ---------------------------------------------------------------------------
6556
6557 \fn sme_RegisterMgtFrame
6558
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006559 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006560 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006561 \param matchData - data which needs to be matched before passing frame
6562 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006563 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006564 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006565 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006566eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006567 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6568{
6569 eHalStatus status = eHAL_STATUS_SUCCESS;
6570 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6571
Katya Nigambcb705f2013-12-26 14:26:22 +05306572 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006573 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006574 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6575 {
6576 tSirRegisterMgmtFrame *pMsg;
6577 tANI_U16 len;
6578 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006579
6580 if(!pSession)
6581 {
6582 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006583 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006584 return eHAL_STATUS_FAILURE;
6585 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006586
Jeff Johnson295189b2012-06-20 16:38:30 -07006587 if( !pSession->sessionActive )
6588 {
6589 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006590 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006591 sme_ReleaseGlobalLock( &pMac->sme );
6592 return eHAL_STATUS_FAILURE;
6593 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006594
Jeff Johnson295189b2012-06-20 16:38:30 -07006595 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6596
Kiet Lam64c1b492013-07-12 13:56:44 +05306597 pMsg = vos_mem_malloc(len);
6598 if ( NULL == pMsg )
6599 status = eHAL_STATUS_FAILURE;
6600 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006601 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306602 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006603 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
6604 pMsg->length = len;
6605 pMsg->sessionId = sessionId;
6606 pMsg->registerFrame = VOS_TRUE;
6607 pMsg->frameType = frameType;
6608 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306609 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006610 status = palSendMBMessage(pMac->hHdd, pMsg);
6611 }
6612 sme_ReleaseGlobalLock( &pMac->sme );
6613 }
6614 return status;
6615}
6616
6617/* ---------------------------------------------------------------------------
6618
6619 \fn sme_DeregisterMgtFrame
6620
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006621 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07006622 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006623 \param matchData - data which needs to be matched before passing frame
6624 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07006625 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006626 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07006627 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006628eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07006629 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
6630{
6631 eHalStatus status = eHAL_STATUS_SUCCESS;
6632 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6633
Katya Nigambcb705f2013-12-26 14:26:22 +05306634 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006635 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006636 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6637 {
6638 tSirRegisterMgmtFrame *pMsg;
6639 tANI_U16 len;
6640 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006641
6642 if(!pSession)
6643 {
6644 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006645 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07006646 return eHAL_STATUS_FAILURE;
6647 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006648
6649 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07006650 {
6651 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006652 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006653 sme_ReleaseGlobalLock( &pMac->sme );
6654 return eHAL_STATUS_FAILURE;
6655 }
6656
6657 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
6658
Kiet Lam64c1b492013-07-12 13:56:44 +05306659 pMsg = vos_mem_malloc(len);
6660 if ( NULL == pMsg )
6661 status = eHAL_STATUS_FAILURE;
6662 else
Jeff Johnson295189b2012-06-20 16:38:30 -07006663 {
Kiet Lam64c1b492013-07-12 13:56:44 +05306664 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07006665 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006666 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07006667 pMsg->registerFrame = VOS_FALSE;
6668 pMsg->frameType = frameType;
6669 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05306670 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07006671 status = palSendMBMessage(pMac->hHdd, pMsg);
6672 }
6673 sme_ReleaseGlobalLock( &pMac->sme );
6674 }
6675 return status;
6676}
6677
6678/* ---------------------------------------------------------------------------
6679 \fn sme_RemainOnChannel
6680 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
6681 \param hHal - The handle returned by macOpen.
6682 \param pRequest - channel
6683 \param duration - duration in ms
6684 \param callback - HDD registered callback to process reaminOnChannelRsp
6685 \param context - HDD Callback param
6686 \return eHalStatus
6687 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006688eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
6689 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306690 remainOnChanCallback callback,
6691 void *pContext,
6692 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07006693{
6694 eHalStatus status = eHAL_STATUS_SUCCESS;
6695 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6696
Katya Nigambcb705f2013-12-26 14:26:22 +05306697 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006698 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006699 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6700 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05306701 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
6702 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07006703#ifdef WLAN_FEATURE_P2P_INTERNAL
6704 , eP2PRemainOnChnReasonUnknown
6705#endif
6706 );
6707 sme_ReleaseGlobalLock( &pMac->sme );
6708 }
6709 return(status);
6710}
6711
6712/* ---------------------------------------------------------------------------
6713 \fn sme_ReportProbeReq
6714 \brief API to enable/disable forwarding of probeReq to apps in p2p.
6715 \param hHal - The handle returned by macOpen.
6716 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
6717 \return eHalStatus
6718 ---------------------------------------------------------------------------*/
6719
6720#ifndef WLAN_FEATURE_CONCURRENT_P2P
6721eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
6722{
6723 eHalStatus status = eHAL_STATUS_SUCCESS;
6724 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6725
6726 do
6727 {
6728 //acquire the lock for the sme object
6729 status = sme_AcquireGlobalLock(&pMac->sme);
6730 if(HAL_STATUS_SUCCESS(status))
6731 {
6732 /* call set in context */
6733 pMac->p2pContext.probeReqForwarding = flag;
6734 //release the lock for the sme object
6735 sme_ReleaseGlobalLock( &pMac->sme );
6736 }
6737 } while(0);
6738
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006739 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006740
6741 return(status);
6742}
6743
6744/* ---------------------------------------------------------------------------
6745 \fn sme_updateP2pIe
6746 \brief API to set the P2p Ie in p2p context
6747 \param hHal - The handle returned by macOpen.
6748 \param p2pIe - Ptr to p2pIe from HDD.
6749 \param p2pIeLength: length of p2pIe
6750 \return eHalStatus
6751 ---------------------------------------------------------------------------*/
6752
6753eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
6754{
6755 eHalStatus status = eHAL_STATUS_SUCCESS;
6756 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6757
6758 //acquire the lock for the sme object
6759 status = sme_AcquireGlobalLock(&pMac->sme);
6760 if(HAL_STATUS_SUCCESS(status))
6761 {
6762 if(NULL != pMac->p2pContext.probeRspIe){
6763 vos_mem_free(pMac->p2pContext.probeRspIe);
6764 pMac->p2pContext.probeRspIeLength = 0;
6765 }
6766
6767 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
6768 if (NULL == pMac->p2pContext.probeRspIe)
6769 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006770 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006771 pMac->p2pContext.probeRspIeLength = 0;
6772 status = eHAL_STATUS_FAILURE;
6773 }
6774 else
6775 {
6776 pMac->p2pContext.probeRspIeLength = p2pIeLength;
6777
6778 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
6779 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006780 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07006781 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
6782 p2pIeLength);
6783 }
6784
6785 //release the lock for the sme object
6786 sme_ReleaseGlobalLock( &pMac->sme );
6787 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006788
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006789 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006790
6791 return(status);
6792}
6793#endif
6794
6795/* ---------------------------------------------------------------------------
6796 \fn sme_sendAction
6797 \brief API to send action frame from supplicant.
6798 \param hHal - The handle returned by macOpen.
6799 \return eHalStatus
6800 ---------------------------------------------------------------------------*/
6801
6802eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006803 const tANI_U8 *pBuf, tANI_U32 len,
6804 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07006805{
6806 eHalStatus status = eHAL_STATUS_SUCCESS;
6807 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6808
Katya Nigambcb705f2013-12-26 14:26:22 +05306809 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006810 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006811 //acquire the lock for the sme object
6812 status = sme_AcquireGlobalLock(&pMac->sme);
6813 if(HAL_STATUS_SUCCESS(status))
6814 {
Jeff Johnsone7245742012-09-05 17:12:55 -07006815 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07006816 //release the lock for the sme object
6817 sme_ReleaseGlobalLock( &pMac->sme );
6818 }
6819
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006820 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006821
6822 return(status);
6823}
6824
6825eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
6826{
6827 eHalStatus status = eHAL_STATUS_SUCCESS;
6828 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6829
Katya Nigambcb705f2013-12-26 14:26:22 +05306830 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006831 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006832 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6833 {
6834 status = p2pCancelRemainOnChannel (hHal, sessionId);
6835 sme_ReleaseGlobalLock( &pMac->sme );
6836 }
6837 return(status);
6838}
6839
6840//Power Save Related
6841eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
6842{
6843 eHalStatus status = eHAL_STATUS_SUCCESS;
6844 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6845
6846 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6847 {
6848 status = p2pSetPs (hHal, data);
6849 sme_ReleaseGlobalLock( &pMac->sme );
6850 }
6851 return(status);
6852}
6853
Jeff Johnson295189b2012-06-20 16:38:30 -07006854
6855/* ---------------------------------------------------------------------------
6856
6857 \fn sme_ConfigureRxpFilter
6858
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006859 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07006860 SME will pass this request to lower mac to set/reset the filter on RXP for
6861 multicast & broadcast traffic.
6862
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006863 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07006864
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006865 hHal - The handle returned by macOpen.
6866
Jeff Johnson295189b2012-06-20 16:38:30 -07006867 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
6868 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
6869 on this param. In future we can use this as a mask to set various types of
6870 filters as suggested below:
6871 FILTER_ALL_MULTICAST:
6872 FILTER_ALL_BROADCAST:
6873 FILTER_ALL_MULTICAST_BROADCAST:
6874
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006875
6876 \return eHalStatus
6877
6878
Jeff Johnson295189b2012-06-20 16:38:30 -07006879--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006880eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07006881 tpSirWlanSetRxpFilters wlanRxpFilterParam)
6882{
6883 eHalStatus status = eHAL_STATUS_SUCCESS;
6884 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6885 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6886 vos_msg_t vosMessage;
6887
Katya Nigambcb705f2013-12-26 14:26:22 +05306888 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006889 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006890 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6891 {
6892 /* serialize the req through MC thread */
6893 vosMessage.bodyptr = wlanRxpFilterParam;
6894 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
6895 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6896 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6897 {
6898 status = eHAL_STATUS_FAILURE;
6899 }
6900 sme_ReleaseGlobalLock( &pMac->sme );
6901 }
6902 return(status);
6903}
6904
Jeff Johnson295189b2012-06-20 16:38:30 -07006905/* ---------------------------------------------------------------------------
6906
6907 \fn sme_ConfigureSuspendInd
6908
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006909 \brief
6910 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07006911 be suspended
6912
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006913 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07006914
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006915 hHal - The handle returned by macOpen.
6916
Jeff Johnson295189b2012-06-20 16:38:30 -07006917 wlanSuspendParam- Depicts the wlan suspend params
6918
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006919
6920 \return eHalStatus
6921
6922
Jeff Johnson295189b2012-06-20 16:38:30 -07006923--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006924eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07006925 tpSirWlanSuspendParam wlanSuspendParam)
6926{
6927 eHalStatus status = eHAL_STATUS_SUCCESS;
6928 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6929 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6930 vos_msg_t vosMessage;
6931
Katya Nigambcb705f2013-12-26 14:26:22 +05306932 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006933 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006934 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6935 {
6936 /* serialize the req through MC thread */
6937 vosMessage.bodyptr = wlanSuspendParam;
6938 vosMessage.type = WDA_WLAN_SUSPEND_IND;
6939 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6940 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6941 {
6942 status = eHAL_STATUS_FAILURE;
6943 }
6944 sme_ReleaseGlobalLock( &pMac->sme );
6945 }
6946 return(status);
6947}
6948
6949/* ---------------------------------------------------------------------------
6950
6951 \fn sme_ConfigureResumeReq
6952
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006953 \brief
6954 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07006955 be Resumed
6956
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006957 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07006958
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006959 hHal - The handle returned by macOpen.
6960
Jeff Johnson295189b2012-06-20 16:38:30 -07006961 wlanResumeParam- Depicts the wlan resume params
6962
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006963
6964 \return eHalStatus
6965
6966
Jeff Johnson295189b2012-06-20 16:38:30 -07006967--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006968eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07006969 tpSirWlanResumeParam wlanResumeParam)
6970{
6971 eHalStatus status = eHAL_STATUS_SUCCESS;
6972 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6973 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6974 vos_msg_t vosMessage;
6975
Katya Nigambcb705f2013-12-26 14:26:22 +05306976 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006977 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006978 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6979 {
6980 /* serialize the req through MC thread */
6981 vosMessage.bodyptr = wlanResumeParam;
6982 vosMessage.type = WDA_WLAN_RESUME_REQ;
6983 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
6984 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
6985 {
6986 status = eHAL_STATUS_FAILURE;
6987 }
6988 sme_ReleaseGlobalLock( &pMac->sme );
6989 }
6990 return(status);
6991}
6992
Jeff Johnson295189b2012-06-20 16:38:30 -07006993/* ---------------------------------------------------------------------------
6994
6995 \fn sme_GetInfraSessionId
6996
6997 \brief To get the session ID for infra session, if connected
6998 This is a synchronous API.
6999
7000 \param hHal - The handle returned by macOpen.
7001
7002 \return sessionid, -1 if infra session is not connected
7003
7004 -------------------------------------------------------------------------------*/
7005tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
7006{
7007 eHalStatus status = eHAL_STATUS_FAILURE;
7008 tANI_S8 sessionid = -1;
7009 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007010
Jeff Johnson295189b2012-06-20 16:38:30 -07007011 status = sme_AcquireGlobalLock( &pMac->sme );
7012 if ( HAL_STATUS_SUCCESS( status ) )
7013 {
7014
7015 sessionid = csrGetInfraSessionId( pMac);
7016
7017 sme_ReleaseGlobalLock( &pMac->sme );
7018 }
7019
7020 return (sessionid);
7021}
7022
7023/* ---------------------------------------------------------------------------
7024
7025 \fn sme_GetInfraOperationChannel
7026
7027 \brief To get the operating channel for infra session, if connected
7028 This is a synchronous API.
7029
7030 \param hHal - The handle returned by macOpen.
7031 \param sessionId - the sessionId returned by sme_OpenSession.
7032
7033 \return operating channel, 0 if infra session is not connected
7034
7035 -------------------------------------------------------------------------------*/
7036tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
7037{
7038 eHalStatus status = eHAL_STATUS_FAILURE;
7039 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7040 tANI_U8 channel = 0;
7041 status = sme_AcquireGlobalLock( &pMac->sme );
7042 if ( HAL_STATUS_SUCCESS( status ) )
7043 {
7044
7045 channel = csrGetInfraOperationChannel( pMac, sessionId);
7046
7047 sme_ReleaseGlobalLock( &pMac->sme );
7048 }
7049
7050 return (channel);
7051}
7052
7053//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 -07007054//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07007055tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
7056{
7057 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007058 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07007059 tANI_U8 channel = 0;
7060 status = sme_AcquireGlobalLock( &pMac->sme );
7061 if ( HAL_STATUS_SUCCESS( status ) )
7062 {
7063
7064 channel = csrGetConcurrentOperationChannel( pMac );
7065 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007066 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07007067 sme_ReleaseGlobalLock( &pMac->sme );
7068 }
7069
7070 return (channel);
7071}
7072
7073#ifdef FEATURE_WLAN_SCAN_PNO
7074/******************************************************************************
7075*
7076* Name: sme_PreferredNetworkFoundInd
7077*
7078* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007079* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07007080*
7081* Parameters:
7082* hHal - HAL handle for device
7083* pMsg - found network description
7084*
7085* Returns: eHalStatus
7086*
7087******************************************************************************/
7088eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
7089{
7090 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7091 eHalStatus status = eHAL_STATUS_SUCCESS;
7092 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07007093 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
7094 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007095
7096 if (NULL == pMsg)
7097 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007098 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007099 status = eHAL_STATUS_FAILURE;
7100 }
7101 else
7102 {
7103 if (pPrefNetworkFoundInd->ssId.length > 0)
7104 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07007105 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
7106 pPrefNetworkFoundInd->ssId.length);
7107 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
7108 dumpSsId[ssIdLength] = 0;
7109 smsLog(pMac, LOG2, "%s:SSID=%s frame length %d",
7110 __func__, dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07007111
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05307112 /* Flush scan results, So as to avoid indication/updation of
7113 * stale entries, which may not have aged out during APPS collapse
7114 */
7115 sme_ScanFlushResult(hHal,0);
7116
Srikant Kuppa066904f2013-05-07 13:56:02 -07007117 //Save the frame to scan result
7118 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
7119 {
7120 //we may have a frame
7121 status = csrScanSavePreferredNetworkFound(pMac,
7122 pPrefNetworkFoundInd);
7123 if (!HAL_STATUS_SUCCESS(status))
7124 {
7125 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
7126 }
7127 }
7128 else
7129 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08007130 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07007131 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07007132 }
7133
Srikant Kuppa066904f2013-05-07 13:56:02 -07007134 /* Call Preferred Netowrk Found Indication callback routine. */
7135 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
7136 {
7137 pMac->pmc.prefNetwFoundCB(
7138 pMac->pmc.preferredNetworkFoundIndCallbackContext,
7139 pPrefNetworkFoundInd);
7140 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007141 }
7142 else
7143 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007144 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007145 status = eHAL_STATUS_FAILURE;
7146 }
7147 }
7148
7149
7150 return(status);
7151}
7152
7153#endif // FEATURE_WLAN_SCAN_PNO
7154
7155
7156eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
7157{
7158 eHalStatus status = eHAL_STATUS_FAILURE;
7159 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007160
Jeff Johnson295189b2012-06-20 16:38:30 -07007161 status = sme_AcquireGlobalLock( &pMac->sme );
7162 if ( HAL_STATUS_SUCCESS( status ) )
7163 {
7164 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
7165 sme_ReleaseGlobalLock( &pMac->sme );
7166 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007167
Jeff Johnson295189b2012-06-20 16:38:30 -07007168 return (status);
7169}
7170
7171
7172/* ---------------------------------------------------------------------------
7173
7174 \fn sme_SetTxPerTracking
7175
7176 \brief Set Tx PER tracking configuration parameters
7177
7178 \param hHal - The handle returned by macOpen.
7179 \param pTxPerTrackingConf - Tx PER configuration parameters
7180
7181 \return eHalStatus
7182
7183 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007184eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
7185 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07007186 void *pCallbackContext,
7187 tpSirTxPerTrackingParam pTxPerTrackingParam)
7188{
7189 vos_msg_t msg;
7190 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
7191 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7192
7193 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7194 {
7195 pMac->sme.pTxPerHitCallback = pCallbackfn;
7196 pMac->sme.pTxPerHitCbContext = pCallbackContext;
7197 sme_ReleaseGlobalLock( &pMac->sme );
7198 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007199
Jeff Johnson295189b2012-06-20 16:38:30 -07007200 // free this memory in failure case or WDA request callback function
7201 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
7202 if (NULL == pTxPerTrackingParamReq)
7203 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007204 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 -07007205 return eHAL_STATUS_FAILURE;
7206 }
7207
Kiet Lam64c1b492013-07-12 13:56:44 +05307208 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
7209 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07007210 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
7211 msg.reserved = 0;
7212 msg.bodyptr = pTxPerTrackingParamReq;
7213
7214 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7215 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007216 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 -07007217 vos_mem_free(pTxPerTrackingParamReq);
7218 return eHAL_STATUS_FAILURE;
7219 }
7220
7221 return eHAL_STATUS_SUCCESS;
7222}
7223
7224/* ---------------------------------------------------------------------------
7225
7226 \fn sme_HandleChangeCountryCode
7227
7228 \brief Change Country code, Reg Domain and channel list
7229
7230 \details Country Code Priority
7231 0 = 11D > Configured Country > NV
7232 1 = Configured Country > 11D > NV
7233 If Supplicant country code is priority than 11d is disabled.
7234 If 11D is enabled, we update the country code after every scan.
7235 Hence when Supplicant country code is priority, we don't need 11D info.
7236 Country code from Supplicant is set as current courtry code.
7237 User can send reset command XX (instead of country code) to reset the
7238 country code to default values which is read from NV.
7239 In case of reset, 11D is enabled and default NV code is Set as current country code
7240 If 11D is priority,
7241 Than Supplicant country code code is set to default code. But 11D code is set as current country code
7242
7243 \param pMac - The handle returned by macOpen.
7244 \param pMsgBuf - MSG Buffer
7245
7246 \return eHalStatus
7247
7248 -------------------------------------------------------------------------------*/
7249eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7250{
7251 eHalStatus status = eHAL_STATUS_SUCCESS;
7252 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007253 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07007254 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7255 static uNvTables nvTables;
7256 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
7257
7258
7259 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
7260 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
7261 {
7262 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7263
7264 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
7265
7266 /* read the country code from NV and use it */
7267 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
7268 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307269 vos_mem_copy(pMsg->countryCode,
7270 nvTables.defaultCountryTable.countryCode,
7271 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007272 }
7273 else
7274 {
7275 status = eHAL_STATUS_FAILURE;
7276 return status;
7277 }
7278 }
7279 else
7280 {
7281 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05307282 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
7283 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07007284 {
7285 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7286 }
7287 }
7288
7289 /* WEXT set country code means
7290 * 11D should be supported?
7291 * 11D Channel should be enforced?
7292 * 11D Country code should be matched?
7293 * 11D Reg Domian should be matched?
7294 * Country string changed */
7295 if(pMac->roam.configParam.Is11dSupportEnabled &&
7296 pMac->roam.configParam.fEnforce11dChannels &&
7297 pMac->roam.configParam.fEnforceCountryCodeMatch &&
7298 pMac->roam.configParam.fEnforceDefaultDomain &&
7299 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
7300 {
7301 /* All 11D related options are already enabled
7302 * Country string is not changed
7303 * Do not need do anything for country code change request */
7304 return eHAL_STATUS_SUCCESS;
7305 }
7306
7307 /* Set Current Country code and Current Regulatory domain */
7308 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
7309 if(eHAL_STATUS_SUCCESS != status)
7310 {
7311 /* Supplicant country code failed. So give 11D priority */
7312 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7313 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007314 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007315 }
7316
Jeff Johnson295189b2012-06-20 16:38:30 -07007317 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05307318 vos_mem_copy(pMac->scan.countryCodeDefault,
7319 pMac->scan.countryCodeCurrent,
7320 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007321
7322 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05307323 status = csrGetRegulatoryDomainForCountry(pMac,
7324 pMac->scan.countryCodeCurrent,
7325 (v_REGDOMAIN_t *) &domainIdIoctl,
7326 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07007327 if ( status != eHAL_STATUS_SUCCESS )
7328 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007329 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007330 return status;
7331 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08007332 else if (REGDOMAIN_WORLD == domainIdIoctl)
7333 {
7334 /* Supplicant country code is invalid, so we are on world mode now. So
7335 give 11D chance to update */
7336 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7337 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
7338 }
7339
Jeff Johnson295189b2012-06-20 16:38:30 -07007340
Abhishek Singha306a442013-11-07 18:39:01 +05307341 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07007342
7343 if ( status != eHAL_STATUS_SUCCESS )
7344 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007345 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007346 return status;
7347 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007348 else
7349 {
7350 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7351 //set again if we find AP with 11d info during scan
7352 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
7353 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007354 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007355 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7356 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7357 }
7358 }
Kiet Lam6c583332013-10-14 05:37:09 +05307359#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07007360 /* set to default domain ID */
7361 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7362
7363 /* get the channels based on new cc */
7364 status = csrInitGetChannels( pMac );
7365
7366 if ( status != eHAL_STATUS_SUCCESS )
7367 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007368 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007369 return status;
7370 }
7371
7372 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08007373 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307374 /* Country code Changed, Purge Only scan result
7375 * which does not have channel number belong to 11d
7376 * channel list
7377 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307378 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307379
Kiet Lam6c583332013-10-14 05:37:09 +05307380#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007381 if( pMsg->changeCCCallback )
7382 {
7383 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
7384 }
7385
7386 return eHAL_STATUS_SUCCESS;
7387}
7388
Amar Singhal0d15bd52013-10-12 23:13:13 -07007389/* ---------------------------------------------------------------------------
7390
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007391 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07007392
7393 \brief Change Country code, Reg Domain and channel list
7394
7395 If Supplicant country code is priority than 11d is disabled.
7396 If 11D is enabled, we update the country code after every scan.
7397 Hence when Supplicant country code is priority, we don't need 11D info.
7398 Country code from Supplicant is set as current country code.
7399
7400 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007401 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07007402
7403 \return eHalStatus
7404
7405 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007406eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
7407 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007408{
7409 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007410 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05307411 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007412
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007413 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007414 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7415
Kiet Lam6c583332013-10-14 05:37:09 +05307416 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
7417 VOS_COUNTRY_CODE_LEN) == 0)
7418 {
7419 is11dCountry = VOS_TRUE;
7420 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007421
Amar Singhal97a2d992013-11-19 10:58:07 -08007422 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7423 (csrGetInfraSessionId(pMac) != -1 ))
7424 {
7425
7426 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
7427
7428 /* we have got a request for a country that should not have been added since the
7429 STA is associated; nullify this request */
7430 status = csrGetRegulatoryDomainForCountry(pMac,
7431 pMac->scan.countryCode11d,
7432 (v_REGDOMAIN_t *) &reg_domain_id,
7433 COUNTRY_IE);
7434
7435 return eHAL_STATUS_FAILURE;
7436 }
7437
Amar Singhal0d15bd52013-10-12 23:13:13 -07007438 /* if Supplicant country code has priority, disable 11d */
Kiet Lam6c583332013-10-14 05:37:09 +05307439 if (!is11dCountry && pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007440 {
7441 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7442 }
7443
Kiet Lamf2f201e2013-11-16 21:24:16 +05307444 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07007445 WNI_CFG_COUNTRY_CODE_LEN);
7446
Abhishek Singha306a442013-11-07 18:39:01 +05307447 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07007448
Kiet Lam6c583332013-10-14 05:37:09 +05307449 if (VOS_FALSE == is11dCountry )
7450 {
7451 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05307452 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05307453 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
7454 /* set to default domain ID */
7455 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7456 }
7457
Amar Singhal0d15bd52013-10-12 23:13:13 -07007458 if ( status != eHAL_STATUS_SUCCESS )
7459 {
7460 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05307461 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007462 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007463 else
7464 {
7465 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7466 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007467 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7468 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007469 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007470 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007471 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7472 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7473 }
7474 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007475
Amar Singhal0d15bd52013-10-12 23:13:13 -07007476 /* get the channels based on new cc */
7477 status = csrInitGetChannels(pMac);
7478
7479 if ( status != eHAL_STATUS_SUCCESS )
7480 {
7481 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7482 return status;
7483 }
7484
7485 /* reset info based on new cc, and we are done */
7486 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05307487 if (VOS_TRUE == is11dCountry)
7488 {
Kiet Lam6c583332013-10-14 05:37:09 +05307489 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
7490 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
7491 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307492 /* Country code Changed, Purge Only scan result
7493 * which does not have channel number belong to 11d
7494 * channel list
7495 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307496 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05307497 // Do active scans after the country is set by User hints or Country IE
7498 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
7499
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007500 smsLog(pMac, LOG1, FL(" returned"));
7501 return eHAL_STATUS_SUCCESS;
7502}
7503
7504/* ---------------------------------------------------------------------------
7505
Kiet Lamcffc5862013-10-30 16:28:45 +05307506 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007507
7508 \brief Update Country code in the driver if set by kernel as world
7509
7510 If 11D is enabled, we update the country code after every scan & notify kernel.
7511 This is to make sure kernel & driver are in sync in case of CC found in
7512 driver but not in kernel database
7513
7514 \param pMac - The handle returned by macOpen.
7515 \param pMsg - Carrying new CC set in kernel
7516
7517 \return eHalStatus
7518
7519 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05307520eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007521{
Kiet Lamcffc5862013-10-30 16:28:45 +05307522 eHalStatus status;
7523
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007524 smsLog(pMac, LOG1, FL(" called"));
7525
7526 //this is to make sure kernel & driver are in sync in case of CC found in
7527 //driver but not in kernel database
7528 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
7529 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007530 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05307531 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007532 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05307533 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08007534 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007535 }
Kiet Lamcffc5862013-10-30 16:28:45 +05307536
Abhishek Singha306a442013-11-07 18:39:01 +05307537 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05307538
7539 if ( status != eHAL_STATUS_SUCCESS )
7540 {
7541 smsLog( pMac, LOGE, FL(" fail to set regId") );
7542 return status;
7543 }
7544 else
7545 {
7546 status = csrInitGetChannels(pMac);
7547 if ( status != eHAL_STATUS_SUCCESS )
7548 {
7549 smsLog( pMac, LOGE, FL(" fail to get Channels "));
7550 }
7551 else
7552 {
7553 csrInitChannelList(pMac);
7554 }
7555 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307556 /* Country code Changed, Purge Only scan result
7557 * which does not have channel number belong to 11d
7558 * channel list
7559 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307560 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007561 smsLog(pMac, LOG1, FL(" returned"));
7562 return eHAL_STATUS_SUCCESS;
7563}
7564
7565/* ---------------------------------------------------------------------------
7566
7567 \fn sme_HandleGenericChangeCountryCode
7568
7569 \brief Change Country code, Reg Domain and channel list
7570
7571 If Supplicant country code is priority than 11d is disabled.
7572 If 11D is enabled, we update the country code after every scan.
7573 Hence when Supplicant country code is priority, we don't need 11D info.
7574 Country code from kernel is set as current country code.
7575
7576 \param pMac - The handle returned by macOpen.
7577 \param pMsgBuf - message buffer
7578
7579 \return eHalStatus
7580
7581 -------------------------------------------------------------------------------*/
7582eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7583{
7584 tAniGenericChangeCountryCodeReq *pMsg;
7585 v_REGDOMAIN_t reg_domain_id;
7586
7587 smsLog(pMac, LOG1, FL(" called"));
7588 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
7589 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7590
7591 if (REGDOMAIN_COUNT == reg_domain_id)
7592 {
Kiet Lamcffc5862013-10-30 16:28:45 +05307593 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007594 }
7595 else
7596 {
7597 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
7598 }
7599 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007600 return eHAL_STATUS_SUCCESS;
7601}
7602
Jeff Johnson295189b2012-06-20 16:38:30 -07007603#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08007604eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07007605{
7606 tpSirRcvFltMcAddrList pRequestBuf;
7607 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007608 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07007609 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07007610
7611 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05307612 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007613 pMulticastAddrs->ulMulticastAddrCnt,
7614 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07007615
7616 /*
7617 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08007618 */
7619 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
7620 csrIsConnStateInfra(pMac, sessionId))
7621 {
7622 pSession = CSR_GET_SESSION( pMac, sessionId );
7623 }
Jeff Johnsone7245742012-09-05 17:12:55 -07007624
7625 if(pSession == NULL )
7626 {
7627 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007628 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07007629 return eHAL_STATUS_FAILURE;
7630 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007631
Jeff Johnson295189b2012-06-20 16:38:30 -07007632 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
7633 if (NULL == pRequestBuf)
7634 {
7635 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007636 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007637 return eHAL_STATUS_FAILED_ALLOC;
7638 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08007639
7640 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
7641 {
7642 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
7643 "indication as we are not connected", __func__);
7644 vos_mem_free(pRequestBuf);
7645 return eHAL_STATUS_FAILURE;
7646 }
7647
Jeff Johnson295189b2012-06-20 16:38:30 -07007648 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
7649
Kiet Lam64c1b492013-07-12 13:56:44 +05307650 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
7651 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007652 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
7653 sizeof(tSirMacAddr));
7654
Jeff Johnson295189b2012-06-20 16:38:30 -07007655 msg.type = WDA_8023_MULTICAST_LIST_REQ;
7656 msg.reserved = 0;
7657 msg.bodyptr = pRequestBuf;
7658 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7659 {
7660 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007661 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007662 vos_mem_free(pRequestBuf);
7663 return eHAL_STATUS_FAILURE;
7664 }
7665
7666 return eHAL_STATUS_SUCCESS;
7667}
7668
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007669eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07007670 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007671{
7672 tpSirRcvPktFilterCfgType pRequestBuf;
7673 v_SINT_t allocSize;
7674 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007675 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7676 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007677 v_U8_t idx=0;
7678
7679 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007680 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007681 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007682
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07007683 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007684
Jeff Johnson295189b2012-06-20 16:38:30 -07007685 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007686
7687 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007688 {
7689 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007690 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007691 return eHAL_STATUS_FAILED_ALLOC;
7692 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007693
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007694 if( NULL == pSession )
7695 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007696 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007697 vos_mem_free(pRequestBuf);
7698 return eHAL_STATUS_FAILURE;
7699 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007700
Kiet Lam64c1b492013-07-12 13:56:44 +05307701 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
7702 sizeof(tSirMacAddr));
7703 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
7704 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007705 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
7706
Jeff Johnson295189b2012-06-20 16:38:30 -07007707 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
7708 msg.reserved = 0;
7709 msg.bodyptr = pRequestBuf;
7710
7711 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007712 "FT %d FID %d ",
7713 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007714
7715 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007716 "params %d CT %d",
7717 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07007718
7719 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
7720 {
7721
7722 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007723 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07007724 pRequestBuf->paramsData[idx].protocolLayer,
7725 pRequestBuf->paramsData[idx].cmpFlag);
7726
7727 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007728 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007729 pRequestBuf->paramsData[idx].dataOffset,
7730 pRequestBuf->paramsData[idx].dataLength);
7731
7732 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007733 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007734 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007735 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07007736 pRequestBuf->paramsData[idx].compareData[2],
7737 pRequestBuf->paramsData[idx].compareData[3],
7738 pRequestBuf->paramsData[idx].compareData[4],
7739 pRequestBuf->paramsData[idx].compareData[5]);
7740
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007741 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007742 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07007743 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007744 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07007745 pRequestBuf->paramsData[idx].dataMask[2],
7746 pRequestBuf->paramsData[idx].dataMask[3],
7747 pRequestBuf->paramsData[idx].dataMask[4],
7748 pRequestBuf->paramsData[idx].dataMask[5]);
7749
7750 }
7751
7752 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7753 {
7754 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007755 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007756 vos_mem_free(pRequestBuf);
7757 return eHAL_STATUS_FAILURE;
7758 }
7759
7760 return eHAL_STATUS_SUCCESS;
7761}
7762
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007763eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007764 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007765 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007766 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007767{
7768 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7769 eHalStatus status;
7770
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007771 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007772
7773 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
7774 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007775 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07007776 sme_ReleaseGlobalLock( &pMac->sme );
7777 }
7778
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007779 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007780
7781 return (status);
7782}
7783
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007784eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07007785 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007786{
7787 tpSirRcvFltPktClearParam pRequestBuf;
7788 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07007789 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7790 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007791
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007792 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07007793 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007794
Jeff Johnson295189b2012-06-20 16:38:30 -07007795 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007796 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07007797 {
7798 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
7799 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007800 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007801 return eHAL_STATUS_FAILED_ALLOC;
7802 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007803 if( NULL == pSession )
7804 {
7805 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007806 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007807 vos_mem_free(pRequestBuf);
7808 return eHAL_STATUS_FAILURE;
7809 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007810
Kiet Lam64c1b492013-07-12 13:56:44 +05307811 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
7812 sizeof(tSirMacAddr));
7813 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
7814 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07007815
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07007816 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
7817
Jeff Johnson295189b2012-06-20 16:38:30 -07007818 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
7819 msg.reserved = 0;
7820 msg.bodyptr = pRequestBuf;
7821 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7822 {
7823 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007824 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007825 vos_mem_free(pRequestBuf);
7826 return eHAL_STATUS_FAILURE;
7827 }
7828
7829 return eHAL_STATUS_SUCCESS;
7830}
7831#endif // WLAN_FEATURE_PACKET_FILTERING
7832
7833/* ---------------------------------------------------------------------------
7834 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007835 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07007836 channel switch.
7837 \param callbackContext
7838 \param status
7839 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007840void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07007841 eHalStatus status)
7842{
7843 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
7844 tSirMbMsg *pMsg;
7845 tANI_U16 msgLen;
7846
7847 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05307848 pMsg = vos_mem_malloc(msgLen);
7849 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07007850 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307851 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007852 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
7853 pMsg->msgLen = pal_cpu_to_be16(msgLen);
7854 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007855 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007856
7857 return;
7858}
7859
7860/* ---------------------------------------------------------------------------
7861 \fn sme_HandlePreChannelSwitchInd
7862 \brief Processes the indcation from PE for pre-channel switch.
7863 \param hHal
7864 \- The handle returned by macOpen. return eHalStatus
7865 ---------------------------------------------------------------------------*/
7866eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
7867{
7868 eHalStatus status = eHAL_STATUS_FAILURE;
7869 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7870 status = sme_AcquireGlobalLock( &pMac->sme );
7871 if ( HAL_STATUS_SUCCESS( status ) )
7872 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007873 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
7874 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07007875 sme_ReleaseGlobalLock( &pMac->sme );
7876 }
7877
7878 return (status);
7879}
7880
7881/* ---------------------------------------------------------------------------
7882 \fn sme_HandlePostChannelSwitchInd
7883 \brief Processes the indcation from PE for post-channel switch.
7884 \param hHal
7885 \- The handle returned by macOpen. return eHalStatus
7886 ---------------------------------------------------------------------------*/
7887eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
7888{
7889 eHalStatus status = eHAL_STATUS_FAILURE;
7890 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7891
7892 status = sme_AcquireGlobalLock( &pMac->sme );
7893 if ( HAL_STATUS_SUCCESS( status ) )
7894 {
7895 status = pmcRequestBmps(hHal, NULL, NULL);
7896 sme_ReleaseGlobalLock( &pMac->sme );
7897 }
7898
7899 return (status);
7900}
7901
7902/* ---------------------------------------------------------------------------
7903
7904 \fn sme_IsChannelValid
7905
7906 \brief To check if the channel is valid for currently established domain
7907 This is a synchronous API.
7908
7909 \param hHal - The handle returned by macOpen.
7910 \param channel - channel to verify
7911
7912 \return TRUE/FALSE, TRUE if channel is valid
7913
7914 -------------------------------------------------------------------------------*/
7915tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
7916{
7917 eHalStatus status = eHAL_STATUS_FAILURE;
7918 tANI_BOOLEAN valid = FALSE;
7919 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007920
Jeff Johnson295189b2012-06-20 16:38:30 -07007921 status = sme_AcquireGlobalLock( &pMac->sme );
7922 if ( HAL_STATUS_SUCCESS( status ) )
7923 {
7924
7925 valid = csrRoamIsChannelValid( pMac, channel);
7926
7927 sme_ReleaseGlobalLock( &pMac->sme );
7928 }
7929
7930 return (valid);
7931}
7932
7933/* ---------------------------------------------------------------------------
7934 \fn sme_SetFreqBand
7935 \brief Used to set frequency band.
7936 \param hHal
7937 \eBand band value to be configured
7938 \- return eHalStatus
7939 -------------------------------------------------------------------------*/
7940eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
7941{
7942 eHalStatus status = eHAL_STATUS_FAILURE;
7943 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7944
7945 status = sme_AcquireGlobalLock( &pMac->sme );
7946 if ( HAL_STATUS_SUCCESS( status ) )
7947 {
7948 status = csrSetBand(hHal, eBand);
7949 sme_ReleaseGlobalLock( &pMac->sme );
7950 }
7951 return status;
7952}
7953
7954/* ---------------------------------------------------------------------------
7955 \fn sme_GetFreqBand
7956 \brief Used to get the current band settings.
7957 \param hHal
7958 \pBand pointer to hold band value
7959 \- return eHalStatus
7960 -------------------------------------------------------------------------*/
7961eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
7962{
7963 eHalStatus status = eHAL_STATUS_FAILURE;
7964 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7965
7966 status = sme_AcquireGlobalLock( &pMac->sme );
7967 if ( HAL_STATUS_SUCCESS( status ) )
7968 {
7969 *pBand = csrGetCurrentBand( hHal );
7970 sme_ReleaseGlobalLock( &pMac->sme );
7971 }
7972 return status;
7973}
7974
7975#ifdef WLAN_WAKEUP_EVENTS
7976/******************************************************************************
7977 \fn sme_WakeReasonIndCallback
7978
7979 \brief
7980 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
7981
7982 \param hHal - HAL handle for device
7983 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
7984
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007985 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007986******************************************************************************/
7987eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
7988{
7989 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7990 eHalStatus status = eHAL_STATUS_SUCCESS;
7991 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
7992
7993 if (NULL == pMsg)
7994 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007995 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007996 status = eHAL_STATUS_FAILURE;
7997 }
7998 else
7999 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008000 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07008001
8002 /* Call Wake Reason Indication callback routine. */
8003 if (pMac->pmc.wakeReasonIndCB != NULL)
8004 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008005
Jeff Johnson295189b2012-06-20 16:38:30 -07008006 pMac->pmc.wakeReasonIndCB = NULL;
8007 pMac->pmc.wakeReasonIndCBContext = NULL;
8008
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008009 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07008010 }
8011
8012 return(status);
8013}
8014#endif // WLAN_WAKEUP_EVENTS
8015
8016
8017/* ---------------------------------------------------------------------------
8018
8019 \fn sme_SetMaxTxPower
8020
8021 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
8022 not persist over reboots.
8023
8024 \param hHal
8025 \param pBssid BSSID to set the power cap for
8026 \param pBssid pSelfMacAddress self MAC Address
8027 \param pBssid power to set in dB
8028 \- return eHalStatus
8029
8030 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008031eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07008032 tSirMacAddr pSelfMacAddress, v_S7_t dB)
8033{
8034 vos_msg_t msg;
8035 tpMaxTxPowerParams pMaxTxParams = NULL;
Katya Nigambcb705f2013-12-26 14:26:22 +05308036 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008037 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008038 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
8039 if (NULL == pMaxTxParams)
8040 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008041 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 -07008042 return eHAL_STATUS_FAILURE;
8043 }
8044
8045 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05308046 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07008047 SIR_MAC_ADDR_LENGTH);
8048 pMaxTxParams->power = dB;
8049
8050 msg.type = WDA_SET_MAX_TX_POWER_REQ;
8051 msg.reserved = 0;
8052 msg.bodyptr = pMaxTxParams;
8053
8054 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8055 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008056 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 -07008057 vos_mem_free(pMaxTxParams);
8058 return eHAL_STATUS_FAILURE;
8059 }
8060
8061 return eHAL_STATUS_SUCCESS;
8062}
8063
Jeff Johnson295189b2012-06-20 16:38:30 -07008064/* ---------------------------------------------------------------------------
8065
Arif Hussaina5ebce02013-08-09 15:09:58 -07008066 \fn sme_SetMaxTxPowerPerBand
8067
8068 \brief Set the Maximum Transmit Power specific to band dynamically.
8069 Note: this setting will not persist over reboots.
8070
8071 \param band
8072 \param power to set in dB
8073 \- return eHalStatus
8074
8075 ----------------------------------------------------------------------------*/
8076eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
8077{
8078 vos_msg_t msg;
8079 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
8080
8081 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
8082 if (NULL == pMaxTxPowerPerBandParams)
8083 {
8084 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8085 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
8086 __func__);
8087 return eHAL_STATUS_FAILURE;
8088 }
8089
8090 pMaxTxPowerPerBandParams->power = dB;
8091 pMaxTxPowerPerBandParams->bandInfo = band;
8092
8093 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
8094 msg.reserved = 0;
8095 msg.bodyptr = pMaxTxPowerPerBandParams;
8096
8097 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8098 {
8099 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8100 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
8101 __func__);
8102 vos_mem_free(pMaxTxPowerPerBandParams);
8103 return eHAL_STATUS_FAILURE;
8104 }
8105
8106 return eHAL_STATUS_SUCCESS;
8107}
8108
8109/* ---------------------------------------------------------------------------
8110
schang86c22c42013-03-13 18:41:24 -07008111 \fn sme_SetTxPower
8112
8113 \brief Set Transmit Power dynamically. Note: this setting will
8114 not persist over reboots.
8115
8116 \param hHal
8117 \param sessionId Target Session ID
8118 \param mW power to set in mW
8119 \- return eHalStatus
8120
8121 -------------------------------------------------------------------------------*/
8122eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
8123{
8124
8125 eHalStatus status = eHAL_STATUS_FAILURE;
8126 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8127
Katya Nigambcb705f2013-12-26 14:26:22 +05308128 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008129 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07008130 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
8131 status = sme_AcquireGlobalLock(&pMac->sme);
8132 if (HAL_STATUS_SUCCESS(status))
8133 {
8134 status = csrSetTxPower(pMac, sessionId, mW);
8135 sme_ReleaseGlobalLock(&pMac->sme);
8136 }
8137 return status;
8138}
8139
8140/* ---------------------------------------------------------------------------
8141
Jeff Johnson295189b2012-06-20 16:38:30 -07008142 \fn sme_HideSSID
8143
8144 \brief hide/show SSID dynamically. Note: this setting will
8145 not persist over reboots.
8146
8147 \param hHal
8148 \param sessionId
8149 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
8150 \- return eHalStatus
8151
8152 -------------------------------------------------------------------------------*/
8153eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
8154{
8155 eHalStatus status = eHAL_STATUS_SUCCESS;
8156 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8157 tANI_U16 len;
8158
8159 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8160 {
8161 tpSirUpdateParams pMsg;
8162 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008163
8164 if(!pSession)
8165 {
8166 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008167 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008168 return eHAL_STATUS_FAILURE;
8169 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008170
8171 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07008172 VOS_ASSERT(0);
8173
8174 /* Create the message and send to lim */
8175 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05308176 pMsg = vos_mem_malloc(len);
8177 if ( NULL == pMsg )
8178 status = eHAL_STATUS_FAILURE;
8179 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008180 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308181 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008182 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
8183 pMsg->length = len;
8184 /* Data starts from here */
8185 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008186 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07008187 status = palSendMBMessage(pMac->hHdd, pMsg);
8188 }
8189 sme_ReleaseGlobalLock( &pMac->sme );
8190 }
8191 return status;
8192}
Jeff Johnson295189b2012-06-20 16:38:30 -07008193
8194/* ---------------------------------------------------------------------------
8195
8196 \fn sme_SetTmLevel
8197 \brief Set Thermal Mitigation Level to RIVA
8198 \param hHal - The handle returned by macOpen.
8199 \param newTMLevel - new Thermal Mitigation Level
8200 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008201 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008202 ---------------------------------------------------------------------------*/
8203eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
8204{
8205 eHalStatus status = eHAL_STATUS_SUCCESS;
8206 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8207 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8208 vos_msg_t vosMessage;
8209 tAniSetTmLevelReq *setTmLevelReq = NULL;
8210
Katya Nigambcb705f2013-12-26 14:26:22 +05308211 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008212 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008213 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8214 {
8215 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05308216 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07008217 {
8218 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008219 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008220 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07008221 return eHAL_STATUS_FAILURE;
8222 }
8223
8224 setTmLevelReq->tmMode = tmMode;
8225 setTmLevelReq->newTmLevel = newTMLevel;
8226
8227 /* serialize the req through MC thread */
8228 vosMessage.bodyptr = setTmLevelReq;
8229 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
8230 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8231 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8232 {
8233 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008234 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008235 vos_mem_free(setTmLevelReq);
8236 status = eHAL_STATUS_FAILURE;
8237 }
8238 sme_ReleaseGlobalLock( &pMac->sme );
8239 }
8240 return(status);
8241}
8242
8243/*---------------------------------------------------------------------------
8244
8245 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
8246 Host and FW.
8247
8248 \param hHal - HAL handle for device
8249
8250 \return NONE
8251
8252---------------------------------------------------------------------------*/
8253void sme_featureCapsExchange( tHalHandle hHal)
8254{
8255 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05308256 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008257 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008258 WDA_featureCapsExchange(vosContext);
8259}
Jeff Johnsond13512a2012-07-17 11:42:19 -07008260
Yathish9f22e662012-12-10 14:21:35 -08008261/*---------------------------------------------------------------------------
8262
8263 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
8264 in Host.
8265
8266 \param hHal - HAL handle for device
8267
8268 \return NONE
8269
8270---------------------------------------------------------------------------*/
8271void sme_disableFeatureCapablity(tANI_U8 feature_index)
8272{
8273 WDA_disableCapablityFeature(feature_index);
8274}
8275
Jeff Johnsond13512a2012-07-17 11:42:19 -07008276/* ---------------------------------------------------------------------------
8277
8278 \fn sme_GetDefaultCountryCode
8279
8280 \brief Get the default country code from NV
8281
8282 \param hHal
8283 \param pCountry
8284 \- return eHalStatus
8285
8286 -------------------------------------------------------------------------------*/
8287eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
8288{
8289 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308290 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008291 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008292 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
8293}
8294
8295/* ---------------------------------------------------------------------------
8296
8297 \fn sme_GetCurrentCountryCode
8298
8299 \brief Get the current country code
8300
8301 \param hHal
8302 \param pCountry
8303 \- return eHalStatus
8304
8305 -------------------------------------------------------------------------------*/
8306eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
8307{
8308 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308309 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008310 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008311 return csrGetCurrentCountryCode(pMac, pCountry);
8312}
8313
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008314/* ---------------------------------------------------------------------------
8315 \fn sme_transportDebug
8316 \brief Dynamically monitoring Transport channels
8317 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07008318 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08008319 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008320 \param toggleStallDetect Enable stall detect feature
8321 This feature will take effect to data performance
8322 Not integrate till fully verification
8323 \- return NONE
8324 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07008325void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008326{
schang6295e542013-03-12 15:31:23 -07008327 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8328
8329 if (NULL == pMac)
8330 {
8331 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8332 "%s: invalid context", __func__);
8333 return;
8334 }
8335 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07008336}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008337
Kiran4a17ebe2013-01-31 10:43:43 -08008338/* ---------------------------------------------------------------------------
8339 \fn sme_ResetPowerValuesFor5G
8340 \brief Reset the power values for 5G band with NV power values.
8341 \param hHal - HAL handle for device
8342 \- return NONE
8343 -------------------------------------------------------------------------*/
8344void sme_ResetPowerValuesFor5G (tHalHandle hHal)
8345{
8346 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +05308347 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008348 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08008349 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
8350 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
8351}
8352
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008353#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
8354/* ---------------------------------------------------------------------------
8355 \fn sme_UpdateRoamPrefer5GHz
8356 \brief enable/disable Roam prefer 5G runtime option
8357 This function is called through dynamic setConfig callback function
8358 to configure the Roam prefer 5G runtime option
8359 \param hHal - HAL handle for device
8360 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
8361 \- return Success or failure
8362 -------------------------------------------------------------------------*/
8363
8364eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
8365{
8366 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008367 eHalStatus status = eHAL_STATUS_SUCCESS;
8368
Katya Nigambcb705f2013-12-26 14:26:22 +05308369 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008370 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008371 status = sme_AcquireGlobalLock( &pMac->sme );
8372 if ( HAL_STATUS_SUCCESS( status ) )
8373 {
8374 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8375 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
8376 pMac->roam.configParam.nRoamPrefer5GHz,
8377 nRoamPrefer5GHz);
8378 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
8379 sme_ReleaseGlobalLock( &pMac->sme );
8380 }
8381
8382 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008383}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008384
8385/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008386 \fn sme_setRoamIntraBand
8387 \brief enable/disable Intra band roaming
8388 This function is called through dynamic setConfig callback function
8389 to configure the intra band roaming
8390 \param hHal - HAL handle for device
8391 \param nRoamIntraBand Enable/Disable Intra band roaming
8392 \- return Success or failure
8393 -------------------------------------------------------------------------*/
8394eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
8395{
8396 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8397 eHalStatus status = eHAL_STATUS_SUCCESS;
8398
Katya Nigambcb705f2013-12-26 14:26:22 +05308399 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008400 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008401 status = sme_AcquireGlobalLock( &pMac->sme );
8402 if ( HAL_STATUS_SUCCESS( status ) )
8403 {
8404 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8405 "%s: gRoamIntraBand is changed from %d to %d", __func__,
8406 pMac->roam.configParam.nRoamIntraBand,
8407 nRoamIntraBand);
8408 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
8409 sme_ReleaseGlobalLock( &pMac->sme );
8410 }
8411
8412 return status ;
8413}
8414
8415/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008416 \fn sme_UpdateRoamScanNProbes
8417 \brief function to update roam scan N probes
8418 This function is called through dynamic setConfig callback function
8419 to update roam scan N probes
8420 \param hHal - HAL handle for device
8421 \param nProbes number of probe requests to be sent out
8422 \- return Success or failure
8423 -------------------------------------------------------------------------*/
8424eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
8425{
8426 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8427 eHalStatus status = eHAL_STATUS_SUCCESS;
8428
8429 status = sme_AcquireGlobalLock( &pMac->sme );
8430 if ( HAL_STATUS_SUCCESS( status ) )
8431 {
8432 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8433 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
8434 pMac->roam.configParam.nProbes,
8435 nProbes);
8436 pMac->roam.configParam.nProbes = nProbes;
8437 sme_ReleaseGlobalLock( &pMac->sme );
8438 }
8439#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8440 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8441 {
8442 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8443 REASON_NPROBES_CHANGED);
8444 }
8445#endif
8446 return status ;
8447}
8448
8449/* ---------------------------------------------------------------------------
8450 \fn sme_UpdateRoamScanHomeAwayTime
8451 \brief function to update roam scan Home away time
8452 This function is called through dynamic setConfig callback function
8453 to update roam scan home away time
8454 \param hHal - HAL handle for device
8455 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008456 \param bSendOffloadCmd If TRUE then send offload command to firmware
8457 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008458 \- return Success or failure
8459 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008460eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
8461 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008462{
8463 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8464 eHalStatus status = eHAL_STATUS_SUCCESS;
8465
8466 status = sme_AcquireGlobalLock( &pMac->sme );
8467 if ( HAL_STATUS_SUCCESS( status ) )
8468 {
8469 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8470 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
8471 pMac->roam.configParam.nRoamScanHomeAwayTime,
8472 nRoamScanHomeAwayTime);
8473 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
8474 sme_ReleaseGlobalLock( &pMac->sme );
8475 }
8476
8477#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07008478 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008479 {
8480 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
8481 REASON_HOME_AWAY_TIME_CHANGED);
8482 }
8483#endif
8484 return status;
8485}
8486
8487
8488/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008489 \fn sme_getRoamIntraBand
8490 \brief get Intra band roaming
8491 \param hHal - HAL handle for device
8492 \- return Success or failure
8493 -------------------------------------------------------------------------*/
8494v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
8495{
8496 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308497 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008498 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008499 return pMac->roam.configParam.nRoamIntraBand;
8500}
8501
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008502/* ---------------------------------------------------------------------------
8503 \fn sme_getRoamScanNProbes
8504 \brief get N Probes
8505 \param hHal - HAL handle for device
8506 \- return Success or failure
8507 -------------------------------------------------------------------------*/
8508v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
8509{
8510 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8511 return pMac->roam.configParam.nProbes;
8512}
8513
8514/* ---------------------------------------------------------------------------
8515 \fn sme_getRoamScanHomeAwayTime
8516 \brief get Roam scan home away time
8517 \param hHal - HAL handle for device
8518 \- return Success or failure
8519 -------------------------------------------------------------------------*/
8520v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
8521{
8522 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8523 return pMac->roam.configParam.nRoamScanHomeAwayTime;
8524}
8525
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008526
8527/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008528 \fn sme_UpdateImmediateRoamRssiDiff
8529 \brief Update nImmediateRoamRssiDiff
8530 This function is called through dynamic setConfig callback function
8531 to configure nImmediateRoamRssiDiff
8532 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
8533 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008534 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008535 candidate and current AP.
8536 \- return Success or failure
8537 -------------------------------------------------------------------------*/
8538
8539eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
8540{
8541 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008542 eHalStatus status = eHAL_STATUS_SUCCESS;
8543
Katya Nigambcb705f2013-12-26 14:26:22 +05308544 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008545 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008546 status = sme_AcquireGlobalLock( &pMac->sme );
8547 if ( HAL_STATUS_SUCCESS( status ) )
8548 {
8549 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308550 "LFR runtime successfully set immediate roam rssi diff to"
8551 "%d - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08008552 nImmediateRoamRssiDiff,
8553 pMac->roam.configParam.nImmediateRoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308554 macTraceGetNeighbourRoamState(
8555 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008556 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
8557 sme_ReleaseGlobalLock( &pMac->sme );
8558 }
8559
8560 return status ;
8561}
8562
8563/* ---------------------------------------------------------------------------
8564 \fn sme_UpdateRoamRssiDiff
8565 \brief Update RoamRssiDiff
8566 This function is called through dynamic setConfig callback function
8567 to configure RoamRssiDiff
8568 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
8569 \param hHal - HAL handle for device
8570 \param RoamRssiDiff - minimum rssi difference between potential
8571 candidate and current AP.
8572 \- return Success or failure
8573 -------------------------------------------------------------------------*/
8574
8575eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
8576{
8577 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8578 eHalStatus status = eHAL_STATUS_SUCCESS;
8579
8580 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +05308581 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008582 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008583 if ( HAL_STATUS_SUCCESS( status ) )
8584 {
8585 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308586 "LFR runtime successfully set roam rssi diff to %d"
8587 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08008588 RoamRssiDiff,
8589 pMac->roam.configParam.RoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308590 macTraceGetNeighbourRoamState(
8591 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008592 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
8593 sme_ReleaseGlobalLock( &pMac->sme );
8594 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008595#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8596 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8597 {
8598 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
8599 }
8600#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08008601 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008602}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008603
8604/*--------------------------------------------------------------------------
8605 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008606 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008607 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008608 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008609 \param hHal - The handle returned by macOpen.
8610 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
8611 Other status means SME is failed to update isFastTransitionEnabled.
8612 \sa
8613 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008614eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008615 v_BOOL_t isFastTransitionEnabled)
8616{
8617 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008618 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008619
Katya Nigambcb705f2013-12-26 14:26:22 +05308620 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008621 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008622 status = sme_AcquireGlobalLock( &pMac->sme );
8623 if ( HAL_STATUS_SUCCESS( status ) )
8624 {
8625 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8626 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
8627 pMac->roam.configParam.isFastTransitionEnabled,
8628 isFastTransitionEnabled);
8629 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
8630 sme_ReleaseGlobalLock( &pMac->sme );
8631 }
8632
8633 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008634}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008635
8636/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008637 \fn sme_UpdateWESMode
8638 \brief Update WES Mode
8639 This function is called through dynamic setConfig callback function
8640 to configure isWESModeEnabled
8641 \param hHal - HAL handle for device
8642 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
8643 Other status means SME is failed to update isWESModeEnabled.
8644 -------------------------------------------------------------------------*/
8645
8646eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
8647{
8648 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8649 eHalStatus status = eHAL_STATUS_SUCCESS;
8650
8651 status = sme_AcquireGlobalLock( &pMac->sme );
8652 if ( HAL_STATUS_SUCCESS( status ) )
8653 {
8654 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308655 "LFR runtime successfully set WES Mode to %d"
8656 "- old value is %d - roam state is %s",
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008657 isWESModeEnabled,
8658 pMac->roam.configParam.isWESModeEnabled,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308659 macTraceGetNeighbourRoamState(
8660 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07008661 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
8662 sme_ReleaseGlobalLock( &pMac->sme );
8663 }
8664
8665 return status ;
8666}
8667
8668/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008669 \fn sme_SetRoamScanControl
8670 \brief Set roam scan control
8671 This function is called to set roam scan control
8672 if roam scan control is set to 0, roaming scan cache is cleared
8673 any value other than 0 is treated as invalid value
8674 \param hHal - HAL handle for device
8675 \return eHAL_STATUS_SUCCESS - SME update config successfully.
8676 Other status means SME failure to update
8677 -------------------------------------------------------------------------*/
8678eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
8679{
8680 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8681 eHalStatus status = eHAL_STATUS_SUCCESS;
8682
Katya Nigambcb705f2013-12-26 14:26:22 +05308683 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008684 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008685 status = sme_AcquireGlobalLock( &pMac->sme );
8686 if ( HAL_STATUS_SUCCESS( status ) )
8687 {
8688 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308689 "LFR runtime successfully set roam scan control to %d"
8690 " - old value is %d - roam state is %s",
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008691 roamScanControl,
8692 pMac->roam.configParam.nRoamScanControl,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308693 macTraceGetNeighbourRoamState(
8694 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008695 pMac->roam.configParam.nRoamScanControl = roamScanControl;
8696 if ( 0 == roamScanControl)
8697 {
8698 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
8699 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07008700 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07008701#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8702 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8703 {
8704 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
8705 }
8706#endif
8707 }
8708 sme_ReleaseGlobalLock( &pMac->sme );
8709 }
8710 return status ;
8711}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008712#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_CCX) || (FEATURE_WLAN_LFR) */
8713
8714#ifdef FEATURE_WLAN_LFR
8715/*--------------------------------------------------------------------------
8716 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008717 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008718 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008719 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008720 \param hHal - The handle returned by macOpen.
8721 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
8722 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
8723 \sa
8724 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008725eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008726 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008727{
8728 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8729
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008730 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
8731 {
8732 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8733 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8734 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8735 isFastRoamIniFeatureEnabled);
8736 return eHAL_STATUS_SUCCESS;
8737 }
8738
Srinivas Girigowdade697412013-02-14 16:31:48 -08008739 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8740 "%s: FastRoamEnabled is changed from %d to %d", __func__,
8741 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
8742 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008743 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008744 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008745
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008746 return eHAL_STATUS_SUCCESS;
8747}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008748
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08008749/*--------------------------------------------------------------------------
8750 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
8751 Enable/disable LFR MAWC support at runtime
8752 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8753 isMAWCIniFeatureEnabled.
8754 This is a synchronous call
8755 \param hHal - The handle returned by macOpen.
8756 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
8757 Other status means SME is failed to update MAWCEnabled.
8758 \sa
8759 --------------------------------------------------------------------------*/
8760eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
8761 const v_BOOL_t MAWCEnabled)
8762{
8763 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8764 eHalStatus status = eHAL_STATUS_SUCCESS;
8765
8766 status = sme_AcquireGlobalLock( &pMac->sme );
8767 if ( HAL_STATUS_SUCCESS( status ) )
8768 {
8769 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8770 "%s: MAWCEnabled is changed from %d to %d", __func__,
8771 pMac->roam.configParam.MAWCEnabled,
8772 MAWCEnabled);
8773 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
8774 sme_ReleaseGlobalLock( &pMac->sme );
8775 }
8776
8777 return status ;
8778
8779}
8780
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07008781#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8782/*--------------------------------------------------------------------------
8783 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
8784 This is a synchronuous call
8785 \param hHal - The handle returned by macOpen.
8786 \return eHAL_STATUS_SUCCESS
8787 Other status means SME is failed
8788 \sa
8789 --------------------------------------------------------------------------*/
8790
8791eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
8792 v_BOOL_t bFastRoamInConIniFeatureEnabled)
8793{
8794
8795 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8796 eHalStatus status = eHAL_STATUS_SUCCESS;
8797
8798 status = sme_AcquireGlobalLock( &pMac->sme );
8799 if ( HAL_STATUS_SUCCESS( status ) )
8800 {
8801 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
8802 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
8803 {
8804 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
8805 }
8806 sme_ReleaseGlobalLock( &pMac->sme );
8807 }
8808
8809 return status;
8810}
8811#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008812#endif /* FEATURE_WLAN_LFR */
8813
8814#ifdef FEATURE_WLAN_CCX
8815/*--------------------------------------------------------------------------
8816 \brief sme_UpdateIsCcxFeatureEnabled() - enable/disable CCX support at runtime
8817 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8818 isCcxIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008819 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008820 \param hHal - The handle returned by macOpen.
8821 \return eHAL_STATUS_SUCCESS - SME update isCcxIniFeatureEnabled config successfully.
8822 Other status means SME is failed to update isCcxIniFeatureEnabled.
8823 \sa
8824 --------------------------------------------------------------------------*/
8825
8826eHalStatus sme_UpdateIsCcxFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008827 const v_BOOL_t isCcxIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008828{
8829 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8830
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008831 if (pMac->roam.configParam.isCcxIniFeatureEnabled == isCcxIniFeatureEnabled)
8832 {
8833 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8834 "%s: CCX Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
8835 pMac->roam.configParam.isCcxIniFeatureEnabled,
8836 isCcxIniFeatureEnabled);
8837 return eHAL_STATUS_SUCCESS;
8838 }
8839
Srinivas Girigowdade697412013-02-14 16:31:48 -08008840 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8841 "%s: CcxEnabled is changed from %d to %d", __func__,
8842 pMac->roam.configParam.isCcxIniFeatureEnabled,
8843 isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008844 pMac->roam.configParam.isCcxIniFeatureEnabled = isCcxIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008845 csrNeighborRoamUpdateCcxModeEnabled(pMac, isCcxIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008846
8847 if(TRUE == isCcxIniFeatureEnabled)
8848 {
8849 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008850 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07008851
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07008852#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
8853 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
8854 {
8855 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CCX_INI_CFG_CHANGED);
8856 }
8857#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008858 return eHAL_STATUS_SUCCESS;
8859}
8860#endif /* FEATURE_WLAN_CCX */
8861
8862/*--------------------------------------------------------------------------
8863 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
8864 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
8865 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08008866 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008867 \param hHal - The handle returned by macOpen.
8868 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
8869 Other status means SME is failed to update fEnableFwRssiMonitoring.
8870 \sa
8871 --------------------------------------------------------------------------*/
8872
8873eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
8874 v_BOOL_t fEnableFwRssiMonitoring)
8875{
8876 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
8877
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008878 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
8879 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
8880 {
8881 halStatus = eHAL_STATUS_FAILURE;
8882 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008883 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08008884 }
8885
8886 return (halStatus);
8887}
8888
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008889#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08008890/*--------------------------------------------------------------------------
8891 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
8892 This is a synchronous call
8893 \param hHal - The handle returned by macOpen.
8894 \return eHAL_STATUS_SUCCESS - SME update config successful.
8895 Other status means SME is failed to update
8896 \sa
8897 --------------------------------------------------------------------------*/
8898eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
8899 v_U8_t neighborLookupRssiThreshold)
8900{
8901 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8902 eHalStatus status = eHAL_STATUS_SUCCESS;
8903
8904 status = sme_AcquireGlobalLock( &pMac->sme );
8905 if ( HAL_STATUS_SUCCESS( status ) )
8906 {
8907 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
8908 if (HAL_STATUS_SUCCESS(status))
8909 {
8910 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308911 "LFR runtime successfully set Lookup threshold to %d"
8912 " - old value is %d - roam state is %s",
8913 neighborLookupRssiThreshold,
8914 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
8915 macTraceGetNeighbourRoamState(
8916 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008917 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
8918 neighborLookupRssiThreshold;
8919 }
8920 sme_ReleaseGlobalLock( &pMac->sme );
8921 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08008922 return status;
8923}
8924
8925/*--------------------------------------------------------------------------
8926 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
8927 This is a synchronous call
8928 \param hHal - The handle returned by macOpen.
8929 \return eHAL_STATUS_SUCCESS - SME update config successful.
8930 Other status means SME is failed to update
8931 \sa
8932 --------------------------------------------------------------------------*/
8933eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
8934 v_U8_t neighborReassocRssiThreshold)
8935{
8936 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8937 eHalStatus status = eHAL_STATUS_SUCCESS;
8938
8939 status = sme_AcquireGlobalLock( &pMac->sme );
8940 if ( HAL_STATUS_SUCCESS( status ) )
8941 {
8942 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308943 "LFR runtime successfully set Reassoc threshold to %d"
8944 "- old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08008945 neighborReassocRssiThreshold,
8946 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308947 macTraceGetNeighbourRoamState(
8948 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008949 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
8950 neighborReassocRssiThreshold;
8951 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
8952 neighborReassocRssiThreshold;
8953 sme_ReleaseGlobalLock( &pMac->sme );
8954 }
8955
8956 return status ;
8957}
8958
8959
8960/*--------------------------------------------------------------------------
8961 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
8962 This is a synchronous call
8963 \param hHal - The handle returned by macOpen.
8964 \return eHAL_STATUS_SUCCESS - SME update config successful.
8965 Other status means SME is failed to update
8966 \sa
8967 --------------------------------------------------------------------------*/
8968v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
8969{
8970 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8971 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
8972}
8973
8974/*--------------------------------------------------------------------------
8975 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
8976 This is a synchronous call
8977 \param hHal - The handle returned by macOpen.
8978 \return eHAL_STATUS_SUCCESS - SME update config successful.
8979 Other status means SME is failed to update
8980 \sa
8981 --------------------------------------------------------------------------*/
8982eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
8983 v_U16_t neighborScanResultsRefreshPeriod)
8984{
8985 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8986 eHalStatus status = eHAL_STATUS_SUCCESS;
8987
8988 status = sme_AcquireGlobalLock( &pMac->sme );
8989 if ( HAL_STATUS_SUCCESS( status ) )
8990 {
8991 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308992 "LFR runtime successfully set roam scan refresh period to %d"
8993 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08008994 neighborScanResultsRefreshPeriod,
8995 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05308996 macTraceGetNeighbourRoamState(
8997 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008998 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
8999 neighborScanResultsRefreshPeriod;
9000 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
9001 neighborScanResultsRefreshPeriod;
9002
9003 sme_ReleaseGlobalLock( &pMac->sme );
9004 }
9005
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009006#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9007 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9008 {
9009 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9010 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
9011 }
9012#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009013 return status ;
9014}
9015
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009016#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9017/*--------------------------------------------------------------------------
9018 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
9019 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9020 gRoamScanOffloadEnabled.
9021 This is a synchronous call
9022 \param hHal - The handle returned by macOpen.
9023 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9024 Other status means SME is failed to update.
9025 \sa
9026 --------------------------------------------------------------------------*/
9027
9028eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
9029 v_BOOL_t nRoamScanOffloadEnabled)
9030{
9031 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9032 eHalStatus status = eHAL_STATUS_SUCCESS;
9033
9034 status = sme_AcquireGlobalLock( &pMac->sme );
9035 if ( HAL_STATUS_SUCCESS( status ) )
9036 {
9037 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9038 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
9039 pMac->roam.configParam.isRoamOffloadScanEnabled,
9040 nRoamScanOffloadEnabled);
9041 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
9042 sme_ReleaseGlobalLock( &pMac->sme );
9043 }
9044
9045 return status ;
9046}
9047#endif
9048
Srinivas Girigowdade697412013-02-14 16:31:48 -08009049/*--------------------------------------------------------------------------
9050 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
9051 This is a synchronous call
9052 \param hHal - The handle returned by macOpen.
9053 \return v_U16_t - Neighbor scan results refresh period value
9054 \sa
9055 --------------------------------------------------------------------------*/
9056v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
9057{
9058 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9059 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
9060}
9061
9062/*--------------------------------------------------------------------------
9063 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
9064 This is a synchronuous call
9065 \param hHal - The handle returned by macOpen.
9066 \return eHAL_STATUS_SUCCESS - SME update config successful.
9067 Other status means SME is failed to update
9068 \sa
9069 --------------------------------------------------------------------------*/
9070v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
9071{
9072 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9073 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
9074}
9075
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009076/* ---------------------------------------------------------------------------
9077 \fn sme_UpdateEmptyScanRefreshPeriod
9078 \brief Update nEmptyScanRefreshPeriod
9079 This function is called through dynamic setConfig callback function
9080 to configure nEmptyScanRefreshPeriod
9081 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
9082 \param hHal - HAL handle for device
9083 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
9084 \- return Success or failure
9085 -------------------------------------------------------------------------*/
9086
9087eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
9088{
9089 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9090 eHalStatus status = eHAL_STATUS_SUCCESS;
9091
9092 status = sme_AcquireGlobalLock( &pMac->sme );
9093 if ( HAL_STATUS_SUCCESS( status ) )
9094 {
9095 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309096 "LFR runtime successfully set roam scan period to %d -"
9097 "old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009098 nEmptyScanRefreshPeriod,
9099 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309100 macTraceGetNeighbourRoamState(
9101 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009102 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9103 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9104 sme_ReleaseGlobalLock( &pMac->sme );
9105 }
9106
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009107#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9108 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9109 {
9110 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9111 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
9112 }
9113#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009114 return status ;
9115}
9116
9117/* ---------------------------------------------------------------------------
9118 \fn sme_setNeighborScanMinChanTime
9119 \brief Update nNeighborScanMinChanTime
9120 This function is called through dynamic setConfig callback function
9121 to configure gNeighborScanChannelMinTime
9122 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
9123 \param hHal - HAL handle for device
9124 \param nNeighborScanMinChanTime - Channel minimum dwell time
9125 \- return Success or failure
9126 -------------------------------------------------------------------------*/
9127eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
9128{
9129 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9130 eHalStatus status = eHAL_STATUS_SUCCESS;
9131
9132 status = sme_AcquireGlobalLock( &pMac->sme );
9133 if ( HAL_STATUS_SUCCESS( status ) )
9134 {
9135 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309136 "LFR runtime successfully set channel min dwell time to %d"
9137 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009138 nNeighborScanMinChanTime,
9139 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309140 macTraceGetNeighbourRoamState(
9141 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009142 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
9143 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
9144 sme_ReleaseGlobalLock( &pMac->sme );
9145 }
9146
9147 return status ;
9148}
9149
9150/* ---------------------------------------------------------------------------
9151 \fn sme_setNeighborScanMaxChanTime
9152 \brief Update nNeighborScanMaxChanTime
9153 This function is called through dynamic setConfig callback function
9154 to configure gNeighborScanChannelMaxTime
9155 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
9156 \param hHal - HAL handle for device
9157 \param nNeighborScanMinChanTime - Channel maximum dwell time
9158 \- return Success or failure
9159 -------------------------------------------------------------------------*/
9160eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
9161{
9162 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9163 eHalStatus status = eHAL_STATUS_SUCCESS;
9164
9165 status = sme_AcquireGlobalLock( &pMac->sme );
9166 if ( HAL_STATUS_SUCCESS( status ) )
9167 {
9168 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309169 "LFR runtime successfully set channel max dwell time to %d"
9170 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009171 nNeighborScanMaxChanTime,
9172 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309173 macTraceGetNeighbourRoamState(
9174 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009175 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
9176 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
9177 sme_ReleaseGlobalLock( &pMac->sme );
9178 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009179#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9180 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9181 {
9182 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9183 REASON_SCAN_CH_TIME_CHANGED);
9184 }
9185#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009186
9187 return status ;
9188}
9189
9190/* ---------------------------------------------------------------------------
9191 \fn sme_getNeighborScanMinChanTime
9192 \brief get neighbor scan min channel time
9193 \param hHal - The handle returned by macOpen.
9194 \return v_U16_t - channel min time value
9195 -------------------------------------------------------------------------*/
9196v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
9197{
9198 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9199 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
9200}
9201
9202/* ---------------------------------------------------------------------------
9203 \fn sme_getNeighborScanMaxChanTime
9204 \brief get neighbor scan max channel time
9205 \param hHal - The handle returned by macOpen.
9206 \return v_U16_t - channel max time value
9207 -------------------------------------------------------------------------*/
9208v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
9209{
9210 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9211 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
9212}
9213
9214/* ---------------------------------------------------------------------------
9215 \fn sme_setNeighborScanPeriod
9216 \brief Update nNeighborScanPeriod
9217 This function is called through dynamic setConfig callback function
9218 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009219 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009220 \param hHal - HAL handle for device
9221 \param nNeighborScanPeriod - neighbor scan period
9222 \- return Success or failure
9223 -------------------------------------------------------------------------*/
9224eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
9225{
9226 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9227 eHalStatus status = eHAL_STATUS_SUCCESS;
9228
9229 status = sme_AcquireGlobalLock( &pMac->sme );
9230 if ( HAL_STATUS_SUCCESS( status ) )
9231 {
9232 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309233 "LFR runtime successfully set neighbor scan period to %d"
9234 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009235 nNeighborScanPeriod,
9236 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309237 macTraceGetNeighbourRoamState(
9238 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009239 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
9240 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
9241 sme_ReleaseGlobalLock( &pMac->sme );
9242 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009243#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9244 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9245 {
9246 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9247 REASON_SCAN_HOME_TIME_CHANGED);
9248 }
9249#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009250
9251 return status ;
9252}
9253
9254/* ---------------------------------------------------------------------------
9255 \fn sme_getNeighborScanPeriod
9256 \brief get neighbor scan period
9257 \param hHal - The handle returned by macOpen.
9258 \return v_U16_t - neighbor scan period
9259 -------------------------------------------------------------------------*/
9260v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
9261{
9262 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9263 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
9264}
9265
9266#endif
9267
Srinivas Girigowdade697412013-02-14 16:31:48 -08009268#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009269
Srinivas Girigowdade697412013-02-14 16:31:48 -08009270/*--------------------------------------------------------------------------
9271 \brief sme_getRoamRssiDiff() - get Roam rssi diff
9272 This is a synchronous call
9273 \param hHal - The handle returned by macOpen.
9274 \return v_U16_t - Rssi diff value
9275 \sa
9276 --------------------------------------------------------------------------*/
9277v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
9278{
9279 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9280 return pMac->roam.configParam.RoamRssiDiff;
9281}
9282
9283/*--------------------------------------------------------------------------
9284 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
9285 This is a synchronous call
9286 \param hHal - The handle returned by macOpen.
9287 \return eHAL_STATUS_SUCCESS - SME update config successful.
9288 Other status means SME is failed to update
9289 \sa
9290 --------------------------------------------------------------------------*/
9291eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9292 tANI_U8 numChannels)
9293{
9294 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9295 eHalStatus status = eHAL_STATUS_SUCCESS;
9296 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009297 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +05309298 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08009299 tANI_U8 i = 0, j = 0;
9300
9301 status = sme_AcquireGlobalLock( &pMac->sme );
9302 if ( HAL_STATUS_SUCCESS( status ) )
9303 {
9304 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9305 {
9306 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
9307 {
9308 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9309 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9310 }
9311 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009312 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009313 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009314 sme_SetRoamScanControl(hHal, 1);
9315 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009316 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009317 j = 0;
9318 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009319 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009320 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9321 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
Srinivas Girigowdade697412013-02-14 16:31:48 -08009322 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009323 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009324
9325 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309326 "LFR runtime successfully set roam scan channels to %s"
9327 "- old value is %s - roam state is %s",
9328 newChannelList, oldChannelList,
9329 macTraceGetNeighbourRoamState(
9330 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009331 sme_ReleaseGlobalLock( &pMac->sme );
9332 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009333#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9334 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9335 {
9336 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9337 }
9338#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009339
9340 return status ;
9341}
9342
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009343
9344#ifdef FEATURE_WLAN_CCX_UPLOAD
9345/*--------------------------------------------------------------------------
9346 \brief sme_SetCcxRoamScanChannelList() - set ccx roam scan channel list
9347 This is a synchronuous call
9348 \param hHal - The handle returned by macOpen.
9349 \return eHAL_STATUS_SUCCESS - SME update config successful.
9350 Other status means SME is failed to update
9351 \sa
9352 --------------------------------------------------------------------------*/
9353eHalStatus sme_SetCcxRoamScanChannelList(tHalHandle hHal,
9354 tANI_U8 *pChannelList,
9355 tANI_U8 numChannels)
9356{
9357 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9358 eHalStatus status = eHAL_STATUS_SUCCESS;
9359 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9360 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
9361 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
9362 tANI_U8 newChannelList[128] = {0};
9363 tANI_U8 i = 0, j = 0;
9364
9365 status = sme_AcquireGlobalLock( &pMac->sme );
9366 if ( HAL_STATUS_SUCCESS( status ) )
9367 {
9368 if (NULL != currChannelListInfo->ChannelList)
9369 {
9370 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9371 {
9372 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9373 currChannelListInfo->ChannelList[i]);
9374 }
9375 }
9376 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
9377
9378 if ( HAL_STATUS_SUCCESS( status ))
9379 {
9380 if (NULL != currChannelListInfo->ChannelList)
9381 {
9382 j = 0;
9383 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9384 {
9385 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9386 currChannelListInfo->ChannelList[i]);
9387 }
9388 }
9389
9390 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309391 "CCX roam scan channel list successfully set to %s"
9392 " - old value is %s - roam state is %s",
9393 newChannelList, oldChannelList,
9394 macTraceGetNeighbourRoamState(
9395 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009396 }
9397 sme_ReleaseGlobalLock( &pMac->sme );
9398 }
9399#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9400 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9401 {
9402 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9403 }
9404#endif
9405
9406 return status ;
9407}
9408#endif
9409
Srinivas Girigowdade697412013-02-14 16:31:48 -08009410/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -08009411 \brief sme_getRoamScanChannelList() - get roam scan channel list
9412 This is a synchronous call
9413 \param hHal - The handle returned by macOpen.
9414 \return eHAL_STATUS_SUCCESS - SME update config successful.
9415 Other status means SME is failed to update
9416 \sa
9417 --------------------------------------------------------------------------*/
9418eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9419 tANI_U8 *pNumChannels)
9420{
9421 int i = 0;
9422 tANI_U8 *pOutPtr = pChannelList;
9423 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9424 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9425 eHalStatus status = eHAL_STATUS_SUCCESS;
9426
9427 status = sme_AcquireGlobalLock( &pMac->sme );
9428 if ( HAL_STATUS_SUCCESS( status ) )
9429 {
9430 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9431 {
9432 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
9433 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009434 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009435 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009436 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -08009437 }
9438
9439 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
9440 for (i = 0; i < (*pNumChannels); i++)
9441 {
9442 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
9443 }
9444 pOutPtr[i] = '\0';
9445 sme_ReleaseGlobalLock( &pMac->sme );
9446 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009447 return status ;
9448}
9449
9450/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009451 \brief sme_getIsCcxFeatureEnabled() - get CCX feature enabled or not
9452 This is a synchronuous call
9453 \param hHal - The handle returned by macOpen.
9454 \return TRUE (1) - if the CCX feature is enabled
9455 FALSE (0) - if feature is disabled (compile or runtime)
9456 \sa
9457 --------------------------------------------------------------------------*/
9458tANI_BOOLEAN sme_getIsCcxFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009459{
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009460#ifdef FEATURE_WLAN_CCX
Srinivas Girigowdade697412013-02-14 16:31:48 -08009461 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009462 return csrRoamIsCcxIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009463#else
9464 return eANI_BOOLEAN_FALSE;
9465#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009466}
9467
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009468/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009469 \brief sme_GetWESMode() - get WES Mode
9470 This is a synchronous call
9471 \param hHal - The handle returned by macOpen
9472 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
9473 \sa
9474 --------------------------------------------------------------------------*/
9475v_BOOL_t sme_GetWESMode(tHalHandle hHal)
9476{
9477 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9478 return pMac->roam.configParam.isWESModeEnabled;
9479}
9480
9481/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009482 \brief sme_GetRoamScanControl() - get scan control
9483 This is a synchronous call
9484 \param hHal - The handle returned by macOpen.
9485 \return v_BOOL_t - Enabled(1)/Disabled(0)
9486 \sa
9487 --------------------------------------------------------------------------*/
9488v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
9489{
9490 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9491 return pMac->roam.configParam.nRoamScanControl;
9492}
9493#endif
9494
9495/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009496 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
9497 This is a synchronuous call
9498 \param hHal - The handle returned by macOpen.
9499 \return TRUE (1) - if the feature is enabled
9500 FALSE (0) - if feature is disabled (compile or runtime)
9501 \sa
9502 --------------------------------------------------------------------------*/
9503tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
9504{
9505#ifdef FEATURE_WLAN_LFR
9506 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9507 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
9508#else
9509 return eANI_BOOLEAN_FALSE;
9510#endif
9511}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08009512
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009513/*--------------------------------------------------------------------------
9514 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
9515 This is a synchronuous call
9516 \param hHal - The handle returned by macOpen.
9517 \return TRUE (1) - if the feature is enabled
9518 FALSE (0) - if feature is disabled (compile or runtime)
9519 \sa
9520 --------------------------------------------------------------------------*/
9521tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
9522{
9523#ifdef WLAN_FEATURE_VOWIFI_11R
9524 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9525 return pMac->roam.configParam.isFastTransitionEnabled;
9526#else
9527 return eANI_BOOLEAN_FALSE;
9528#endif
9529}
9530
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009531/* ---------------------------------------------------------------------------
9532 \fn sme_IsFeatureSupportedByFW
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009533
Kiet Lam0f320422013-11-21 19:29:17 +05309534 \brief Check if a feature is enabled by FW
9535
9536 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009537
Kiet Lam0f320422013-11-21 19:29:17 +05309538 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009539 -------------------------------------------------------------------------*/
9540tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
9541{
9542 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
9543}
Kiet Lam0f320422013-11-21 19:29:17 +05309544
9545/* ---------------------------------------------------------------------------
9546 \fn sme_IsFeatureSupportedByDriver
9547 \brief Check if a feature is enabled by Driver
9548
9549 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
9550 \- return 1/0 (TRUE/FALSE)
9551 -------------------------------------------------------------------------*/
9552
9553tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
9554{
9555 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
9556}
9557
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009558#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05309559
9560/* ---------------------------------------------------------------------------
9561 \fn sme_SendTdlsMgmtFrame
9562 \brief API to send TDLS management frames.
9563
9564 \param peerMac - peer's Mac Adress.
9565 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
9566 \- return VOS_STATUS_SUCCES
9567 -------------------------------------------------------------------------*/
9568VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
9569 tANI_U8 sessionId,
9570 tSirMacAddr peerMac,
9571 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
9572{
9573 eHalStatus status = eHAL_STATUS_SUCCESS;
9574 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9575
9576 status = sme_AcquireGlobalLock( &pMac->sme );
9577
9578 if ( HAL_STATUS_SUCCESS( status ) )
9579 {
9580 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
9581 sme_ReleaseGlobalLock( &pMac->sme );
9582 }
9583 return status ;
9584}
9585
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009586/* ---------------------------------------------------------------------------
9587 \fn sme_SendTdlsMgmtFrame
9588 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009589
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009590 \param peerMac - peer's Mac Adress.
9591 \param frame_type - Type of TDLS mgmt frame to be sent.
9592 \param dialog - dialog token used in the frame.
9593 \param status - status to be incuded in the frame.
9594 \param buf - additional IEs to be included
9595 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -08009596 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009597 \- return VOS_STATUS_SUCCES
9598 -------------------------------------------------------------------------*/
9599VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Hoonki Leea34dd892013-02-05 22:56:02 -08009600 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 -08009601{
9602 eHalStatus status = eHAL_STATUS_SUCCESS;
9603 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
9604 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9605
9606 status = sme_AcquireGlobalLock( &pMac->sme );
9607 if ( HAL_STATUS_SUCCESS( status ) )
9608 {
9609 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9610 sendTdlsReq.frameType = frame_type;
9611 sendTdlsReq.buf = buf;
9612 sendTdlsReq.len = len;
9613 sendTdlsReq.dialog = dialog;
9614 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -08009615 sendTdlsReq.responder = responder;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009616
9617 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
9618
9619 sme_ReleaseGlobalLock( &pMac->sme );
9620 }
9621
9622 return status ;
9623
9624}
9625/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -08009626 \fn sme_ChangeTdlsPeerSta
9627 \brief API to Update TDLS peer sta parameters.
9628
9629 \param peerMac - peer's Mac Adress.
9630 \param staParams - Peer Station Parameters
9631 \- return VOS_STATUS_SUCCES
9632 -------------------------------------------------------------------------*/
9633VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
9634 tCsrStaParams *pstaParams)
9635{
9636 eHalStatus status = eHAL_STATUS_SUCCESS;
9637 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9638
9639 status = sme_AcquireGlobalLock( &pMac->sme );
9640 if ( HAL_STATUS_SUCCESS( status ) )
9641 {
9642 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
9643
9644 sme_ReleaseGlobalLock( &pMac->sme );
9645 }
9646
9647 return status ;
9648
9649}
9650
9651/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009652 \fn sme_AddTdlsPeerSta
9653 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009654
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009655 \param peerMac - peer's Mac Adress.
9656 \- return VOS_STATUS_SUCCES
9657 -------------------------------------------------------------------------*/
9658VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9659{
9660 eHalStatus status = eHAL_STATUS_SUCCESS;
9661 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9662
9663 status = sme_AcquireGlobalLock( &pMac->sme );
9664 if ( HAL_STATUS_SUCCESS( status ) )
9665 {
9666 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
9667
9668 sme_ReleaseGlobalLock( &pMac->sme );
9669 }
9670
9671 return status ;
9672
9673}
9674/* ---------------------------------------------------------------------------
9675 \fn sme_DeleteTdlsPeerSta
9676 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009677
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009678 \param peerMac - peer's Mac Adress.
9679 \- return VOS_STATUS_SUCCES
9680 -------------------------------------------------------------------------*/
9681VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9682{
9683 eHalStatus status = eHAL_STATUS_SUCCESS;
9684 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9685
9686 status = sme_AcquireGlobalLock( &pMac->sme );
9687 if ( HAL_STATUS_SUCCESS( status ) )
9688 {
9689 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
9690
9691 sme_ReleaseGlobalLock( &pMac->sme );
9692 }
9693
9694 return status ;
9695
9696}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -07009697/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -07009698 \fn sme_SetTdlsPowerSaveProhibited
9699 \API to set/reset the isTdlsPowerSaveProhibited.
9700
9701 \- return void
9702 -------------------------------------------------------------------------*/
9703void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
9704{
9705 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9706
9707 pMac->isTdlsPowerSaveProhibited = val;
9708 return;
9709}
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009710#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +05309711/* ---------------------------------------------------------------------------
9712 \fn sme_IsPmcBmps
9713 \API to Check if PMC state is BMPS.
9714
9715 \- return v_BOOL_t
9716 -------------------------------------------------------------------------*/
9717v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
9718{
9719 return (BMPS == pmcGetPmcState(hHal));
9720}
9721
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009722#ifdef FEATURE_WLAN_TDLS_INTERNAL
9723/*
9724 * SME API to start TDLS discovery Procedure
9725 */
9726VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9727{
9728 VOS_STATUS status = VOS_STATUS_SUCCESS;
9729 tCsrTdlsDisRequest disReq = {{0}} ;
9730 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9731 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
9732
9733 return status ;
9734
9735}
9736
9737/*
9738 * Process TDLS discovery results
9739 */
9740v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
9741 tSmeTdlsDisResult *disResult, v_U8_t listType)
9742{
9743 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
9744 tSirTdlsPeerInfo *peerInfo = NULL ;
9745 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9746 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
9747 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
9748 tListElem *pEntry = NULL ;
9749 v_U8_t peerCnt = 0 ;
9750
9751 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009752 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009753 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
9754 while(pEntry)
9755 {
9756 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
9757 tdlsPeerStaLink) ;
9758 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
9759
9760 switch(listType)
9761 {
9762 case TDLS_SETUP_LIST:
9763 {
9764 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
9765 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309766 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9767 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009768 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9769 peerCnt++ ;
9770 }
9771 break ;
9772 }
9773 case TDLS_DIS_LIST:
9774 {
Kiet Lam64c1b492013-07-12 13:56:44 +05309775 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
9776 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009777 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
9778 peerCnt++ ;
9779 break ;
9780 }
9781 default:
9782 {
9783 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009784 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08009785 break ;
9786 }
9787 }
9788
9789 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
9790 }
9791
9792 return peerCnt ;
9793
9794}
9795
9796/*
9797 * SME API to start TDLS link setup Procedure.
9798 */
9799VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9800{
9801 VOS_STATUS status = VOS_STATUS_SUCCESS;
9802 tCsrTdlsSetupRequest setupReq = {{0}} ;
9803 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9804 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
9805 return status ;
9806
9807}
9808
9809/*
9810 * SME API to start TDLS link Teardown Procedure.
9811 */
9812VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
9813{
9814 VOS_STATUS status = VOS_STATUS_SUCCESS;
9815 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
9816 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
9817 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
9818 return status ;
9819
9820}
9821
9822#endif /* FEATURE_WLAN_TDLS */
9823
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -07009824eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
9825{
9826 eHalStatus status = eHAL_STATUS_FAILURE;
9827 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9828
9829 smsLog(pMac, LOG2, FL("enter"));
9830 status = sme_AcquireGlobalLock( &pMac->sme );
9831 if ( HAL_STATUS_SUCCESS( status ) )
9832 {
9833 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
9834 sme_ReleaseGlobalLock( &pMac->sme );
9835 }
9836 smsLog(pMac, LOG2, FL("exit status %d"), status);
9837
9838 return (status);
9839}
9840
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -07009841/*
9842 * SME API to enable/disable WLAN driver initiated SSR
9843 */
9844void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
9845{
9846 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9847 eHalStatus status = eHAL_STATUS_SUCCESS;
9848
9849 status = sme_AcquireGlobalLock(&pMac->sme);
9850 if (HAL_STATUS_SUCCESS(status))
9851 {
9852 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9853 "SSR level is changed %d", enableSSR);
9854 /* not serializing this messsage, as this is only going
9855 * to set a variable in WDA/WDI
9856 */
9857 WDA_SetEnableSSR(enableSSR);
9858 sme_ReleaseGlobalLock(&pMac->sme);
9859 }
9860 return;
9861}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009862
9863/*
9864 * SME API to determine the channel bonding mode
9865 */
9866VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
9867{
9868 tSmeConfigParams smeConfig;
9869 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9870
9871 if (
9872#ifdef WLAN_FEATURE_11AC
9873 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
9874 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
9875#endif
9876 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
9877 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode
9878 )
9879 {
9880 return VOS_STATUS_SUCCESS;
9881 }
9882
9883 /* If channel bonding mode is not required */
9884 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
9885 return VOS_STATUS_SUCCESS;
9886 }
9887
9888 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
9889 sme_GetConfigParam(pMac, &smeConfig);
9890
9891#ifdef WLAN_FEATURE_11AC
9892 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
9893 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
9894 {
9895 if ( channel== 36 || channel == 52 || channel == 100 ||
9896 channel == 116 || channel == 149 )
9897 {
9898 smeConfig.csrConfig.channelBondingMode5GHz =
9899 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW - 1;
9900 }
9901 else if ( channel == 40 || channel == 56 || channel == 104 ||
9902 channel == 120 || channel == 153 )
9903 {
9904 smeConfig.csrConfig.channelBondingMode5GHz =
9905 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW - 1;
9906 }
9907 else if ( channel == 44 || channel == 60 || channel == 108 ||
9908 channel == 124 || channel == 157 )
9909 {
9910 smeConfig.csrConfig.channelBondingMode5GHz =
9911 PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH -1;
9912 }
9913 else if ( channel == 48 || channel == 64 || channel == 112 ||
Leo Changd0a49842013-12-30 11:41:04 -08009914 channel == 128 || channel == 144 || channel == 161 )
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009915 {
9916 smeConfig.csrConfig.channelBondingMode5GHz =
9917 PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH - 1;
9918 }
9919 else if ( channel == 165 )
9920 {
9921 smeConfig.csrConfig.channelBondingMode5GHz = 0;
9922 }
9923 }
9924#endif
9925
9926 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
9927 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
9928 {
9929 if ( channel== 40 || channel == 48 || channel == 56 ||
9930 channel == 64 || channel == 104 || channel == 112 ||
9931 channel == 120 || channel == 128 || channel == 136 ||
9932 channel == 144 || channel == 153 || channel == 161 )
9933 {
9934 smeConfig.csrConfig.channelBondingMode5GHz = 1;
9935 }
9936 else if ( channel== 36 || channel == 44 || channel == 52 ||
9937 channel == 60 || channel == 100 || channel == 108 ||
9938 channel == 116 || channel == 124 || channel == 132 ||
9939 channel == 140 || channel == 149 || channel == 157 )
9940 {
9941 smeConfig.csrConfig.channelBondingMode5GHz = 2;
9942 }
9943 else if ( channel == 165 )
9944 {
9945 smeConfig.csrConfig.channelBondingMode5GHz = 0;
9946 }
9947 }
9948 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Jeff Johnsonce8ad512013-10-30 12:34:42 -07009949 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -07009950
9951 sme_UpdateConfig (pMac, &smeConfig);
9952 return VOS_STATUS_SUCCESS;
9953}
9954
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07009955/*--------------------------------------------------------------------------
9956
9957 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
9958 \param hHal - The handle returned by macOpen.
9959 \param currDeviceMode - Current operating device mode.
9960 --------------------------------------------------------------------------*/
9961
9962void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
9963{
9964 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
9965 pMac->sme.currDeviceMode = currDeviceMode;
9966 return;
9967}
9968
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07009969#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9970/*--------------------------------------------------------------------------
9971 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
9972 from CSR.
9973 This is a synchronous call
9974 \param hHal - The handle returned by macOpen
9975 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
9976 BSSID, channel etc.)
9977 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
9978 Other status means SME is failed to send the request.
9979 \sa
9980 --------------------------------------------------------------------------*/
9981
9982eHalStatus sme_HandoffRequest(tHalHandle hHal,
9983 tCsrHandoffRequest *pHandoffInfo)
9984{
9985 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9986 eHalStatus status = eHAL_STATUS_SUCCESS;
9987
9988 status = sme_AcquireGlobalLock( &pMac->sme );
9989 if ( HAL_STATUS_SUCCESS( status ) )
9990 {
9991 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9992 "%s: invoked", __func__);
9993 status = csrHandoffRequest(pMac, pHandoffInfo);
9994 sme_ReleaseGlobalLock( &pMac->sme );
9995 }
9996
9997 return status ;
9998}
9999#endif
10000
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -070010001/*
10002 * SME API to check if there is any infra station or
10003 * P2P client is connected
10004 */
10005VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
10006{
10007 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10008 if(csrIsInfraConnected(pMac))
10009 {
10010 return VOS_STATUS_SUCCESS;
10011 }
10012 return VOS_STATUS_E_FAILURE;
10013}
10014
Leo Chang9056f462013-08-01 19:21:11 -070010015
10016#ifdef FEATURE_WLAN_LPHB
10017/* ---------------------------------------------------------------------------
10018 \fn sme_LPHBConfigReq
10019 \API to make configuration LPHB within FW.
10020 \param hHal - The handle returned by macOpen
10021 \param lphdReq - LPHB request argument by client
10022 \param pCallbackfn - LPHB timeout notification callback function pointer
10023 \- return Configuration message posting status, SUCCESS or Fail
10024 -------------------------------------------------------------------------*/
10025eHalStatus sme_LPHBConfigReq
10026(
10027 tHalHandle hHal,
10028 tSirLPHBReq *lphdReq,
10029 void (*pCallbackfn)(void *pAdapter, void *indParam)
10030)
10031{
10032 eHalStatus status = eHAL_STATUS_SUCCESS;
10033 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
10034 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10035 vos_msg_t vosMessage;
10036
10037 status = sme_AcquireGlobalLock(&pMac->sme);
10038 if (eHAL_STATUS_SUCCESS == status)
10039 {
10040 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
10041 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070010042 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070010043 {
10044 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10045 "%s: Indication Call back did not registered", __func__);
10046 sme_ReleaseGlobalLock(&pMac->sme);
10047 return eHAL_STATUS_FAILURE;
10048 }
10049 else if (NULL != pCallbackfn)
10050 {
Leo Changd9df8aa2013-09-26 13:32:26 -070010051 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070010052 }
10053
10054 /* serialize the req through MC thread */
10055 vosMessage.bodyptr = lphdReq;
10056 vosMessage.type = WDA_LPHB_CONF_REQ;
10057 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
10058 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
10059 {
10060 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10061 "%s: Post Config LPHB MSG fail", __func__);
10062 status = eHAL_STATUS_FAILURE;
10063 }
10064 sme_ReleaseGlobalLock(&pMac->sme);
10065 }
10066
10067 return(status);
10068}
10069#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070010070/*--------------------------------------------------------------------------
10071 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
10072 scan parameter.
10073 This is a synchronous call
10074 \param hHal - The handle returned by macOpen
10075 \return NONE.
10076 \sa
10077 --------------------------------------------------------------------------*/
10078void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
10079 tANI_U8 nNumP2PChan)
10080{
10081 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10082
10083 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
10084 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
10085
10086 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10087 "%s: SCAN nNumStaChanCombinedConc : %d,"
10088 "nNumP2PChanCombinedConc : %d ",
10089 __func__, nNumStaChan, nNumP2PChan);
10090
10091 return;
10092
10093}
Leo Chang9056f462013-08-01 19:21:11 -070010094
Yue Mab9c86f42013-08-14 15:59:08 -070010095/* ---------------------------------------------------------------------------
10096 \fn sme_AddPeriodicTxPtrn
10097 \brief API to Periodic TX Pattern Offload feature
10098 \param hHal - The handle returned by macOpen
10099 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
10100 \return eHalStatus
10101 ---------------------------------------------------------------------------*/
10102eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
10103 *addPeriodicTxPtrnParams)
10104{
10105 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10106 eHalStatus status;
10107 vos_msg_t msg;
10108
10109 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10110 {
10111 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
10112 msg.bodyptr = addPeriodicTxPtrnParams;
10113
10114 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10115 {
10116 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10117 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
10118 __func__);
10119
10120 sme_ReleaseGlobalLock(&pMac->sme);
10121 return eHAL_STATUS_FAILURE;
10122 }
10123
10124 sme_ReleaseGlobalLock(&pMac->sme);
10125 return eHAL_STATUS_SUCCESS;
10126 }
10127
10128 return status;
10129}
10130
10131/* ---------------------------------------------------------------------------
10132 \fn sme_DelPeriodicTxPtrn
10133 \brief API to Periodic TX Pattern Offload feature
10134 \param hHal - The handle returned by macOpen
10135 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
10136 \return eHalStatus
10137 ---------------------------------------------------------------------------*/
10138eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
10139 *delPeriodicTxPtrnParams)
10140{
10141 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10142 eHalStatus status;
10143 vos_msg_t msg;
10144
10145 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10146 {
10147 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
10148 msg.bodyptr = delPeriodicTxPtrnParams;
10149
10150 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10151 {
10152 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10153 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
10154 __func__);
10155
10156 sme_ReleaseGlobalLock(&pMac->sme);
10157 return eHAL_STATUS_FAILURE;
10158 }
10159
10160 sme_ReleaseGlobalLock(&pMac->sme);
10161 return eHAL_STATUS_SUCCESS;
10162 }
10163
10164 return status;
10165}
10166
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010167void smeGetCommandQStatus( tHalHandle hHal )
10168{
10169 tSmeCmd *pTempCmd = NULL;
10170 tListElem *pEntry;
10171 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10172
10173 if (NULL == pMac)
10174 {
Kiet Lamcffc5862013-10-30 16:28:45 +053010175 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
10176 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010177 return;
10178 }
10179
10180 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
10181 if( pEntry )
10182 {
10183 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
10184 }
10185 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
10186 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
10187 if(pTempCmd)
10188 {
10189 if( eSmeCsrCommandMask & pTempCmd->command )
10190 {
10191 //CSR command is stuck. See what the reason code is for that command
10192 dumpCsrCommandInfo(pMac, pTempCmd);
10193 }
10194 } //if(pTempCmd)
10195
10196 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
10197 csrLLCount(&pMac->sme.smeCmdPendingList));
10198
10199 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
10200 csrLLCount(&pMac->roam.roamCmdPendingList));
10201
10202 return;
10203}
Rajeev79dbe4c2013-10-05 11:03:42 +053010204
10205#ifdef FEATURE_WLAN_BATCH_SCAN
10206/* ---------------------------------------------------------------------------
10207 \fn sme_SetBatchScanReq
10208 \brief API to set batch scan request in FW
10209 \param hHal - The handle returned by macOpen.
10210 \param pRequest - Pointer to the batch request.
10211 \param sessionId - session ID
10212 \param callbackRoutine - HDD callback which needs to be invoked after
10213 getting set batch scan response from FW
10214 \param callbackContext - pAdapter context
10215 \return eHalStatus
10216 ---------------------------------------------------------------------------*/
10217eHalStatus sme_SetBatchScanReq
10218(
10219 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
10220 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
10221 void *callbackContext
10222)
10223{
10224 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10225 eHalStatus status;
10226
10227 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10228 {
10229 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
10230 callbackContext);
10231 sme_ReleaseGlobalLock( &pMac->sme );
10232 }
10233
10234 return status;
10235}
10236
10237/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -070010238 \fn sme_SendRateUpdateInd
10239 \brief API to Update rate
10240 \param hHal - The handle returned by macOpen
10241 \param rateUpdateParams - Pointer to rate update params
10242 \return eHalStatus
10243 ---------------------------------------------------------------------------*/
10244eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
10245{
10246 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10247 eHalStatus status;
10248 vos_msg_t msg;
10249
10250 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10251 {
10252 msg.type = WDA_RATE_UPDATE_IND;
10253 msg.bodyptr = rateUpdateParams;
10254
10255 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10256 {
10257 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10258 "to post WDA_SET_RMC_RATE_IND to WDA!",
10259 __func__);
10260
10261 sme_ReleaseGlobalLock(&pMac->sme);
10262 return eHAL_STATUS_FAILURE;
10263 }
10264
10265 sme_ReleaseGlobalLock(&pMac->sme);
10266 return eHAL_STATUS_SUCCESS;
10267 }
10268
10269 return status;
10270}
10271
10272/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053010273 \fn sme_TriggerBatchScanResultInd
10274 \brief API to trigger batch scan result indications from FW
10275 \param hHal - The handle returned by macOpen.
10276 \param pRequest - Pointer to get batch request.
10277 \param sessionId - session ID
10278 \param callbackRoutine - HDD callback which needs to be invoked after
10279 getting batch scan result indication from FW
10280 \param callbackContext - pAdapter context
10281 \return eHalStatus
10282 ---------------------------------------------------------------------------*/
10283eHalStatus sme_TriggerBatchScanResultInd
10284(
10285 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
10286 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
10287 void *callbackContext
10288)
10289{
10290 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10291 eHalStatus status;
10292
10293 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10294 {
10295 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
10296 callbackRoutine, callbackContext);
10297 sme_ReleaseGlobalLock( &pMac->sme );
10298 }
10299
10300 return status;
10301}
10302
10303
10304/* ---------------------------------------------------------------------------
10305 \fn sme_StopBatchScanInd
10306 \brief API to stop batch scan request in FW
10307 \param hHal - The handle returned by macOpen.
10308 \param pRequest - Pointer to the batch request.
10309 \param sessionId - session ID
10310 \return eHalStatus
10311 ---------------------------------------------------------------------------*/
10312eHalStatus sme_StopBatchScanInd
10313(
10314 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
10315)
10316{
10317 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10318 eHalStatus status;
10319
10320 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
10321 {
10322 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
10323 sme_ReleaseGlobalLock( &pMac->sme );
10324 }
10325
10326 return status;
10327}
10328
10329#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080010330
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010331
Leo Chang0b0e45a2013-12-15 15:18:55 -080010332#ifdef FEATURE_WLAN_CH_AVOID
10333/* ---------------------------------------------------------------------------
10334 \fn sme_AddChAvoidCallback
10335 \brief Used to plug in callback function
10336 Which notify channel may not be used with SAP or P2PGO mode.
10337 Notification come from FW.
10338 \param hHal
10339 \param pCallbackfn : callback function pointer should be plugged in
10340 \- return eHalStatus
10341 -------------------------------------------------------------------------*/
10342eHalStatus sme_AddChAvoidCallback
10343(
10344 tHalHandle hHal,
10345 void (*pCallbackfn)(void *pAdapter, void *indParam)
10346)
10347{
10348 eHalStatus status = eHAL_STATUS_SUCCESS;
10349 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10350
10351 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10352 "%s: Plug in CH AVOID CB", __func__);
10353
10354 status = sme_AcquireGlobalLock(&pMac->sme);
10355 if (eHAL_STATUS_SUCCESS == status)
10356 {
10357 if (NULL != pCallbackfn)
10358 {
10359 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
10360 }
10361 sme_ReleaseGlobalLock(&pMac->sme);
10362 }
10363
10364 return(status);
10365}
10366#endif /* FEATURE_WLAN_CH_AVOID */
10367
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010368
10369void activeListCmdTimeoutHandle(void *userData)
10370{
10371 if (NULL == userData)
10372 return;
10373 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10374 "%s: Active List command timeout Cmd List Count %d", __func__,
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010375 csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010376 smeGetCommandQStatus((tHalHandle) userData);
10377}
10378
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080010379eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
10380{
10381 eHalStatus status = eHAL_STATUS_SUCCESS;
10382 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10383 pMac->fEnableDebugLog = set_value;
10384 return (status);
10385}
10386