blob: d24037800610a14a6d4e59de016b7e9363b24b93 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05302 * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
Kiet Lam0fb93dd2014-02-19 00:32:59 -08003 *
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 Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080026 */
Kiet Lam0fb93dd2014-02-19 00:32:59 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Jeff Johnson295189b2012-06-20 16:38:30 -070031/**=========================================================================
32
33 \file smeApi.c
34
35 \brief Definitions for SME APIs
36
Kiet Lamaa8e15a2014-02-11 23:30:06 -080037
Jeff Johnson295189b2012-06-20 16:38:30 -070038 ========================================================================*/
39
40/*===========================================================================
41
42 EDIT HISTORY FOR FILE
43
44
45 This section contains comments describing changes made to the module.
46 Notice that changes are listed in reverse chronological order.
47
48
49
50 when who what, where, why
51---------- --- --------------------------------------------------------
5206/03/10 js Added support to hostapd driven
53 * deauth/disassoc/mic failure
54
55===========================================================================*/
56
57/*--------------------------------------------------------------------------
58 Include Files
59 ------------------------------------------------------------------------*/
60
Jeff Johnson295189b2012-06-20 16:38:30 -070061
62#include "smsDebug.h"
63#include "sme_Api.h"
64#include "csrInsideApi.h"
65#include "smeInside.h"
66#include "csrInternal.h"
67#include "wlan_qct_wda.h"
68#include "halMsgApi.h"
Katya Nigam70d68332013-09-16 16:49:45 +053069#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070070#include "sme_Trace.h"
Katya Nigambcb705f2013-12-26 14:26:22 +053071#include "vos_types.h"
72#include "vos_trace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070073#include "sapApi.h"
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053074#include "macTrace.h"
Mukul Sharmabe91e2f2014-06-29 22:09:20 +053075#include "vos_utils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070076
Jeff Johnson295189b2012-06-20 16:38:30 -070077extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
78
79#include <wlan_qct_pal_api.h>
Katya Nigam70d68332013-09-16 16:49:45 +053080#define LOG_SIZE 256
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080081#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053082#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080083
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070084
85#define CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE 1000*30 //30s
86
Jeff Johnson295189b2012-06-20 16:38:30 -070087// TxMB Functions
88extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
89 tANI_U32 size, tSmeCmd **ppCmd );
90extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
91extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Sushant Kaushik298a8592014-12-09 17:34:07 +053092extern void csrReleaseRocReqCommand( tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -070093extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
94extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
95extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
96extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
97extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
98extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -070099
100static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
101static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
102
103eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
104
105eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
106
Sushant Kaushik1d732562014-05-21 14:15:37 +0530107void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac);
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;
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530387 static int smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 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 );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530396 /* reset when free list is available */
397 smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700398 }
399 else {
400 int idx = 1;
401
402 //Cannot change pRetCmd here since it needs to return later.
403 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
404 if( pEntry )
405 {
406 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
407 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800408 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700409 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
410 if(pTempCmd)
411 {
412 if( eSmeCsrCommandMask & pTempCmd->command )
413 {
414 //CSR command is stuck. See what the reason code is for that command
415 dumpCsrCommandInfo(pMac, pTempCmd);
416 }
417 } //if(pTempCmd)
418
419 //dump what is in the pending queue
420 csrLLLock(&pMac->sme.smeCmdPendingList);
421 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530422 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700423 {
424 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530425 /* Print only 1st five commands from pending queue. */
426 if (idx <= 5)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800427 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530428 idx, pTempCmd->command );
429 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700430 if( eSmeCsrCommandMask & pTempCmd->command )
431 {
432 //CSR command is stuck. See what the reason code is for that command
433 dumpCsrCommandInfo(pMac, pTempCmd);
434 }
435 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
436 }
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530437 /* Increament static variable so that it prints pending command only once*/
438 smeCommandQueueFull++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700439 csrLLUnlock(&pMac->sme.smeCmdPendingList);
440
441 //There may be some more command in CSR's own pending queue
442 csrLLLock(&pMac->roam.roamCmdPendingList);
443 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
444 while(pEntry)
445 {
446 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800447 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 idx++, pTempCmd->command );
449 dumpCsrCommandInfo(pMac, pTempCmd);
450 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
451 }
452 csrLLUnlock(&pMac->roam.roamCmdPendingList);
453 }
454
Masti, Narayanraddi5240fbe2015-02-05 16:51:28 +0530455 if( pRetCmd )
456 {
457 vos_mem_set((tANI_U8 *)&pRetCmd->command, sizeof(pRetCmd->command), 0);
458 vos_mem_set((tANI_U8 *)&pRetCmd->sessionId, sizeof(pRetCmd->sessionId), 0);
459 vos_mem_set((tANI_U8 *)&pRetCmd->u, sizeof(pRetCmd->u), 0);
460 }
461
Jeff Johnson295189b2012-06-20 16:38:30 -0700462 return( pRetCmd );
463}
464
465
466void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
467{
Sushant Kaushik4928e542014-12-29 15:25:54 +0530468 if (!SME_IS_START(pMac))
469 {
470 smsLog( pMac, LOGE, FL("Sme in stop state"));
471 return;
472 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 if ( fHighPriority )
474 {
475 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
476 }
477 else
478 {
479 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
480 }
481
482 // process the command queue...
483 smeProcessPendingQueue( pMac );
484
485 return;
486}
487
488
489static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
490{
491 eSmeCommandType pmcCommand = eSmeNoCommand;
492 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
493 tPmcState pmcState;
494 eHalStatus status;
495
496 do
497 {
498 pmcState = pmcGetPmcState(pMac);
499
500 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
501 if( !HAL_STATUS_SUCCESS(status) )
502 {
503 //PMC state is not right for the command, drop it
504 return ( eSmeDropCommand );
505 }
506 if( fFullPowerNeeded ) break;
507 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
508 ( eSmeCommandDelTs == pCommand->command ) );
509 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700510#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700511 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700512 eSmeCommandOemDataReq == pCommand->command);
513 if(fFullPowerNeeded) break;
514#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700515 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700516 eSmeCommandRemainOnChannel == pCommand->command);
517 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 } while(0);
519
520 if( fFullPowerNeeded )
521 {
522 switch( pmcState )
523 {
524 case IMPS:
525 case STANDBY:
526 pmcCommand = eSmeCommandExitImps;
527 break;
528
529 case BMPS:
530 pmcCommand = eSmeCommandExitBmps;
531 break;
532
533 case UAPSD:
534 pmcCommand = eSmeCommandExitUapsd;
535 break;
536
537 case WOWL:
538 pmcCommand = eSmeCommandExitWowl;
539 break;
540
541 default:
542 break;
543 }
544 }
545
546 return ( pmcCommand );
547}
548
549
550//For commands that need to do extra cleanup.
551static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
552{
553 if( eSmePmcCommandMask & pCommand->command )
554 {
555 pmcAbortCommand( pMac, pCommand, fStopping );
556 }
557 else if ( eSmeCsrCommandMask & pCommand->command )
558 {
559 csrAbortCommand( pMac, pCommand, fStopping );
560 }
561 else
562 {
563 switch( pCommand->command )
564 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 case eSmeCommandRemainOnChannel:
566 if (NULL != pCommand->u.remainChlCmd.callback)
567 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700568 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 pCommand->u.remainChlCmd.callback;
570 /* process the msg */
571 if( callback )
572 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700573 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700574 eCSR_SCAN_ABORT );
575 }
576 }
577 smeReleaseCommand( pMac, pCommand );
578 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700579 default:
580 smeReleaseCommand( pMac, pCommand );
581 break;
582 }
583 }
584}
585
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530586tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
587 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
588{
589 tListElem *pCurEntry = NULL;
590 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700591
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530592 /* Go through the list and return the command whose session id is not
593 * matching with the current ongoing scan cmd sessionId */
594 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
595 while (pCurEntry)
596 {
597 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
598 if (pCommand->sessionId != sessionId)
599 {
600 smsLog(pMac, LOG1, "selected the command with different sessionId");
601 return pCurEntry;
602 }
603
604 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
605 }
606
607 smsLog(pMac, LOG1, "No command pending with different sessionId");
608 return NULL;
609}
610
611tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
612{
613 tListElem *pEntry;
614 tSmeCmd *pCommand;
615 tListElem *pSmeEntry;
616 tSmeCmd *pSmeCommand;
617 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
618
619 csrLLLock( &pMac->sme.smeScanCmdActiveList );
620 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
621 LL_ACCESS_NOLOCK ))
622 {
623 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
624 LL_ACCESS_LOCK))
625 {
626 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
627 LL_ACCESS_LOCK );
628 if (pEntry)
629 {
630 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
631 //We cannot execute any command in wait-for-key state until setKey is through.
632 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
633 {
634 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
635 {
636 smsLog(pMac, LOGE,
637 " Cannot process command(%d) while waiting for key",
638 pCommand->command);
639 status = eANI_BOOLEAN_FALSE;
640 goto end;
641 }
642 }
643
644 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
645 LL_ACCESS_LOCK )))
646 {
647 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
648 LL_ACCESS_LOCK);
649 if (pEntry)
650 {
651 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
652 Link) ;
653
654 /* if scan is running on one interface and SME recei
655 ves the next command on the same interface then
656 dont the allow the command to be queued to
657 smeCmdPendingList. If next scan is allowed on
658 the same interface the CSR state machine will
659 get screwed up. */
660 if (pSmeCommand->sessionId == pCommand->sessionId)
661 {
662 status = eANI_BOOLEAN_FALSE;
663 goto end;
664 }
665 }
666 }
667 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
668 pEntry, LL_ACCESS_LOCK ) )
669 {
670 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
671 &pCommand->Link, LL_ACCESS_NOLOCK );
672
673 switch (pCommand->command)
674 {
675 case eSmeCommandScan:
676 smsLog(pMac, LOG1,
677 " Processing scan offload command ");
678 csrProcessScanCommand( pMac, pCommand );
679 break;
680 default:
681 smsLog(pMac, LOGE,
682 " Something wrong, wrong command enqueued"
683 " to smeScanCmdPendingList");
684 pEntry = csrLLRemoveHead(
685 &pMac->sme.smeScanCmdActiveList,
686 LL_ACCESS_NOLOCK );
687 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
688 smeReleaseCommand( pMac, pCommand );
689 break;
690 }
691 }
692 }
693 }
694 }
695end:
696 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
697 return status;
698}
Jeff Johnson295189b2012-06-20 16:38:30 -0700699
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +0530700eHalStatus smeProcessPnoCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
701{
702 tpSirPNOScanReq pnoReqBuf;
703 tSirMsgQ msgQ;
704
705 pnoReqBuf = vos_mem_malloc(sizeof(tSirPNOScanReq));
706 if ( NULL == pnoReqBuf )
707 {
708 smsLog(pMac, LOGE, FL("failed to allocate memory"));
709 return eHAL_STATUS_FAILURE;
710 }
711
712 vos_mem_copy(pnoReqBuf, &(pCmd->u.pnoInfo), sizeof(tSirPNOScanReq));
713
714 smsLog(pMac, LOG1, FL("post WDA_SET_PNO_REQ comamnd"));
715 msgQ.type = WDA_SET_PNO_REQ;
716 msgQ.reserved = 0;
717 msgQ.bodyptr = pnoReqBuf;
718 msgQ.bodyval = 0;
719 wdaPostCtrlMsg( pMac, &msgQ);
720
721 return eHAL_STATUS_SUCCESS;
722}
723
Jeff Johnson295189b2012-06-20 16:38:30 -0700724tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
725{
726 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
727 eHalStatus status = eHAL_STATUS_SUCCESS;
728 tListElem *pEntry;
729 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530730 tListElem *pSmeEntry;
731 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 eSmeCommandType pmcCommand = eSmeNoCommand;
733
734 // if the ActiveList is empty, then nothing is active so we can process a
735 // pending command...
736 //alwasy lock active list before locking pending list
737 csrLLLock( &pMac->sme.smeCmdActiveList );
738 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
739 {
740 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
741 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530742 /* If scan command is pending in the smeScanCmdActive list
743 * then pick the command from smeCmdPendingList which is
744 * not matching with the scan command session id.
745 * At any point of time only one command will be allowed
746 * on a single session. */
747 if ((pMac->fScanOffload) &&
748 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
749 LL_ACCESS_LOCK)))
750 {
751 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
752 LL_ACCESS_LOCK);
753 if (pSmeEntry)
754 {
755 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
756
757 pEntry = csrGetCmdToProcess(pMac,
758 &pMac->sme.smeCmdPendingList,
759 pSmeCommand->sessionId,
760 LL_ACCESS_LOCK);
761 goto sme_process_cmd;
762 }
763 }
764
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 //Peek the command
766 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530767sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700768 if( pEntry )
769 {
770 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530771
Abhishek Singhf4669da2014-05-26 15:07:49 +0530772 /* Allow only disconnect command
773 * in wait-for-key state until setKey is through.
774 */
775 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) &&
776 !CSR_IS_DISCONNECT_COMMAND( pCommand ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 {
778 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
779 {
780 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Abhishek Singhf4669da2014-05-26 15:07:49 +0530781 smsLog(pMac, LOGE, FL("SessionId %d: Cannot process "
782 "command(%d) while waiting for key"),
783 pCommand->sessionId, pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530784 fContinue = eANI_BOOLEAN_FALSE;
785 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700786 }
787 }
788 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
789 if( eSmeDropCommand == pmcCommand )
790 {
791 //This command is not ok for current PMC state
792 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
793 {
794 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
795 }
796 csrLLUnlock( &pMac->sme.smeCmdActiveList );
797 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530798 fContinue = eANI_BOOLEAN_TRUE;
799 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700800 }
801 else if( eSmeNoCommand != pmcCommand )
802 {
803 tExitBmpsInfo exitBmpsInfo;
804 void *pv = NULL;
805 tANI_U32 size = 0;
806 tSmeCmd *pPmcCmd = NULL;
807
808 if( eSmeCommandExitBmps == pmcCommand )
809 {
810 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
811 pv = (void *)&exitBmpsInfo;
812 size = sizeof(tExitBmpsInfo);
813 }
814 //pmcCommand has to be one of the exit power save command
815 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
816 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
817 {
818 //Force this command to wake up the chip
819 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
820 csrLLUnlock( &pMac->sme.smeCmdActiveList );
821 fContinue = pmcProcessCommand( pMac, pPmcCmd );
822 if( fContinue )
823 {
824 //The command failed, remove it
825 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
826 {
827 pmcReleaseCommand( pMac, pPmcCmd );
828 }
829 }
830 }
831 else
832 {
833 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800834 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 -0700835 //Let it retry
836 fContinue = eANI_BOOLEAN_TRUE;
837 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530838 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 }
840 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
841 {
842 // we can reuse the pCommand
843
844 // Insert the command onto the ActiveList...
845 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
846
Rashmi Ramanna68b309c2014-05-20 11:52:22 +0530847 if( pMac->deferImps )
848 {
849 /* IMPS timer is already running so stop it and
850 * it will get restarted when no command is pending
851 */
852 csrScanStopIdleScanTimer( pMac );
853 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
854 pMac->deferImps = eANI_BOOLEAN_FALSE;
855 }
856
Jeff Johnson295189b2012-06-20 16:38:30 -0700857 // .... and process the command.
858
Katya Nigambcb705f2013-12-26 14:26:22 +0530859 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -0700860 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700861 switch ( pCommand->command )
862 {
863
864 case eSmeCommandScan:
865 csrLLUnlock( &pMac->sme.smeCmdActiveList );
866 status = csrProcessScanCommand( pMac, pCommand );
867 break;
868
869 case eSmeCommandRoam:
870 csrLLUnlock( &pMac->sme.smeCmdActiveList );
871 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800872 if(!HAL_STATUS_SUCCESS(status))
873 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700874 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800875 &pCommand->Link, LL_ACCESS_LOCK ) )
876 {
877 csrReleaseCommandRoam( pMac, pCommand );
878 }
879 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700880 break;
881
882 case eSmeCommandWmStatusChange:
883 csrLLUnlock( &pMac->sme.smeCmdActiveList );
884 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
885 break;
886
887 case eSmeCommandSetKey:
888 csrLLUnlock( &pMac->sme.smeCmdActiveList );
889 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
890 if(!HAL_STATUS_SUCCESS(status))
891 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700892 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700893 &pCommand->Link, LL_ACCESS_LOCK ) )
894 {
895 csrReleaseCommandSetKey( pMac, pCommand );
896 }
897 }
898 break;
899
900 case eSmeCommandRemoveKey:
901 csrLLUnlock( &pMac->sme.smeCmdActiveList );
902 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
903 if(!HAL_STATUS_SUCCESS(status))
904 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700905 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700906 &pCommand->Link, LL_ACCESS_LOCK ) )
907 {
908 csrReleaseCommandRemoveKey( pMac, pCommand );
909 }
910 }
911 break;
912
913 case eSmeCommandAddStaSession:
914 csrLLUnlock( &pMac->sme.smeCmdActiveList );
915 csrProcessAddStaSessionCommand( pMac, pCommand );
916 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700917 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -0700918 csrLLUnlock( &pMac->sme.smeCmdActiveList );
919 csrProcessDelStaSessionCommand( pMac, pCommand );
920 break;
Siddharth Bhald8a95e82015-02-12 20:14:52 +0530921 case eSmeCommandMacSpoofRequest:
922 csrLLUnlock( &pMac->sme.smeCmdActiveList );
923 csrProcessMacAddrSpoofCommand( pMac, pCommand );
924 // No Rsp expected, free cmd from active list
925 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
926 &pCommand->Link, LL_ACCESS_LOCK ) )
927 {
928 csrReleaseCommand( pMac, pCommand );
929 }
930
931 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700932
Jeff Johnsone7245742012-09-05 17:12:55 -0700933#ifdef FEATURE_OEM_DATA_SUPPORT
934 case eSmeCommandOemDataReq:
935 csrLLUnlock(&pMac->sme.smeCmdActiveList);
936 oemData_ProcessOemDataReqCommand(pMac, pCommand);
937 break;
938#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700939 case eSmeCommandRemainOnChannel:
940 csrLLUnlock(&pMac->sme.smeCmdActiveList);
941 p2pProcessRemainOnChannelCmd(pMac, pCommand);
942 break;
943 case eSmeCommandNoAUpdate:
944 csrLLUnlock( &pMac->sme.smeCmdActiveList );
945 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700946 case eSmeCommandEnterImps:
947 case eSmeCommandExitImps:
948 case eSmeCommandEnterBmps:
949 case eSmeCommandExitBmps:
950 case eSmeCommandEnterUapsd:
951 case eSmeCommandExitUapsd:
952 case eSmeCommandEnterWowl:
953 case eSmeCommandExitWowl:
954 csrLLUnlock( &pMac->sme.smeCmdActiveList );
955 fContinue = pmcProcessCommand( pMac, pCommand );
956 if( fContinue )
957 {
958 //The command failed, remove it
959 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
960 &pCommand->Link, LL_ACCESS_LOCK ) )
961 {
962 pmcReleaseCommand( pMac, pCommand );
963 }
964 }
965 break;
966
967 //Treat standby differently here because caller may not be able to handle
968 //the failure so we do our best here
969 case eSmeCommandEnterStandby:
970 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
971 {
972 //It can continue
973 csrLLUnlock( &pMac->sme.smeCmdActiveList );
974 fContinue = pmcProcessCommand( pMac, pCommand );
975 if( fContinue )
976 {
977 //The command failed, remove it
978 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
979 &pCommand->Link, LL_ACCESS_LOCK ) )
980 {
981 pmcReleaseCommand( pMac, pCommand );
982 }
983 }
984 }
985 else
986 {
987 //Need to issue a disconnect first before processing this command
988 tSmeCmd *pNewCmd;
989
990 //We need to re-run the command
991 fContinue = eANI_BOOLEAN_TRUE;
992 //Pull off the standby command first
993 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
994 &pCommand->Link, LL_ACCESS_NOLOCK ) )
995 {
996 csrLLUnlock( &pMac->sme.smeCmdActiveList );
997 //Need to call CSR function here because the disconnect command
998 //is handled by CSR
999 pNewCmd = csrGetCommandBuffer( pMac );
1000 if( NULL != pNewCmd )
1001 {
1002 //Put the standby command to the head of the pending list first
1003 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
1004 LL_ACCESS_LOCK );
1005 pNewCmd->command = eSmeCommandRoam;
1006 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
1007 //Put the disassoc command before the standby command
1008 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
1009 LL_ACCESS_LOCK );
1010 }
1011 else
1012 {
1013 //Continue the command here
1014 fContinue = pmcProcessCommand( pMac, pCommand );
1015 if( fContinue )
1016 {
1017 //The command failed, remove it
1018 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1019 &pCommand->Link, LL_ACCESS_LOCK ) )
1020 {
1021 pmcReleaseCommand( pMac, pCommand );
1022 }
1023 }
1024 }
1025 }
1026 else
1027 {
1028 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001029 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001030 VOS_ASSERT(0);
1031 }
1032 }
1033 break;
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301034 case eSmeCommandPnoReq:
1035 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1036 status = smeProcessPnoCommand(pMac, pCommand);
1037 if (!HAL_STATUS_SUCCESS(status)){
1038 smsLog(pMac, LOGE,
1039 FL("failed to post SME PNO SCAN %d"), status);
1040 }
Mahesh A Saptasagarbafce5a2015-02-26 12:29:22 +05301041 //We need to re-run the command
1042 fContinue = eANI_BOOLEAN_TRUE;
1043
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301044 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1045 &pCommand->Link, LL_ACCESS_LOCK))
1046 {
1047 csrReleaseCommand(pMac, pCommand);
1048 }
1049 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001050 case eSmeCommandAddTs:
1051 case eSmeCommandDelTs:
1052 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1053#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1054 fContinue = qosProcessCommand( pMac, pCommand );
1055 if( fContinue )
1056 {
1057 //The command failed, remove it
1058 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1059 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1060 {
1061//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1062 qosReleaseCommand( pMac, pCommand );
1063//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
1064 }
1065 }
1066#endif
1067 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001068#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001069 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001070 case eSmeCommandTdlsAddPeer:
1071 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301072 case eSmeCommandTdlsLinkEstablish:
Atul Mittalc0f739f2014-07-31 13:47:47 +05301073 case eSmeCommandTdlsChannelSwitch: // tdlsoffchan
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001074#ifdef FEATURE_WLAN_TDLS_INTERNAL
1075 case eSmeCommandTdlsDiscovery:
1076 case eSmeCommandTdlsLinkSetup:
1077 case eSmeCommandTdlsLinkTear:
1078 case eSmeCommandTdlsEnterUapsd:
1079 case eSmeCommandTdlsExitUapsd:
1080#endif
1081 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -08001082 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001083 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001084
1085 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1086 status = csrTdlsProcessCmd( pMac, pCommand );
1087 }
1088 break ;
1089#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001090
1091 default:
1092 //something is wrong
1093 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001094 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001095 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1096 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1097 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1098 smeReleaseCommand( pMac, pCommand );
1099 status = eHAL_STATUS_FAILURE;
1100 break;
1101 }
1102 if(!HAL_STATUS_SUCCESS(status))
1103 {
1104 fContinue = eANI_BOOLEAN_TRUE;
1105 }
1106 }//if(pEntry)
1107 else
1108 {
1109 //This is odd. Some one else pull off the command.
1110 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1111 }
1112 }
1113 else
1114 {
1115 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1116 }
1117 }
1118 else
1119 {
1120 //No command waiting
1121 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1122 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1123 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1124 {
1125 tANI_U32 nTime = 0;
1126
1127 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1128 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1129 {
1130 csrScanStartIdleScanTimer(pMac, nTime);
1131 }
1132 }
1133 }
1134 }
1135 else {
1136 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1137 }
1138
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301139sme_process_scan_queue:
1140 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1141 fContinue = eANI_BOOLEAN_FALSE;
1142
Jeff Johnson295189b2012-06-20 16:38:30 -07001143 return ( fContinue );
1144}
1145
1146void smeProcessPendingQueue( tpAniSirGlobal pMac )
1147{
1148 while( smeProcessCommand( pMac ) );
1149}
1150
1151
1152tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1153{
1154 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1155 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1156}
1157
1158
1159
1160//Global APIs
1161
1162/*--------------------------------------------------------------------------
1163
1164 \brief sme_Open() - Initialze all SME modules and put them at idle state
1165
1166 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1167 successfully return, all modules are at idle state ready to start.
1168
1169 smeOpen must be called before any other SME APIs can be involved.
1170 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001171 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001172 \param hHal - The handle returned by macOpen.
1173
1174 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1175
1176 Other status means SME is failed to be initialized
1177 \sa
1178
1179 --------------------------------------------------------------------------*/
1180eHalStatus sme_Open(tHalHandle hHal)
1181{
1182 eHalStatus status = eHAL_STATUS_FAILURE;
1183 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1184
1185 do {
1186 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001187 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001188 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1189 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001190 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001191 status = eHAL_STATUS_FAILURE;
1192 break;
1193 }
1194
1195 status = ccmOpen(hHal);
1196 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1197 smsLog( pMac, LOGE,
1198 "ccmOpen failed during initialization with status=%d", status );
1199 break;
1200 }
1201
1202 status = csrOpen(pMac);
1203 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1204 smsLog( pMac, LOGE,
1205 "csrOpen failed during initialization with status=%d", status );
1206 break;
1207 }
1208
1209 status = pmcOpen(hHal);
1210 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1211 smsLog( pMac, LOGE,
1212 "pmcOpen failed during initialization with status=%d", status );
1213 break;
1214 }
1215
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001216#ifdef FEATURE_WLAN_TDLS
1217 pMac->isTdlsPowerSaveProhibited = 0;
1218#endif
1219
Jeff Johnson295189b2012-06-20 16:38:30 -07001220#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1221 status = sme_QosOpen(pMac);
1222 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1223 smsLog( pMac, LOGE,
1224 "Qos open failed during initialization with status=%d", status );
1225 break;
1226 }
1227
1228 status = btcOpen(pMac);
1229 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1230 smsLog( pMac, LOGE,
1231 "btcOpen open failed during initialization with status=%d", status );
1232 break;
1233 }
1234#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001235#ifdef FEATURE_OEM_DATA_SUPPORT
1236 status = oemData_OemDataReqOpen(pMac);
1237 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1238 smsLog(pMac, LOGE,
1239 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1240 break;
1241 }
1242#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001243
1244 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1245 break;
1246
Jeff Johnson295189b2012-06-20 16:38:30 -07001247 {
1248 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1249 if ( NULL == pvosGCtx ){
1250 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1251 status = eHAL_STATUS_FAILURE;
1252 break;
1253 }
1254
1255 status = WLANSAP_Open( pvosGCtx );
1256 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1257 smsLog( pMac, LOGE,
1258 "WLANSAP_Open open failed during initialization with status=%d", status );
1259 break;
1260 }
1261 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001262#if defined WLAN_FEATURE_VOWIFI
1263 status = rrmOpen(pMac);
1264 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1265 smsLog( pMac, LOGE,
1266 "rrmOpen open failed during initialization with status=%d", status );
1267 break;
1268 }
1269#endif
1270
1271#if defined WLAN_FEATURE_VOWIFI_11R
1272 sme_FTOpen(pMac);
1273#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001274 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001275 smeTraceInit(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001276
1277 }while (0);
1278
1279 return status;
1280}
1281
Jeff Johnson295189b2012-06-20 16:38:30 -07001282/*--------------------------------------------------------------------------
1283
1284 \brief sme_set11dinfo() - Set the 11d information about valid channels
1285 and there power using information from nvRAM
1286 This function is called only for AP.
1287
Srinivas Girigowdade697412013-02-14 16:31:48 -08001288 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001289
1290 \param hHal - The handle returned by macOpen.
1291 \Param pSmeConfigParams - a pointer to a caller allocated object of
1292 typedef struct _smeConfigParams.
1293
1294 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1295
1296 Other status means SME is failed to update the config parameters.
1297 \sa
1298--------------------------------------------------------------------------*/
1299
1300eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1301{
1302 eHalStatus status = eHAL_STATUS_FAILURE;
1303 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1304
Katya Nigambcb705f2013-12-26 14:26:22 +05301305 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001306 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001307 if (NULL == pSmeConfigParams ) {
1308 smsLog( pMac, LOGE,
1309 "Empty config param structure for SME, nothing to update");
1310 return status;
1311 }
1312
1313 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1314 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001315 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001316 status );
1317 }
1318 return status;
1319}
1320
1321/*--------------------------------------------------------------------------
1322
1323 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1324
Srinivas Girigowdade697412013-02-14 16:31:48 -08001325 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001326
1327 \param hHal - The handle returned by HostapdAdapter.
1328 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1329
1330 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1331
1332 Other status means, failed to get the current regulatory domain.
1333 \sa
1334--------------------------------------------------------------------------*/
1335
1336eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1337{
1338 eHalStatus status = eHAL_STATUS_FAILURE;
1339 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1340
Katya Nigambcb705f2013-12-26 14:26:22 +05301341 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001342 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001343 if (NULL == domainIdSoftAp ) {
1344 smsLog( pMac, LOGE, "Uninitialized domain Id");
1345 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001346 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001347
1348 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1349 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001350
Jeff Johnson295189b2012-06-20 16:38:30 -07001351 return status;
1352}
1353
1354
1355eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1356{
1357 eHalStatus status = eHAL_STATUS_FAILURE;
1358 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1359
Katya Nigambcb705f2013-12-26 14:26:22 +05301360 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001361 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001362 if (NULL == apCntryCode ) {
1363 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1364 return status;
1365 }
1366
1367 status = csrSetRegInfo(hHal, apCntryCode );
1368 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001369 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001370 status );
1371 }
1372 return status;
1373}
1374
Jeff Johnson295189b2012-06-20 16:38:30 -07001375#ifdef FEATURE_WLAN_SCAN_PNO
1376/*--------------------------------------------------------------------------
1377
1378 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001379
1380 It is used at driver start up to inform RIVA of the default channel
1381 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001382
Srinivas Girigowdade697412013-02-14 16:31:48 -08001383 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001384
1385 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001386
Jeff Johnson295189b2012-06-20 16:38:30 -07001387 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1388
1389 Other status means SME is failed to update the channel config.
1390 \sa
1391
1392 --------------------------------------------------------------------------*/
1393eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1394{
1395 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1396
Katya Nigambcb705f2013-12-26 14:26:22 +05301397 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001398 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1399 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 &pMac->scan.base20MHzChannels, FALSE);
1401 return eHAL_STATUS_SUCCESS;
1402}
1403#endif // FEATURE_WLAN_SCAN_PNLO
1404
Abhishek Singhf644b272014-08-21 02:59:39 +05301405eHalStatus sme_UpdateChannelList(tHalHandle hHal)
1406{
1407 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1408 eHalStatus status = eHAL_STATUS_SUCCESS;
1409
1410 status = csrUpdateChannelList(pMac);
1411
1412 if (eHAL_STATUS_SUCCESS != status)
1413 {
1414 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1415 "failed to update the supported channel list");
1416 }
1417 return status;
1418}
1419
Jeff Johnson295189b2012-06-20 16:38:30 -07001420/*--------------------------------------------------------------------------
1421
1422 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1423
1424 The function updates some configuration for modules in SME, CCM, CSR, etc
1425 during SMEs close open sequence.
1426
1427 Modules inside SME apply the new configuration at the next transaction.
1428
Srinivas Girigowdade697412013-02-14 16:31:48 -08001429 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001430
1431 \param hHal - The handle returned by macOpen.
1432 \Param pSmeConfigParams - a pointer to a caller allocated object of
1433 typedef struct _smeConfigParams.
1434
1435 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1436
1437 Other status means SME is failed to update the config parameters.
1438 \sa
1439
1440 --------------------------------------------------------------------------*/
1441eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1442{
1443 eHalStatus status = eHAL_STATUS_FAILURE;
1444 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1445
Katya Nigambcb705f2013-12-26 14:26:22 +05301446 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001447 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001448 if (NULL == pSmeConfigParams ) {
1449 smsLog( pMac, LOGE,
1450 "Empty config param structure for SME, nothing to update");
1451 return status;
1452 }
1453
1454 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1455
1456 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001457 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001458 status );
1459 }
1460#if defined WLAN_FEATURE_P2P_INTERNAL
1461 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1462
1463 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001464 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001465 status );
1466 }
1467#endif
1468#if defined WLAN_FEATURE_VOWIFI
1469 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1470
1471 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001472 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001473 status );
1474 }
1475#endif
1476 //For SOC, CFG is set before start
1477 //We don't want to apply global CFG in connect state because that may cause some side affect
1478 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 csrIsAllSessionDisconnected( pMac) )
1480 {
1481 csrSetGlobalCfgs(pMac);
1482 }
1483
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301484 /* update the directed scan offload setting */
1485 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1486
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301487 if (pMac->fScanOffload)
1488 {
1489 /* If scan offload is enabled then lim has allow the sending of
1490 scan request to firmware even in powersave mode. The firmware has
1491 to take care of exiting from power save mode */
1492 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1493 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1494
1495 if (eHAL_STATUS_SUCCESS != status)
1496 {
1497 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1498 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1499 }
1500 }
krunal sonie9002db2013-11-25 14:24:17 -08001501 pMac->isCoalesingInIBSSAllowed =
1502 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001503 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301504 pMac->fDeferIMPSTime = pSmeConfigParams->fDeferIMPSTime;
Chandrasekaran, Manishekar5cb0acd2014-12-23 20:06:52 +05301505 pMac->fBtcEnableIndTimerVal = pSmeConfigParams->fBtcEnableIndTimerVal;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301506
Jeff Johnson295189b2012-06-20 16:38:30 -07001507 return status;
1508}
1509
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301510#ifdef WLAN_FEATURE_GTK_OFFLOAD
1511void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1512 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1513{
1514 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1515
1516 if (NULL == pMac)
1517 {
1518 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1519 "%s: pMac is null", __func__);
1520 return ;
1521 }
1522 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1523 {
1524 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1525 "%s: HDD callback is null", __func__);
1526 return ;
1527 }
1528 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1529 pGtkOffloadGetInfoRsp);
1530}
1531#endif
1532
Jeff Johnson295189b2012-06-20 16:38:30 -07001533/* ---------------------------------------------------------------------------
1534 \fn sme_ChangeConfigParams
1535 \brief The SME API exposed for HDD to provide config params to SME during
1536 SMEs stop -> start sequence.
1537
1538 If HDD changed the domain that will cause a reset. This function will
1539 provide the new set of 11d information for the new domain. Currrently this
1540 API provides info regarding 11d only at reset but we can extend this for
1541 other params (PMC, QoS) which needs to be initialized again at reset.
1542
Srinivas Girigowdade697412013-02-14 16:31:48 -08001543 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001544
1545 \param hHal - The handle returned by macOpen.
1546
1547 \Param
1548 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1549 currently provides 11d related information like Country code,
1550 Regulatory domain, valid channel list, Tx power per channel, a
1551 list with active/passive scan allowed per valid channel.
1552
1553 \return eHalStatus
1554 ---------------------------------------------------------------------------*/
1555eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1556 tCsrUpdateConfigParam *pUpdateConfigParam)
1557{
1558 eHalStatus status = eHAL_STATUS_FAILURE;
1559 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1560
1561 if (NULL == pUpdateConfigParam ) {
1562 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001563 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001564 return status;
1565 }
1566
1567 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1568
1569 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001570 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001571 status );
1572 }
1573
1574 return status;
1575
1576}
1577
1578/*--------------------------------------------------------------------------
1579
1580 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1581 that the NIC is ready tio run.
1582
1583 The function is called by HDD at the end of initialization stage so PE/HAL can
1584 enable the NIC to running state.
1585
Srinivas Girigowdade697412013-02-14 16:31:48 -08001586 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001587 \param hHal - The handle returned by macOpen.
1588
1589 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1590 successfully.
1591
1592 Other status means SME failed to send the message to PE.
1593 \sa
1594
1595 --------------------------------------------------------------------------*/
1596eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1597{
1598 tSirSmeReadyReq Msg;
1599 eHalStatus status = eHAL_STATUS_FAILURE;
1600 tPmcPowerState powerState;
1601 tPmcSwitchState hwWlanSwitchState;
1602 tPmcSwitchState swWlanSwitchState;
1603 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1604
Katya Nigambcb705f2013-12-26 14:26:22 +05301605 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001606 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001607 do
1608 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001609
1610 Msg.messageType = eWNI_SME_SYS_READY_IND;
1611 Msg.length = sizeof( tSirSmeReadyReq );
1612
1613 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1614 {
1615 status = eHAL_STATUS_SUCCESS;
1616 }
1617 else
1618 {
1619 smsLog( pMac, LOGE,
1620 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1621 break;
1622 }
1623
1624 status = pmcQueryPowerState( hHal, &powerState,
1625 &hwWlanSwitchState, &swWlanSwitchState );
1626 if ( ! HAL_STATUS_SUCCESS( status ) )
1627 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001628 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001629 status );
1630 break;
1631 }
1632
1633 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1634 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1635 {
1636 status = csrReady(pMac);
1637 if ( ! HAL_STATUS_SUCCESS( status ) )
1638 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001639 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001640 break;
1641 }
1642 status = pmcReady(hHal);
1643 if ( ! HAL_STATUS_SUCCESS( status ) )
1644 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001645 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001646 break;
1647 }
1648#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1649 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1650 {
1651 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001652 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001653 break;
1654 }
1655#endif
1656
1657#if defined WLAN_FEATURE_VOWIFI
1658 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1659 {
1660 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001661 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001662 break;
1663 }
1664#endif
1665 }
1666 pMac->sme.state = SME_STATE_READY;
1667 } while( 0 );
1668
1669 return status;
1670}
1671
1672/*--------------------------------------------------------------------------
1673
1674 \brief sme_Start() - Put all SME modules at ready state.
1675
1676 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1677 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001678 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001679 \param hHal - The handle returned by macOpen.
1680
1681 \return eHAL_STATUS_SUCCESS - SME is ready.
1682
1683 Other status means SME is failed to start
1684 \sa
1685
1686 --------------------------------------------------------------------------*/
1687eHalStatus sme_Start(tHalHandle hHal)
1688{
1689 eHalStatus status = eHAL_STATUS_FAILURE;
1690 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1691
1692 do
1693 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 status = csrStart(pMac);
1695 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001696 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001697 status );
1698 break;
1699 }
1700
1701 status = pmcStart(hHal);
1702 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001703 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001704 status );
1705 break;
1706 }
1707
Jeff Johnson295189b2012-06-20 16:38:30 -07001708 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1709 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001710 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001711 status );
1712 break;
1713 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001714 pMac->sme.state = SME_STATE_START;
1715 }while (0);
1716
1717 return status;
1718}
1719
1720
1721#ifdef WLAN_FEATURE_PACKET_FILTERING
1722/******************************************************************************
1723*
1724* Name: sme_PCFilterMatchCountResponseHandler
1725*
1726* Description:
1727* Invoke Packet Coalescing Filter Match Count callback routine
1728*
1729* Parameters:
1730* hHal - HAL handle for device
1731* pMsg - Pointer to tRcvFltPktMatchRsp structure
1732*
1733* Returns: eHalStatus
1734*
1735******************************************************************************/
1736eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1737{
1738 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1739 eHalStatus status = eHAL_STATUS_SUCCESS;
1740 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1741
1742 if (NULL == pMsg)
1743 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001744 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001745 status = eHAL_STATUS_FAILURE;
1746 }
1747 else
1748 {
1749 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001750 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001751
1752 /* Call Packet Coalescing Filter Match Count callback routine. */
1753 if (pMac->pmc.FilterMatchCountCB != NULL)
1754 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1755 pRcvFltPktMatchRsp);
1756
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001757 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001758 pRcvFltPktMatchRsp->status);
1759
1760 pMac->pmc.FilterMatchCountCB = NULL;
1761 pMac->pmc.FilterMatchCountCBContext = NULL;
1762 }
1763
1764 return(status);
1765}
1766#endif // WLAN_FEATURE_PACKET_FILTERING
1767
1768
Chet Lanctot186b5732013-03-18 10:26:30 -07001769#ifdef WLAN_FEATURE_11W
1770/*------------------------------------------------------------------
1771 *
1772 * Handle the unprotected management frame indication from LIM and
1773 * forward it to HDD.
1774 *
1775 *------------------------------------------------------------------*/
1776
1777eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1778 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1779{
1780 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1781 eHalStatus status = eHAL_STATUS_SUCCESS;
1782 tCsrRoamInfo pRoamInfo = {0};
1783 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1784
1785 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1786 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1787 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1788
1789 /* forward the mgmt frame to HDD */
1790 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1791
1792 return status;
1793}
1794#endif
1795
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08001796#ifdef WLAN_FEATURE_AP_HT40_24G
1797/* ---------------------------------------------------------------------------
1798 \fn sme_HT2040CoexInfoInd
1799 \brief a Send 20/40 Coex info to SAP layer
1800
1801 \param tpSirHT2040CoexInfoInd - 20/40 Coex info param
1802 \return eHalStatus
1803 ---------------------------------------------------------------------------*/
1804
1805eHalStatus sme_HT2040CoexInfoInd( tHalHandle hHal,
1806 tpSirHT2040CoexInfoInd pSmeHT2040CoexInfoInd)
1807{
1808 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1809 eHalStatus status = eHAL_STATUS_SUCCESS;
1810 tANI_U32 SessionId = pSmeHT2040CoexInfoInd->sessionId;
1811 tCsrRoamInfo roamInfo = {0};
1812
1813 roamInfo.pSmeHT2040CoexInfoInd = pSmeHT2040CoexInfoInd;
1814
1815 smsLog(pMac, LOGW, FL("HT40MHzIntolerant: %d HT20MHzBssWidthReq: %d"),
1816 roamInfo.pSmeHT2040CoexInfoInd->HT40MHzIntolerant,
1817 roamInfo.pSmeHT2040CoexInfoInd->HT20MHzBssWidthReq);
1818
1819 smsLog(pMac, LOGW, FL("Total Intolerant Channel: %d"),
1820 roamInfo.pSmeHT2040CoexInfoInd->channel_num);
1821
1822 /* forward the 20/40 BSS Coex information to HDD */
1823 smsLog(pMac, LOGW, FL("Sending eCSR_ROAM_2040_COEX_INFO_IND"
1824 " to WLANSAP_RoamCallback "));
1825
1826 csrRoamCallCallback(pMac, SessionId, &roamInfo,
1827 0, eCSR_ROAM_2040_COEX_INFO_IND, 0);
1828 return status;
1829}
1830#endif
1831
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001832#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001833/*------------------------------------------------------------------
1834 *
1835 * Handle the tsm ie indication from LIM and forward it to HDD.
1836 *
1837 *------------------------------------------------------------------*/
1838
1839eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1840{
1841 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1842 eHalStatus status = eHAL_STATUS_SUCCESS;
1843 tCsrRoamInfo pRoamInfo = {0};
1844 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1845
1846 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1847 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1848 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1849
1850 /* forward the tsm ie information to HDD */
1851 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1852
1853 return status;
1854}
1855
1856/* ---------------------------------------------------------------------------
1857 \fn sme_SetCCKMIe
1858 \brief function to store the CCKM IE passed from supplicant and use it while packing
1859 reassociation request
1860 \param hHal - HAL handle for device
1861 \param pCckmIe - pointer to CCKM IE data
1862 \param pCckmIeLen - length of the CCKM IE
1863 \- return Success or failure
1864 -------------------------------------------------------------------------*/
1865eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1866 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1867{
1868 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1869 eHalStatus status = eHAL_STATUS_SUCCESS;
1870
1871 status = sme_AcquireGlobalLock( &pMac->sme );
1872 if ( HAL_STATUS_SUCCESS( status ) )
1873 {
1874 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1875 sme_ReleaseGlobalLock( &pMac->sme );
1876 }
1877 return status;
1878}
1879
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001880/* ---------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001881 \fn sme_SetEseBeaconRequest
1882 \brief function to set Ese beacon request parameters
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001883 \param hHal - HAL handle for device
1884 \param sessionId - Session id
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001885 \param pEseBcnReq - pointer to Ese beacon request
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001886 \- return Success or failure
1887 -------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001888eHalStatus sme_SetEseBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
1889 const tCsrEseBeaconReq* pEseBcnReq)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001890{
1891 eHalStatus status = eSIR_SUCCESS;
1892 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1893 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001894 tCsrEseBeaconReqParams *pBeaconReq = NULL;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001895 tANI_U8 counter = 0;
1896 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
1897 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
1898
1899 /* Store the info in RRM context */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001900 vos_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, sizeof(tCsrEseBeaconReq));
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001901
1902 //Prepare the request to send to SME.
1903 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
1904 if(NULL == pSmeBcnReportReq)
1905 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001906 smsLog(pMac, LOGP, "Memory Allocation Failure!!! Ese BcnReq Ind to SME");
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001907 return eSIR_FAILURE;
1908 }
1909
1910 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
1911 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
1912
1913 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
1914 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
1915 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
1916 pSmeBcnReportReq->channelInfo.channelNum = 255;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001917 pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe;
1918 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001919
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001920 for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001921 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001922 pBeaconReq = (tCsrEseBeaconReqParams *)&pEseBcnReq->bcnReq[counter];
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001923 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
1924 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
1925 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
1926 }
1927
1928 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
1929 return status;
1930}
1931
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001932#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001933
Chet Lanctot186b5732013-03-18 10:26:30 -07001934
c_hpothu92367912014-05-01 15:18:17 +05301935/* ---------------------------------------------------------------------------
1936 \fn sme_getBcnMissRate
1937 \brief function sends 'WDA_GET_BCN_MISS_RATE_REQ' to WDA layer,
1938 \param hHal - HAL handle for device.
1939 \param sessionId - session ID.
1940 \- return Success or Failure.
1941 -------------------------------------------------------------------------*/
1942
1943eHalStatus sme_getBcnMissRate(tHalHandle hHal, tANI_U8 sessionId, void *callback, void *data)
1944{
1945 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1946 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
1947 vos_msg_t vosMessage;
1948 tSirBcnMissRateReq *pMsg;
1949 tCsrRoamSession *pSession;
1950
1951 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
1952 {
1953 pSession = CSR_GET_SESSION( pMac, sessionId );
1954
1955 if (!pSession)
1956 {
1957 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
1958 sme_ReleaseGlobalLock( &pMac->sme );
1959 return eHAL_STATUS_FAILURE;
1960 }
1961
c_hpothu402de812014-07-10 15:55:45 +05301962 pMsg = (tSirBcnMissRateReq *) vos_mem_malloc(sizeof(tSirBcnMissRateReq));
c_hpothu92367912014-05-01 15:18:17 +05301963 if (NULL == pMsg)
1964 {
1965 smsLog(pMac, LOGE, FL("failed to allocated memory"));
1966 sme_ReleaseGlobalLock( &pMac->sme );
1967 return eHAL_STATUS_FAILURE;
1968 }
1969
1970 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
1971 sizeof(tSirMacAddr));
1972
1973 pMsg->msgLen = sizeof(tSirBcnMissRateReq);
1974 pMsg->callback = callback;
1975 pMsg->data = data;
1976
1977 vosMessage.type = WDA_GET_BCN_MISS_RATE_REQ;
1978 vosMessage.bodyptr = pMsg;
1979 vosMessage.reserved = 0;
1980 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
1981 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1982 {
1983 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1984 "%s: Post Set TM Level MSG fail", __func__);
1985 vos_mem_free(pMsg);
1986 sme_ReleaseGlobalLock( &pMac->sme );
1987 return eHAL_STATUS_FAILURE;
1988 }
1989 sme_ReleaseGlobalLock( &pMac->sme);
1990 return eHAL_STATUS_SUCCESS;
1991 }
1992 return eHAL_STATUS_FAILURE;
1993}
1994
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05301995eHalStatus sme_EncryptMsgResponseHandler(tHalHandle hHal,
1996 tpSirEncryptedDataRspParams pEncRspParams)
1997{
1998 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1999
2000 if (NULL == pMac)
2001 {
2002 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
2003 "%s: pMac is null", __func__);
2004 return eHAL_STATUS_FAILURE;
2005 }
2006 if (pMac->sme.pEncMsgInfoParams.pEncMsgCbk == NULL)
2007 {
2008 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2009 "%s: HDD callback is null", __func__);
2010 return eHAL_STATUS_FAILURE;
2011 }
2012 pMac->sme.pEncMsgInfoParams.pEncMsgCbk(pMac->sme.pEncMsgInfoParams.pUserData,
2013 &pEncRspParams->encryptedDataRsp);
2014 return eHAL_STATUS_SUCCESS;
2015}
2016
Girish Gowlia95daca2015-02-04 20:31:31 +05302017eHalStatus sme_UpdateMaxRateInd(tHalHandle hHal,
2018 tSirSmeUpdateMaxRateParams *pSmeUpdateMaxRateParams)
2019{
2020 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2021 eHalStatus status = eHAL_STATUS_SUCCESS;
2022 tANI_U8 sessionId = pSmeUpdateMaxRateParams->smeSessionId;
2023
2024 /* forward the information to HDD */
2025 status = csrRoamCallCallback(pMac, sessionId, NULL, 0,
2026 eCSR_ROAM_UPDATE_MAX_RATE_IND,
2027 pSmeUpdateMaxRateParams->maxRateFlag);
2028 return status;
2029}
2030
Jeff Johnson295189b2012-06-20 16:38:30 -07002031/*--------------------------------------------------------------------------
2032
2033 \brief sme_ProcessMsg() - The main message processor for SME.
2034
2035 The function is called by a message dispatcher when to process a message
2036 targeted for SME.
2037
Srinivas Girigowdade697412013-02-14 16:31:48 -08002038 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002039 \param hHal - The handle returned by macOpen.
2040 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
2041
2042 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
2043
2044 Other status means SME failed to process the message to HAL.
2045 \sa
2046
2047 --------------------------------------------------------------------------*/
2048eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
2049{
2050 eHalStatus status = eHAL_STATUS_FAILURE;
2051 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2052
2053 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002054 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002055 return status;
2056 }
2057
2058 status = sme_AcquireGlobalLock( &pMac->sme );
2059 if ( HAL_STATUS_SUCCESS( status ) )
2060 {
2061 if( SME_IS_START(pMac) )
2062 {
2063 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
2064 case eWNI_PMC_ENTER_BMPS_RSP:
2065 case eWNI_PMC_EXIT_BMPS_RSP:
2066 case eWNI_PMC_EXIT_BMPS_IND:
2067 case eWNI_PMC_ENTER_IMPS_RSP:
2068 case eWNI_PMC_EXIT_IMPS_RSP:
2069 case eWNI_PMC_SMPS_STATE_IND:
2070 case eWNI_PMC_ENTER_UAPSD_RSP:
2071 case eWNI_PMC_EXIT_UAPSD_RSP:
2072 case eWNI_PMC_ENTER_WOWL_RSP:
2073 case eWNI_PMC_EXIT_WOWL_RSP:
2074 //PMC
2075 if (pMsg->bodyptr)
2076 {
2077 pmcMessageProcessor(hHal, pMsg->bodyptr);
2078 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302079 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002080 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002081 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002082 }
2083 break;
2084
2085 case WNI_CFG_SET_CNF:
2086 case WNI_CFG_DNLD_CNF:
2087 case WNI_CFG_GET_RSP:
2088 case WNI_CFG_ADD_GRP_ADDR_CNF:
2089 case WNI_CFG_DEL_GRP_ADDR_CNF:
2090 //CCM
2091 if (pMsg->bodyptr)
2092 {
2093 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
2094 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302095 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002096 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002097 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002098 }
2099 break;
2100
2101 case eWNI_SME_ADDTS_RSP:
2102 case eWNI_SME_DELTS_RSP:
2103 case eWNI_SME_DELTS_IND:
2104#ifdef WLAN_FEATURE_VOWIFI_11R
2105 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002106#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002107 //QoS
2108 if (pMsg->bodyptr)
2109 {
2110#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2111 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302112 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002113#endif
2114 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002115 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002116 }
2117 break;
2118#if defined WLAN_FEATURE_VOWIFI
2119 case eWNI_SME_NEIGHBOR_REPORT_IND:
2120 case eWNI_SME_BEACON_REPORT_REQ_IND:
2121#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002122 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07002123#endif
2124 if ( pMsg->bodyptr )
2125 {
2126 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05302127 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002128 }
2129 else
2130 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002131 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002132 }
2133 break;
2134#endif
2135
Jeff Johnsone7245742012-09-05 17:12:55 -07002136#ifdef FEATURE_OEM_DATA_SUPPORT
2137 //Handle the eWNI_SME_OEM_DATA_RSP:
2138 case eWNI_SME_OEM_DATA_RSP:
2139 if(pMsg->bodyptr)
2140 {
2141 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
2142 vos_mem_free(pMsg->bodyptr);
2143 }
2144 else
2145 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002146 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07002147 }
2148 smeProcessPendingQueue( pMac );
2149 break;
2150#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002151
2152 case eWNI_SME_ADD_STA_SELF_RSP:
2153 if(pMsg->bodyptr)
2154 {
2155 status = csrProcessAddStaSessionRsp(pMac, pMsg->bodyptr);
2156 vos_mem_free(pMsg->bodyptr);
2157 }
2158 else
2159 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002160 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002161 }
2162 break;
2163 case eWNI_SME_DEL_STA_SELF_RSP:
2164 if(pMsg->bodyptr)
2165 {
2166 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
2167 vos_mem_free(pMsg->bodyptr);
2168 }
2169 else
2170 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002171 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002172 }
2173 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002174 case eWNI_SME_REMAIN_ON_CHN_RSP:
2175 if(pMsg->bodyptr)
2176 {
2177 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
2178 vos_mem_free(pMsg->bodyptr);
2179 }
2180 else
2181 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002182 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002183 }
2184 break;
2185 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
2186 if(pMsg->bodyptr)
2187 {
2188 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
2189 vos_mem_free(pMsg->bodyptr);
2190 }
2191 else
2192 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002193 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 -07002194 }
2195 break;
2196 case eWNI_SME_MGMT_FRM_IND:
2197 if(pMsg->bodyptr)
2198 {
2199 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
2200 vos_mem_free(pMsg->bodyptr);
2201 }
2202 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002203 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002204 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002205 }
2206 break;
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002207#ifdef WLAN_FEATURE_AP_HT40_24G
2208 case eWNI_SME_2040_COEX_IND:
2209 if(pMsg->bodyptr)
2210 {
2211 sme_HT2040CoexInfoInd(pMac, pMsg->bodyptr);
2212 vos_mem_free(pMsg->bodyptr);
2213 }
2214 else
2215 {
2216 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_2040_COEX_IND), nothing to process");
2217 }
2218 break;
2219#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 case eWNI_SME_ACTION_FRAME_SEND_CNF:
2221 if(pMsg->bodyptr)
2222 {
2223 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
2224 vos_mem_free(pMsg->bodyptr);
2225 }
2226 else
2227 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002228 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002229 }
2230 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 case eWNI_SME_COEX_IND:
2232 if(pMsg->bodyptr)
2233 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302234 tSirSmeCoexInd *pSmeCoexInd = (tSirSmeCoexInd *)pMsg->bodyptr;
2235
2236 if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4)
2237 {
2238 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4"));
2239 sme_RequestFullPower(hHal, NULL, NULL, eSME_REASON_OTHER);
2240 pMac->isCoexScoIndSet = 1;
2241 }
2242 else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4)
2243 {
2244 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4"));
2245 pMac->isCoexScoIndSet = 0;
2246 sme_RequestBmps(hHal, NULL, NULL);
2247 }
2248
Jeff Johnson295189b2012-06-20 16:38:30 -07002249 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
2250 vos_mem_free(pMsg->bodyptr);
2251 }
2252 else
2253 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002254 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002255 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002256 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002257
2258#ifdef FEATURE_WLAN_SCAN_PNO
2259 case eWNI_SME_PREF_NETWORK_FOUND_IND:
2260 if(pMsg->bodyptr)
2261 {
2262 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2263 vos_mem_free(pMsg->bodyptr);
2264 }
2265 else
2266 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002267 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002268 }
2269 break;
2270#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002271
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 case eWNI_SME_TX_PER_HIT_IND:
2273 if (pMac->sme.pTxPerHitCallback)
2274 {
2275 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2276 }
2277 break;
2278
2279 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002280 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002281 {
2282 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2283 vos_mem_free(pMsg->bodyptr);
2284 }
2285 else
2286 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002287 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2288 }
2289 break;
2290
2291 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2292 if (pMsg->bodyptr)
2293 {
2294 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2295 vos_mem_free(pMsg->bodyptr);
2296 }
2297 else
2298 {
2299 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 }
2301 break;
2302
2303#ifdef WLAN_FEATURE_PACKET_FILTERING
2304 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2305 if(pMsg->bodyptr)
2306 {
2307 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2308 vos_mem_free(pMsg->bodyptr);
2309 }
2310 else
2311 {
2312 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002313 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002314 }
2315 break;
2316#endif // WLAN_FEATURE_PACKET_FILTERING
2317 case eWNI_SME_PRE_SWITCH_CHL_IND:
2318 {
2319 status = sme_HandlePreChannelSwitchInd(pMac);
2320 break;
2321 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002322
Jeff Johnson295189b2012-06-20 16:38:30 -07002323 case eWNI_SME_POST_SWITCH_CHL_IND:
2324 {
2325 status = sme_HandlePostChannelSwitchInd(pMac);
2326 break;
2327 }
2328
2329#ifdef WLAN_WAKEUP_EVENTS
2330 case eWNI_SME_WAKE_REASON_IND:
2331 if(pMsg->bodyptr)
2332 {
2333 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2334 vos_mem_free(pMsg->bodyptr);
2335 }
2336 else
2337 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002338 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002339 }
2340 break;
2341#endif // WLAN_WAKEUP_EVENTS
2342
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002343#ifdef FEATURE_WLAN_TDLS
2344 /*
2345 * command rescived from PE, SME tdls msg processor shall be called
2346 * to process commands recieved from PE
2347 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002348 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2349 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002350 case eWNI_SME_TDLS_DEL_STA_RSP:
2351 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002352 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002353 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302354 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Atul Mittal60bd4292014-08-14 12:19:27 +05302355 case eWNI_SME_TDLS_CHANNEL_SWITCH_RSP:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002356#ifdef FEATURE_WLAN_TDLS_INTERNAL
2357 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
2358 case eWNI_SME_TDLS_DISCOVERY_START_IND:
2359 case eWNI_SME_TDLS_LINK_START_RSP:
2360 case eWNI_SME_TDLS_LINK_START_IND:
2361 case eWNI_SME_TDLS_TEARDOWN_RSP:
2362 case eWNI_SME_TDLS_TEARDOWN_IND:
2363 case eWNI_SME_ADD_TDLS_PEER_IND:
2364 case eWNI_SME_DELETE_TDLS_PEER_IND:
2365#endif
2366 {
2367 if (pMsg->bodyptr)
2368 {
2369 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302370 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002371 }
2372 else
2373 {
2374 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002375 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002376 }
2377 break;
2378 }
2379#endif
2380
Chet Lanctot186b5732013-03-18 10:26:30 -07002381#ifdef WLAN_FEATURE_11W
2382 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2383 if (pMsg->bodyptr)
2384 {
2385 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2386 vos_mem_free(pMsg->bodyptr);
2387 }
2388 else
2389 {
2390 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2391 }
2392 break;
2393#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002394#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002395 case eWNI_SME_TSM_IE_IND:
2396 {
2397 if (pMsg->bodyptr)
2398 {
2399 sme_TsmIeInd(pMac, pMsg->bodyptr);
2400 vos_mem_free(pMsg->bodyptr);
2401 }
2402 else
2403 {
2404 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2405 }
2406 break;
2407 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002408#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002409#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2410 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2411 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2412 break;
2413#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002414
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302415#ifdef WLAN_FEATURE_GTK_OFFLOAD
2416 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2417 if (pMsg->bodyptr)
2418 {
2419 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302420 vos_mem_zero(pMsg->bodyptr,
2421 sizeof(tSirGtkOffloadGetInfoRspParams));
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302422 vos_mem_free(pMsg->bodyptr);
2423 }
2424 else
2425 {
2426 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2427 }
2428 break ;
2429#endif
Leo Chang9056f462013-08-01 19:21:11 -07002430
2431#ifdef FEATURE_WLAN_LPHB
2432 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002433 case eWNI_SME_LPHB_IND:
2434 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002435 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002436 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002437 }
2438 vos_mem_free(pMsg->bodyptr);
2439
2440 break;
2441#endif /* FEATURE_WLAN_LPHB */
2442
Leo Chang0b0e45a2013-12-15 15:18:55 -08002443#ifdef FEATURE_WLAN_CH_AVOID
2444 /* LPHB timeout indication arrived, send IND to client */
2445 case eWNI_SME_CH_AVOID_IND:
2446 if (pMac->sme.pChAvoidNotificationCb)
2447 {
2448 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2449 "%s: CH avoid notification", __func__);
2450 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2451 }
2452 vos_mem_free(pMsg->bodyptr);
2453
2454 break;
2455#endif /* FEATURE_WLAN_CH_AVOID */
2456
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302457 case eWNI_SME_ENCRYPT_MSG_RSP:
2458 if (pMsg->bodyptr)
2459 {
2460 sme_EncryptMsgResponseHandler(pMac, pMsg->bodyptr);
2461 vos_mem_free(pMsg->bodyptr);
2462 }
2463 else
2464 {
2465 smsLog(pMac, LOGE,
2466 "Empty rsp message for (eWNI_SME_ENCRYPT_MSG_RSP),"
2467 " nothing to process");
2468 }
2469 break ;
2470
Girish Gowlia95daca2015-02-04 20:31:31 +05302471 case eWNI_SME_UPDATE_MAX_RATE_IND:
2472 if (pMsg->bodyptr)
2473 {
2474 sme_UpdateMaxRateInd(pMac, pMsg->bodyptr);
2475 vos_mem_free(pMsg->bodyptr);
2476 }
2477 else
2478 {
2479 smsLog(pMac, LOGE,
2480 "Empty message for (eWNI_SME_UPDATE_MAX_RATE_IND),"
2481 " nothing to process");
2482 }
2483 break;
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302484
Jeff Johnson295189b2012-06-20 16:38:30 -07002485 default:
2486
2487 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2488 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2489 {
2490 //CSR
2491 if (pMsg->bodyptr)
2492 {
2493 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302494 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002495 }
2496 else
2497 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002498 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002499 }
2500 }
2501 else
2502 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002503 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002504 pMsg->type);
2505 if (pMsg->bodyptr)
2506 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302507 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002508 }
2509 }
2510 }//switch
2511 } //SME_IS_START
2512 else
2513 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002514 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002515 if (pMsg->bodyptr)
2516 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302517 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002518 }
2519 }
2520 sme_ReleaseGlobalLock( &pMac->sme );
2521 }
2522 else
2523 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002524 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002525 if (pMsg->bodyptr)
2526 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302527 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002528 }
2529 }
2530
2531 return status;
2532}
2533
2534
2535//No need to hold the global lock here because this function can only be called
2536//after sme_Stop.
2537v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2538{
2539 if( pMsg )
2540 {
2541 if (pMsg->bodyptr)
2542 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302543 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002544 }
2545 }
2546
2547}
2548
2549
2550/*--------------------------------------------------------------------------
2551
2552 \brief sme_Stop() - Stop all SME modules and put them at idle state
2553
2554 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2555 return, all modules are at idle state ready to start.
2556
Srinivas Girigowdade697412013-02-14 16:31:48 -08002557 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002558 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302559 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002560
2561 \return eHAL_STATUS_SUCCESS - SME is stopped.
2562
2563 Other status means SME is failed to stop but caller should still
2564 consider SME is stopped.
2565 \sa
2566
2567 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302568eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002569{
2570 eHalStatus status = eHAL_STATUS_FAILURE;
2571 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2572 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2573
Jeff Johnson295189b2012-06-20 16:38:30 -07002574 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2575 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002576 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002577 status );
2578 fail_status = status;
2579 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002580
2581 p2pStop(hHal);
2582
Kiet Lama72a2322013-11-15 11:18:11 +05302583 status = pmcStop(hHal);
2584 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2585 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2586 status );
2587 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002588 }
2589
Kiet Lama72a2322013-11-15 11:18:11 +05302590 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002591 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002592 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002593 status );
2594 fail_status = status;
2595 }
2596
2597 ccmStop(hHal);
2598
2599 purgeSmeCmdList(pMac);
2600
2601 if (!HAL_STATUS_SUCCESS( fail_status )) {
2602 status = fail_status;
2603 }
2604
2605 pMac->sme.state = SME_STATE_STOP;
2606
2607 return status;
2608}
2609
2610/*--------------------------------------------------------------------------
2611
2612 \brief sme_Close() - Release all SME modules and their resources.
2613
2614 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2615 return, all modules are at closed state.
2616
2617 No SME APIs can be involved after smeClose except smeOpen.
2618 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002619 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002620 \param hHal - The handle returned by macOpen
2621
2622 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2623
2624 Other status means SME is failed to be closed but caller still cannot
2625 call any other SME functions except smeOpen.
2626 \sa
2627
2628 --------------------------------------------------------------------------*/
2629eHalStatus sme_Close(tHalHandle hHal)
2630{
2631 eHalStatus status = eHAL_STATUS_FAILURE;
2632 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2633 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2634
2635 status = csrClose(pMac);
2636 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002637 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002638 status );
2639 fail_status = status;
2640 }
2641
Jeff Johnson295189b2012-06-20 16:38:30 -07002642 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2643 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002644 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002645 status );
2646 fail_status = status;
2647 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002648
2649#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2650 status = btcClose(hHal);
2651 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002652 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002653 status );
2654 fail_status = status;
2655 }
2656
2657 status = sme_QosClose(pMac);
2658 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002659 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002660 status );
2661 fail_status = status;
2662 }
2663#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002664#ifdef FEATURE_OEM_DATA_SUPPORT
2665 status = oemData_OemDataReqClose(hHal);
2666 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002667 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002668 status );
2669 fail_status = status;
2670 }
2671#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002672
2673 status = ccmClose(hHal);
2674 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002675 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002676 status );
2677 fail_status = status;
2678 }
2679
2680 status = pmcClose(hHal);
2681 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002682 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002683 status );
2684 fail_status = status;
2685 }
2686#if defined WLAN_FEATURE_VOWIFI
2687 status = rrmClose(hHal);
2688 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002689 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002690 status );
2691 fail_status = status;
2692 }
2693#endif
2694
2695#if defined WLAN_FEATURE_VOWIFI_11R
2696 sme_FTClose(hHal);
2697#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002698 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002699
2700 freeSmeCmdList(pMac);
2701
2702 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2703 {
2704 fail_status = eHAL_STATUS_FAILURE;
2705 }
2706
2707 if (!HAL_STATUS_SUCCESS( fail_status )) {
2708 status = fail_status;
2709 }
2710
2711 pMac->sme.state = SME_STATE_STOP;
2712
2713 return status;
2714}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002715#ifdef FEATURE_WLAN_LFR
2716tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2717{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002718#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002719 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2720 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2721 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2722 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2723 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2724 return eANI_BOOLEAN_FALSE;
2725 default:
2726 return eANI_BOOLEAN_TRUE;
2727 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002728#else
2729 /*
2730 * TODO: always return TRUE for now until
2731 * we figure out why we could be stuck in
2732 * one of the roaming states forever.
2733 */
2734 return eANI_BOOLEAN_TRUE;
2735#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002736}
2737#endif
c_hpothu58901462014-11-01 16:44:34 +05302738
2739/* ---------------------------------------------------------------------------
2740 \fn sco_isScanAllowed
2741 \brief check for scan interface connection status
2742 \param pMac - Pointer to the global MAC parameter structure
2743 \param pScanReq - scan request structure.
2744
2745 \return tANI_BOOLEAN TRUE to allow scan otherwise FALSE
2746 ---------------------------------------------------------------------------*/
2747tANI_BOOLEAN sco_isScanAllowed(tpAniSirGlobal pMac, tCsrScanRequest *pscanReq)
2748{
2749 tANI_BOOLEAN ret;
2750
2751 if (pscanReq->p2pSearch)
2752 ret = csrIsP2pSessionConnected(pMac);
2753 else
2754 ret = csrIsStaSessionConnected(pMac);
2755
2756 return !ret;
2757}
2758
Jeff Johnson295189b2012-06-20 16:38:30 -07002759/* ---------------------------------------------------------------------------
2760 \fn sme_ScanRequest
2761 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002762 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002763 \param pScanRequestID - pointer to an object to get back the request ID
2764 \param callback - a callback function that scan calls upon finish, will not
2765 be called if csrScanRequest returns error
2766 \param pContext - a pointer passed in for the callback
2767 \return eHalStatus
2768 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002769eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2770 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002771 csrScanCompleteCallback callback, void *pContext)
2772{
2773 eHalStatus status = eHAL_STATUS_FAILURE;
2774 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05302775 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002776 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002777 smsLog(pMac, LOG2, FL("enter"));
2778 do
2779 {
c_hpothu304c0522014-09-30 10:22:57 +05302780 if(pMac->scan.fScanEnable &&
c_hpothu58901462014-11-01 16:44:34 +05302781 (pMac->isCoexScoIndSet ? sco_isScanAllowed(pMac, pscanReq) : TRUE))
Jeff Johnson295189b2012-06-20 16:38:30 -07002782 {
2783 status = sme_AcquireGlobalLock( &pMac->sme );
2784 if ( HAL_STATUS_SUCCESS( status ) )
2785 {
2786 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002787#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002788 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002789 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002790#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002791 status = csrScanRequest( hHal, sessionId, pscanReq,
2792 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05302793 if ( !HAL_STATUS_SUCCESS( status ) )
2794 {
2795 smsLog(pMac, LOGE, FL("csrScanRequest failed"
2796 " SId=%d"), sessionId);
2797 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002798#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002799 }
2800 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002801 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302802 smsLog(pMac, LOGE, FL("Scan denied in state %s"
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302803 "(sub-state %s)"),
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302804 macTraceGetNeighbourRoamState(
2805 pMac->roam.neighborRoamInfo.neighborRoamState),
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302806 macTraceGetcsrRoamSubState(
2807 pMac->roam.curSubState[sessionId]));
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002808 /*HandOff is in progress. So schedule this scan later*/
2809 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002810 }
2811#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002812 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002813
Jeff Johnson295189b2012-06-20 16:38:30 -07002814 sme_ReleaseGlobalLock( &pMac->sme );
2815 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002816 else
2817 {
2818 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2819 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002820 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002821 else
2822 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302823 smsLog(pMac, LOGE, FL("fScanEnable %d isCoexScoIndSet: %d "),
2824 pMac->scan.fScanEnable, pMac->isCoexScoIndSet);
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002825 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002826 } while( 0 );
2827
2828 return (status);
2829
2830
2831}
2832
2833/* ---------------------------------------------------------------------------
2834 \fn sme_ScanGetResult
2835 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002836 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002837 \param pFilter - If pFilter is NULL, all cached results are returned
2838 \param phResult - an object for the result.
2839 \return eHalStatus
2840 ---------------------------------------------------------------------------*/
2841eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2842 tScanResultHandle *phResult)
2843{
2844 eHalStatus status = eHAL_STATUS_FAILURE;
2845 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2846
Katya Nigambcb705f2013-12-26 14:26:22 +05302847 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002848 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002849 smsLog(pMac, LOG2, FL("enter"));
2850 status = sme_AcquireGlobalLock( &pMac->sme );
2851 if ( HAL_STATUS_SUCCESS( status ) )
2852 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002853 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002854 sme_ReleaseGlobalLock( &pMac->sme );
2855 }
2856 smsLog(pMac, LOG2, FL("exit status %d"), status);
2857
2858 return (status);
2859}
2860
2861
2862/* ---------------------------------------------------------------------------
2863 \fn sme_ScanFlushResult
2864 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002865 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002866 \return eHalStatus
2867 ---------------------------------------------------------------------------*/
2868eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2869{
2870 eHalStatus status = eHAL_STATUS_FAILURE;
2871 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2872
Katya Nigambcb705f2013-12-26 14:26:22 +05302873 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002874 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002875 status = sme_AcquireGlobalLock( &pMac->sme );
2876 if ( HAL_STATUS_SUCCESS( status ) )
2877 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002878 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002879 sme_ReleaseGlobalLock( &pMac->sme );
2880 }
2881
2882 return (status);
2883}
2884
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05302885/* ---------------------------------------------------------------------------
2886 \fn sme_FilterScanResults
2887 \brief a wrapper function to request CSR to clear scan results.
2888 This is a synchronous call
2889 \return eHalStatus
2890 ---------------------------------------------------------------------------*/
2891eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
2892{
2893 eHalStatus status = eHAL_STATUS_SUCCESS;
2894 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2895
2896 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2897 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
2898 status = sme_AcquireGlobalLock( &pMac->sme );
2899 if ( HAL_STATUS_SUCCESS( status ) )
2900 {
2901 csrScanFilterResults(pMac);
2902 sme_ReleaseGlobalLock( &pMac->sme );
2903 }
2904
2905 return (status);
2906}
2907
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002908eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2909{
2910 eHalStatus status = eHAL_STATUS_FAILURE;
2911 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2912
Katya Nigambcb705f2013-12-26 14:26:22 +05302913 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002914 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002915 status = sme_AcquireGlobalLock( &pMac->sme );
2916 if ( HAL_STATUS_SUCCESS( status ) )
2917 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302918 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002919 sme_ReleaseGlobalLock( &pMac->sme );
2920 }
2921
2922 return (status);
2923}
Jeff Johnson295189b2012-06-20 16:38:30 -07002924
2925/* ---------------------------------------------------------------------------
2926 \fn sme_ScanResultGetFirst
2927 \brief a wrapper function to request CSR to returns the first element of
2928 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002929 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002930 \param hScanResult - returned from csrScanGetResult
2931 \return tCsrScanResultInfo * - NULL if no result
2932 ---------------------------------------------------------------------------*/
2933tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2934 tScanResultHandle hScanResult)
2935{
2936 eHalStatus status = eHAL_STATUS_FAILURE;
2937 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2938 tCsrScanResultInfo *pRet = NULL;
2939
Katya Nigambcb705f2013-12-26 14:26:22 +05302940 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002941 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002942 status = sme_AcquireGlobalLock( &pMac->sme );
2943 if ( HAL_STATUS_SUCCESS( status ) )
2944 {
2945 pRet = csrScanResultGetFirst( pMac, hScanResult );
2946 sme_ReleaseGlobalLock( &pMac->sme );
2947 }
2948
2949 return (pRet);
2950}
2951
2952
2953/* ---------------------------------------------------------------------------
2954 \fn sme_ScanResultGetNext
2955 \brief a wrapper function to request CSR to returns the next element of
2956 scan result. It can be called without calling csrScanResultGetFirst
2957 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002958 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002959 \param hScanResult - returned from csrScanGetResult
2960 \return Null if no result or reach the end
2961 ---------------------------------------------------------------------------*/
2962tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2963 tScanResultHandle hScanResult)
2964{
2965 eHalStatus status = eHAL_STATUS_FAILURE;
2966 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2967 tCsrScanResultInfo *pRet = NULL;
2968
Katya Nigambcb705f2013-12-26 14:26:22 +05302969 MTRACE(vos_trace(VOS_MODULE_ID_SME ,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002970 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002971 status = sme_AcquireGlobalLock( &pMac->sme );
2972 if ( HAL_STATUS_SUCCESS( status ) )
2973 {
2974 pRet = csrScanResultGetNext( pMac, hScanResult );
2975 sme_ReleaseGlobalLock( &pMac->sme );
2976 }
2977
2978 return (pRet);
2979}
2980
2981
2982/* ---------------------------------------------------------------------------
2983 \fn sme_ScanSetBGScanparams
2984 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002985 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002986 \param pScanReq - BG scan request structure
2987 \return eHalStatus
2988 ---------------------------------------------------------------------------*/
2989eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2990{
2991 eHalStatus status = eHAL_STATUS_FAILURE;
2992 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2993
2994 if( NULL != pScanReq )
2995 {
2996 status = sme_AcquireGlobalLock( &pMac->sme );
2997 if ( HAL_STATUS_SUCCESS( status ) )
2998 {
2999 status = csrScanSetBGScanparams( hHal, pScanReq );
3000 sme_ReleaseGlobalLock( &pMac->sme );
3001 }
3002 }
3003
3004 return (status);
3005}
3006
3007
3008/* ---------------------------------------------------------------------------
3009 \fn sme_ScanResultPurge
3010 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
3011 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08003012 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003013 \param hScanResult - returned from csrScanGetResult. hScanResult is
3014 considered gone by
3015 calling this function and even before this function reutrns.
3016 \return eHalStatus
3017 ---------------------------------------------------------------------------*/
3018eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
3019{
3020 eHalStatus status = eHAL_STATUS_FAILURE;
3021 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3022
Katya Nigambcb705f2013-12-26 14:26:22 +05303023 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003024 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003025 status = sme_AcquireGlobalLock( &pMac->sme );
3026 if ( HAL_STATUS_SUCCESS( status ) )
3027 {
3028 status = csrScanResultPurge( hHal, hScanResult );
3029 sme_ReleaseGlobalLock( &pMac->sme );
3030 }
3031
3032 return (status);
3033}
3034
3035/* ---------------------------------------------------------------------------
3036 \fn sme_ScanGetPMKIDCandidateList
3037 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003038 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003039 \param pPmkidList - caller allocated buffer point to an array of
3040 tPmkidCandidateInfo
3041 \param pNumItems - pointer to a variable that has the number of
3042 tPmkidCandidateInfo allocated when retruning, this is
3043 either the number needed or number of items put into
3044 pPmkidList
3045 \return eHalStatus - when fail, it usually means the buffer allocated is not
3046 big enough and pNumItems
3047 has the number of tPmkidCandidateInfo.
3048 \Note: pNumItems is a number of tPmkidCandidateInfo,
3049 not sizeof(tPmkidCandidateInfo) * something
3050 ---------------------------------------------------------------------------*/
3051eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003052 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07003053 tANI_U32 *pNumItems )
3054{
3055 eHalStatus status = eHAL_STATUS_FAILURE;
3056 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3057
3058 status = sme_AcquireGlobalLock( &pMac->sme );
3059 if ( HAL_STATUS_SUCCESS( status ) )
3060 {
3061 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
3062 sme_ReleaseGlobalLock( &pMac->sme );
3063 }
3064
3065 return (status);
3066}
3067
3068/*----------------------------------------------------------------------------
3069 \fn sme_RoamRegisterLinkQualityIndCallback
3070
3071 \brief
3072 a wrapper function to allow HDD to register a callback handler with CSR for
3073 link quality indications.
3074
3075 Only one callback may be registered at any time.
3076 In order to deregister the callback, a NULL cback may be provided.
3077
3078 Registration happens in the task context of the caller.
3079
3080 \param callback - Call back being registered
3081 \param pContext - user data
3082
3083 DEPENDENCIES: After CSR open
3084
3085 \return eHalStatus
3086-----------------------------------------------------------------------------*/
3087eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
3088 csrRoamLinkQualityIndCallback callback,
3089 void *pContext)
3090{
3091 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
3092}
3093
3094/* ---------------------------------------------------------------------------
3095 \fn sme_RoamRegisterCallback
3096 \brief a wrapper function to allow HDD to register a callback with CSR.
3097 Unlike scan, roam has one callback for all the roam requests
3098 \param callback - a callback function that roam calls upon when state changes
3099 \param pContext - a pointer passed in for the callback
3100 \return eHalStatus
3101 ---------------------------------------------------------------------------*/
3102eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
3103 csrRoamCompleteCallback callback,
3104 void *pContext)
3105{
3106 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
3107}
3108
3109eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
3110{
3111 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3112 return pMac->roam.configParam.phyMode;
3113}
3114
3115/* ---------------------------------------------------------------------------
Peng Xu117eab42014-09-25 13:33:27 +05303116 \fn sme_GetChannelBondingMode5G
3117 \brief get the channel bonding mode for 5G band
3118 \param hHal - HAL handle
3119 \return channel bonding mode for 5G
3120 ---------------------------------------------------------------------------*/
3121tANI_U32 sme_GetChannelBondingMode5G(tHalHandle hHal)
3122{
3123 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3124 tSmeConfigParams smeConfig;
3125
3126 sme_GetConfigParam(pMac, &smeConfig);
3127
3128 return smeConfig.csrConfig.channelBondingMode5GHz;
3129}
3130
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303131#ifdef WLAN_FEATURE_AP_HT40_24G
Peng Xu117eab42014-09-25 13:33:27 +05303132/* ---------------------------------------------------------------------------
3133 \fn sme_GetChannelBondingMode24G
3134 \brief get the channel bonding mode for 2.4G band
3135 \param hHal - HAL handle
3136 \return channel bonding mode for 2.4G
3137 ---------------------------------------------------------------------------*/
3138tANI_U32 sme_GetChannelBondingMode24G(tHalHandle hHal)
3139{
3140 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3141 tSmeConfigParams smeConfig;
3142
3143 sme_GetConfigParam(pMac, &smeConfig);
3144
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303145 return smeConfig.csrConfig.channelBondingAPMode24GHz;
Peng Xu117eab42014-09-25 13:33:27 +05303146}
3147
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303148/* ---------------------------------------------------------------------------
3149 \fn sme_UpdateChannelBondingMode24G
3150 \brief update the channel bonding mode for 2.4G band
3151 \param hHal - HAL handle
3152 \param cbMode - channel bonding mode
3153 \return
3154 ---------------------------------------------------------------------------*/
3155void sme_UpdateChannelBondingMode24G(tHalHandle hHal, tANI_U8 cbMode)
3156{
3157 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3158 tSmeConfigParams smeConfig;
3159
3160 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
3161 sme_GetConfigParam(pMac, &smeConfig);
3162 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3163 FL("Previous Channel Bonding : = %d"),
3164 smeConfig.csrConfig.channelBondingAPMode24GHz);
3165
3166 smeConfig.csrConfig.channelBondingAPMode24GHz = cbMode;
3167 sme_UpdateConfig(hHal, &smeConfig);
3168 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3169 FL("New Channel Bonding : = %d"),
3170 sme_GetChannelBondingMode24G(hHal));
3171 return;
3172}
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05303173
3174/* ---------------------------------------------------------------------------
3175
3176 \fn sme_SetHT2040Mode
3177
3178 \brief To update HT Operation beacon IE & Channel Bonding.
3179
3180 \param
3181
3182 \return eHalStatus SUCCESS
3183 FAILURE or RESOURCES
3184 The API finished and failed.
3185
3186 -------------------------------------------------------------------------------*/
3187eHalStatus sme_SetHT2040Mode(tHalHandle hHal, tANI_U8 sessionId, tANI_U8 cbMode)
3188{
3189 eHalStatus status = eHAL_STATUS_FAILURE;
3190 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3191
3192 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3193 FL("Channel Bonding =%d"),
3194 cbMode);
3195
3196 status = sme_AcquireGlobalLock(&pMac->sme);
3197 if (HAL_STATUS_SUCCESS(status))
3198 {
3199 status = csrSetHT2040Mode(pMac, sessionId, cbMode);
3200 sme_ReleaseGlobalLock(&pMac->sme );
3201 }
3202 return (status);
3203}
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303204#endif
Peng Xu117eab42014-09-25 13:33:27 +05303205
3206/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003207 \fn sme_RoamConnect
3208 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08003209 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003210 \param sessionId - the sessionId returned by sme_OpenSession.
3211 \param pProfile - description of the network to which to connect
3212 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
3213 from csrScanGetResult
3214 \param pRoamId - to get back the request ID
3215 \return eHalStatus
3216 ---------------------------------------------------------------------------*/
3217eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3218 tANI_U32 *pRoamId)
3219{
3220 eHalStatus status = eHAL_STATUS_FAILURE;
3221 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3222
Yue Mae36e3552014-03-05 17:06:20 -08003223 if (!pMac)
3224 {
3225 return eHAL_STATUS_FAILURE;
3226 }
3227
Katya Nigambcb705f2013-12-26 14:26:22 +05303228 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003229 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003230 smsLog(pMac, LOG2, FL("enter"));
3231 status = sme_AcquireGlobalLock( &pMac->sme );
3232 if ( HAL_STATUS_SUCCESS( status ) )
3233 {
3234 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3235 {
3236 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
3237 }
3238 else
3239 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003240 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003241 status = eHAL_STATUS_INVALID_PARAMETER;
3242 }
3243 sme_ReleaseGlobalLock( &pMac->sme );
3244 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003245 else
3246 {
3247 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
3248 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003249
3250 return (status);
3251}
3252
3253/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05303254
3255 \fn sme_SetPhyMode
3256
3257 \brief Changes the PhyMode.
3258
3259 \param hHal - The handle returned by macOpen.
3260
3261 \param phyMode new phyMode which is to set
3262
3263 \return eHalStatus SUCCESS.
3264
3265 -------------------------------------------------------------------------------*/
3266eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
3267{
3268 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3269
3270 if (NULL == pMac)
3271 {
3272 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3273 "%s: invalid context", __func__);
3274 return eHAL_STATUS_FAILURE;
3275 }
3276
3277 pMac->roam.configParam.phyMode = phyMode;
3278 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
3279 pMac->roam.configParam.phyMode,
3280 pMac->roam.configParam.ProprietaryRatesEnabled);
3281
3282 return eHAL_STATUS_SUCCESS;
3283}
3284
3285/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003286 \fn sme_RoamReassoc
3287 \brief a wrapper function to request CSR to inititiate a re-association
3288 \param pProfile - can be NULL to join the currently connected AP. In that
3289 case modProfileFields should carry the modified field(s) which could trigger
3290 reassoc
3291 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
3292 that might need modification dynamically once STA is up & running and this
3293 could trigger a reassoc
3294 \param pRoamId - to get back the request ID
3295 \return eHalStatus
3296 -------------------------------------------------------------------------------*/
3297eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3298 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003299 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07003300{
3301 eHalStatus status = eHAL_STATUS_FAILURE;
3302 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3303
Katya Nigambcb705f2013-12-26 14:26:22 +05303304 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003305 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003306 smsLog(pMac, LOG2, FL("enter"));
3307 status = sme_AcquireGlobalLock( &pMac->sme );
3308 if ( HAL_STATUS_SUCCESS( status ) )
3309 {
3310 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3311 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003312 if((NULL == pProfile) && (fForce == 1))
3313 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07003314 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
3315 /* to force the AP initiate fresh 802.1x authentication need to clear
3316 * the PMKID cache for that set the following boolean. this is needed
3317 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
3318 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003319 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
3320 }
3321 else
3322 {
3323 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003324 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003325 }
3326 else
3327 {
3328 status = eHAL_STATUS_INVALID_PARAMETER;
3329 }
3330 sme_ReleaseGlobalLock( &pMac->sme );
3331 }
3332
3333 return (status);
3334}
3335
3336/* ---------------------------------------------------------------------------
3337 \fn sme_RoamConnectToLastProfile
3338 \brief a wrapper function to request CSR to disconnect and reconnect with
3339 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08003340 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003341 \return eHalStatus. It returns fail if currently connected
3342 ---------------------------------------------------------------------------*/
3343eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
3344{
3345 eHalStatus status = eHAL_STATUS_FAILURE;
3346 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3347
3348 status = sme_AcquireGlobalLock( &pMac->sme );
3349 if ( HAL_STATUS_SUCCESS( status ) )
3350 {
3351 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3352 {
3353 status = csrRoamConnectToLastProfile( pMac, sessionId );
3354 }
3355 else
3356 {
3357 status = eHAL_STATUS_INVALID_PARAMETER;
3358 }
3359 sme_ReleaseGlobalLock( &pMac->sme );
3360 }
3361
3362 return (status);
3363}
3364
3365/* ---------------------------------------------------------------------------
3366 \fn sme_RoamDisconnect
3367 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08003368 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003369 \param reason -- To indicate the reason for disconnecting. Currently, only
3370 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
3371 \return eHalStatus
3372 ---------------------------------------------------------------------------*/
3373eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
3374{
3375 eHalStatus status = eHAL_STATUS_FAILURE;
3376 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3377
Katya Nigambcb705f2013-12-26 14:26:22 +05303378 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003379 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003380 smsLog(pMac, LOG2, FL("enter"));
3381 status = sme_AcquireGlobalLock( &pMac->sme );
3382 if ( HAL_STATUS_SUCCESS( status ) )
3383 {
3384 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3385 {
3386 status = csrRoamDisconnect( pMac, sessionId, reason );
3387 }
3388 else
3389 {
3390 status = eHAL_STATUS_INVALID_PARAMETER;
3391 }
3392 sme_ReleaseGlobalLock( &pMac->sme );
3393 }
3394
3395 return (status);
3396}
3397
Jeff Johnson295189b2012-06-20 16:38:30 -07003398/* ---------------------------------------------------------------------------
3399 \fn sme_RoamStopBss
3400 \brief To stop BSS for Soft AP. This is an asynchronous API.
3401 \param hHal - Global structure
3402 \param sessionId - sessionId of SoftAP
3403 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3404 -------------------------------------------------------------------------------*/
3405eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3406{
3407 eHalStatus status = eHAL_STATUS_FAILURE;
3408 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3409
3410 smsLog(pMac, LOG2, FL("enter"));
3411 status = sme_AcquireGlobalLock( &pMac->sme );
3412 if ( HAL_STATUS_SUCCESS( status ) )
3413 {
3414 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3415 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303416 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003417 }
3418 else
3419 {
3420 status = eHAL_STATUS_INVALID_PARAMETER;
3421 }
3422 sme_ReleaseGlobalLock( &pMac->sme );
3423 }
3424
3425 return (status);
3426}
3427
3428/* ---------------------------------------------------------------------------
3429 \fn sme_RoamDisconnectSta
3430 \brief To disassociate a station. This is an asynchronous API.
3431 \param hHal - Global structure
3432 \param sessionId - sessionId of SoftAP
3433 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3434 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3435 -------------------------------------------------------------------------------*/
3436eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
3437 tANI_U8 *pPeerMacAddr)
3438{
3439 eHalStatus status = eHAL_STATUS_FAILURE;
3440 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3441
3442 if ( NULL == pMac )
3443 {
3444 VOS_ASSERT(0);
3445 return status;
3446 }
3447
3448 status = sme_AcquireGlobalLock( &pMac->sme );
3449 if ( HAL_STATUS_SUCCESS( status ) )
3450 {
3451 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3452 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003453 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303454 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003455 }
3456 else
3457 {
3458 status = eHAL_STATUS_INVALID_PARAMETER;
3459 }
3460 sme_ReleaseGlobalLock( &pMac->sme );
3461 }
3462
3463 return (status);
3464}
3465
3466/* ---------------------------------------------------------------------------
3467 \fn sme_RoamDeauthSta
3468 \brief To disassociate a station. This is an asynchronous API.
3469 \param hHal - Global structure
3470 \param sessionId - sessionId of SoftAP
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303471 \param pDelStaParams -Pointer to parameters of the station to deauthenticate
Jeff Johnson295189b2012-06-20 16:38:30 -07003472 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3473 -------------------------------------------------------------------------------*/
3474eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303475 struct tagCsrDelStaParams *pDelStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003476{
3477 eHalStatus status = eHAL_STATUS_FAILURE;
3478 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3479
3480 if ( NULL == pMac )
3481 {
3482 VOS_ASSERT(0);
3483 return status;
3484 }
3485
3486 status = sme_AcquireGlobalLock( &pMac->sme );
3487 if ( HAL_STATUS_SUCCESS( status ) )
3488 {
3489 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3490 {
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303491 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003492 }
3493 else
3494 {
3495 status = eHAL_STATUS_INVALID_PARAMETER;
3496 }
3497 sme_ReleaseGlobalLock( &pMac->sme );
3498 }
3499
3500 return (status);
3501}
3502
3503/* ---------------------------------------------------------------------------
3504 \fn sme_RoamTKIPCounterMeasures
3505 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3506 \param sessionId - sessionId of SoftAP
3507 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3508 \return eHalStatus
3509 -------------------------------------------------------------------------------*/
3510eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3511 tANI_BOOLEAN bEnable)
3512{
3513 eHalStatus status = eHAL_STATUS_FAILURE;
3514 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3515
3516 if ( NULL == pMac )
3517 {
3518 VOS_ASSERT(0);
3519 return status;
3520 }
3521
3522 status = sme_AcquireGlobalLock( &pMac->sme );
3523 if ( HAL_STATUS_SUCCESS( status ) )
3524 {
3525 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3526 {
3527 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3528 }
3529 else
3530 {
3531 status = eHAL_STATUS_INVALID_PARAMETER;
3532 }
3533 sme_ReleaseGlobalLock( &pMac->sme );
3534 }
3535
3536 return (status);
3537}
3538
3539/* ---------------------------------------------------------------------------
3540 \fn sme_RoamGetAssociatedStas
3541 \brief To probe the list of associated stations from various modules of CORE stack.
3542 \This is an asynchronous API.
3543 \param sessionId - sessionId of SoftAP
3544 \param modId - Module from whom list of associtated stations is to be probed.
3545 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3546 \param pUsrContext - Opaque HDD context
3547 \param pfnSapEventCallback - Sap event callback in HDD
3548 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3549 \return eHalStatus
3550 -------------------------------------------------------------------------------*/
3551eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3552 VOS_MODULE_ID modId, void *pUsrContext,
3553 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3554{
3555 eHalStatus status = eHAL_STATUS_FAILURE;
3556 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3557
3558 if ( NULL == pMac )
3559 {
3560 VOS_ASSERT(0);
3561 return status;
3562 }
3563
3564 status = sme_AcquireGlobalLock( &pMac->sme );
3565 if ( HAL_STATUS_SUCCESS( status ) )
3566 {
3567 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3568 {
3569 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3570 }
3571 else
3572 {
3573 status = eHAL_STATUS_INVALID_PARAMETER;
3574 }
3575 sme_ReleaseGlobalLock( &pMac->sme );
3576 }
3577
3578 return (status);
3579}
3580
3581/* ---------------------------------------------------------------------------
3582 \fn sme_RoamGetWpsSessionOverlap
3583 \brief To get the WPS PBC session overlap information.
3584 \This is an asynchronous API.
3585 \param sessionId - sessionId of SoftAP
3586 \param pUsrContext - Opaque HDD context
3587 \param pfnSapEventCallback - Sap event callback in HDD
3588 \pRemoveMac - pointer to Mac address which needs to be removed from session
3589 \return eHalStatus
3590 -------------------------------------------------------------------------------*/
3591eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003592 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07003593 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3594{
3595 eHalStatus status = eHAL_STATUS_FAILURE;
3596 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3597
3598 if ( NULL == pMac )
3599 {
3600 VOS_ASSERT(0);
3601 return status;
3602 }
3603
3604 status = sme_AcquireGlobalLock( &pMac->sme );
3605 if ( HAL_STATUS_SUCCESS( status ) )
3606 {
3607 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3608 {
3609 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3610 }
3611 else
3612 {
3613 status = eHAL_STATUS_INVALID_PARAMETER;
3614 }
3615 sme_ReleaseGlobalLock( &pMac->sme );
3616 }
3617
3618 return (status);
3619}
3620
Jeff Johnson295189b2012-06-20 16:38:30 -07003621
3622/* ---------------------------------------------------------------------------
3623 \fn sme_RoamGetConnectState
3624 \brief a wrapper function to request CSR to return the current connect state
3625 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003626 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003627 \return eHalStatus
3628 ---------------------------------------------------------------------------*/
3629eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3630{
3631 eHalStatus status = eHAL_STATUS_FAILURE;
3632 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3633
3634 status = sme_AcquireGlobalLock( &pMac->sme );
3635 if ( HAL_STATUS_SUCCESS( status ) )
3636 {
3637 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3638 {
3639 status = csrRoamGetConnectState( pMac, sessionId, pState );
3640 }
3641 else
3642 {
3643 status = eHAL_STATUS_INVALID_PARAMETER;
3644 }
3645 sme_ReleaseGlobalLock( &pMac->sme );
3646 }
3647
3648 return (status);
3649}
3650
3651/* ---------------------------------------------------------------------------
3652 \fn sme_RoamGetConnectProfile
3653 \brief a wrapper function to request CSR to return the current connect
3654 profile. Caller must call csrRoamFreeConnectProfile after it is done
3655 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003656 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003657 \param pProfile - pointer to a caller allocated structure
3658 tCsrRoamConnectedProfile
3659 \return eHalStatus. Failure if not connected
3660 ---------------------------------------------------------------------------*/
3661eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3662 tCsrRoamConnectedProfile *pProfile)
3663{
3664 eHalStatus status = eHAL_STATUS_FAILURE;
3665 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3666
Katya Nigambcb705f2013-12-26 14:26:22 +05303667 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003668 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003669 status = sme_AcquireGlobalLock( &pMac->sme );
3670 if ( HAL_STATUS_SUCCESS( status ) )
3671 {
3672 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3673 {
3674 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3675 }
3676 else
3677 {
3678 status = eHAL_STATUS_INVALID_PARAMETER;
3679 }
3680 sme_ReleaseGlobalLock( &pMac->sme );
3681 }
3682
3683 return (status);
3684}
3685
3686/* ---------------------------------------------------------------------------
3687 \fn sme_RoamFreeConnectProfile
3688 \brief a wrapper function to request CSR to free and reinitialize the
3689 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003690 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003691 \param pProfile - pointer to a caller allocated structure
3692 tCsrRoamConnectedProfile
3693 \return eHalStatus.
3694 ---------------------------------------------------------------------------*/
3695eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3696 tCsrRoamConnectedProfile *pProfile)
3697{
3698 eHalStatus status = eHAL_STATUS_FAILURE;
3699 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3700
Katya Nigambcb705f2013-12-26 14:26:22 +05303701 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003702 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003703 status = sme_AcquireGlobalLock( &pMac->sme );
3704 if ( HAL_STATUS_SUCCESS( status ) )
3705 {
3706 status = csrRoamFreeConnectProfile( pMac, pProfile );
3707 sme_ReleaseGlobalLock( &pMac->sme );
3708 }
3709
3710 return (status);
3711}
3712
3713/* ---------------------------------------------------------------------------
3714 \fn sme_RoamSetPMKIDCache
3715 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003716 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003717 \param pPMKIDCache - caller allocated buffer point to an array of
3718 tPmkidCacheInfo
3719 \param numItems - a variable that has the number of tPmkidCacheInfo
3720 allocated when retruning, this is either the number needed
3721 or number of items put into pPMKIDCache
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303722 \param update_entire_cache - this bool value specifies if the entire pmkid
3723 cache should be overwritten or should it be
3724 updated entry by entry.
Jeff Johnson295189b2012-06-20 16:38:30 -07003725 \return eHalStatus - when fail, it usually means the buffer allocated is not
3726 big enough and pNumItems has the number of
3727 tPmkidCacheInfo.
3728 \Note: pNumItems is a number of tPmkidCacheInfo,
3729 not sizeof(tPmkidCacheInfo) * something
3730 ---------------------------------------------------------------------------*/
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303731eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId,
3732 tPmkidCacheInfo *pPMKIDCache,
3733 tANI_U32 numItems,
3734 tANI_BOOLEAN update_entire_cache )
Jeff Johnson295189b2012-06-20 16:38:30 -07003735{
3736 eHalStatus status = eHAL_STATUS_FAILURE;
3737 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3738
Katya Nigambcb705f2013-12-26 14:26:22 +05303739 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003740 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003741 status = sme_AcquireGlobalLock( &pMac->sme );
3742 if ( HAL_STATUS_SUCCESS( status ) )
3743 {
3744 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3745 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303746 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache,
3747 numItems, update_entire_cache );
Jeff Johnson295189b2012-06-20 16:38:30 -07003748 }
3749 else
3750 {
3751 status = eHAL_STATUS_INVALID_PARAMETER;
3752 }
3753 sme_ReleaseGlobalLock( &pMac->sme );
3754 }
3755
3756 return (status);
3757}
3758
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303759eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId,
3760 tANI_U8 *pBSSId,
3761 tANI_BOOLEAN flush_cache )
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003762{
3763 eHalStatus status = eHAL_STATUS_FAILURE;
3764 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3765 status = sme_AcquireGlobalLock( &pMac->sme );
3766 if ( HAL_STATUS_SUCCESS( status ) )
3767 {
3768 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3769 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303770 status = csrRoamDelPMKIDfromCache( pMac, sessionId,
3771 pBSSId, flush_cache );
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003772 }
3773 else
3774 {
3775 status = eHAL_STATUS_INVALID_PARAMETER;
3776 }
3777 sme_ReleaseGlobalLock( &pMac->sme );
3778 }
3779 return (status);
3780}
Wilson Yang47b58192013-12-11 11:40:19 -08003781
Jeff Johnson295189b2012-06-20 16:38:30 -07003782/* ---------------------------------------------------------------------------
3783 \fn sme_RoamGetSecurityReqIE
3784 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3785 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003786 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003787 \param pLen - caller allocated memory that has the length of pBuf as input.
3788 Upon returned, *pLen has the needed or IE length in pBuf.
3789 \param pBuf - Caller allocated memory that contain the IE field, if any,
3790 upon return
3791 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3792 \return eHalStatus - when fail, it usually means the buffer allocated is not
3793 big enough
3794 ---------------------------------------------------------------------------*/
3795eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3796 tANI_U8 *pBuf, eCsrSecurityType secType)
3797{
3798 eHalStatus status = eHAL_STATUS_FAILURE;
3799 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3800
3801 status = sme_AcquireGlobalLock( &pMac->sme );
3802 if ( HAL_STATUS_SUCCESS( status ) )
3803 {
3804 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3805 {
3806 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3807 }
3808 else
3809 {
3810 status = eHAL_STATUS_INVALID_PARAMETER;
3811 }
3812 sme_ReleaseGlobalLock( &pMac->sme );
3813 }
3814
3815 return (status);
3816}
3817
3818/* ---------------------------------------------------------------------------
3819 \fn sme_RoamGetSecurityRspIE
3820 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3821 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003822 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003823 \param pLen - caller allocated memory that has the length of pBuf as input.
3824 Upon returned, *pLen has the needed or IE length in pBuf.
3825 \param pBuf - Caller allocated memory that contain the IE field, if any,
3826 upon return
3827 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3828 \return eHalStatus - when fail, it usually means the buffer allocated is not
3829 big enough
3830 ---------------------------------------------------------------------------*/
3831eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3832 tANI_U8 *pBuf, eCsrSecurityType secType)
3833{
3834 eHalStatus status = eHAL_STATUS_FAILURE;
3835 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3836
3837 status = sme_AcquireGlobalLock( &pMac->sme );
3838 if ( HAL_STATUS_SUCCESS( status ) )
3839 {
3840 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3841 {
3842 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3843 }
3844 else
3845 {
3846 status = eHAL_STATUS_INVALID_PARAMETER;
3847 }
3848 sme_ReleaseGlobalLock( &pMac->sme );
3849 }
3850
3851 return (status);
3852
3853}
3854
3855
3856/* ---------------------------------------------------------------------------
3857 \fn sme_RoamGetNumPMKIDCache
3858 \brief a wrapper function to request CSR to return number of PMKID cache
3859 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003860 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003861 \return tANI_U32 - the number of PMKID cache entries
3862 ---------------------------------------------------------------------------*/
3863tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3864{
3865 eHalStatus status = eHAL_STATUS_FAILURE;
3866 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3867 tANI_U32 numPmkidCache = 0;
3868
3869 status = sme_AcquireGlobalLock( &pMac->sme );
3870 if ( HAL_STATUS_SUCCESS( status ) )
3871 {
3872 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3873 {
3874 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3875 status = eHAL_STATUS_SUCCESS;
3876 }
3877 else
3878 {
3879 status = eHAL_STATUS_INVALID_PARAMETER;
3880 }
3881 sme_ReleaseGlobalLock( &pMac->sme );
3882 }
3883
3884 return (numPmkidCache);
3885}
3886
3887/* ---------------------------------------------------------------------------
3888 \fn sme_RoamGetPMKIDCache
3889 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003890 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003891 \param pNum - caller allocated memory that has the space of the number of
3892 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3893 needed or actually number in tPmkidCacheInfo.
3894 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3895 any, upon return
3896 \return eHalStatus - when fail, it usually means the buffer allocated is not
3897 big enough
3898 ---------------------------------------------------------------------------*/
3899eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3900 tPmkidCacheInfo *pPmkidCache)
3901{
3902 eHalStatus status = eHAL_STATUS_FAILURE;
3903 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3904
3905 status = sme_AcquireGlobalLock( &pMac->sme );
3906 if ( HAL_STATUS_SUCCESS( status ) )
3907 {
3908 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3909 {
3910 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3911 }
3912 else
3913 {
3914 status = eHAL_STATUS_INVALID_PARAMETER;
3915 }
3916 sme_ReleaseGlobalLock( &pMac->sme );
3917 }
3918
3919 return (status);
3920}
3921
3922
3923/* ---------------------------------------------------------------------------
3924 \fn sme_GetConfigParam
3925 \brief a wrapper function that HDD calls to get the global settings
3926 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003927 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003928 \param pParam - caller allocated memory
3929 \return eHalStatus
3930 ---------------------------------------------------------------------------*/
3931eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3932{
3933 eHalStatus status = eHAL_STATUS_FAILURE;
3934 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3935
Katya Nigambcb705f2013-12-26 14:26:22 +05303936 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003937 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003938 status = sme_AcquireGlobalLock( &pMac->sme );
3939 if ( HAL_STATUS_SUCCESS( status ) )
3940 {
3941 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3942 if (status != eHAL_STATUS_SUCCESS)
3943 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003944 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003945 sme_ReleaseGlobalLock( &pMac->sme );
3946 return status;
3947 }
3948#if defined WLAN_FEATURE_P2P_INTERNAL
3949 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3950 if (status != eHAL_STATUS_SUCCESS)
3951 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003952 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003953 sme_ReleaseGlobalLock( &pMac->sme );
3954 return status;
3955 }
3956#endif
3957 sme_ReleaseGlobalLock( &pMac->sme );
3958 }
3959
3960 return (status);
3961}
3962
3963/* ---------------------------------------------------------------------------
3964 \fn sme_CfgSetInt
3965 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003966 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003967 \param cfgId - Configuration Parameter ID (type) for STA.
3968 \param ccmValue - The information related to Configuration Parameter ID
3969 which needs to be saved in CFG
3970 \param callback - To be registered by CSR with CCM. Once the CFG done with
3971 saving the information in the database, it notifies CCM &
3972 then the callback will be invoked to notify.
3973 \param toBeSaved - To save the request for future reference
3974 \return eHalStatus
3975 ---------------------------------------------------------------------------*/
3976eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3977 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3978{
3979 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3980}
3981
3982/* ---------------------------------------------------------------------------
3983 \fn sme_CfgSetStr
3984 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003985 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003986 \param cfgId - Configuration Parameter ID (type) for STA.
3987 \param pStr - Pointer to the byte array which carries the information needs
3988 to be saved in CFG
3989 \param length - Length of the data to be saved
3990 \param callback - To be registered by CSR with CCM. Once the CFG done with
3991 saving the information in the database, it notifies CCM &
3992 then the callback will be invoked to notify.
3993 \param toBeSaved - To save the request for future reference
3994 \return eHalStatus
3995 ---------------------------------------------------------------------------*/
3996eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3997 tANI_U32 length, tCcmCfgSetCallback callback,
3998 eAniBoolean toBeSaved)
3999{
4000 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
4001}
4002
4003/* ---------------------------------------------------------------------------
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05304004 \fn sme_GetModifyProfileFields
4005 \brief HDD or SME - QOS calls this function to get the current values of
4006 connected profile fields, changing which can cause reassoc.
4007 This function must be called after CFG is downloaded and STA is in connected
4008 state. Also, make sure to call this function to get the current profile
4009 fields before calling the reassoc. So that pModifyProfileFields will have
4010 all the latest values plus the one(s) has been updated as part of reassoc
4011 request.
4012 \param pModifyProfileFields - pointer to the connected profile fields
4013 changing which can cause reassoc
4014
4015 \return eHalStatus
4016 -------------------------------------------------------------------------------*/
4017eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
4018 tCsrRoamModifyProfileFields * pModifyProfileFields)
4019{
4020 eHalStatus status = eHAL_STATUS_FAILURE;
4021 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4022
4023 MTRACE(vos_trace(VOS_MODULE_ID_SME,
4024 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
4025 status = sme_AcquireGlobalLock( &pMac->sme );
4026 if ( HAL_STATUS_SUCCESS( status ) )
4027 {
4028 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4029 {
4030 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
4031 }
4032 else
4033 {
4034 status = eHAL_STATUS_INVALID_PARAMETER;
4035 }
4036 sme_ReleaseGlobalLock( &pMac->sme );
4037 }
4038
4039 return (status);
4040}
4041
4042/* ---------------------------------------------------------------------------
Sandeep Puligilla332ea912014-02-04 00:16:24 +05304043 \fn sme_HT40StopOBSSScan
4044 \brief HDD or SME - Command to stop the OBSS scan
4045 THis is implemented only for debugging purpose.
4046 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
4047 \param sessionId - sessionId
4048 changing which can cause reassoc
4049
4050 \return eHalStatus
4051 -------------------------------------------------------------------------------*/
4052eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
4053{
4054 eHalStatus status = eHAL_STATUS_FAILURE;
4055 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4056
4057 smsLog(pMac, LOG2, FL("enter"));
4058 status = sme_AcquireGlobalLock( &pMac->sme );
4059 if ( HAL_STATUS_SUCCESS( status ) )
4060 {
4061 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4062 {
4063 csrHT40StopOBSSScan( pMac, sessionId );
4064 }
4065 else
4066 {
4067 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4068 "%s: Invalid session sessionId %d", __func__,sessionId);
4069 status = eHAL_STATUS_INVALID_PARAMETER;
4070 }
4071 sme_ReleaseGlobalLock( &pMac->sme );
4072 }
4073 return (status);
4074}
4075
Jeff Johnson295189b2012-06-20 16:38:30 -07004076/*--------------------------------------------------------------------------
4077 \fn sme_SetConfigPowerSave
4078 \brief Wrapper fn to change power save configuration in SME (PMC) module.
4079 For BMPS related configuration, this function also updates the CFG
4080 and sends a message to FW to pick up the new values. Note: Calling
4081 this function only updates the configuration and does not enable
4082 the specified power save mode.
4083 \param hHal - The handle returned by macOpen.
4084 \param psMode - Power Saving mode being modified
4085 \param pConfigParams - a pointer to a caller allocated object of type
4086 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4087 \return eHalStatus
4088 --------------------------------------------------------------------------*/
4089eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4090 void *pConfigParams)
4091{
4092 eHalStatus status = eHAL_STATUS_FAILURE;
4093 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4094
Katya Nigambcb705f2013-12-26 14:26:22 +05304095 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004096 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004097 if (NULL == pConfigParams ) {
4098 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4099 "nothing to update");
4100 return eHAL_STATUS_FAILURE;
4101 }
4102
4103 status = sme_AcquireGlobalLock( &pMac->sme );
4104 if ( HAL_STATUS_SUCCESS( status ) )
4105 {
4106 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
4107 sme_ReleaseGlobalLock( &pMac->sme );
4108 }
4109
4110 return (status);
4111}
4112
4113/*--------------------------------------------------------------------------
4114 \fn sme_GetConfigPowerSave
4115 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
4116 \param hHal - The handle returned by macOpen.
4117 \param psMode - Power Saving mode
4118 \param pConfigParams - a pointer to a caller allocated object of type
4119 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4120 \return eHalStatus
4121 --------------------------------------------------------------------------*/
4122eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4123 void *pConfigParams)
4124{
4125 eHalStatus status = eHAL_STATUS_FAILURE;
4126 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4127
Katya Nigambcb705f2013-12-26 14:26:22 +05304128 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004129 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004130 if (NULL == pConfigParams ) {
4131 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4132 "nothing to update");
4133 return eHAL_STATUS_FAILURE;
4134 }
4135
4136 status = sme_AcquireGlobalLock( &pMac->sme );
4137 if ( HAL_STATUS_SUCCESS( status ) )
4138 {
4139 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
4140 sme_ReleaseGlobalLock( &pMac->sme );
4141 }
4142
4143 return (status);
4144}
4145
4146/* ---------------------------------------------------------------------------
4147 \fn sme_SignalPowerEvent
4148 \brief Signals to PMC that a power event has occurred. Used for putting
4149 the chip into deep sleep mode.
4150 \param hHal - The handle returned by macOpen.
4151 \param event - the event that has occurred
4152 \return eHalStatus
4153 ---------------------------------------------------------------------------*/
4154eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
4155{
4156 eHalStatus status = eHAL_STATUS_FAILURE;
4157 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4158
4159 status = sme_AcquireGlobalLock( &pMac->sme );
4160 if ( HAL_STATUS_SUCCESS( status ) )
4161 {
4162 status = pmcSignalPowerEvent(hHal, event);
4163 sme_ReleaseGlobalLock( &pMac->sme );
4164 }
4165
4166 return (status);
4167}
4168
4169/* ---------------------------------------------------------------------------
4170 \fn sme_EnablePowerSave
4171 \brief Enables one of the power saving modes.
4172 \param hHal - The handle returned by macOpen.
4173 \param psMode - The power saving mode to enable. If BMPS mode is enabled
4174 while the chip is operating in Full Power, PMC will start
4175 a timer that will try to put the chip in BMPS mode after
4176 expiry.
4177 \return eHalStatus
4178 ---------------------------------------------------------------------------*/
4179eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4180{
4181 eHalStatus status = eHAL_STATUS_FAILURE;
4182 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4183
Katya Nigambcb705f2013-12-26 14:26:22 +05304184 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004185 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004186 status = sme_AcquireGlobalLock( &pMac->sme );
4187 if ( HAL_STATUS_SUCCESS( status ) )
4188 {
4189 status = pmcEnablePowerSave(hHal, psMode);
4190 sme_ReleaseGlobalLock( &pMac->sme );
4191 }
4192
4193 return (status);
4194}
4195
4196/* ---------------------------------------------------------------------------
4197 \fn sme_DisablePowerSave
4198 \brief Disables one of the power saving modes.
4199 \param hHal - The handle returned by macOpen.
4200 \param psMode - The power saving mode to disable. Disabling does not imply
4201 that device will be brought out of the current PS mode. This
4202 is purely a configuration API.
4203 \return eHalStatus
4204 ---------------------------------------------------------------------------*/
4205eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4206{
4207 eHalStatus status = eHAL_STATUS_FAILURE;
4208 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4209
Katya Nigambcb705f2013-12-26 14:26:22 +05304210 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004211 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004212 status = sme_AcquireGlobalLock( &pMac->sme );
4213 if ( HAL_STATUS_SUCCESS( status ) )
4214 {
4215 status = pmcDisablePowerSave(hHal, psMode);
4216 sme_ReleaseGlobalLock( &pMac->sme );
4217 }
4218
4219 return (status);
4220 }
4221
4222/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05304223+ \fn sme_SetHostPowerSave
4224+ \brief Enables BMPS logic to be controlled by User level apps
4225+ \param hHal - The handle returned by macOpen.
4226+ \param psMode - The power saving mode to disable. Disabling does not imply
4227+ that device will be brought out of the current PS mode. This
4228+ is purely a configuration API.
4229+ \return eHalStatus
4230+ ---------------------------------------------------------------------------*/
4231eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
4232{
4233 eHalStatus status = eHAL_STATUS_FAILURE;
4234 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4235
4236 pMac->pmc.isHostPsEn = psMode;
4237
4238 return (status);
4239}
4240
4241/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004242 \fn sme_StartAutoBmpsTimer
4243 \brief Starts a timer that periodically polls all the registered
4244 module for entry into Bmps mode. This timer is started only if BMPS is
4245 enabled and whenever the device is in full power.
4246 \param hHal - The handle returned by macOpen.
4247 \return eHalStatus
4248 ---------------------------------------------------------------------------*/
4249eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
4250{
4251 eHalStatus status = eHAL_STATUS_FAILURE;
4252 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4253
Katya Nigambcb705f2013-12-26 14:26:22 +05304254 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004255 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004256 status = sme_AcquireGlobalLock( &pMac->sme );
4257 if ( HAL_STATUS_SUCCESS( status ) )
4258 {
4259 status = pmcStartAutoBmpsTimer(hHal);
4260 sme_ReleaseGlobalLock( &pMac->sme );
4261 }
4262
4263 return (status);
4264}
4265/* ---------------------------------------------------------------------------
4266 \fn sme_StopAutoBmpsTimer
4267 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
4268 Stopping the timer does not cause a device state change. Only the timer
4269 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
4270 \param hHal - The handle returned by macOpen.
4271 \return eHalStatus
4272 ---------------------------------------------------------------------------*/
4273eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
4274{
4275 eHalStatus status = eHAL_STATUS_FAILURE;
4276 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4277
Katya Nigambcb705f2013-12-26 14:26:22 +05304278 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004279 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004280 status = sme_AcquireGlobalLock( &pMac->sme );
4281 if ( HAL_STATUS_SUCCESS( status ) )
4282 {
4283 status = pmcStopAutoBmpsTimer(hHal);
4284 sme_ReleaseGlobalLock( &pMac->sme );
4285 }
4286
4287 return (status);
4288}
4289/* ---------------------------------------------------------------------------
4290 \fn sme_QueryPowerState
4291 \brief Returns the current power state of the device.
4292 \param hHal - The handle returned by macOpen.
4293 \param pPowerState - pointer to location to return power state (LOW or HIGH)
4294 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
4295 \return eHalStatus
4296 ---------------------------------------------------------------------------*/
4297eHalStatus sme_QueryPowerState (
4298 tHalHandle hHal,
4299 tPmcPowerState *pPowerState,
4300 tPmcSwitchState *pSwWlanSwitchState)
4301{
4302 eHalStatus status = eHAL_STATUS_FAILURE;
4303 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4304
4305 status = sme_AcquireGlobalLock( &pMac->sme );
4306 if ( HAL_STATUS_SUCCESS( status ) )
4307 {
4308 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
4309 sme_ReleaseGlobalLock( &pMac->sme );
4310 }
4311
4312 return (status);
4313}
4314
4315/* ---------------------------------------------------------------------------
4316 \fn sme_IsPowerSaveEnabled
4317 \brief Checks if the device is able to enter a particular power save mode
4318 This does not imply that the device is in a particular PS mode
4319 \param hHal - The handle returned by macOpen.
4320 \param psMode - the power saving mode
4321 \return eHalStatus
4322 ---------------------------------------------------------------------------*/
4323tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
4324{
4325 eHalStatus status = eHAL_STATUS_FAILURE;
4326 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4327 tANI_BOOLEAN result = false;
4328
Katya Nigambcb705f2013-12-26 14:26:22 +05304329 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004330 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004331 status = sme_AcquireGlobalLock( &pMac->sme );
4332 if ( HAL_STATUS_SUCCESS( status ) )
4333 {
4334 result = pmcIsPowerSaveEnabled(hHal, psMode);
4335 sme_ReleaseGlobalLock( &pMac->sme );
4336 return result;
4337 }
4338
4339 return false;
4340}
4341
4342/* ---------------------------------------------------------------------------
4343 \fn sme_RequestFullPower
4344 \brief Request that the device be brought to full power state. When the
4345 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
4346 is enabled. On timer expiry PMC will attempt to put the device in
4347 BMPS mode if following holds true:
4348 - BMPS mode is enabled
4349 - Polling of all modules through the Power Save Check routine passes
4350 - STA is associated to an access point
4351 \param hHal - The handle returned by macOpen.
4352 \param - callbackRoutine Callback routine invoked in case of success/failure
4353 \return eHalStatus - status
4354 eHAL_STATUS_SUCCESS - device brought to full power state
4355 eHAL_STATUS_FAILURE - device cannot be brought to full power state
4356 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
4357 ---------------------------------------------------------------------------*/
4358eHalStatus sme_RequestFullPower (
4359 tHalHandle hHal,
4360 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4361 void *callbackContext,
4362 tRequestFullPowerReason fullPowerReason)
4363{
4364 eHalStatus status = eHAL_STATUS_FAILURE;
4365 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4366
Katya Nigambcb705f2013-12-26 14:26:22 +05304367 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004368 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07004369 status = sme_AcquireGlobalLock( &pMac->sme );
4370 if ( HAL_STATUS_SUCCESS( status ) )
4371 {
4372 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
4373 sme_ReleaseGlobalLock( &pMac->sme );
4374 }
4375
4376 return (status);
4377}
4378
4379/* ---------------------------------------------------------------------------
4380 \fn sme_RequestBmps
4381 \brief Request that the device be put in BMPS state. Request will be
4382 accepted only if BMPS mode is enabled and power save check routine
4383 passes.
4384 \param hHal - The handle returned by macOpen.
4385 \param - callbackRoutine Callback routine invoked in case of success/failure
4386 \return eHalStatus
4387 eHAL_STATUS_SUCCESS - device is in BMPS state
4388 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
4389 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
4390 ---------------------------------------------------------------------------*/
4391eHalStatus sme_RequestBmps (
4392 tHalHandle hHal,
4393 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4394 void *callbackContext)
4395{
4396 eHalStatus status = eHAL_STATUS_FAILURE;
4397 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4398
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_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004401 status = sme_AcquireGlobalLock( &pMac->sme );
4402 if ( HAL_STATUS_SUCCESS( status ) )
4403 {
4404 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
4405 sme_ReleaseGlobalLock( &pMac->sme );
4406 }
4407
4408 return (status);
4409}
4410
4411
4412/* ---------------------------------------------------------------------------
4413 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004414 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4415 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004416 \param hHal - The handle returned by macOpen.
4417 ---------------------------------------------------------------------------*/
4418void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4419{
4420 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4421
Katya Nigambcb705f2013-12-26 14:26:22 +05304422 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004423 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004424 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4425 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4426}
4427
4428
4429/* ---------------------------------------------------------------------------
4430 \fn sme_StartUapsd
4431 \brief Request that the device be put in UAPSD state. If the device is in
4432 Full Power it will be put in BMPS mode first and then into UAPSD
4433 mode.
4434 \param hHal - The handle returned by macOpen.
4435 \param - callbackRoutine Callback routine invoked in case of success/failure
4436 eHAL_STATUS_SUCCESS - device is in UAPSD state
4437 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4438 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4439 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4440 \return eHalStatus
4441 ---------------------------------------------------------------------------*/
4442eHalStatus sme_StartUapsd (
4443 tHalHandle hHal,
4444 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4445 void *callbackContext)
4446{
4447 eHalStatus status = eHAL_STATUS_FAILURE;
4448 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4449
4450 status = sme_AcquireGlobalLock( &pMac->sme );
4451 if ( HAL_STATUS_SUCCESS( status ) )
4452 {
4453 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4454 sme_ReleaseGlobalLock( &pMac->sme );
4455 }
4456
4457 return (status);
4458 }
4459
4460/* ---------------------------------------------------------------------------
4461 \fn sme_StopUapsd
4462 \brief Request that the device be put out of UAPSD state. Device will be
4463 put in in BMPS state after stop UAPSD completes.
4464 \param hHal - The handle returned by macOpen.
4465 \return eHalStatus
4466 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4467 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4468 ---------------------------------------------------------------------------*/
4469eHalStatus sme_StopUapsd (tHalHandle hHal)
4470{
4471 eHalStatus status = eHAL_STATUS_FAILURE;
4472 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4473
4474 status = sme_AcquireGlobalLock( &pMac->sme );
4475 if ( HAL_STATUS_SUCCESS( status ) )
4476 {
4477 status = pmcStopUapsd(hHal);
4478 sme_ReleaseGlobalLock( &pMac->sme );
4479 }
4480
4481 return (status);
4482}
4483
4484/* ---------------------------------------------------------------------------
4485 \fn sme_RequestStandby
4486 \brief Request that the device be put in standby. It is HDD's responsibility
4487 to bring the chip to full power and do a disassoc before calling
4488 this API.
4489 \param hHal - The handle returned by macOpen.
4490 \param - callbackRoutine Callback routine invoked in case of success/failure
4491 \return eHalStatus
4492 eHAL_STATUS_SUCCESS - device is in Standby mode
4493 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4494 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4495 ---------------------------------------------------------------------------*/
4496eHalStatus sme_RequestStandby (
4497 tHalHandle hHal,
4498 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4499 void *callbackContext)
4500{
4501 eHalStatus status = eHAL_STATUS_FAILURE;
4502 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4503
Katya Nigambcb705f2013-12-26 14:26:22 +05304504 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004505 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05304506 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004507 status = sme_AcquireGlobalLock( &pMac->sme );
4508 if ( HAL_STATUS_SUCCESS( status ) )
4509 {
4510 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
4511 sme_ReleaseGlobalLock( &pMac->sme );
4512 }
4513
4514 return (status);
4515}
4516
4517/* ---------------------------------------------------------------------------
4518 \fn sme_RegisterPowerSaveCheck
4519 \brief Register a power save check routine that is called whenever
4520 the device is about to enter one of the power save modes.
4521 \param hHal - The handle returned by macOpen.
4522 \param checkRoutine - Power save check routine to be registered
4523 \return eHalStatus
4524 eHAL_STATUS_SUCCESS - successfully registered
4525 eHAL_STATUS_FAILURE - not successfully registered
4526 ---------------------------------------------------------------------------*/
4527eHalStatus sme_RegisterPowerSaveCheck (
4528 tHalHandle hHal,
4529 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4530{
4531 eHalStatus status = eHAL_STATUS_FAILURE;
4532 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4533
4534 status = sme_AcquireGlobalLock( &pMac->sme );
4535 if ( HAL_STATUS_SUCCESS( status ) )
4536 {
4537 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4538 sme_ReleaseGlobalLock( &pMac->sme );
4539 }
4540
4541 return (status);
4542}
4543
4544/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05304545 \fn sme_Register11dScanDoneCallback
4546 \brief Register a routine of type csrScanCompleteCallback which is
4547 called whenever an 11d scan is done
4548 \param hHal - The handle returned by macOpen.
4549 \param callback - 11d scan complete routine to be registered
4550 \return eHalStatus
4551 ---------------------------------------------------------------------------*/
4552eHalStatus sme_Register11dScanDoneCallback (
4553 tHalHandle hHal,
4554 csrScanCompleteCallback callback)
4555{
4556 eHalStatus status = eHAL_STATUS_SUCCESS;
4557 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4558
4559 pMac->scan.callback11dScanDone = callback;
4560
4561 return (status);
4562}
4563
4564/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004565 \fn sme_DeregisterPowerSaveCheck
4566 \brief Deregister a power save check routine
4567 \param hHal - The handle returned by macOpen.
4568 \param checkRoutine - Power save check routine to be deregistered
4569 \return eHalStatus
4570 eHAL_STATUS_SUCCESS - successfully deregistered
4571 eHAL_STATUS_FAILURE - not successfully deregistered
4572 ---------------------------------------------------------------------------*/
4573eHalStatus sme_DeregisterPowerSaveCheck (
4574 tHalHandle hHal,
4575 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4576{
4577 eHalStatus status = eHAL_STATUS_FAILURE;
4578 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4579
4580 status = sme_AcquireGlobalLock( &pMac->sme );
4581 if ( HAL_STATUS_SUCCESS( status ) )
4582 {
4583 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4584 sme_ReleaseGlobalLock( &pMac->sme );
4585 }
4586
4587 return (status);
4588}
4589
4590/* ---------------------------------------------------------------------------
4591 \fn sme_RegisterDeviceStateUpdateInd
4592 \brief Register a callback routine that is called whenever
4593 the device enters a new device state (Full Power, BMPS, UAPSD)
4594 \param hHal - The handle returned by macOpen.
4595 \param callbackRoutine - Callback routine to be registered
4596 \param callbackContext - Cookie to be passed back during callback
4597 \return eHalStatus
4598 eHAL_STATUS_SUCCESS - successfully registered
4599 eHAL_STATUS_FAILURE - not successfully registered
4600 ---------------------------------------------------------------------------*/
4601eHalStatus sme_RegisterDeviceStateUpdateInd (
4602 tHalHandle hHal,
4603 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4604 void *callbackContext)
4605{
4606 eHalStatus status = eHAL_STATUS_FAILURE;
4607 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4608
4609 status = sme_AcquireGlobalLock( &pMac->sme );
4610 if ( HAL_STATUS_SUCCESS( status ) )
4611 {
4612 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4613 sme_ReleaseGlobalLock( &pMac->sme );
4614 }
4615
4616 return (status);
4617}
4618
4619/* ---------------------------------------------------------------------------
4620 \fn sme_DeregisterDeviceStateUpdateInd
4621 \brief Deregister a routine that was registered for device state changes
4622 \param hHal - The handle returned by macOpen.
4623 \param callbackRoutine - Callback routine to be deregistered
4624 \return eHalStatus
4625 eHAL_STATUS_SUCCESS - successfully deregistered
4626 eHAL_STATUS_FAILURE - not successfully deregistered
4627 ---------------------------------------------------------------------------*/
4628eHalStatus sme_DeregisterDeviceStateUpdateInd (
4629 tHalHandle hHal,
4630 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4631{
4632 eHalStatus status = eHAL_STATUS_FAILURE;
4633 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4634
4635 status = sme_AcquireGlobalLock( &pMac->sme );
4636 if ( HAL_STATUS_SUCCESS( status ) )
4637 {
4638 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4639 sme_ReleaseGlobalLock( &pMac->sme );
4640 }
4641
4642 return (status);
4643}
4644
4645/* ---------------------------------------------------------------------------
4646 \fn sme_WowlAddBcastPattern
4647 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4648 do a pattern match on these patterns when Wowl is enabled during BMPS
4649 mode. Note that Firmware performs the pattern matching only on
4650 broadcast frames and while Libra is in BMPS mode.
4651 \param hHal - The handle returned by macOpen.
4652 \param pattern - Pattern to be added
4653 \return eHalStatus
4654 eHAL_STATUS_FAILURE Cannot add pattern
4655 eHAL_STATUS_SUCCESS Request accepted.
4656 ---------------------------------------------------------------------------*/
4657eHalStatus sme_WowlAddBcastPattern (
4658 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004659 tpSirWowlAddBcastPtrn pattern,
4660 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004661{
4662 eHalStatus status = eHAL_STATUS_FAILURE;
4663 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304664 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004665 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004666 status = sme_AcquireGlobalLock( &pMac->sme );
4667 if ( HAL_STATUS_SUCCESS( status ) )
4668 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004669 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004670 sme_ReleaseGlobalLock( &pMac->sme );
4671 }
4672
4673 return (status);
4674}
4675
4676/* ---------------------------------------------------------------------------
4677 \fn sme_WowlDelBcastPattern
4678 \brief Delete a pattern that was added for Pattern Byte Matching.
4679 \param hHal - The handle returned by macOpen.
4680 \param pattern - Pattern to be deleted
4681 \return eHalStatus
4682 eHAL_STATUS_FAILURE Cannot delete pattern
4683 eHAL_STATUS_SUCCESS Request accepted.
4684 ---------------------------------------------------------------------------*/
4685eHalStatus sme_WowlDelBcastPattern (
4686 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004687 tpSirWowlDelBcastPtrn pattern,
4688 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004689{
4690 eHalStatus status = eHAL_STATUS_FAILURE;
4691 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304692 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004693 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004694 status = sme_AcquireGlobalLock( &pMac->sme );
4695 if ( HAL_STATUS_SUCCESS( status ) )
4696 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004697 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004698 sme_ReleaseGlobalLock( &pMac->sme );
4699 }
4700
4701 return (status);
4702}
4703
4704/* ---------------------------------------------------------------------------
4705 \fn sme_EnterWowl
4706 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4707 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4708 SME will will cache the information that WOWL has been enabled and
4709 attempt to put the device in BMPS. On entry into BMPS, SME will
4710 enable the WOWL mode.
4711 Note 1: If we exit BMPS mode (someone requests full power), we
4712 will NOT resume WOWL when we go back to BMPS again. Request for full
4713 power (while in WOWL mode) means disable WOWL and go to full power.
4714 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4715 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4716 are required. Currently there is no requirement or use case to support
4717 UAPSD and WOWL at the same time.
4718
4719 \param hHal - The handle returned by macOpen.
4720 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4721 Used for success/failure notification by SME
4722 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4723 at the time of callback.
4724 \param wakeReasonIndCB - Callback routine provided by HDD.
4725 Used for Wake Reason Indication by SME
4726 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4727 at the time of callback.
4728 \return eHalStatus
4729 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4730 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4731 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4732 BMPS mode is entered.
4733 ---------------------------------------------------------------------------*/
4734eHalStatus sme_EnterWowl (
4735 tHalHandle hHal,
4736 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4737 void *enterWowlCallbackContext,
4738#ifdef WLAN_WAKEUP_EVENTS
4739 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4740 void *wakeIndicationCBContext,
4741#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004742 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004743{
4744 eHalStatus status = eHAL_STATUS_FAILURE;
4745 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304746 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004747 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004748 status = sme_AcquireGlobalLock( &pMac->sme );
4749 if ( HAL_STATUS_SUCCESS( status ) )
4750 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004751 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004752#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004753 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004754#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004755 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004756 sme_ReleaseGlobalLock( &pMac->sme );
4757 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004758 return (status);
4759}
4760/* ---------------------------------------------------------------------------
4761 \fn sme_ExitWowl
4762 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4763 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4764 mode.
4765 \param hHal - The handle returned by macOpen.
4766 \return eHalStatus
4767 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4768 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4769 ---------------------------------------------------------------------------*/
c_hpothu01484c02014-05-16 14:05:15 +05304770eHalStatus sme_ExitWowl (tHalHandle hHal, tWowlExitSource wowlExitSrc)
Jeff Johnson295189b2012-06-20 16:38:30 -07004771{
4772 eHalStatus status = eHAL_STATUS_FAILURE;
4773 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304774 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004775 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004776 status = sme_AcquireGlobalLock( &pMac->sme );
4777 if ( HAL_STATUS_SUCCESS( status ) )
4778 {
c_hpothu01484c02014-05-16 14:05:15 +05304779 status = pmcExitWowl (hHal, wowlExitSrc);
Jeff Johnson295189b2012-06-20 16:38:30 -07004780 sme_ReleaseGlobalLock( &pMac->sme );
4781 }
4782
4783 return (status);
4784}
4785
4786/* ---------------------------------------------------------------------------
4787
4788 \fn sme_RoamSetKey
4789
4790 \brief To set encryption key. This function should be called only when connected
4791 This is an asynchronous API.
4792
4793 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4794
4795 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4796
4797 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4798
4799 FAILURE or RESOURCES The API finished and failed.
4800
4801 -------------------------------------------------------------------------------*/
4802eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4803{
4804 eHalStatus status = eHAL_STATUS_FAILURE;
4805 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4806 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004807 tANI_U32 i;
4808 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004809
Katya Nigambcb705f2013-12-26 14:26:22 +05304810 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004811 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004812 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4813 {
4814 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4815 return eHAL_STATUS_FAILURE;
4816 }
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304817 /*Once Setkey is done, we can go in BMPS*/
4818 if(pSetKey->keyLength)
Abhishek Singh65d939e2014-04-25 13:33:07 +05304819 {
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304820 pMac->pmc.remainInPowerActiveTillDHCP = FALSE;
Abhishek Singh65d939e2014-04-25 13:33:07 +05304821 smsLog(pMac, LOG1, FL("Reset remainInPowerActiveTillDHCP"
4822 " to allow BMPS"));
4823 }
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004824
Jeff Johnson295189b2012-06-20 16:38:30 -07004825 status = sme_AcquireGlobalLock( &pMac->sme );
4826 if ( HAL_STATUS_SUCCESS( status ) )
4827 {
4828 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4829 if(pRoamId)
4830 {
4831 *pRoamId = roamId;
4832 }
4833
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004834 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004835
4836 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004837 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004838
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004839 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004840
4841 pSession = CSR_GET_SESSION(pMac, sessionId);
4842
Jeff Johnson32d95a32012-09-10 13:15:23 -07004843 if(!pSession)
4844 {
4845 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004846 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004847 return eHAL_STATUS_FAILURE;
4848 }
4849
Jeff Johnson295189b2012-06-20 16:38:30 -07004850 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4851 {
4852 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4853 {
4854 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4855 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4856 {
4857 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4858 }
4859 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4860 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4861 {
4862 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4863 }
4864 }
4865 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004866
4867 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4868 sme_ReleaseGlobalLock( &pMac->sme );
4869 }
Girish Gowli1c2fc802015-01-19 16:18:07 +05304870 if (pMac->roam.configParam.roamDelayStatsEnabled)
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05304871 {
Girish Gowli1c2fc802015-01-19 16:18:07 +05304872 //Store sent PTK key time
4873 if(pSetKey->keyDirection == eSIR_TX_RX)
4874 {
4875 vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
4876 }
4877 else if(pSetKey->keyDirection == eSIR_RX_ONLY)
4878 {
4879 vos_record_roam_event(e_HDD_SET_GTK_REQ, NULL, 0);
4880 }
4881 else
4882 {
4883 return (status);
4884 }
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05304885 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004886
4887 return (status);
4888}
4889
4890
4891/* ---------------------------------------------------------------------------
4892
4893 \fn sme_RoamRemoveKey
4894
4895 \brief To set encryption key. This is an asynchronous API.
4896
4897 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4898
4899 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4900
4901 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4902
4903 FAILURE or RESOURCES The API finished and failed.
4904
4905 -------------------------------------------------------------------------------*/
4906eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4907 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4908{
4909 eHalStatus status = eHAL_STATUS_FAILURE;
4910 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4911 tANI_U32 roamId;
4912
Katya Nigambcb705f2013-12-26 14:26:22 +05304913 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004914 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004915 status = sme_AcquireGlobalLock( &pMac->sme );
4916 if ( HAL_STATUS_SUCCESS( status ) )
4917 {
4918 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4919 if(pRoamId)
4920 {
4921 *pRoamId = roamId;
4922 }
4923 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4924 sme_ReleaseGlobalLock( &pMac->sme );
4925 }
4926
4927 return (status);
4928}
4929
4930/* ---------------------------------------------------------------------------
4931 \fn sme_GetRssi
4932 \brief a wrapper function that client calls to register a callback to get RSSI
4933
4934 \param callback - SME sends back the requested stats using the callback
4935 \param staId - The station ID for which the stats is requested for
4936 \param pContext - user context to be passed back along with the callback
4937 \param pVosContext - vos context
4938 \return eHalStatus
4939 ---------------------------------------------------------------------------*/
4940eHalStatus sme_GetRssi(tHalHandle hHal,
4941 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004942 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07004943 void *pContext, void* pVosContext)
4944{
4945 eHalStatus status = eHAL_STATUS_FAILURE;
4946 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4947
4948 status = sme_AcquireGlobalLock( &pMac->sme );
4949 if ( HAL_STATUS_SUCCESS( status ) )
4950 {
4951 status = csrGetRssi( pMac, callback,
4952 staId, bssId, pContext, pVosContext);
4953 sme_ReleaseGlobalLock( &pMac->sme );
4954 }
4955 return (status);
4956}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304957
4958/* ---------------------------------------------------------------------------
4959 \fn sme_GetSnr
4960 \brief a wrapper function that client calls to register a callback to
4961 get SNR
4962
4963 \param callback - SME sends back the requested stats using the callback
4964 \param staId - The station ID for which the stats is requested for
4965 \param pContext - user context to be passed back along with the callback
4966 \param pVosContext - vos context
4967 \return eHalStatus
4968 ---------------------------------------------------------------------------*/
4969eHalStatus sme_GetSnr(tHalHandle hHal,
4970 tCsrSnrCallback callback,
4971 tANI_U8 staId, tCsrBssid bssId,
4972 void *pContext)
4973{
4974 eHalStatus status = eHAL_STATUS_FAILURE;
4975 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4976
4977 status = sme_AcquireGlobalLock( &pMac->sme );
4978 if ( HAL_STATUS_SUCCESS( status ) )
4979 {
4980 status = csrGetSnr(pMac, callback,
4981 staId, bssId, pContext);
4982 sme_ReleaseGlobalLock( &pMac->sme );
4983 }
4984 return status;
4985}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004986#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004987/* ---------------------------------------------------------------------------
4988 \fn sme_GetRoamRssi
4989 \brief a wrapper function that client calls to register a callback to get Roam RSSI
4990
4991 \param callback - SME sends back the requested stats using the callback
4992 \param staId - The station ID for which the stats is requested for
4993 \param pContext - user context to be passed back along with the callback
4994 \param pVosContext - vos context
4995 \return eHalStatus
4996 ---------------------------------------------------------------------------*/
4997eHalStatus sme_GetRoamRssi(tHalHandle hHal,
4998 tCsrRssiCallback callback,
4999 tANI_U8 staId, tCsrBssid bssId,
5000 void *pContext, void* pVosContext)
5001{
5002 eHalStatus status = eHAL_STATUS_FAILURE;
5003 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5004
5005 status = sme_AcquireGlobalLock( &pMac->sme );
5006 if ( HAL_STATUS_SUCCESS( status ) )
5007 {
5008 status = csrGetRoamRssi( pMac, callback,
5009 staId, bssId, pContext, pVosContext);
5010 sme_ReleaseGlobalLock( &pMac->sme );
5011 }
5012 return (status);
5013}
5014#endif
5015
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005016#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005017/* ---------------------------------------------------------------------------
5018 \fn sme_GetTsmStats
5019 \brief a wrapper function that client calls to register a callback to get TSM Stats
5020
5021 \param callback - SME sends back the requested stats using the callback
5022 \param staId - The station ID for which the stats is requested for
5023 \param pContext - user context to be passed back along with the callback
5024 \param pVosContext - vos context
5025 \return eHalStatus
5026 ---------------------------------------------------------------------------*/
5027eHalStatus sme_GetTsmStats(tHalHandle hHal,
5028 tCsrTsmStatsCallback callback,
5029 tANI_U8 staId, tCsrBssid bssId,
5030 void *pContext, void* pVosContext, tANI_U8 tid)
5031{
5032 eHalStatus status = eHAL_STATUS_FAILURE;
5033 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5034
5035 status = sme_AcquireGlobalLock( &pMac->sme );
5036 if ( HAL_STATUS_SUCCESS( status ) )
5037 {
5038 status = csrGetTsmStats( pMac, callback,
5039 staId, bssId, pContext, pVosContext, tid);
5040 sme_ReleaseGlobalLock( &pMac->sme );
5041 }
5042 return (status);
5043}
5044#endif
5045
5046
Jeff Johnson295189b2012-06-20 16:38:30 -07005047/* ---------------------------------------------------------------------------
5048 \fn sme_GetStatistics
5049 \brief a wrapper function that client calls to register a callback to get
5050 different PHY level statistics from CSR.
5051
5052 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
5053 \param statsMask - The different category/categories of stats requester is looking for
5054 \param callback - SME sends back the requested stats using the callback
5055 \param periodicity - If requester needs periodic update in millisec, 0 means
5056 it's an one time request
5057 \param cache - If requester is happy with cached stats
5058 \param staId - The station ID for which the stats is requested for
5059 \param pContext - user context to be passed back along with the callback
5060 \return eHalStatus
5061 ---------------------------------------------------------------------------*/
5062eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
5063 tANI_U32 statsMask,
5064 tCsrStatsCallback callback,
5065 tANI_U32 periodicity, tANI_BOOLEAN cache,
5066 tANI_U8 staId, void *pContext)
5067{
5068 eHalStatus status = eHAL_STATUS_FAILURE;
5069 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5070
Katya Nigambcb705f2013-12-26 14:26:22 +05305071 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005072 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07005073 status = sme_AcquireGlobalLock( &pMac->sme );
5074 if ( HAL_STATUS_SUCCESS( status ) )
5075 {
5076 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
5077 periodicity, cache, staId, pContext);
5078 sme_ReleaseGlobalLock( &pMac->sme );
5079 }
5080
5081 return (status);
5082
5083}
5084
Abhishek Singh08aa7762014-12-16 13:59:03 +05305085eHalStatus sme_GetFwStats(tHalHandle hHal, tANI_U32 stats,
5086 void *pContext, tSirFWStatsCallback callback)
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305087{
5088 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5089 vos_msg_t msg;
5090 tSirFWStatsGetReq *pGetFWStatsReq;
5091
5092 smsLog(pMac, LOG1, FL(" ENTER stats = %d "),stats);
5093
5094 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
5095 {
5096 pGetFWStatsReq = (tSirFWStatsGetReq *)vos_mem_malloc(sizeof(tSirFWStatsGetReq));
5097 if ( NULL == pGetFWStatsReq)
5098 {
5099 smsLog(pMac, LOGE, FL("Not able to allocate memory for "
5100 "WDA_FW_STATS_GET_REQ"));
5101 sme_ReleaseGlobalLock( &pMac->sme );
5102 return eHAL_STATUS_FAILURE;
5103 }
5104 pGetFWStatsReq->stats = stats;
5105 pGetFWStatsReq->callback = (tSirFWStatsCallback)callback;
Abhishek Singh08aa7762014-12-16 13:59:03 +05305106 pGetFWStatsReq->data = pContext;
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305107
5108 msg.type = WDA_FW_STATS_GET_REQ;
5109 msg.reserved = 0;
5110 msg.bodyptr = pGetFWStatsReq;
5111 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
5112 {
5113 smsLog(pMac, LOGE,
5114 FL("Not able to post WDA_FW_STATS_GET_REQ message to HAL"));
5115 vos_mem_free(pGetFWStatsReq);
5116 sme_ReleaseGlobalLock( &pMac->sme );
5117 return eHAL_STATUS_FAILURE;
5118 }
5119 sme_ReleaseGlobalLock( &pMac->sme );
5120 return eHAL_STATUS_SUCCESS;
5121 }
5122 return eHAL_STATUS_FAILURE;
5123}
5124
Jeff Johnson295189b2012-06-20 16:38:30 -07005125/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305126 \fn smeGetTLSTAState
5127 \helper function to get the TL STA State whenever the function is called.
5128
5129 \param staId - The staID to be passed to the TL
5130 to get the relevant TL STA State
5131 \return the state as tANI_U16
5132 ---------------------------------------------------------------------------*/
5133tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
5134{
5135 tANI_U16 tlSTAState = TL_INIT_STATE;
5136 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5137 eHalStatus status = eHAL_STATUS_FAILURE;
5138
5139 status = sme_AcquireGlobalLock( &pMac->sme );
5140 if ( HAL_STATUS_SUCCESS( status ) )
5141 {
5142 tlSTAState = csrGetTLSTAState( pMac, staId);
5143 sme_ReleaseGlobalLock( &pMac->sme );
5144 }
5145
5146 return tlSTAState;
5147}
5148
5149/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005150
5151 \fn sme_GetCountryCode
5152
5153 \brief To return the current country code. If no country code is applied, default country code is
5154 used to fill the buffer.
5155 If 11d supported is turned off, an error is return and the last applied/default country code is used.
5156 This is a synchronous API.
5157
5158 \param pBuf - pointer to a caller allocated buffer for returned country code.
5159
5160 \param pbLen For input, this parameter indicates how big is the buffer.
5161 Upon return, this parameter has the number of bytes for country. If pBuf
5162 doesn't have enough space, this function returns
5163 fail status and this parameter contains the number that is needed.
5164
5165 \return eHalStatus SUCCESS.
5166
5167 FAILURE or RESOURCES The API finished and failed.
5168
5169 -------------------------------------------------------------------------------*/
5170eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
5171{
5172 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5173
Katya Nigambcb705f2013-12-26 14:26:22 +05305174 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005175 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
5176
Jeff Johnson295189b2012-06-20 16:38:30 -07005177 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
5178}
5179
5180
5181/* ---------------------------------------------------------------------------
5182
5183 \fn sme_SetCountryCode
5184
5185 \brief To change the current/default country code.
5186 If 11d supported is turned off, an error is return.
5187 This is a synchronous API.
5188
5189 \param pCountry - pointer to a caller allocated buffer for the country code.
5190
5191 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
5192 whether a reset is required.
5193
5194 \return eHalStatus SUCCESS.
5195
5196 FAILURE or RESOURCES The API finished and failed.
5197
5198 -------------------------------------------------------------------------------*/
5199eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
5200{
5201 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5202
Katya Nigambcb705f2013-12-26 14:26:22 +05305203 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005204 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005205 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
5206}
5207
5208
5209/* ---------------------------------------------------------------------------
5210 \fn sme_ResetCountryCodeInformation
5211 \brief this function is to reset the country code current being used back to EEPROM default
5212 this includes channel list and power setting. This is a synchronous API.
5213 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5214 a restart is needed to apply the change
5215 \return eHalStatus
5216 -------------------------------------------------------------------------------*/
5217eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
5218{
5219 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5220
5221 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
5222}
5223
5224
5225/* ---------------------------------------------------------------------------
5226 \fn sme_GetSupportedCountryCode
5227 \brief this function is to get a list of the country code current being supported
5228 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
5229 this has the country code list. 3 bytes for each country code. This may be NULL if
5230 caller wants to know the needed byte count.
5231 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
5232 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
5233 \return eHalStatus
5234 -------------------------------------------------------------------------------*/
5235eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
5236{
5237 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5238
5239 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
5240}
5241
5242
5243/* ---------------------------------------------------------------------------
5244 \fn sme_GetCurrentRegulatoryDomain
5245 \brief this function is to get the current regulatory domain. This is a synchronous API.
5246 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5247 SME. The function fails if 11d support is turned off.
5248 \param pDomain - Caller allocated buffer to return the current domain.
5249 \return eHalStatus SUCCESS.
5250
5251 FAILURE or RESOURCES The API finished and failed.
5252 -------------------------------------------------------------------------------*/
5253eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
5254{
5255 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5256 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5257
5258 if( pDomain )
5259 {
5260 if( csrIs11dSupported( pMac ) )
5261 {
5262 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
5263 status = eHAL_STATUS_SUCCESS;
5264 }
5265 else
5266 {
5267 status = eHAL_STATUS_FAILURE;
5268 }
5269 }
5270
5271 return ( status );
5272}
5273
5274
5275/* ---------------------------------------------------------------------------
5276 \fn sme_SetRegulatoryDomain
5277 \brief this function is to set the current regulatory domain.
5278 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5279 SME. This is a synchronous API.
5280 \param domainId - indicate the domain (defined in the driver) needs to set to.
5281 See v_REGDOMAIN_t for definition
5282 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5283 a restart is needed to apply the change
5284 \return eHalStatus
5285 -------------------------------------------------------------------------------*/
5286eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
5287{
5288 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5289
5290 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
5291}
5292
5293
5294/* ---------------------------------------------------------------------------
5295
5296 \fn sme_GetRegulatoryDomainForCountry
5297
5298 \brief To return a regulatory domain base on a country code. This is a synchronous API.
5299
5300 \param pCountry - pointer to a caller allocated buffer for input country code.
5301
5302 \param pDomainId Upon successful return, it is the domain that country belongs to.
5303 If it is NULL, returning success means that the country code is known.
5304
5305 \return eHalStatus SUCCESS.
5306
5307 FAILURE or RESOURCES The API finished and failed.
5308
5309 -------------------------------------------------------------------------------*/
5310eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
5311{
5312 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5313
Kiet Lam6c583332013-10-14 05:37:09 +05305314 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
5315 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07005316}
5317
5318
5319
5320
5321/* ---------------------------------------------------------------------------
5322
5323 \fn sme_GetSupportedRegulatoryDomains
5324
5325 \brief To return a list of supported regulatory domains. This is a synchronous API.
5326
5327 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
5328
5329 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
5330 Upon return, this parameter has the number for supported domains. If pDomains
5331 doesn't have enough space for all the supported domains, this function returns
5332 fail status and this parameter contains the number that is needed.
5333
5334 \return eHalStatus SUCCESS.
5335
5336 FAILURE or RESOURCES The API finished and failed.
5337
5338 -------------------------------------------------------------------------------*/
5339eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
5340{
5341 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5342
5343 //We support all domains for now
5344 if( pNumDomains )
5345 {
5346 if( NUM_REG_DOMAINS <= *pNumDomains )
5347 {
5348 status = eHAL_STATUS_SUCCESS;
5349 }
5350 *pNumDomains = NUM_REG_DOMAINS;
5351 }
5352 if( HAL_STATUS_SUCCESS( status ) )
5353 {
5354 if( pDomains )
5355 {
5356 pDomains[0] = REGDOMAIN_FCC;
5357 pDomains[1] = REGDOMAIN_ETSI;
5358 pDomains[2] = REGDOMAIN_JAPAN;
5359 pDomains[3] = REGDOMAIN_WORLD;
5360 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
5361 pDomains[5] = REGDOMAIN_APAC;
5362 pDomains[6] = REGDOMAIN_KOREA;
5363 pDomains[7] = REGDOMAIN_HI_5GHZ;
5364 pDomains[8] = REGDOMAIN_NO_5GHZ;
5365 }
5366 else
5367 {
5368 status = eHAL_STATUS_INVALID_PARAMETER;
5369 }
5370 }
5371
5372 return ( status );
5373}
5374
5375
5376//some support functions
5377tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
5378{
5379 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5380
5381 return ( csrIs11dSupported( pMac ) );
5382}
5383
5384
5385tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
5386{
5387 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5388
5389 return ( csrIs11hSupported( pMac ) );
5390}
5391
5392
5393tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
5394{
5395 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5396
5397 return ( csrIsWmmSupported( pMac ) );
5398}
5399
5400//Upper layer to get the list of the base channels to scan for passively 11d info from csr
5401eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
5402{
5403 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5404
5405 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
5406}
5407
5408/* ---------------------------------------------------------------------------
5409
5410 \fn sme_ChangeCountryCode
5411
5412 \brief Change Country code from upperlayer during WLAN driver operation.
5413 This is a synchronous API.
5414
5415 \param hHal - The handle returned by macOpen.
5416
5417 \param pCountry New Country Code String
5418
Abhishek Singha306a442013-11-07 18:39:01 +05305419 \param sendRegHint If we want to send reg hint to nl80211
5420
Jeff Johnson295189b2012-06-20 16:38:30 -07005421 \return eHalStatus SUCCESS.
5422
5423 FAILURE or RESOURCES The API finished and failed.
5424
5425 -------------------------------------------------------------------------------*/
5426eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
5427 tSmeChangeCountryCallback callback,
5428 tANI_U8 *pCountry,
5429 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305430 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05305431 tAniBool countryFromUserSpace,
5432 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07005433{
5434 eHalStatus status = eHAL_STATUS_FAILURE;
5435 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5436 vos_msg_t msg;
5437 tAniChangeCountryCodeReq *pMsg;
5438
Katya Nigambcb705f2013-12-26 14:26:22 +05305439 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005440 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005441 status = sme_AcquireGlobalLock( &pMac->sme );
5442 if ( HAL_STATUS_SUCCESS( status ) )
5443 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005444 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08005445
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05305446 if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) &&
Amar Singhal97a2d992013-11-19 10:58:07 -08005447 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
5448 {
5449
5450 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
5451
5452 sme_ReleaseGlobalLock( &pMac->sme );
5453 status = eHAL_STATUS_FAILURE;
5454 return status;
5455 }
5456
Kiet Lam64c1b492013-07-12 13:56:44 +05305457 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
5458 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07005459 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005460 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005461 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05305462 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005463 }
5464
5465 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
5466 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05305467 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305468 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05305469 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07005470 pMsg->changeCCCallback = callback;
5471 pMsg->pDevContext = pContext;
5472 pMsg->pVosContext = pVosContext;
5473
5474 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
5475 msg.bodyptr = pMsg;
5476 msg.reserved = 0;
5477
5478 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5479 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005480 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305481 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005482 status = eHAL_STATUS_FAILURE;
5483 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005484 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005485 sme_ReleaseGlobalLock( &pMac->sme );
5486 }
5487
5488 return (status);
5489}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005490
5491/*--------------------------------------------------------------------------
5492
5493 \fn sme_GenericChangeCountryCode
5494
5495 \brief Change Country code from upperlayer during WLAN driver operation.
5496 This is a synchronous API.
5497
5498 \param hHal - The handle returned by macOpen.
5499
5500 \param pCountry New Country Code String
5501
5502 \param reg_domain regulatory domain
5503
5504 \return eHalStatus SUCCESS.
5505
5506 FAILURE or RESOURCES The API finished and failed.
5507
5508-----------------------------------------------------------------------------*/
5509eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
5510 tANI_U8 *pCountry,
5511 v_REGDOMAIN_t reg_domain)
5512{
5513 eHalStatus status = eHAL_STATUS_FAILURE;
5514 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5515 vos_msg_t msg;
5516 tAniGenericChangeCountryCodeReq *pMsg;
5517
Kiet Lamcffc5862013-10-30 16:28:45 +05305518 if (NULL == pMac)
5519 {
5520 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5521 "%s: pMac is null", __func__);
5522 return status;
5523 }
5524
Amar Singhal0d15bd52013-10-12 23:13:13 -07005525 status = sme_AcquireGlobalLock( &pMac->sme );
5526 if ( HAL_STATUS_SUCCESS( status ) )
5527 {
5528 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05305529 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
5530 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07005531 {
5532 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
5533 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05305534 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07005535 }
5536
5537 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
5538 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08005539 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Dino Mycle6c77a962014-08-19 15:34:23 +05305540
5541 pMsg->countryCode[2] = ' '; /* For ASCII space */
5542
Amar Singhal0d15bd52013-10-12 23:13:13 -07005543 pMsg->domain_index = reg_domain;
5544
5545 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
5546 msg.bodyptr = pMsg;
5547 msg.reserved = 0;
5548
5549 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5550 {
5551 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05305552 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005553 status = eHAL_STATUS_FAILURE;
5554 }
5555 smsLog(pMac, LOG1, FL(" returned"));
5556 sme_ReleaseGlobalLock( &pMac->sme );
5557 }
5558
5559 return (status);
5560}
Mihir Shetee1093ba2014-01-21 20:13:32 +05305561
5562/* ---------------------------------------------------------------------------
5563
5564 \fn sme_InitChannels
5565
5566 \brief Used to initialize CSR channel lists while driver loading
5567
5568 \param hHal - global pMac structure
5569
5570 \return eHalStatus SUCCESS.
5571
5572 FAILURE or RESOURCES The API finished and failed.
5573
5574 -------------------------------------------------------------------------------*/
5575eHalStatus sme_InitChannels(tHalHandle hHal)
5576{
5577 eHalStatus status = eHAL_STATUS_FAILURE;
5578 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5579
5580 if (NULL == pMac)
5581 {
5582 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5583 "%s: pMac is null", __func__);
5584 return status;
5585 }
5586
Vinay Krishna Erannab9295ae2014-05-09 13:43:23 +05305587 status = csrInitChannels(pMac);
5588
Mihir Shetee1093ba2014-01-21 20:13:32 +05305589 return status;
5590}
5591
Mihir Shete04206452014-11-20 17:50:58 +05305592#ifdef CONFIG_ENABLE_LINUX_REG
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305593/*-------------------------------------------------------------------------
5594 \fn sme_InitChannelsForCC
5595
5596 \brief Used to issue regulatory hint to user
5597
5598 \param hHal - global pMac structure
5599
5600 \return eHalStatus SUCCESS.
5601
5602 FAILURE or RESOURCES The API finished and failed.
5603--------------------------------------------------------------------------*/
5604
Agarwal Ashish6db9d532014-09-30 18:19:10 +05305605eHalStatus sme_InitChannelsForCC(tHalHandle hHal, driver_load_type init)
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305606{
5607 eHalStatus status = eHAL_STATUS_FAILURE;
5608 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5609
5610 if (NULL == pMac)
5611 {
5612 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5613 "%s: pMac is null", __func__);
5614 return status;
5615 }
Agarwal Ashish6db9d532014-09-30 18:19:10 +05305616 status = csrInitChannelsForCC(pMac, init);
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305617
5618 return status;
5619}
Mihir Shete04206452014-11-20 17:50:58 +05305620#endif
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305621
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305622/* ---------------------------------------------------------------------------
5623
5624 \fn sme_DHCPStartInd
5625
5626 \brief API to signal the FW about the DHCP Start event.
5627
5628 \param hHal - HAL handle for device.
5629
5630 \param device_mode - mode(AP,SAP etc) of the device.
5631
5632 \param macAddr - MAC address of the device.
5633
5634 \return eHalStatus SUCCESS.
5635
5636 FAILURE or RESOURCES The API finished and failed.
5637 --------------------------------------------------------------------------*/
5638eHalStatus sme_DHCPStartInd( tHalHandle hHal,
5639 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305640 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305641{
5642 eHalStatus status;
5643 VOS_STATUS vosStatus;
5644 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5645 vos_msg_t vosMessage;
5646 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305647 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305648
5649 status = sme_AcquireGlobalLock(&pMac->sme);
5650 if ( eHAL_STATUS_SUCCESS == status)
5651 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305652 pSession = CSR_GET_SESSION( pMac, sessionId );
5653
5654 if (!pSession)
5655 {
5656 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5657 sme_ReleaseGlobalLock( &pMac->sme );
5658 return eHAL_STATUS_FAILURE;
5659 }
5660
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305661 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5662 if (NULL == pMsg)
5663 {
5664 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5665 "%s: Not able to allocate memory for dhcp start", __func__);
5666 sme_ReleaseGlobalLock( &pMac->sme );
5667 return eHAL_STATUS_FAILURE;
5668 }
5669 pMsg->msgType = WDA_DHCP_START_IND;
5670 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5671 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305672 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5673 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305674 vosMessage.type = WDA_DHCP_START_IND;
5675 vosMessage.bodyptr = pMsg;
5676 vosMessage.reserved = 0;
5677
5678 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5679 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5680 {
5681 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5682 "%s: Post DHCP Start MSG fail", __func__);
5683 vos_mem_free(pMsg);
5684 status = eHAL_STATUS_FAILURE;
5685 }
5686 sme_ReleaseGlobalLock( &pMac->sme );
5687 }
5688 return (status);
5689}
5690/* ---------------------------------------------------------------------------
5691 \fn sme_DHCPStopInd
5692
5693 \brief API to signal the FW about the DHCP complete event.
5694
5695 \param hHal - HAL handle for device.
5696
5697 \param device_mode - mode(AP, SAP etc) of the device.
5698
5699 \param macAddr - MAC address of the device.
5700
5701 \return eHalStatus SUCCESS.
5702 FAILURE or RESOURCES The API finished and failed.
5703 --------------------------------------------------------------------------*/
5704eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5705 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305706 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305707{
5708 eHalStatus status;
5709 VOS_STATUS vosStatus;
5710 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5711 vos_msg_t vosMessage;
5712 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305713 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305714
5715 status = sme_AcquireGlobalLock(&pMac->sme);
5716 if ( eHAL_STATUS_SUCCESS == status)
5717 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305718 pSession = CSR_GET_SESSION( pMac, sessionId );
5719
5720 if (!pSession)
5721 {
5722 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5723 sme_ReleaseGlobalLock( &pMac->sme );
5724 return eHAL_STATUS_FAILURE;
5725 }
5726
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305727 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5728 if (NULL == pMsg)
5729 {
5730 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5731 "%s: Not able to allocate memory for dhcp stop", __func__);
5732 sme_ReleaseGlobalLock( &pMac->sme );
5733 return eHAL_STATUS_FAILURE;
5734 }
5735
5736 pMsg->msgType = WDA_DHCP_STOP_IND;
5737 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5738 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305739 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5740 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305741
5742 vosMessage.type = WDA_DHCP_STOP_IND;
5743 vosMessage.bodyptr = pMsg;
5744 vosMessage.reserved = 0;
5745
5746 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5747 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5748 {
5749 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5750 "%s: Post DHCP Stop MSG fail", __func__);
5751 vos_mem_free(pMsg);
5752 status = eHAL_STATUS_FAILURE;
5753 }
5754
5755 sme_ReleaseGlobalLock( &pMac->sme );
5756 }
5757 return (status);
5758}
5759
Jeff Johnson295189b2012-06-20 16:38:30 -07005760
5761/* ---------------------------------------------------------------------------
5762 \fn sme_BtcSignalBtEvent
5763 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
5764 BT event type and the current operating mode of Libra (full power,
5765 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
5766 would be employed.
5767 \param hHal - The handle returned by macOpen.
5768 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
5769 Caller owns the memory and is responsible for freeing it.
5770 \return VOS_STATUS
5771 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
5772 if BTC execution mode is set to BTC_WLAN_ONLY
5773 or BTC_PTA_ONLY.
5774 VOS_STATUS_SUCCESS BT Event passed to HAL
5775 ---------------------------------------------------------------------------*/
5776VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
5777{
5778 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005779
Jeff Johnson295189b2012-06-20 16:38:30 -07005780#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5781 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5782
Katya Nigambcb705f2013-12-26 14:26:22 +05305783 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005784 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005785 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5786 {
5787 status = btcSignalBTEvent (hHal, pBtEvent);
5788 sme_ReleaseGlobalLock( &pMac->sme );
5789 }
5790#endif
5791 return (status);
5792}
5793
5794/* ---------------------------------------------------------------------------
5795 \fn sme_BtcSetConfig
5796 \brief API to change the current Bluetooth Coexistence (BTC) configuration
5797 This function should be invoked only after CFG download has completed.
5798 Calling it after sme_HDDReadyInd is recommended.
5799 \param hHal - The handle returned by macOpen.
5800 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
5801 Caller owns the memory and is responsible for freeing it.
5802 \return VOS_STATUS
5803 VOS_STATUS_E_FAILURE Config not passed to HAL.
5804 VOS_STATUS_SUCCESS Config passed to HAL
5805 ---------------------------------------------------------------------------*/
5806VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5807{
5808 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5809#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5810 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305811 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005812 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005813 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5814 {
5815 status = btcSetConfig (hHal, pSmeBtcConfig);
5816 sme_ReleaseGlobalLock( &pMac->sme );
5817 }
5818#endif
5819 return (status);
5820}
5821
5822/* ---------------------------------------------------------------------------
5823 \fn sme_BtcGetConfig
5824 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
5825 \param hHal - The handle returned by macOpen.
5826 \param pSmeBtcConfig - Pointer to a caller allocated object of type
5827 tSmeBtcConfig. Caller owns the memory and is responsible
5828 for freeing it.
5829 \return VOS_STATUS
5830 VOS_STATUS_E_FAILURE - failure
5831 VOS_STATUS_SUCCESS success
5832 ---------------------------------------------------------------------------*/
5833VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5834{
5835 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5836#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5837 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5838
Katya Nigambcb705f2013-12-26 14:26:22 +05305839 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005840 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005841 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5842 {
5843 status = btcGetConfig (hHal, pSmeBtcConfig);
5844 sme_ReleaseGlobalLock( &pMac->sme );
5845 }
5846#endif
5847 return (status);
5848}
5849/* ---------------------------------------------------------------------------
5850 \fn sme_SetCfgPrivacy
5851 \brief API to set configure privacy parameters
5852 \param hHal - The handle returned by macOpen.
5853 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005854 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07005855
5856 \return void
5857 ---------------------------------------------------------------------------*/
5858void sme_SetCfgPrivacy( tHalHandle hHal,
5859 tCsrRoamProfile *pProfile,
5860 tANI_BOOLEAN fPrivacy
5861 )
5862{
5863 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305864 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005865 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005866 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5867 {
5868 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5869 sme_ReleaseGlobalLock( &pMac->sme );
5870 }
5871}
5872
5873#if defined WLAN_FEATURE_VOWIFI
5874/* ---------------------------------------------------------------------------
5875 \fn sme_NeighborReportRequest
5876 \brief API to request neighbor report.
5877 \param hHal - The handle returned by macOpen.
5878 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5879 tRrmNeighborReq. Caller owns the memory and is responsible
5880 for freeing it.
5881 \return VOS_STATUS
5882 VOS_STATUS_E_FAILURE - failure
5883 VOS_STATUS_SUCCESS success
5884 ---------------------------------------------------------------------------*/
5885VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5886 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5887{
5888 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5889 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305890 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005891 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005892
5893 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5894 {
5895 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5896 sme_ReleaseGlobalLock( &pMac->sme );
5897 }
5898
5899 return (status);
5900}
5901#endif
5902
5903//The following are debug APIs to support direct read/write register/memory
5904//They are placed in SME because HW cannot be access when in LOW_POWER state
5905//AND not connected. The knowledge and synchronization is done in SME
5906
5907//sme_DbgReadRegister
5908//Caller needs to validate the input values
5909VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
5910{
5911 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5912 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005913 tPmcPowerState PowerState;
5914 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05305915 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005916 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005917
5918 /* 1) To make Quarky work in FTM mode **************************************/
5919
5920 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5921 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005922 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005923 {
5924 return VOS_STATUS_SUCCESS;
5925 }
5926 return VOS_STATUS_E_FAILURE;
5927 }
5928
5929 /* 2) NON FTM mode driver *************************************************/
5930
5931 /* Acquire SME global lock */
5932 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5933 {
5934 return VOS_STATUS_E_FAILURE;
5935 }
5936
5937 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5938 {
5939 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5940 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5941 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005942 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005943 {
5944 status = VOS_STATUS_SUCCESS;
5945 }
5946 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005947 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005948 status = VOS_STATUS_E_FAILURE;
5949 }
5950 }
5951 else
5952 {
5953 status = VOS_STATUS_E_FAILURE;
5954 }
5955 }
5956
5957 /* This is a hack for Qualky/pttWniSocket
5958 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5959 if ( VOS_STATUS_SUCCESS != status )
5960 {
5961 *pRegValue = 0xDEADBEEF;
5962 status = VOS_STATUS_SUCCESS;
5963 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005964
Jeff Johnson295189b2012-06-20 16:38:30 -07005965 /* Release SME global lock */
5966 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005967
Jeff Johnson295189b2012-06-20 16:38:30 -07005968 return (status);
5969}
5970
5971
5972//sme_DbgWriteRegister
5973//Caller needs to validate the input values
5974VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
5975{
5976 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5977 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005978 tPmcPowerState PowerState;
5979 tANI_U32 sessionId = 0;
5980
5981 /* 1) To make Quarky work in FTM mode **************************************/
5982
Katya Nigambcb705f2013-12-26 14:26:22 +05305983 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005984 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005985 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5986 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005987 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005988 {
5989 return VOS_STATUS_SUCCESS;
5990 }
5991 return VOS_STATUS_E_FAILURE;
5992 }
5993
5994 /* 2) NON FTM mode driver *************************************************/
5995
5996 /* Acquire SME global lock */
5997 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5998 {
5999 return VOS_STATUS_E_FAILURE;
6000 }
6001
6002 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6003 {
6004 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6005 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6006 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006007 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006008 {
6009 status = VOS_STATUS_SUCCESS;
6010 }
6011 else
6012 {
6013 status = VOS_STATUS_E_FAILURE;
6014 }
6015 }
6016 else
6017 {
6018 status = VOS_STATUS_E_FAILURE;
6019 }
6020 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006021
Jeff Johnson295189b2012-06-20 16:38:30 -07006022 /* Release SME global lock */
6023 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006024
Jeff Johnson295189b2012-06-20 16:38:30 -07006025 return (status);
6026}
6027
6028
6029
6030//sme_DbgReadMemory
6031//Caller needs to validate the input values
6032//pBuf caller allocated buffer has the length of nLen
6033VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6034{
6035 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6036 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07006037 tPmcPowerState PowerState;
6038 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08006039 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
6040 tANI_U32 arg1 = memAddr;
6041 tANI_U32 arg2 = nLen/4;
6042 tANI_U32 arg3 = 4;
6043 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006044 /* 1) To make Quarky work in FTM mode **************************************/
6045
Katya Nigambcb705f2013-12-26 14:26:22 +05306046 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006047 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006048 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6049 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306050 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006051 {
6052 return VOS_STATUS_SUCCESS;
6053 }
6054 return VOS_STATUS_E_FAILURE;
6055 }
6056
6057 /* 2) NON FTM mode driver *************************************************/
6058
6059 /* Acquire SME global lock */
6060 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6061 {
6062 return VOS_STATUS_E_FAILURE;
6063 }
6064
6065 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6066 {
6067 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6068 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6069 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306070 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006071 {
6072 status = VOS_STATUS_SUCCESS;
6073 }
6074 else
6075 {
6076 status = VOS_STATUS_E_FAILURE;
6077 }
6078 }
6079 else
6080 {
6081 status = VOS_STATUS_E_FAILURE;
6082 }
6083 }
6084
6085 /* This is a hack for Qualky/pttWniSocket
6086 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
6087 if (VOS_STATUS_SUCCESS != status)
6088 {
6089 vos_mem_set(pBuf, nLen, 0xCD);
6090 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006091 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006092 }
6093
6094 /* Release SME lock */
6095 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006096
Jeff Johnson295189b2012-06-20 16:38:30 -07006097 return (status);
6098}
6099
6100
6101//sme_DbgWriteMemory
6102//Caller needs to validate the input values
6103VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6104{
6105 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6106 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006107 tPmcPowerState PowerState;
6108 tANI_U32 sessionId = 0;
6109
6110 /* 1) To make Quarky work in FTM mode **************************************/
6111
Katya Nigambcb705f2013-12-26 14:26:22 +05306112 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006113 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006114 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6115 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006116 {
6117 return VOS_STATUS_SUCCESS;
6118 }
6119 return VOS_STATUS_E_FAILURE;
6120 }
6121
6122 /* 2) NON FTM mode driver *************************************************/
6123
6124 /* Acquire SME global lock */
6125 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6126 {
6127 return VOS_STATUS_E_FAILURE;
6128 }
6129
6130 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6131 {
6132 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6133 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6134 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006135 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07006136 {
6137 status = VOS_STATUS_SUCCESS;
6138 }
6139 else
6140 {
6141 status = VOS_STATUS_E_FAILURE;
6142 }
6143 }
6144 else
6145 {
6146 status = VOS_STATUS_E_FAILURE;
6147 }
6148 }
6149
6150 /* Release Global lock */
6151 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006152
Jeff Johnson295189b2012-06-20 16:38:30 -07006153 return (status);
6154}
6155
6156
Katya Nigam70d68332013-09-16 16:49:45 +05306157void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
6158{
6159 VOS_TRACE_LEVEL vosDebugLevel;
6160 char logBuffer[LOG_SIZE];
6161 va_list marker;
6162
6163 /* getting proper Debug level */
6164 vosDebugLevel = getVosDebugLevel(loglevel);
6165
6166 /* extracting arguments from pstring */
6167 va_start( marker, pString );
6168 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
6169
6170 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
6171 va_end( marker );
6172}
6173
6174
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006175void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07006176{
6177#ifdef WLAN_DEBUG
6178 // Verify against current log level
6179 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
6180 return;
6181 else
6182 {
6183 va_list marker;
6184
6185 va_start( marker, pString ); /* Initialize variable arguments. */
6186
6187 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
6188
6189 va_end( marker ); /* Reset variable arguments. */
6190 }
6191#endif
6192}
Jeff Johnson295189b2012-06-20 16:38:30 -07006193
Jeff Johnson295189b2012-06-20 16:38:30 -07006194/* ---------------------------------------------------------------------------
6195 \fn sme_GetWcnssWlanCompiledVersion
6196 \brief This API returns the version of the WCNSS WLAN API with
6197 which the HOST driver was built
6198 \param hHal - The handle returned by macOpen.
6199 \param pVersion - Points to the Version structure to be filled
6200 \return VOS_STATUS
6201 VOS_STATUS_E_INVAL - failure
6202 VOS_STATUS_SUCCESS success
6203 ---------------------------------------------------------------------------*/
6204VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
6205 tSirVersionType *pVersion)
6206{
6207 VOS_STATUS status = VOS_STATUS_SUCCESS;
6208 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6209 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6210
6211 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6212 {
6213 if( pVersion != NULL )
6214 {
6215 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
6216 }
6217 else
6218 {
6219 status = VOS_STATUS_E_INVAL;
6220 }
6221 sme_ReleaseGlobalLock( &pMac->sme );
6222 }
6223
6224 return (status);
6225}
6226
6227
6228/* ---------------------------------------------------------------------------
6229 \fn sme_GetWcnssWlanReportedVersion
6230 \brief This API returns the version of the WCNSS WLAN API with
6231 which the WCNSS driver reports it was built
6232 \param hHal - The handle returned by macOpen.
6233 \param pVersion - Points to the Version structure to be filled
6234 \return VOS_STATUS
6235 VOS_STATUS_E_INVAL - failure
6236 VOS_STATUS_SUCCESS success
6237 ---------------------------------------------------------------------------*/
6238VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
6239 tSirVersionType *pVersion)
6240{
6241 VOS_STATUS status = VOS_STATUS_SUCCESS;
6242 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6243 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6244
6245 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6246 {
6247 if( pVersion != NULL )
6248 {
6249 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
6250 }
6251 else
6252 {
6253 status = VOS_STATUS_E_INVAL;
6254 }
6255 sme_ReleaseGlobalLock( &pMac->sme );
6256 }
6257
6258 return (status);
6259}
6260
6261
6262/* ---------------------------------------------------------------------------
6263 \fn sme_GetWcnssSoftwareVersion
6264 \brief This API returns the version string of the WCNSS driver
6265 \param hHal - The handle returned by macOpen.
6266 \param pVersion - Points to the Version string buffer to be filled
6267 \param versionBufferSize - THe size of the Version string buffer
6268 \return VOS_STATUS
6269 VOS_STATUS_E_INVAL - failure
6270 VOS_STATUS_SUCCESS success
6271 ---------------------------------------------------------------------------*/
6272VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
6273 tANI_U8 *pVersion,
6274 tANI_U32 versionBufferSize)
6275{
6276 VOS_STATUS status = VOS_STATUS_SUCCESS;
6277 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6278 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6279
6280 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6281 {
6282 if( pVersion != NULL )
6283 {
6284 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
6285 versionBufferSize);
6286 }
6287 else
6288 {
6289 status = VOS_STATUS_E_INVAL;
6290 }
6291 sme_ReleaseGlobalLock( &pMac->sme );
6292 }
6293
6294 return (status);
6295}
6296
6297
6298/* ---------------------------------------------------------------------------
6299 \fn sme_GetWcnssHardwareVersion
6300 \brief This API returns the version string of the WCNSS hardware
6301 \param hHal - The handle returned by macOpen.
6302 \param pVersion - Points to the Version string buffer to be filled
6303 \param versionBufferSize - THe size of the Version string buffer
6304 \return VOS_STATUS
6305 VOS_STATUS_E_INVAL - failure
6306 VOS_STATUS_SUCCESS success
6307 ---------------------------------------------------------------------------*/
6308VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
6309 tANI_U8 *pVersion,
6310 tANI_U32 versionBufferSize)
6311{
6312 VOS_STATUS status = VOS_STATUS_SUCCESS;
6313 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6314 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6315
6316 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6317 {
6318 if( pVersion != NULL )
6319 {
6320 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
6321 versionBufferSize);
6322 }
6323 else
6324 {
6325 status = VOS_STATUS_E_INVAL;
6326 }
6327 sme_ReleaseGlobalLock( &pMac->sme );
6328 }
6329
6330 return (status);
6331}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08006332
Jeff Johnson295189b2012-06-20 16:38:30 -07006333
6334#ifdef FEATURE_WLAN_WAPI
6335/* ---------------------------------------------------------------------------
6336 \fn sme_RoamSetBKIDCache
6337 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
6338 candidate list.
6339 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6340 it is opened (by calling halOpen).
6341 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
6342 \param numItems - a variable that has the number of tBkidCacheInfo allocated
6343 when retruning, this is the number of items put into pBKIDCache
6344 \return eHalStatus - when fail, it usually means the buffer allocated is not
6345 big enough and pNumItems has the number of tBkidCacheInfo.
6346 ---------------------------------------------------------------------------*/
6347eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
6348 tANI_U32 numItems )
6349{
6350 eHalStatus status = eHAL_STATUS_FAILURE;
6351 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6352
6353 status = sme_AcquireGlobalLock( &pMac->sme );
6354 if ( HAL_STATUS_SUCCESS( status ) )
6355 {
6356 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
6357 sme_ReleaseGlobalLock( &pMac->sme );
6358 }
6359
6360 return (status);
6361}
6362
6363/* ---------------------------------------------------------------------------
6364 \fn sme_RoamGetBKIDCache
6365 \brief The SME API exposed to HDD to allow HDD to request SME to return its
6366 BKID cache.
6367 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6368 it is opened (by calling halOpen).
6369 \param pNum - caller allocated memory that has the space of the number of
6370 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
6371 in SME cache.
6372 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
6373 upon return
6374 \return eHalStatus - when fail, it usually means the buffer allocated is not
6375 big enough.
6376 ---------------------------------------------------------------------------*/
6377eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
6378 tBkidCacheInfo *pBkidCache)
6379{
6380 eHalStatus status = eHAL_STATUS_FAILURE;
6381 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6382
6383 status = sme_AcquireGlobalLock( &pMac->sme );
6384 if ( HAL_STATUS_SUCCESS( status ) )
6385 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006386 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006387 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
6388 sme_ReleaseGlobalLock( &pMac->sme );
6389 }
6390
6391 return (status);
6392}
6393
6394/* ---------------------------------------------------------------------------
6395 \fn sme_RoamGetNumBKIDCache
6396 \brief The SME API exposed to HDD to allow HDD to request SME to return the
6397 number of BKID cache entries.
6398 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6399 it is opened (by calling halOpen).
6400 \return tANI_U32 - the number of BKID cache entries.
6401 ---------------------------------------------------------------------------*/
6402tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
6403{
6404 eHalStatus status = eHAL_STATUS_FAILURE;
6405 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6406 tANI_U32 numBkidCache = 0;
6407
6408 status = sme_AcquireGlobalLock( &pMac->sme );
6409 if ( HAL_STATUS_SUCCESS( status ) )
6410 {
6411 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
6412 sme_ReleaseGlobalLock( &pMac->sme );
6413 }
6414
6415 return (numBkidCache);
6416}
6417
6418/* ---------------------------------------------------------------------------
6419 \fn sme_ScanGetBKIDCandidateList
6420 \brief a wrapper function to return the BKID candidate list
6421 \param pBkidList - caller allocated buffer point to an array of
6422 tBkidCandidateInfo
6423 \param pNumItems - pointer to a variable that has the number of
6424 tBkidCandidateInfo allocated when retruning, this is
6425 either the number needed or number of items put into
6426 pPmkidList
6427 \return eHalStatus - when fail, it usually means the buffer allocated is not
6428 big enough and pNumItems
6429 has the number of tBkidCandidateInfo.
6430 \Note: pNumItems is a number of tBkidCandidateInfo,
6431 not sizeof(tBkidCandidateInfo) * something
6432 ---------------------------------------------------------------------------*/
6433eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
6434 tBkidCandidateInfo *pBkidList,
6435 tANI_U32 *pNumItems )
6436{
6437 eHalStatus status = eHAL_STATUS_FAILURE;
6438 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6439
6440 status = sme_AcquireGlobalLock( &pMac->sme );
6441 if ( HAL_STATUS_SUCCESS( status ) )
6442 {
6443 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
6444 sme_ReleaseGlobalLock( &pMac->sme );
6445 }
6446
6447 return (status);
6448}
6449#endif /* FEATURE_WLAN_WAPI */
6450
Jeff Johnsone7245742012-09-05 17:12:55 -07006451#ifdef FEATURE_OEM_DATA_SUPPORT
6452
6453/*****************************************************************************
6454 OEM DATA related modifications and function additions
6455 *****************************************************************************/
6456
6457/* ---------------------------------------------------------------------------
6458 \fn sme_getOemDataRsp
6459 \brief a wrapper function to obtain the OEM DATA RSP
6460 \param pOemDataRsp - A pointer to the response object
6461 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006462 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006463 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006464eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006465 tOemDataRsp **pOemDataRsp)
6466{
6467 eHalStatus status = eHAL_STATUS_SUCCESS;
6468 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6469
6470 do
6471 {
6472 //acquire the lock for the sme object
6473 status = sme_AcquireGlobalLock(&pMac->sme);
6474
6475 if(!HAL_STATUS_SUCCESS(status))
6476 {
6477 break;
6478 }
6479
6480 if(pMac->oemData.pOemDataRsp != NULL)
6481 {
6482 *pOemDataRsp = pMac->oemData.pOemDataRsp;
6483 }
6484 else
6485 {
6486 status = eHAL_STATUS_FAILURE;
6487 }
6488
6489 //release the lock for the sme object
6490 sme_ReleaseGlobalLock( &pMac->sme );
6491
6492 } while(0);
6493
6494 return status;
6495}
6496
6497/* ---------------------------------------------------------------------------
6498 \fn sme_OemDataReq
6499 \brief a wrapper function for OEM DATA REQ
6500 \param sessionId - session id to be used.
6501 \param pOemDataReqId - pointer to an object to get back the request ID
6502 \param callback - a callback function that is called upon finish
6503 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006504 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006505 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006506eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006507 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006508 tOemDataReqConfig *pOemDataReqConfig,
6509 tANI_U32 *pOemDataReqID,
6510 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07006511 void *pContext)
6512{
6513 eHalStatus status = eHAL_STATUS_SUCCESS;
6514 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6515
6516 do
6517 {
6518 //acquire the lock for the sme object
6519 status = sme_AcquireGlobalLock(&pMac->sme);
6520 if(HAL_STATUS_SUCCESS(status))
6521 {
6522 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
6523
6524 if(pOemDataReqID)
6525 {
6526 *pOemDataReqID = lOemDataReqId;
6527 }
6528 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006529 {
6530 sme_ReleaseGlobalLock( &pMac->sme );
6531 return eHAL_STATUS_FAILURE;
6532 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006533
6534 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
6535
6536 //release the lock for the sme object
6537 sme_ReleaseGlobalLock( &pMac->sme );
6538 }
6539 } while(0);
6540
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006541 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006542
6543 return(status);
6544}
6545
6546#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006547
6548/*--------------------------------------------------------------------------
6549
6550 \brief sme_OpenSession() - Open a session for scan/roam operation.
6551
6552 This is a synchronous API.
6553
6554
6555 \param hHal - The handle returned by macOpen.
6556 \param callback - A pointer to the function caller specifies for roam/connect status indication
6557 \param pContext - The context passed with callback
6558 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
6559 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
6560
6561 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
6562
6563 Other status means SME is failed to open the session.
6564 eHAL_STATUS_RESOURCES - no more session available.
6565 \sa
6566
6567 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006568eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
6569 void *pContext, tANI_U8 *pSelfMacAddr,
6570 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006571{
6572 eHalStatus status;
6573 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6574
6575 if( NULL == pbSessionId )
6576 {
6577 status = eHAL_STATUS_INVALID_PARAMETER;
6578 }
6579 else
6580 {
6581 status = sme_AcquireGlobalLock( &pMac->sme );
6582 if ( HAL_STATUS_SUCCESS( status ) )
6583 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006584 status = csrRoamOpenSession(pMac, callback, pContext,
6585 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006586
6587 sme_ReleaseGlobalLock( &pMac->sme );
6588 }
6589 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006590 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05306591 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006592 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006593
6594 return ( status );
6595}
6596
6597
6598/*--------------------------------------------------------------------------
6599
6600 \brief sme_CloseSession() - Open a session for scan/roam operation.
6601
6602 This is a synchronous API.
6603
6604
6605 \param hHal - The handle returned by macOpen.
6606
6607 \param sessionId - A previous opened session's ID.
6608
6609 \return eHAL_STATUS_SUCCESS - session is closed.
6610
6611 Other status means SME is failed to open the session.
6612 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
6613 \sa
6614
6615 --------------------------------------------------------------------------*/
6616eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
6617 csrRoamSessionCloseCallback callback, void *pContext)
6618{
6619 eHalStatus status;
6620 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6621
Katya Nigambcb705f2013-12-26 14:26:22 +05306622 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006623 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006624 status = sme_AcquireGlobalLock( &pMac->sme );
6625 if ( HAL_STATUS_SUCCESS( status ) )
6626 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006627 status = csrRoamCloseSession( pMac, sessionId, FALSE,
Jeff Johnson295189b2012-06-20 16:38:30 -07006628 callback, pContext );
6629
6630 sme_ReleaseGlobalLock( &pMac->sme );
6631 }
6632
6633 return ( status );
6634}
6635
Jeff Johnson295189b2012-06-20 16:38:30 -07006636/* ---------------------------------------------------------------------------
6637
6638 \fn sme_RoamUpdateAPWPSIE
6639
6640 \brief To update AP's WPS IE. This function should be called after SME AP session is created
6641 This is an asynchronous API.
6642
6643 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
6644
6645 \return eHalStatus – SUCCESS –
6646
6647 FAILURE or RESOURCES – The API finished and failed.
6648
6649 -------------------------------------------------------------------------------*/
6650eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
6651{
6652
6653 eHalStatus status = eHAL_STATUS_FAILURE;
6654 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6655
6656 status = sme_AcquireGlobalLock( &pMac->sme );
6657 if ( HAL_STATUS_SUCCESS( status ) )
6658 {
6659
6660 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
6661
6662 sme_ReleaseGlobalLock( &pMac->sme );
6663 }
6664
6665 return (status);
6666}
6667/* ---------------------------------------------------------------------------
6668
6669 \fn sme_RoamUpdateAPWPARSNIEs
6670
6671 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
6672 This is an asynchronous API.
6673
6674 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
6675
6676 \return eHalStatus – SUCCESS –
6677
6678 FAILURE or RESOURCES – The API finished and failed.
6679
6680 -------------------------------------------------------------------------------*/
6681eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
6682{
6683
6684 eHalStatus status = eHAL_STATUS_FAILURE;
6685 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6686
6687 status = sme_AcquireGlobalLock( &pMac->sme );
6688 if ( HAL_STATUS_SUCCESS( status ) )
6689 {
6690
6691 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
6692
6693 sme_ReleaseGlobalLock( &pMac->sme );
6694 }
6695
6696 return (status);
6697}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006698/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006699
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006700 \fn sme_ChangeMCCBeaconInterval
6701
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006702 \brief To update P2P-GO beaconInterval. This function should be called after
6703 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006704 This is an asynchronous API.
6705
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006706 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006707
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006708 \return eHalStatus SUCCESS
6709 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006710 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006711
6712 -------------------------------------------------------------------------------*/
6713eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
6714{
6715 eHalStatus status = eHAL_STATUS_FAILURE;
6716 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6717
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006718 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006719 status = sme_AcquireGlobalLock( &pMac->sme );
6720 if ( HAL_STATUS_SUCCESS( status ) )
6721 {
6722 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
6723 sme_ReleaseGlobalLock( &pMac->sme );
6724 }
6725 return (status);
6726}
Jeff Johnson295189b2012-06-20 16:38:30 -07006727
6728/*-------------------------------------------------------------------------------*
6729
6730 \fn sme_sendBTAmpEvent
6731
6732 \brief to receive the coex priorty request from BT-AMP PAL
6733 and send the BT_AMP link state to HAL
6734
6735 \param btAmpEvent - btAmpEvent
6736
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08006737 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07006738
6739 FAILURE: API failed
6740
6741-------------------------------------------------------------------------------*/
6742
6743eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
6744{
6745 vos_msg_t msg;
6746 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
6747 eHalStatus status = eHAL_STATUS_FAILURE;
6748
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08006749 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07006750 if (NULL == ptrSmeBtAmpEvent)
6751 {
6752 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006753 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006754 return status;
6755 }
6756
6757 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
6758 msg.type = WDA_SIGNAL_BTAMP_EVENT;
6759 msg.reserved = 0;
6760 msg.bodyptr = ptrSmeBtAmpEvent;
6761
6762 //status = halFW_SendBTAmpEventMesg(pMac, event);
6763
6764 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6765 {
6766 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006767 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006768 vos_mem_free(ptrSmeBtAmpEvent);
6769 return status;
6770 }
6771
6772 return eHAL_STATUS_SUCCESS;
6773
6774}
6775
6776/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306777 \fn smeIssueFastRoamNeighborAPEvent
6778 \brief API to trigger fast BSS roam independent of RSSI triggers
6779 \param hHal - The handle returned by macOpen.
6780 \param bssid - Pointer to the BSSID to roam to.
6781 \param fastRoamTrig - Trigger to Scan or roam
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306782 \param channel - channel number on which fastroam is requested
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306783 \return eHalStatus
6784 ---------------------------------------------------------------------------*/
6785eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
6786 tANI_U8 *bssid,
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306787 tSmeFastRoamTrigger fastRoamTrig,
6788 tANI_U8 channel)
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306789{
6790 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6791 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
6792 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6793 eHalStatus status = eHAL_STATUS_SUCCESS;
6794
6795 status = sme_AcquireGlobalLock( &pMac->sme );
6796 if ( HAL_STATUS_SUCCESS( status ) )
6797 {
6798 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6799 "%s: invoked", __func__);
6800
6801 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
6802 {
6803 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
6804 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
6805 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6806 (void *)bssid, sizeof(tSirMacAddr));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306807 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID"
Arif Hussaina7c8e412013-11-20 11:06:42 -08006808 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306809 /*
6810 * As FastReassoc is based on assumption that roamable AP should be
6811 * present into the occupied channel list.We shd add i/p channel
6812 * in occupied channel list if roamable-ap(BSSID in fastreassoc cmd)
6813 * aged out prior to connection and there is no scan from aged out
6814 * to till connection indication.
6815 */
6816 csrAddChannelToOccupiedChannelList(pMac, channel);
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306817 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
6818 if (VOS_STATUS_SUCCESS != vosStatus)
6819 {
6820 smsLog(pMac, LOGE,
6821 FL("CFG Channel list scan state failed with status %d "),
6822 vosStatus);
6823 }
6824 }
6825 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
6826 {
6827 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6828 (void *)bssid, sizeof(tSirMacAddr));
6829 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08006830 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
6831 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306832
6833 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
6834 0,
6835 pMac,
6836 0);
6837
6838 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6839 {
6840 smsLog(pMac,
6841 LOGE,
6842 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
6843 vosStatus);
6844 }
6845 }
6846 sme_ReleaseGlobalLock( &pMac->sme );
6847 }
6848 return vosStatus;
6849}
6850/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006851 \fn sme_SetHostOffload
6852 \brief API to set the host offload feature.
6853 \param hHal - The handle returned by macOpen.
6854 \param pRequest - Pointer to the offload request.
6855 \return eHalStatus
6856 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006857eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006858 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006859{
6860 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07006861 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006862
Katya Nigambcb705f2013-12-26 14:26:22 +05306863 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006864 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006865 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6866 {
6867#ifdef WLAN_NS_OFFLOAD
6868 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
6869 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006870 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006871 }
6872 else
6873#endif //WLAN_NS_OFFLOAD
6874 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006875 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006876 }
6877 sme_ReleaseGlobalLock( &pMac->sme );
6878 }
6879
6880 return (status);
6881}
6882
6883#ifdef WLAN_FEATURE_GTK_OFFLOAD
6884/* ---------------------------------------------------------------------------
6885 \fn sme_SetGTKOffload
6886 \brief API to set GTK offload information.
6887 \param hHal - The handle returned by macOpen.
6888 \param pRequest - Pointer to the GTK offload request.
6889 \return eHalStatus
6890 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006891eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006892 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006893{
6894 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6895 eHalStatus status;
6896
Katya Nigambcb705f2013-12-26 14:26:22 +05306897 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006898 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006899 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6900 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006901 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006902 sme_ReleaseGlobalLock( &pMac->sme );
6903 }
6904
6905 return (status);
6906}
6907
6908/* ---------------------------------------------------------------------------
6909 \fn sme_GetGTKOffload
6910 \brief API to get GTK offload information.
6911 \param hHal - The handle returned by macOpen.
6912 \param pRequest - Pointer to the GTK offload response.
6913 \return eHalStatus
6914 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006915eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006916 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07006917{
6918 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6919 eHalStatus status;
6920
Katya Nigambcb705f2013-12-26 14:26:22 +05306921 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006922 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006923 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6924 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006925 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006926 sme_ReleaseGlobalLock( &pMac->sme );
6927 }
6928
6929 return (status);
6930}
6931#endif // WLAN_FEATURE_GTK_OFFLOAD
6932
6933/* ---------------------------------------------------------------------------
6934 \fn sme_SetKeepAlive
6935 \brief API to set the Keep Alive feature.
6936 \param hHal - The handle returned by macOpen.
6937 \param pRequest - Pointer to the Keep Alive request.
6938 \return eHalStatus
6939 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006940eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006941 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006942{
6943 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6944 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07006945 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6946 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006947 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006948 sme_ReleaseGlobalLock( &pMac->sme );
6949 }
6950
6951 return (status);
6952}
6953
6954#ifdef FEATURE_WLAN_SCAN_PNO
6955/* ---------------------------------------------------------------------------
6956 \fn sme_SetPreferredNetworkList
6957 \brief API to set the Preferred Network List Offload feature.
6958 \param hHal - The handle returned by macOpen.
6959 \param pRequest - Pointer to the offload request.
6960 \return eHalStatus
6961 ---------------------------------------------------------------------------*/
6962eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
6963{
6964 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6965 eHalStatus status;
6966
6967 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6968 {
6969 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
6970 sme_ReleaseGlobalLock( &pMac->sme );
6971 }
6972
6973 return (status);
6974}
6975
6976eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
6977{
6978 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6979 eHalStatus status;
6980
6981 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6982 {
6983 pmcSetRssiFilter(hHal, rssiThreshold);
6984 sme_ReleaseGlobalLock( &pMac->sme );
6985 }
6986
6987 return (status);
6988}
6989
6990#endif // FEATURE_WLAN_SCAN_PNO
6991
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006992eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07006993{
6994 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6995 eHalStatus status;
6996
Katya Nigambcb705f2013-12-26 14:26:22 +05306997 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006998 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006999 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7000 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08007001 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07007002 sme_ReleaseGlobalLock( &pMac->sme );
7003 }
7004
7005 return (status);
7006}
7007
7008/* ---------------------------------------------------------------------------
7009 \fn sme_AbortMacScan
7010 \brief API to cancel MAC scan.
7011 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05307012 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05307013 \param reason - Reason to abort the scan.
c_hpothua3d45d52015-01-05 14:11:17 +05307014 \return tSirAbortScanStatus Abort scan status
Jeff Johnson295189b2012-06-20 16:38:30 -07007015 ---------------------------------------------------------------------------*/
c_hpothua3d45d52015-01-05 14:11:17 +05307016tSirAbortScanStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
7017 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07007018{
c_hpothua3d45d52015-01-05 14:11:17 +05307019 tSirAbortScanStatus scanAbortStatus = eSIR_ABORT_SCAN_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007020 eHalStatus status;
7021 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7022
Katya Nigambcb705f2013-12-26 14:26:22 +05307023 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007024 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007025 status = sme_AcquireGlobalLock( &pMac->sme );
7026 if ( HAL_STATUS_SUCCESS( status ) )
7027 {
c_hpothua3d45d52015-01-05 14:11:17 +05307028 scanAbortStatus = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007029
Jeff Johnson295189b2012-06-20 16:38:30 -07007030 sme_ReleaseGlobalLock( &pMac->sme );
7031 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007032
c_hpothua3d45d52015-01-05 14:11:17 +05307033 return ( scanAbortStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07007034}
7035
7036/* ----------------------------------------------------------------------------
7037 \fn sme_GetOperationChannel
7038 \brief API to get current channel on which STA is parked
7039 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007040 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07007041 \returns eHAL_STATUS_SUCCESS
7042 eHAL_STATUS_FAILURE
7043-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007044eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007045{
Jeff Johnson295189b2012-06-20 16:38:30 -07007046 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7047 tCsrRoamSession *pSession;
7048
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007049 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07007050 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007051 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007052
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007053 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007054 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007055 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007056 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
7057 {
7058 *pChannel =pSession->connectedProfile.operationChannel;
7059 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007060 }
7061 }
7062 return eHAL_STATUS_FAILURE;
7063}// sme_GetOperationChannel ends here
7064
Jeff Johnson295189b2012-06-20 16:38:30 -07007065/* ---------------------------------------------------------------------------
7066
7067 \fn sme_RegisterMgtFrame
7068
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007069 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007070 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007071 \param matchData - data which needs to be matched before passing frame
7072 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007073 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007074 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007075 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007076eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007077 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7078{
7079 eHalStatus status = eHAL_STATUS_SUCCESS;
7080 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7081
Katya Nigambcb705f2013-12-26 14:26:22 +05307082 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007083 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007084 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7085 {
7086 tSirRegisterMgmtFrame *pMsg;
7087 tANI_U16 len;
7088 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007089
7090 if(!pSession)
7091 {
7092 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007093 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007094 return eHAL_STATUS_FAILURE;
7095 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007096
Jeff Johnson295189b2012-06-20 16:38:30 -07007097 if( !pSession->sessionActive )
7098 {
7099 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007100 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007101 sme_ReleaseGlobalLock( &pMac->sme );
7102 return eHAL_STATUS_FAILURE;
7103 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007104
Jeff Johnson295189b2012-06-20 16:38:30 -07007105 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7106
Kiet Lam64c1b492013-07-12 13:56:44 +05307107 pMsg = vos_mem_malloc(len);
7108 if ( NULL == pMsg )
7109 status = eHAL_STATUS_FAILURE;
7110 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007111 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307112 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007113 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
7114 pMsg->length = len;
7115 pMsg->sessionId = sessionId;
7116 pMsg->registerFrame = VOS_TRUE;
7117 pMsg->frameType = frameType;
7118 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307119 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007120 status = palSendMBMessage(pMac->hHdd, pMsg);
7121 }
7122 sme_ReleaseGlobalLock( &pMac->sme );
7123 }
7124 return status;
7125}
7126
7127/* ---------------------------------------------------------------------------
7128
7129 \fn sme_DeregisterMgtFrame
7130
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007131 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007132 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007133 \param matchData - data which needs to be matched before passing frame
7134 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007135 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007136 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007137 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007138eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007139 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7140{
7141 eHalStatus status = eHAL_STATUS_SUCCESS;
7142 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7143
Katya Nigambcb705f2013-12-26 14:26:22 +05307144 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007145 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007146 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7147 {
7148 tSirRegisterMgmtFrame *pMsg;
7149 tANI_U16 len;
7150 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007151
7152 if(!pSession)
7153 {
7154 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007155 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007156 return eHAL_STATUS_FAILURE;
7157 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007158
7159 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07007160 {
7161 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007162 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007163 sme_ReleaseGlobalLock( &pMac->sme );
7164 return eHAL_STATUS_FAILURE;
7165 }
7166
7167 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7168
Kiet Lam64c1b492013-07-12 13:56:44 +05307169 pMsg = vos_mem_malloc(len);
7170 if ( NULL == pMsg )
7171 status = eHAL_STATUS_FAILURE;
7172 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007173 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307174 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007175 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007176 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07007177 pMsg->registerFrame = VOS_FALSE;
7178 pMsg->frameType = frameType;
7179 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307180 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007181 status = palSendMBMessage(pMac->hHdd, pMsg);
7182 }
7183 sme_ReleaseGlobalLock( &pMac->sme );
7184 }
7185 return status;
7186}
7187
7188/* ---------------------------------------------------------------------------
7189 \fn sme_RemainOnChannel
7190 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
7191 \param hHal - The handle returned by macOpen.
7192 \param pRequest - channel
7193 \param duration - duration in ms
7194 \param callback - HDD registered callback to process reaminOnChannelRsp
7195 \param context - HDD Callback param
7196 \return eHalStatus
7197 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07007198eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
7199 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307200 remainOnChanCallback callback,
7201 void *pContext,
7202 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07007203{
7204 eHalStatus status = eHAL_STATUS_SUCCESS;
7205 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7206
Katya Nigambcb705f2013-12-26 14:26:22 +05307207 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007208 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007209 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7210 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307211 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
7212 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07007213#ifdef WLAN_FEATURE_P2P_INTERNAL
7214 , eP2PRemainOnChnReasonUnknown
7215#endif
7216 );
7217 sme_ReleaseGlobalLock( &pMac->sme );
7218 }
7219 return(status);
7220}
7221
7222/* ---------------------------------------------------------------------------
7223 \fn sme_ReportProbeReq
7224 \brief API to enable/disable forwarding of probeReq to apps in p2p.
7225 \param hHal - The handle returned by macOpen.
7226 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
7227 \return eHalStatus
7228 ---------------------------------------------------------------------------*/
7229
7230#ifndef WLAN_FEATURE_CONCURRENT_P2P
7231eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
7232{
7233 eHalStatus status = eHAL_STATUS_SUCCESS;
7234 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7235
7236 do
7237 {
7238 //acquire the lock for the sme object
7239 status = sme_AcquireGlobalLock(&pMac->sme);
7240 if(HAL_STATUS_SUCCESS(status))
7241 {
7242 /* call set in context */
7243 pMac->p2pContext.probeReqForwarding = flag;
7244 //release the lock for the sme object
7245 sme_ReleaseGlobalLock( &pMac->sme );
7246 }
7247 } while(0);
7248
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007249 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007250
7251 return(status);
7252}
7253
7254/* ---------------------------------------------------------------------------
7255 \fn sme_updateP2pIe
7256 \brief API to set the P2p Ie in p2p context
7257 \param hHal - The handle returned by macOpen.
7258 \param p2pIe - Ptr to p2pIe from HDD.
7259 \param p2pIeLength: length of p2pIe
7260 \return eHalStatus
7261 ---------------------------------------------------------------------------*/
7262
7263eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
7264{
7265 eHalStatus status = eHAL_STATUS_SUCCESS;
7266 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7267
7268 //acquire the lock for the sme object
7269 status = sme_AcquireGlobalLock(&pMac->sme);
7270 if(HAL_STATUS_SUCCESS(status))
7271 {
7272 if(NULL != pMac->p2pContext.probeRspIe){
7273 vos_mem_free(pMac->p2pContext.probeRspIe);
7274 pMac->p2pContext.probeRspIeLength = 0;
7275 }
7276
7277 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
7278 if (NULL == pMac->p2pContext.probeRspIe)
7279 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007280 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007281 pMac->p2pContext.probeRspIeLength = 0;
7282 status = eHAL_STATUS_FAILURE;
7283 }
7284 else
7285 {
7286 pMac->p2pContext.probeRspIeLength = p2pIeLength;
7287
7288 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
7289 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007290 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07007291 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
7292 p2pIeLength);
7293 }
7294
7295 //release the lock for the sme object
7296 sme_ReleaseGlobalLock( &pMac->sme );
7297 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007298
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007299 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007300
7301 return(status);
7302}
7303#endif
7304
7305/* ---------------------------------------------------------------------------
7306 \fn sme_sendAction
7307 \brief API to send action frame from supplicant.
7308 \param hHal - The handle returned by macOpen.
7309 \return eHalStatus
7310 ---------------------------------------------------------------------------*/
7311
7312eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007313 const tANI_U8 *pBuf, tANI_U32 len,
7314 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07007315{
7316 eHalStatus status = eHAL_STATUS_SUCCESS;
7317 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7318
Katya Nigambcb705f2013-12-26 14:26:22 +05307319 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007320 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007321 //acquire the lock for the sme object
7322 status = sme_AcquireGlobalLock(&pMac->sme);
7323 if(HAL_STATUS_SUCCESS(status))
7324 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007325 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07007326 //release the lock for the sme object
7327 sme_ReleaseGlobalLock( &pMac->sme );
7328 }
7329
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007330 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007331
7332 return(status);
7333}
7334
7335eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
7336{
7337 eHalStatus status = eHAL_STATUS_SUCCESS;
7338 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7339
Katya Nigambcb705f2013-12-26 14:26:22 +05307340 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007341 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007342 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7343 {
7344 status = p2pCancelRemainOnChannel (hHal, sessionId);
7345 sme_ReleaseGlobalLock( &pMac->sme );
7346 }
7347 return(status);
7348}
7349
7350//Power Save Related
7351eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
7352{
7353 eHalStatus status = eHAL_STATUS_SUCCESS;
7354 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7355
7356 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7357 {
7358 status = p2pSetPs (hHal, data);
7359 sme_ReleaseGlobalLock( &pMac->sme );
7360 }
7361 return(status);
7362}
7363
Jeff Johnson295189b2012-06-20 16:38:30 -07007364
7365/* ---------------------------------------------------------------------------
7366
7367 \fn sme_ConfigureRxpFilter
7368
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007369 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07007370 SME will pass this request to lower mac to set/reset the filter on RXP for
7371 multicast & broadcast traffic.
7372
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007373 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007374
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007375 hHal - The handle returned by macOpen.
7376
Jeff Johnson295189b2012-06-20 16:38:30 -07007377 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
7378 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
7379 on this param. In future we can use this as a mask to set various types of
7380 filters as suggested below:
7381 FILTER_ALL_MULTICAST:
7382 FILTER_ALL_BROADCAST:
7383 FILTER_ALL_MULTICAST_BROADCAST:
7384
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007385
7386 \return eHalStatus
7387
7388
Jeff Johnson295189b2012-06-20 16:38:30 -07007389--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007390eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007391 tpSirWlanSetRxpFilters wlanRxpFilterParam)
7392{
7393 eHalStatus status = eHAL_STATUS_SUCCESS;
7394 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7395 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7396 vos_msg_t vosMessage;
7397
Katya Nigambcb705f2013-12-26 14:26:22 +05307398 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007399 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007400 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7401 {
7402 /* serialize the req through MC thread */
7403 vosMessage.bodyptr = wlanRxpFilterParam;
7404 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
7405 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7406 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7407 {
7408 status = eHAL_STATUS_FAILURE;
7409 }
7410 sme_ReleaseGlobalLock( &pMac->sme );
7411 }
7412 return(status);
7413}
7414
Jeff Johnson295189b2012-06-20 16:38:30 -07007415/* ---------------------------------------------------------------------------
7416
7417 \fn sme_ConfigureSuspendInd
7418
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007419 \brief
7420 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007421 be suspended
7422
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007423 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007424
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007425 hHal - The handle returned by macOpen.
7426
Jeff Johnson295189b2012-06-20 16:38:30 -07007427 wlanSuspendParam- Depicts the wlan suspend params
7428
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007429
7430 \return eHalStatus
7431
7432
Jeff Johnson295189b2012-06-20 16:38:30 -07007433--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007434eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007435 tpSirWlanSuspendParam wlanSuspendParam)
7436{
7437 eHalStatus status = eHAL_STATUS_SUCCESS;
7438 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7439 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7440 vos_msg_t vosMessage;
7441
Katya Nigambcb705f2013-12-26 14:26:22 +05307442 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007443 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007444 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7445 {
7446 /* serialize the req through MC thread */
7447 vosMessage.bodyptr = wlanSuspendParam;
7448 vosMessage.type = WDA_WLAN_SUSPEND_IND;
7449 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7450 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7451 {
7452 status = eHAL_STATUS_FAILURE;
7453 }
7454 sme_ReleaseGlobalLock( &pMac->sme );
7455 }
7456 return(status);
7457}
7458
7459/* ---------------------------------------------------------------------------
7460
7461 \fn sme_ConfigureResumeReq
7462
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007463 \brief
7464 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007465 be Resumed
7466
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007467 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007468
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007469 hHal - The handle returned by macOpen.
7470
Jeff Johnson295189b2012-06-20 16:38:30 -07007471 wlanResumeParam- Depicts the wlan resume params
7472
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007473
7474 \return eHalStatus
7475
7476
Jeff Johnson295189b2012-06-20 16:38:30 -07007477--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007478eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007479 tpSirWlanResumeParam wlanResumeParam)
7480{
7481 eHalStatus status = eHAL_STATUS_SUCCESS;
7482 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7483 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7484 vos_msg_t vosMessage;
7485
Katya Nigambcb705f2013-12-26 14:26:22 +05307486 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007487 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007488 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7489 {
7490 /* serialize the req through MC thread */
7491 vosMessage.bodyptr = wlanResumeParam;
7492 vosMessage.type = WDA_WLAN_RESUME_REQ;
7493 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7494 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7495 {
7496 status = eHAL_STATUS_FAILURE;
7497 }
7498 sme_ReleaseGlobalLock( &pMac->sme );
7499 }
7500 return(status);
7501}
7502
Jeff Johnson295189b2012-06-20 16:38:30 -07007503/* ---------------------------------------------------------------------------
7504
7505 \fn sme_GetInfraSessionId
7506
7507 \brief To get the session ID for infra session, if connected
7508 This is a synchronous API.
7509
7510 \param hHal - The handle returned by macOpen.
7511
7512 \return sessionid, -1 if infra session is not connected
7513
7514 -------------------------------------------------------------------------------*/
7515tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
7516{
7517 eHalStatus status = eHAL_STATUS_FAILURE;
7518 tANI_S8 sessionid = -1;
7519 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007520
Jeff Johnson295189b2012-06-20 16:38:30 -07007521 status = sme_AcquireGlobalLock( &pMac->sme );
7522 if ( HAL_STATUS_SUCCESS( status ) )
7523 {
7524
7525 sessionid = csrGetInfraSessionId( pMac);
7526
7527 sme_ReleaseGlobalLock( &pMac->sme );
7528 }
7529
7530 return (sessionid);
7531}
7532
7533/* ---------------------------------------------------------------------------
7534
7535 \fn sme_GetInfraOperationChannel
7536
7537 \brief To get the operating channel for infra session, if connected
7538 This is a synchronous API.
7539
7540 \param hHal - The handle returned by macOpen.
7541 \param sessionId - the sessionId returned by sme_OpenSession.
7542
7543 \return operating channel, 0 if infra session is not connected
7544
7545 -------------------------------------------------------------------------------*/
7546tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
7547{
7548 eHalStatus status = eHAL_STATUS_FAILURE;
7549 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7550 tANI_U8 channel = 0;
7551 status = sme_AcquireGlobalLock( &pMac->sme );
7552 if ( HAL_STATUS_SUCCESS( status ) )
7553 {
7554
7555 channel = csrGetInfraOperationChannel( pMac, sessionId);
7556
7557 sme_ReleaseGlobalLock( &pMac->sme );
7558 }
7559
7560 return (channel);
7561}
7562
7563//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 -07007564//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07007565tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
7566{
7567 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007568 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07007569 tANI_U8 channel = 0;
7570 status = sme_AcquireGlobalLock( &pMac->sme );
7571 if ( HAL_STATUS_SUCCESS( status ) )
7572 {
7573
7574 channel = csrGetConcurrentOperationChannel( pMac );
7575 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007576 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07007577 sme_ReleaseGlobalLock( &pMac->sme );
7578 }
7579
7580 return (channel);
7581}
7582
7583#ifdef FEATURE_WLAN_SCAN_PNO
7584/******************************************************************************
7585*
7586* Name: sme_PreferredNetworkFoundInd
7587*
7588* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007589* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07007590*
7591* Parameters:
7592* hHal - HAL handle for device
7593* pMsg - found network description
7594*
7595* Returns: eHalStatus
7596*
7597******************************************************************************/
7598eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
7599{
7600 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7601 eHalStatus status = eHAL_STATUS_SUCCESS;
7602 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07007603 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
7604 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007605
7606 if (NULL == pMsg)
7607 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007608 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007609 status = eHAL_STATUS_FAILURE;
7610 }
7611 else
7612 {
7613 if (pPrefNetworkFoundInd->ssId.length > 0)
7614 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07007615 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
7616 pPrefNetworkFoundInd->ssId.length);
7617 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
7618 dumpSsId[ssIdLength] = 0;
Abhishek Singh195c03e2014-05-14 17:21:30 +05307619 smsLog(pMac, LOG1, FL(" SSID=%s frame length %d"),
7620 dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07007621
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05307622 /* Flush scan results, So as to avoid indication/updation of
7623 * stale entries, which may not have aged out during APPS collapse
7624 */
7625 sme_ScanFlushResult(hHal,0);
7626
Srikant Kuppa066904f2013-05-07 13:56:02 -07007627 //Save the frame to scan result
7628 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
7629 {
7630 //we may have a frame
7631 status = csrScanSavePreferredNetworkFound(pMac,
7632 pPrefNetworkFoundInd);
7633 if (!HAL_STATUS_SUCCESS(status))
7634 {
7635 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
7636 }
7637 }
7638 else
7639 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08007640 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07007641 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07007642 }
7643
Srikant Kuppa066904f2013-05-07 13:56:02 -07007644 /* Call Preferred Netowrk Found Indication callback routine. */
7645 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
7646 {
7647 pMac->pmc.prefNetwFoundCB(
7648 pMac->pmc.preferredNetworkFoundIndCallbackContext,
7649 pPrefNetworkFoundInd);
7650 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007651 }
7652 else
7653 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007654 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007655 status = eHAL_STATUS_FAILURE;
7656 }
7657 }
7658
7659
7660 return(status);
7661}
7662
7663#endif // FEATURE_WLAN_SCAN_PNO
7664
7665
7666eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
7667{
7668 eHalStatus status = eHAL_STATUS_FAILURE;
7669 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007670
Jeff Johnson295189b2012-06-20 16:38:30 -07007671 status = sme_AcquireGlobalLock( &pMac->sme );
7672 if ( HAL_STATUS_SUCCESS( status ) )
7673 {
7674 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
7675 sme_ReleaseGlobalLock( &pMac->sme );
7676 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007677
Jeff Johnson295189b2012-06-20 16:38:30 -07007678 return (status);
7679}
7680
7681
7682/* ---------------------------------------------------------------------------
7683
7684 \fn sme_SetTxPerTracking
7685
7686 \brief Set Tx PER tracking configuration parameters
7687
7688 \param hHal - The handle returned by macOpen.
7689 \param pTxPerTrackingConf - Tx PER configuration parameters
7690
7691 \return eHalStatus
7692
7693 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007694eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
7695 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07007696 void *pCallbackContext,
7697 tpSirTxPerTrackingParam pTxPerTrackingParam)
7698{
7699 vos_msg_t msg;
7700 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
7701 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7702
7703 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7704 {
7705 pMac->sme.pTxPerHitCallback = pCallbackfn;
7706 pMac->sme.pTxPerHitCbContext = pCallbackContext;
7707 sme_ReleaseGlobalLock( &pMac->sme );
7708 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007709
Jeff Johnson295189b2012-06-20 16:38:30 -07007710 // free this memory in failure case or WDA request callback function
7711 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
7712 if (NULL == pTxPerTrackingParamReq)
7713 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007714 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 -07007715 return eHAL_STATUS_FAILURE;
7716 }
7717
Kiet Lam64c1b492013-07-12 13:56:44 +05307718 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
7719 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07007720 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
7721 msg.reserved = 0;
7722 msg.bodyptr = pTxPerTrackingParamReq;
7723
7724 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7725 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007726 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 -07007727 vos_mem_free(pTxPerTrackingParamReq);
7728 return eHAL_STATUS_FAILURE;
7729 }
7730
7731 return eHAL_STATUS_SUCCESS;
7732}
7733
7734/* ---------------------------------------------------------------------------
7735
7736 \fn sme_HandleChangeCountryCode
7737
7738 \brief Change Country code, Reg Domain and channel list
7739
7740 \details Country Code Priority
7741 0 = 11D > Configured Country > NV
7742 1 = Configured Country > 11D > NV
7743 If Supplicant country code is priority than 11d is disabled.
7744 If 11D is enabled, we update the country code after every scan.
7745 Hence when Supplicant country code is priority, we don't need 11D info.
7746 Country code from Supplicant is set as current courtry code.
7747 User can send reset command XX (instead of country code) to reset the
7748 country code to default values which is read from NV.
7749 In case of reset, 11D is enabled and default NV code is Set as current country code
7750 If 11D is priority,
7751 Than Supplicant country code code is set to default code. But 11D code is set as current country code
7752
7753 \param pMac - The handle returned by macOpen.
7754 \param pMsgBuf - MSG Buffer
7755
7756 \return eHalStatus
7757
7758 -------------------------------------------------------------------------------*/
7759eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7760{
7761 eHalStatus status = eHAL_STATUS_SUCCESS;
7762 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007763 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07007764 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7765 static uNvTables nvTables;
7766 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
7767
7768
7769 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
7770 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
7771 {
7772 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7773
7774 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
7775
7776 /* read the country code from NV and use it */
7777 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
7778 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307779 vos_mem_copy(pMsg->countryCode,
7780 nvTables.defaultCountryTable.countryCode,
7781 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007782 }
7783 else
7784 {
7785 status = eHAL_STATUS_FAILURE;
7786 return status;
7787 }
Abhishek Singh4d6b54c2014-10-14 12:31:00 +05307788 /* Update the 11d country to default country from NV bin so that when
7789 * callback is received for this default country, driver will not
7790 * disable the 11d taking it as valid country by user.
7791 */
7792 smsLog(pMac, LOG1,
7793 FL("Set default country code (%c%c) from NV as invalid country received"),
7794 pMsg->countryCode[0],pMsg->countryCode[1]);
7795 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
7796 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007797 }
7798 else
7799 {
7800 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05307801 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
7802 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07007803 {
7804 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7805 }
7806 }
7807
7808 /* WEXT set country code means
7809 * 11D should be supported?
7810 * 11D Channel should be enforced?
7811 * 11D Country code should be matched?
7812 * 11D Reg Domian should be matched?
7813 * Country string changed */
7814 if(pMac->roam.configParam.Is11dSupportEnabled &&
7815 pMac->roam.configParam.fEnforce11dChannels &&
7816 pMac->roam.configParam.fEnforceCountryCodeMatch &&
7817 pMac->roam.configParam.fEnforceDefaultDomain &&
7818 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
7819 {
7820 /* All 11D related options are already enabled
7821 * Country string is not changed
7822 * Do not need do anything for country code change request */
7823 return eHAL_STATUS_SUCCESS;
7824 }
7825
7826 /* Set Current Country code and Current Regulatory domain */
7827 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
7828 if(eHAL_STATUS_SUCCESS != status)
7829 {
7830 /* Supplicant country code failed. So give 11D priority */
7831 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7832 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007833 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007834 }
7835
Jeff Johnson295189b2012-06-20 16:38:30 -07007836 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05307837 vos_mem_copy(pMac->scan.countryCodeDefault,
7838 pMac->scan.countryCodeCurrent,
7839 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007840
7841 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05307842 status = csrGetRegulatoryDomainForCountry(pMac,
7843 pMac->scan.countryCodeCurrent,
7844 (v_REGDOMAIN_t *) &domainIdIoctl,
7845 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07007846 if ( status != eHAL_STATUS_SUCCESS )
7847 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007848 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007849 return status;
7850 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08007851 else if (REGDOMAIN_WORLD == domainIdIoctl)
7852 {
7853 /* Supplicant country code is invalid, so we are on world mode now. So
7854 give 11D chance to update */
7855 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7856 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
7857 }
7858
Jeff Johnson295189b2012-06-20 16:38:30 -07007859
Abhishek Singha306a442013-11-07 18:39:01 +05307860 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07007861
7862 if ( status != eHAL_STATUS_SUCCESS )
7863 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007864 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007865 return status;
7866 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007867 else
7868 {
7869 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7870 //set again if we find AP with 11d info during scan
Sachin Ahujacb64fc82015-01-12 17:01:05 +05307871 status = csrSetRegulatoryDomain(pMac, domainIdIoctl, NULL);
7872 if (status != eHAL_STATUS_SUCCESS)
7873 {
7874 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
7875 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007876 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
7877 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007878 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007879 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7880 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7881 }
7882 }
Kiet Lam6c583332013-10-14 05:37:09 +05307883#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07007884 /* set to default domain ID */
7885 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7886
7887 /* get the channels based on new cc */
7888 status = csrInitGetChannels( pMac );
7889
7890 if ( status != eHAL_STATUS_SUCCESS )
7891 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007892 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007893 return status;
7894 }
7895
7896 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08007897 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307898 /* Country code Changed, Purge Only scan result
7899 * which does not have channel number belong to 11d
7900 * channel list
7901 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307902 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307903
Kiet Lam6c583332013-10-14 05:37:09 +05307904#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007905 if( pMsg->changeCCCallback )
7906 {
7907 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
7908 }
7909
7910 return eHAL_STATUS_SUCCESS;
7911}
7912
Amar Singhal0d15bd52013-10-12 23:13:13 -07007913/* ---------------------------------------------------------------------------
7914
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007915 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07007916
7917 \brief Change Country code, Reg Domain and channel list
7918
7919 If Supplicant country code is priority than 11d is disabled.
7920 If 11D is enabled, we update the country code after every scan.
7921 Hence when Supplicant country code is priority, we don't need 11D info.
7922 Country code from Supplicant is set as current country code.
7923
7924 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007925 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07007926
7927 \return eHalStatus
7928
7929 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007930eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
7931 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007932{
7933 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007934 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05307935 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007936
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007937 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007938 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7939
Kiet Lam6c583332013-10-14 05:37:09 +05307940 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
7941 VOS_COUNTRY_CODE_LEN) == 0)
7942 {
7943 is11dCountry = VOS_TRUE;
7944 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007945
Sachin Ahuja120bf632015-02-24 18:06:34 +05307946 smsLog( pMac, LOG1, FL("pMsg->countryCode : %c%c,"
7947 "pMac->scan.countryCode11d : %c%c\n"),
7948 pMsg->countryCode[0], pMsg->countryCode[1],
7949 pMac->scan.countryCode11d[0], pMac->scan.countryCode11d[1]);
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307950 /* Set the country code given by userspace when 11dOriginal is FALSE
7951 * when 11doriginal is True,is11dCountry =0 and
7952 * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
7953 * and return failure
7954 */
7955 if (pMac->roam.configParam.Is11dSupportEnabledOriginal == true)
Amar Singhal97a2d992013-11-19 10:58:07 -08007956 {
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05307957 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)&&
7958 (!pMac->roam.configParam.fEnforceCountryCode) )
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307959 {
Amar Singhal97a2d992013-11-19 10:58:07 -08007960
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307961 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
Amar Singhal97a2d992013-11-19 10:58:07 -08007962
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307963 status = csrGetRegulatoryDomainForCountry(pMac,
Amar Singhal97a2d992013-11-19 10:58:07 -08007964 pMac->scan.countryCode11d,
7965 (v_REGDOMAIN_t *) &reg_domain_id,
7966 COUNTRY_IE);
7967
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307968 return eHAL_STATUS_FAILURE;
7969 }
Amar Singhal97a2d992013-11-19 10:58:07 -08007970 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007971 /* if Supplicant country code has priority, disable 11d */
Sachin Ahuja120bf632015-02-24 18:06:34 +05307972 if ((!is11dCountry) &&
7973 (pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7974 (!pMac->roam.configParam.fEnforceCountryCode))
Amar Singhal0d15bd52013-10-12 23:13:13 -07007975 {
7976 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
Agarwal Ashishcd9b8e62014-07-21 19:48:24 +05307977 smsLog( pMac, LOG1, FL(" 11d is being disabled"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007978 }
7979
Sachin Ahuja120bf632015-02-24 18:06:34 +05307980 pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_FALSE;
Kiet Lamf2f201e2013-11-16 21:24:16 +05307981 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07007982 WNI_CFG_COUNTRY_CODE_LEN);
Sachin Ahuja120bf632015-02-24 18:06:34 +05307983 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
7984 WNI_CFG_COUNTRY_CODE_LEN);
7985
Amar Singhal0d15bd52013-10-12 23:13:13 -07007986
Sachin Ahujacb64fc82015-01-12 17:01:05 +05307987 status = csrSetRegulatoryDomain(pMac, reg_domain_id, NULL);
7988 if (status != eHAL_STATUS_SUCCESS)
7989 {
7990 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
7991 }
Abhishek Singha306a442013-11-07 18:39:01 +05307992 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07007993
Kiet Lam6c583332013-10-14 05:37:09 +05307994 if (VOS_FALSE == is11dCountry )
7995 {
7996 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05307997 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05307998 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
7999 /* set to default domain ID */
8000 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
8001 }
8002
Amar Singhal0d15bd52013-10-12 23:13:13 -07008003 if ( status != eHAL_STATUS_SUCCESS )
8004 {
8005 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05308006 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07008007 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008008 else
8009 {
8010 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
8011 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008012 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
8013 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008014 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008015 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008016 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
8017 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
8018 }
8019 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07008020
Amar Singhal0d15bd52013-10-12 23:13:13 -07008021 /* get the channels based on new cc */
8022 status = csrInitGetChannels(pMac);
8023
8024 if ( status != eHAL_STATUS_SUCCESS )
8025 {
8026 smsLog( pMac, LOGE, FL(" fail to get Channels "));
8027 return status;
8028 }
8029
8030 /* reset info based on new cc, and we are done */
8031 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05308032 if (VOS_TRUE == is11dCountry)
8033 {
Kiet Lam6c583332013-10-14 05:37:09 +05308034 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
8035 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
8036 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308037 /* Country code Changed, Purge Only scan result
8038 * which does not have channel number belong to 11d
8039 * channel list
8040 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308041 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05308042 // Do active scans after the country is set by User hints or Country IE
8043 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
Sushant Kaushik1d732562014-05-21 14:15:37 +05308044 sme_DisconnectConnectedSessions(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008045 smsLog(pMac, LOG1, FL(" returned"));
8046 return eHAL_STATUS_SUCCESS;
8047}
8048
8049/* ---------------------------------------------------------------------------
8050
Kiet Lamcffc5862013-10-30 16:28:45 +05308051 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008052
8053 \brief Update Country code in the driver if set by kernel as world
8054
8055 If 11D is enabled, we update the country code after every scan & notify kernel.
8056 This is to make sure kernel & driver are in sync in case of CC found in
8057 driver but not in kernel database
8058
8059 \param pMac - The handle returned by macOpen.
8060 \param pMsg - Carrying new CC set in kernel
8061
8062 \return eHalStatus
8063
8064 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05308065eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008066{
Kiet Lamcffc5862013-10-30 16:28:45 +05308067 eHalStatus status;
8068
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008069 smsLog(pMac, LOG1, FL(" called"));
8070
8071 //this is to make sure kernel & driver are in sync in case of CC found in
8072 //driver but not in kernel database
8073 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
8074 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08008075 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05308076 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008077 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05308078 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08008079 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008080 }
Kiet Lamcffc5862013-10-30 16:28:45 +05308081
Abhishek Singha306a442013-11-07 18:39:01 +05308082 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05308083
8084 if ( status != eHAL_STATUS_SUCCESS )
8085 {
8086 smsLog( pMac, LOGE, FL(" fail to set regId") );
8087 return status;
8088 }
8089 else
8090 {
Sachin Ahujacb64fc82015-01-12 17:01:05 +05308091 status = csrSetRegulatoryDomain(pMac, REGDOMAIN_WORLD, NULL);
8092 if (status != eHAL_STATUS_SUCCESS)
8093 {
8094 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
8095 }
Kiet Lamcffc5862013-10-30 16:28:45 +05308096 status = csrInitGetChannels(pMac);
8097 if ( status != eHAL_STATUS_SUCCESS )
8098 {
8099 smsLog( pMac, LOGE, FL(" fail to get Channels "));
8100 }
8101 else
8102 {
8103 csrInitChannelList(pMac);
8104 }
8105 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308106 /* Country code Changed, Purge Only scan result
8107 * which does not have channel number belong to 11d
8108 * channel list
8109 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308110 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008111 smsLog(pMac, LOG1, FL(" returned"));
8112 return eHAL_STATUS_SUCCESS;
8113}
8114
8115/* ---------------------------------------------------------------------------
8116
Sushant Kaushik1d732562014-05-21 14:15:37 +05308117 \fn sme_DisconnectConnectedSessions
8118
8119 \brief Disconnect STA and P2P client session if channel is not supported
8120
8121 If new country code does not support the channel on which STA/P2P client
8122 is connetced, it sends the disconnect to the AP/P2P GO
8123
8124 \param pMac - The handle returned by macOpen
8125
8126 \return eHalStatus
8127
8128 -------------------------------------------------------------------------------*/
8129
8130void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac)
8131{
8132 v_U8_t i, sessionId, isChanFound = false;
8133 tANI_U8 currChannel;
8134
8135 for (sessionId=0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
8136 {
8137 if (csrIsSessionClientAndConnected(pMac, sessionId))
8138 {
8139 isChanFound = false;
8140 //Session is connected.Check the channel
8141 currChannel = csrGetInfraOperationChannel(pMac, sessionId);
8142 smsLog(pMac, LOGW, "Current Operating channel : %d, session :%d",
8143 currChannel, sessionId);
8144 for (i=0; i < pMac->scan.base20MHzChannels.numChannels; i++)
8145 {
8146 if (pMac->scan.base20MHzChannels.channelList[i] == currChannel)
8147 {
8148 isChanFound = true;
8149 break;
8150 }
8151 }
8152
8153 if (!isChanFound)
8154 {
8155 for (i=0; i < pMac->scan.base40MHzChannels.numChannels; i++)
8156 {
8157 if (pMac->scan.base40MHzChannels.channelList[i] == currChannel)
8158 {
8159 isChanFound = true;
8160 break;
8161 }
8162 }
8163 }
8164 if (!isChanFound)
8165 {
8166 smsLog(pMac, LOGW, "%s : Disconnect Session :%d", __func__, sessionId);
8167 csrRoamDisconnect(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
8168 }
8169 }
8170 }
8171}
8172/* ---------------------------------------------------------------------------
8173
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008174 \fn sme_HandleGenericChangeCountryCode
8175
8176 \brief Change Country code, Reg Domain and channel list
8177
8178 If Supplicant country code is priority than 11d is disabled.
8179 If 11D is enabled, we update the country code after every scan.
8180 Hence when Supplicant country code is priority, we don't need 11D info.
8181 Country code from kernel is set as current country code.
8182
8183 \param pMac - The handle returned by macOpen.
8184 \param pMsgBuf - message buffer
8185
8186 \return eHalStatus
8187
8188 -------------------------------------------------------------------------------*/
8189eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
8190{
8191 tAniGenericChangeCountryCodeReq *pMsg;
8192 v_REGDOMAIN_t reg_domain_id;
8193
8194 smsLog(pMac, LOG1, FL(" called"));
8195 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
8196 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
8197
8198 if (REGDOMAIN_COUNT == reg_domain_id)
8199 {
Kiet Lamcffc5862013-10-30 16:28:45 +05308200 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008201 }
8202 else
8203 {
8204 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
8205 }
8206 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07008207 return eHAL_STATUS_SUCCESS;
8208}
8209
Jeff Johnson295189b2012-06-20 16:38:30 -07008210#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08008211eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07008212{
8213 tpSirRcvFltMcAddrList pRequestBuf;
8214 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008215 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07008216 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008217
8218 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05308219 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008220 pMulticastAddrs->ulMulticastAddrCnt,
8221 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07008222
8223 /*
8224 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08008225 */
8226 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
8227 csrIsConnStateInfra(pMac, sessionId))
8228 {
8229 pSession = CSR_GET_SESSION( pMac, sessionId );
8230 }
Jeff Johnsone7245742012-09-05 17:12:55 -07008231
8232 if(pSession == NULL )
8233 {
8234 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008235 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07008236 return eHAL_STATUS_FAILURE;
8237 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08008238
Jeff Johnson295189b2012-06-20 16:38:30 -07008239 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
8240 if (NULL == pRequestBuf)
8241 {
8242 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008243 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008244 return eHAL_STATUS_FAILED_ALLOC;
8245 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08008246
8247 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
8248 {
8249 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
8250 "indication as we are not connected", __func__);
8251 vos_mem_free(pRequestBuf);
8252 return eHAL_STATUS_FAILURE;
8253 }
8254
Jeff Johnson295189b2012-06-20 16:38:30 -07008255 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
8256
Kiet Lam64c1b492013-07-12 13:56:44 +05308257 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
8258 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008259 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
8260 sizeof(tSirMacAddr));
8261
Jeff Johnson295189b2012-06-20 16:38:30 -07008262 msg.type = WDA_8023_MULTICAST_LIST_REQ;
8263 msg.reserved = 0;
8264 msg.bodyptr = pRequestBuf;
8265 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8266 {
8267 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008268 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008269 vos_mem_free(pRequestBuf);
8270 return eHAL_STATUS_FAILURE;
8271 }
8272
8273 return eHAL_STATUS_SUCCESS;
8274}
8275
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008276eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07008277 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008278{
8279 tpSirRcvPktFilterCfgType pRequestBuf;
8280 v_SINT_t allocSize;
8281 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008282 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8283 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07008284 v_U8_t idx=0;
8285
8286 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008287 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008288 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008289
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07008290 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008291
Jeff Johnson295189b2012-06-20 16:38:30 -07008292 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008293
8294 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008295 {
8296 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008297 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008298 return eHAL_STATUS_FAILED_ALLOC;
8299 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008300
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008301 if( NULL == pSession )
8302 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008303 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008304 vos_mem_free(pRequestBuf);
8305 return eHAL_STATUS_FAILURE;
8306 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008307
Kiet Lam64c1b492013-07-12 13:56:44 +05308308 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
8309 sizeof(tSirMacAddr));
8310 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
8311 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008312 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
8313
Jeff Johnson295189b2012-06-20 16:38:30 -07008314 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
8315 msg.reserved = 0;
8316 msg.bodyptr = pRequestBuf;
8317
8318 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008319 "FT %d FID %d ",
8320 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07008321
8322 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008323 "params %d CT %d",
8324 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07008325
8326 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
8327 {
8328
8329 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008330 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07008331 pRequestBuf->paramsData[idx].protocolLayer,
8332 pRequestBuf->paramsData[idx].cmpFlag);
8333
8334 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008335 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008336 pRequestBuf->paramsData[idx].dataOffset,
8337 pRequestBuf->paramsData[idx].dataLength);
8338
8339 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008340 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008341 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008342 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008343 pRequestBuf->paramsData[idx].compareData[2],
8344 pRequestBuf->paramsData[idx].compareData[3],
8345 pRequestBuf->paramsData[idx].compareData[4],
8346 pRequestBuf->paramsData[idx].compareData[5]);
8347
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008348 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008349 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008350 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008351 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008352 pRequestBuf->paramsData[idx].dataMask[2],
8353 pRequestBuf->paramsData[idx].dataMask[3],
8354 pRequestBuf->paramsData[idx].dataMask[4],
8355 pRequestBuf->paramsData[idx].dataMask[5]);
8356
8357 }
8358
8359 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8360 {
8361 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008362 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008363 vos_mem_free(pRequestBuf);
8364 return eHAL_STATUS_FAILURE;
8365 }
8366
8367 return eHAL_STATUS_SUCCESS;
8368}
8369
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008370eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008371 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008372 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008373 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008374{
8375 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8376 eHalStatus status;
8377
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008378 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008379
8380 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
8381 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008382 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07008383 sme_ReleaseGlobalLock( &pMac->sme );
8384 }
8385
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008386 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008387
8388 return (status);
8389}
8390
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008391eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07008392 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008393{
8394 tpSirRcvFltPktClearParam pRequestBuf;
8395 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008396 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8397 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07008398
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008399 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008400 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008401
Jeff Johnson295189b2012-06-20 16:38:30 -07008402 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008403 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008404 {
8405 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8406 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008407 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008408 return eHAL_STATUS_FAILED_ALLOC;
8409 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008410 if( NULL == pSession )
8411 {
8412 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008413 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008414 vos_mem_free(pRequestBuf);
8415 return eHAL_STATUS_FAILURE;
8416 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008417
Kiet Lam64c1b492013-07-12 13:56:44 +05308418 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
8419 sizeof(tSirMacAddr));
8420 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
8421 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008422
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008423 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
8424
Jeff Johnson295189b2012-06-20 16:38:30 -07008425 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
8426 msg.reserved = 0;
8427 msg.bodyptr = pRequestBuf;
8428 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8429 {
8430 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008431 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008432 vos_mem_free(pRequestBuf);
8433 return eHAL_STATUS_FAILURE;
8434 }
8435
8436 return eHAL_STATUS_SUCCESS;
8437}
8438#endif // WLAN_FEATURE_PACKET_FILTERING
8439
8440/* ---------------------------------------------------------------------------
8441 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008442 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07008443 channel switch.
8444 \param callbackContext
8445 \param status
8446 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008447void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07008448 eHalStatus status)
8449{
8450 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
8451 tSirMbMsg *pMsg;
8452 tANI_U16 msgLen;
8453
8454 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05308455 pMsg = vos_mem_malloc(msgLen);
8456 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07008457 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308458 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008459 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
8460 pMsg->msgLen = pal_cpu_to_be16(msgLen);
8461 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008462 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008463
8464 return;
8465}
8466
8467/* ---------------------------------------------------------------------------
8468 \fn sme_HandlePreChannelSwitchInd
8469 \brief Processes the indcation from PE for pre-channel switch.
8470 \param hHal
8471 \- The handle returned by macOpen. return eHalStatus
8472 ---------------------------------------------------------------------------*/
8473eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
8474{
8475 eHalStatus status = eHAL_STATUS_FAILURE;
8476 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8477 status = sme_AcquireGlobalLock( &pMac->sme );
8478 if ( HAL_STATUS_SUCCESS( status ) )
8479 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008480 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
8481 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07008482 sme_ReleaseGlobalLock( &pMac->sme );
8483 }
8484
8485 return (status);
8486}
8487
8488/* ---------------------------------------------------------------------------
8489 \fn sme_HandlePostChannelSwitchInd
8490 \brief Processes the indcation from PE for post-channel switch.
8491 \param hHal
8492 \- The handle returned by macOpen. return eHalStatus
8493 ---------------------------------------------------------------------------*/
8494eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
8495{
8496 eHalStatus status = eHAL_STATUS_FAILURE;
8497 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8498
8499 status = sme_AcquireGlobalLock( &pMac->sme );
8500 if ( HAL_STATUS_SUCCESS( status ) )
8501 {
8502 status = pmcRequestBmps(hHal, NULL, NULL);
8503 sme_ReleaseGlobalLock( &pMac->sme );
8504 }
8505
8506 return (status);
8507}
8508
8509/* ---------------------------------------------------------------------------
8510
8511 \fn sme_IsChannelValid
8512
8513 \brief To check if the channel is valid for currently established domain
8514 This is a synchronous API.
8515
8516 \param hHal - The handle returned by macOpen.
8517 \param channel - channel to verify
8518
8519 \return TRUE/FALSE, TRUE if channel is valid
8520
8521 -------------------------------------------------------------------------------*/
8522tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
8523{
8524 eHalStatus status = eHAL_STATUS_FAILURE;
8525 tANI_BOOLEAN valid = FALSE;
8526 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008527
Jeff Johnson295189b2012-06-20 16:38:30 -07008528 status = sme_AcquireGlobalLock( &pMac->sme );
8529 if ( HAL_STATUS_SUCCESS( status ) )
8530 {
8531
8532 valid = csrRoamIsChannelValid( pMac, channel);
8533
8534 sme_ReleaseGlobalLock( &pMac->sme );
8535 }
8536
8537 return (valid);
8538}
8539
8540/* ---------------------------------------------------------------------------
8541 \fn sme_SetFreqBand
8542 \brief Used to set frequency band.
8543 \param hHal
8544 \eBand band value to be configured
8545 \- return eHalStatus
8546 -------------------------------------------------------------------------*/
8547eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
8548{
8549 eHalStatus status = eHAL_STATUS_FAILURE;
8550 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8551
8552 status = sme_AcquireGlobalLock( &pMac->sme );
8553 if ( HAL_STATUS_SUCCESS( status ) )
8554 {
8555 status = csrSetBand(hHal, eBand);
8556 sme_ReleaseGlobalLock( &pMac->sme );
8557 }
8558 return status;
8559}
8560
8561/* ---------------------------------------------------------------------------
8562 \fn sme_GetFreqBand
8563 \brief Used to get the current band settings.
8564 \param hHal
8565 \pBand pointer to hold band value
8566 \- return eHalStatus
8567 -------------------------------------------------------------------------*/
8568eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
8569{
8570 eHalStatus status = eHAL_STATUS_FAILURE;
8571 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8572
8573 status = sme_AcquireGlobalLock( &pMac->sme );
8574 if ( HAL_STATUS_SUCCESS( status ) )
8575 {
8576 *pBand = csrGetCurrentBand( hHal );
8577 sme_ReleaseGlobalLock( &pMac->sme );
8578 }
8579 return status;
8580}
8581
8582#ifdef WLAN_WAKEUP_EVENTS
8583/******************************************************************************
8584 \fn sme_WakeReasonIndCallback
8585
8586 \brief
8587 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
8588
8589 \param hHal - HAL handle for device
8590 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
8591
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008592 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008593******************************************************************************/
8594eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
8595{
8596 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8597 eHalStatus status = eHAL_STATUS_SUCCESS;
8598 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
8599
8600 if (NULL == pMsg)
8601 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008602 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008603 status = eHAL_STATUS_FAILURE;
8604 }
8605 else
8606 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008607 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07008608
8609 /* Call Wake Reason Indication callback routine. */
8610 if (pMac->pmc.wakeReasonIndCB != NULL)
8611 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008612
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008613 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07008614 }
8615
8616 return(status);
8617}
8618#endif // WLAN_WAKEUP_EVENTS
8619
8620
8621/* ---------------------------------------------------------------------------
8622
8623 \fn sme_SetMaxTxPower
8624
8625 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
8626 not persist over reboots.
8627
8628 \param hHal
8629 \param pBssid BSSID to set the power cap for
8630 \param pBssid pSelfMacAddress self MAC Address
8631 \param pBssid power to set in dB
8632 \- return eHalStatus
8633
8634 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008635eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07008636 tSirMacAddr pSelfMacAddress, v_S7_t dB)
8637{
8638 vos_msg_t msg;
8639 tpMaxTxPowerParams pMaxTxParams = NULL;
Katya Nigambcb705f2013-12-26 14:26:22 +05308640 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008641 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008642 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
8643 if (NULL == pMaxTxParams)
8644 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008645 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 -07008646 return eHAL_STATUS_FAILURE;
8647 }
8648
8649 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05308650 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07008651 SIR_MAC_ADDR_LENGTH);
8652 pMaxTxParams->power = dB;
8653
8654 msg.type = WDA_SET_MAX_TX_POWER_REQ;
8655 msg.reserved = 0;
8656 msg.bodyptr = pMaxTxParams;
8657
8658 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8659 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008660 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 -07008661 vos_mem_free(pMaxTxParams);
8662 return eHAL_STATUS_FAILURE;
8663 }
8664
8665 return eHAL_STATUS_SUCCESS;
8666}
8667
Jeff Johnson295189b2012-06-20 16:38:30 -07008668/* ---------------------------------------------------------------------------
8669
Arif Hussaina5ebce02013-08-09 15:09:58 -07008670 \fn sme_SetMaxTxPowerPerBand
8671
8672 \brief Set the Maximum Transmit Power specific to band dynamically.
8673 Note: this setting will not persist over reboots.
8674
8675 \param band
8676 \param power to set in dB
8677 \- return eHalStatus
8678
8679 ----------------------------------------------------------------------------*/
8680eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
8681{
8682 vos_msg_t msg;
8683 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
8684
8685 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
8686 if (NULL == pMaxTxPowerPerBandParams)
8687 {
8688 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8689 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
8690 __func__);
8691 return eHAL_STATUS_FAILURE;
8692 }
8693
8694 pMaxTxPowerPerBandParams->power = dB;
8695 pMaxTxPowerPerBandParams->bandInfo = band;
8696
8697 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
8698 msg.reserved = 0;
8699 msg.bodyptr = pMaxTxPowerPerBandParams;
8700
8701 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8702 {
8703 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8704 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
8705 __func__);
8706 vos_mem_free(pMaxTxPowerPerBandParams);
8707 return eHAL_STATUS_FAILURE;
8708 }
8709
8710 return eHAL_STATUS_SUCCESS;
8711}
8712
8713/* ---------------------------------------------------------------------------
8714
schang86c22c42013-03-13 18:41:24 -07008715 \fn sme_SetTxPower
8716
8717 \brief Set Transmit Power dynamically. Note: this setting will
8718 not persist over reboots.
8719
8720 \param hHal
8721 \param sessionId Target Session ID
8722 \param mW power to set in mW
8723 \- return eHalStatus
8724
8725 -------------------------------------------------------------------------------*/
8726eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
8727{
8728
8729 eHalStatus status = eHAL_STATUS_FAILURE;
8730 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8731
Katya Nigambcb705f2013-12-26 14:26:22 +05308732 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008733 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07008734 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
8735 status = sme_AcquireGlobalLock(&pMac->sme);
8736 if (HAL_STATUS_SUCCESS(status))
8737 {
8738 status = csrSetTxPower(pMac, sessionId, mW);
8739 sme_ReleaseGlobalLock(&pMac->sme);
8740 }
8741 return status;
8742}
8743
8744/* ---------------------------------------------------------------------------
8745
Jeff Johnson295189b2012-06-20 16:38:30 -07008746 \fn sme_HideSSID
8747
8748 \brief hide/show SSID dynamically. Note: this setting will
8749 not persist over reboots.
8750
8751 \param hHal
8752 \param sessionId
8753 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
8754 \- return eHalStatus
8755
8756 -------------------------------------------------------------------------------*/
8757eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
8758{
8759 eHalStatus status = eHAL_STATUS_SUCCESS;
8760 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8761 tANI_U16 len;
8762
8763 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8764 {
8765 tpSirUpdateParams pMsg;
8766 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008767
8768 if(!pSession)
8769 {
8770 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008771 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008772 return eHAL_STATUS_FAILURE;
8773 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008774
8775 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07008776 VOS_ASSERT(0);
8777
8778 /* Create the message and send to lim */
8779 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05308780 pMsg = vos_mem_malloc(len);
8781 if ( NULL == pMsg )
8782 status = eHAL_STATUS_FAILURE;
8783 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008784 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308785 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008786 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
8787 pMsg->length = len;
8788 /* Data starts from here */
8789 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008790 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07008791 status = palSendMBMessage(pMac->hHdd, pMsg);
8792 }
8793 sme_ReleaseGlobalLock( &pMac->sme );
8794 }
8795 return status;
8796}
Jeff Johnson295189b2012-06-20 16:38:30 -07008797
8798/* ---------------------------------------------------------------------------
8799
8800 \fn sme_SetTmLevel
8801 \brief Set Thermal Mitigation Level to RIVA
8802 \param hHal - The handle returned by macOpen.
8803 \param newTMLevel - new Thermal Mitigation Level
8804 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008805 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008806 ---------------------------------------------------------------------------*/
8807eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
8808{
8809 eHalStatus status = eHAL_STATUS_SUCCESS;
8810 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8811 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8812 vos_msg_t vosMessage;
8813 tAniSetTmLevelReq *setTmLevelReq = NULL;
8814
Katya Nigambcb705f2013-12-26 14:26:22 +05308815 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008816 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008817 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8818 {
8819 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05308820 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07008821 {
8822 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008823 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008824 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07008825 return eHAL_STATUS_FAILURE;
8826 }
8827
8828 setTmLevelReq->tmMode = tmMode;
8829 setTmLevelReq->newTmLevel = newTMLevel;
8830
8831 /* serialize the req through MC thread */
8832 vosMessage.bodyptr = setTmLevelReq;
8833 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
8834 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8835 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8836 {
8837 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008838 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008839 vos_mem_free(setTmLevelReq);
8840 status = eHAL_STATUS_FAILURE;
8841 }
8842 sme_ReleaseGlobalLock( &pMac->sme );
8843 }
8844 return(status);
8845}
8846
8847/*---------------------------------------------------------------------------
8848
8849 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
8850 Host and FW.
8851
8852 \param hHal - HAL handle for device
8853
8854 \return NONE
8855
8856---------------------------------------------------------------------------*/
8857void sme_featureCapsExchange( tHalHandle hHal)
8858{
8859 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05308860 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008861 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008862 WDA_featureCapsExchange(vosContext);
8863}
Jeff Johnsond13512a2012-07-17 11:42:19 -07008864
Yathish9f22e662012-12-10 14:21:35 -08008865/*---------------------------------------------------------------------------
8866
8867 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
8868 in Host.
8869
8870 \param hHal - HAL handle for device
8871
8872 \return NONE
8873
8874---------------------------------------------------------------------------*/
8875void sme_disableFeatureCapablity(tANI_U8 feature_index)
8876{
8877 WDA_disableCapablityFeature(feature_index);
8878}
8879
Jeff Johnsond13512a2012-07-17 11:42:19 -07008880/* ---------------------------------------------------------------------------
8881
8882 \fn sme_GetDefaultCountryCode
8883
8884 \brief Get the default country code from NV
8885
8886 \param hHal
8887 \param pCountry
8888 \- return eHalStatus
8889
8890 -------------------------------------------------------------------------------*/
8891eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
8892{
8893 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308894 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008895 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008896 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
8897}
8898
8899/* ---------------------------------------------------------------------------
8900
8901 \fn sme_GetCurrentCountryCode
8902
8903 \brief Get the current country code
8904
8905 \param hHal
8906 \param pCountry
8907 \- return eHalStatus
8908
8909 -------------------------------------------------------------------------------*/
8910eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
8911{
8912 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308913 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008914 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008915 return csrGetCurrentCountryCode(pMac, pCountry);
8916}
8917
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008918/* ---------------------------------------------------------------------------
8919 \fn sme_transportDebug
8920 \brief Dynamically monitoring Transport channels
8921 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07008922 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08008923 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008924 \param toggleStallDetect Enable stall detect feature
8925 This feature will take effect to data performance
8926 Not integrate till fully verification
8927 \- return NONE
8928 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07008929void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008930{
schang6295e542013-03-12 15:31:23 -07008931 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8932
8933 if (NULL == pMac)
8934 {
8935 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8936 "%s: invalid context", __func__);
8937 return;
8938 }
8939 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07008940}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008941
Kiran4a17ebe2013-01-31 10:43:43 -08008942/* ---------------------------------------------------------------------------
8943 \fn sme_ResetPowerValuesFor5G
8944 \brief Reset the power values for 5G band with NV power values.
8945 \param hHal - HAL handle for device
8946 \- return NONE
8947 -------------------------------------------------------------------------*/
8948void sme_ResetPowerValuesFor5G (tHalHandle hHal)
8949{
8950 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +05308951 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008952 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08008953 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
8954 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
8955}
8956
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008957#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008958/* ---------------------------------------------------------------------------
8959 \fn sme_UpdateRoamPrefer5GHz
8960 \brief enable/disable Roam prefer 5G runtime option
8961 This function is called through dynamic setConfig callback function
8962 to configure the Roam prefer 5G runtime option
8963 \param hHal - HAL handle for device
8964 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
8965 \- return Success or failure
8966 -------------------------------------------------------------------------*/
8967
8968eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
8969{
8970 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008971 eHalStatus status = eHAL_STATUS_SUCCESS;
8972
Katya Nigambcb705f2013-12-26 14:26:22 +05308973 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008974 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008975 status = sme_AcquireGlobalLock( &pMac->sme );
8976 if ( HAL_STATUS_SUCCESS( status ) )
8977 {
8978 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8979 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
8980 pMac->roam.configParam.nRoamPrefer5GHz,
8981 nRoamPrefer5GHz);
8982 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
8983 sme_ReleaseGlobalLock( &pMac->sme );
8984 }
8985
8986 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008987}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008988
8989/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008990 \fn sme_setRoamIntraBand
8991 \brief enable/disable Intra band roaming
8992 This function is called through dynamic setConfig callback function
8993 to configure the intra band roaming
8994 \param hHal - HAL handle for device
8995 \param nRoamIntraBand Enable/Disable Intra band roaming
8996 \- return Success or failure
8997 -------------------------------------------------------------------------*/
8998eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
8999{
9000 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9001 eHalStatus status = eHAL_STATUS_SUCCESS;
9002
Katya Nigambcb705f2013-12-26 14:26:22 +05309003 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009004 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009005 status = sme_AcquireGlobalLock( &pMac->sme );
9006 if ( HAL_STATUS_SUCCESS( status ) )
9007 {
9008 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9009 "%s: gRoamIntraBand is changed from %d to %d", __func__,
9010 pMac->roam.configParam.nRoamIntraBand,
9011 nRoamIntraBand);
9012 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
9013 sme_ReleaseGlobalLock( &pMac->sme );
9014 }
9015
9016 return status ;
9017}
9018
9019/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009020 \fn sme_UpdateRoamScanNProbes
9021 \brief function to update roam scan N probes
9022 This function is called through dynamic setConfig callback function
9023 to update roam scan N probes
9024 \param hHal - HAL handle for device
9025 \param nProbes number of probe requests to be sent out
9026 \- return Success or failure
9027 -------------------------------------------------------------------------*/
9028eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
9029{
9030 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9031 eHalStatus status = eHAL_STATUS_SUCCESS;
9032
9033 status = sme_AcquireGlobalLock( &pMac->sme );
9034 if ( HAL_STATUS_SUCCESS( status ) )
9035 {
9036 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9037 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
9038 pMac->roam.configParam.nProbes,
9039 nProbes);
9040 pMac->roam.configParam.nProbes = nProbes;
9041 sme_ReleaseGlobalLock( &pMac->sme );
9042 }
9043#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9044 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9045 {
9046 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9047 REASON_NPROBES_CHANGED);
9048 }
9049#endif
9050 return status ;
9051}
9052
9053/* ---------------------------------------------------------------------------
9054 \fn sme_UpdateRoamScanHomeAwayTime
9055 \brief function to update roam scan Home away time
9056 This function is called through dynamic setConfig callback function
9057 to update roam scan home away time
9058 \param hHal - HAL handle for device
9059 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009060 \param bSendOffloadCmd If TRUE then send offload command to firmware
9061 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009062 \- return Success or failure
9063 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009064eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
9065 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009066{
9067 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9068 eHalStatus status = eHAL_STATUS_SUCCESS;
9069
9070 status = sme_AcquireGlobalLock( &pMac->sme );
9071 if ( HAL_STATUS_SUCCESS( status ) )
9072 {
9073 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9074 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
9075 pMac->roam.configParam.nRoamScanHomeAwayTime,
9076 nRoamScanHomeAwayTime);
9077 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
9078 sme_ReleaseGlobalLock( &pMac->sme );
9079 }
9080
9081#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009082 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009083 {
9084 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9085 REASON_HOME_AWAY_TIME_CHANGED);
9086 }
9087#endif
9088 return status;
9089}
9090
9091
9092/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009093 \fn sme_getRoamIntraBand
9094 \brief get Intra band roaming
9095 \param hHal - HAL handle for device
9096 \- return Success or failure
9097 -------------------------------------------------------------------------*/
9098v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
9099{
9100 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05309101 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009102 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009103 return pMac->roam.configParam.nRoamIntraBand;
9104}
9105
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009106/* ---------------------------------------------------------------------------
9107 \fn sme_getRoamScanNProbes
9108 \brief get N Probes
9109 \param hHal - HAL handle for device
9110 \- return Success or failure
9111 -------------------------------------------------------------------------*/
9112v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
9113{
9114 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9115 return pMac->roam.configParam.nProbes;
9116}
9117
9118/* ---------------------------------------------------------------------------
9119 \fn sme_getRoamScanHomeAwayTime
9120 \brief get Roam scan home away time
9121 \param hHal - HAL handle for device
9122 \- return Success or failure
9123 -------------------------------------------------------------------------*/
9124v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
9125{
9126 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9127 return pMac->roam.configParam.nRoamScanHomeAwayTime;
9128}
9129
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009130
9131/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009132 \fn sme_UpdateImmediateRoamRssiDiff
9133 \brief Update nImmediateRoamRssiDiff
9134 This function is called through dynamic setConfig callback function
9135 to configure nImmediateRoamRssiDiff
9136 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
9137 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009138 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009139 candidate and current AP.
9140 \- return Success or failure
9141 -------------------------------------------------------------------------*/
9142
9143eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
9144{
9145 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08009146 eHalStatus status = eHAL_STATUS_SUCCESS;
9147
Katya Nigambcb705f2013-12-26 14:26:22 +05309148 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009149 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009150 status = sme_AcquireGlobalLock( &pMac->sme );
9151 if ( HAL_STATUS_SUCCESS( status ) )
9152 {
9153 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309154 "LFR runtime successfully set immediate roam rssi diff to"
9155 "%d - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009156 nImmediateRoamRssiDiff,
9157 pMac->roam.configParam.nImmediateRoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309158 macTraceGetNeighbourRoamState(
9159 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009160 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
9161 sme_ReleaseGlobalLock( &pMac->sme );
9162 }
9163
9164 return status ;
9165}
9166
9167/* ---------------------------------------------------------------------------
9168 \fn sme_UpdateRoamRssiDiff
9169 \brief Update RoamRssiDiff
9170 This function is called through dynamic setConfig callback function
9171 to configure RoamRssiDiff
9172 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
9173 \param hHal - HAL handle for device
9174 \param RoamRssiDiff - minimum rssi difference between potential
9175 candidate and current AP.
9176 \- return Success or failure
9177 -------------------------------------------------------------------------*/
9178
9179eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
9180{
9181 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9182 eHalStatus status = eHAL_STATUS_SUCCESS;
9183
9184 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +05309185 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009186 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009187 if ( HAL_STATUS_SUCCESS( status ) )
9188 {
9189 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309190 "LFR runtime successfully set roam rssi diff to %d"
9191 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009192 RoamRssiDiff,
9193 pMac->roam.configParam.RoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309194 macTraceGetNeighbourRoamState(
9195 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009196 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
9197 sme_ReleaseGlobalLock( &pMac->sme );
9198 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009199#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9200 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9201 {
9202 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
9203 }
9204#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009205 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009206}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009207
9208/*--------------------------------------------------------------------------
9209 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009210 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009211 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009212 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009213 \param hHal - The handle returned by macOpen.
9214 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
9215 Other status means SME is failed to update isFastTransitionEnabled.
9216 \sa
9217 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009218eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009219 v_BOOL_t isFastTransitionEnabled)
9220{
9221 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08009222 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009223
Katya Nigambcb705f2013-12-26 14:26:22 +05309224 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009225 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009226 status = sme_AcquireGlobalLock( &pMac->sme );
9227 if ( HAL_STATUS_SUCCESS( status ) )
9228 {
9229 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9230 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
9231 pMac->roam.configParam.isFastTransitionEnabled,
9232 isFastTransitionEnabled);
9233 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
9234 sme_ReleaseGlobalLock( &pMac->sme );
9235 }
9236
9237 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009238}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009239
9240/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009241 \fn sme_UpdateWESMode
9242 \brief Update WES Mode
9243 This function is called through dynamic setConfig callback function
9244 to configure isWESModeEnabled
9245 \param hHal - HAL handle for device
9246 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
9247 Other status means SME is failed to update isWESModeEnabled.
9248 -------------------------------------------------------------------------*/
9249
9250eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
9251{
9252 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9253 eHalStatus status = eHAL_STATUS_SUCCESS;
9254
9255 status = sme_AcquireGlobalLock( &pMac->sme );
9256 if ( HAL_STATUS_SUCCESS( status ) )
9257 {
9258 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309259 "LFR runtime successfully set WES Mode to %d"
9260 "- old value is %d - roam state is %s",
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009261 isWESModeEnabled,
9262 pMac->roam.configParam.isWESModeEnabled,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309263 macTraceGetNeighbourRoamState(
9264 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009265 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
9266 sme_ReleaseGlobalLock( &pMac->sme );
9267 }
9268
9269 return status ;
9270}
9271
9272/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009273 \fn sme_SetRoamScanControl
9274 \brief Set roam scan control
9275 This function is called to set roam scan control
9276 if roam scan control is set to 0, roaming scan cache is cleared
9277 any value other than 0 is treated as invalid value
9278 \param hHal - HAL handle for device
9279 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9280 Other status means SME failure to update
9281 -------------------------------------------------------------------------*/
9282eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
9283{
9284 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9285 eHalStatus status = eHAL_STATUS_SUCCESS;
9286
Katya Nigambcb705f2013-12-26 14:26:22 +05309287 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009288 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009289 status = sme_AcquireGlobalLock( &pMac->sme );
9290 if ( HAL_STATUS_SUCCESS( status ) )
9291 {
9292 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309293 "LFR runtime successfully set roam scan control to %d"
9294 " - old value is %d - roam state is %s",
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009295 roamScanControl,
9296 pMac->roam.configParam.nRoamScanControl,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309297 macTraceGetNeighbourRoamState(
9298 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009299 pMac->roam.configParam.nRoamScanControl = roamScanControl;
9300 if ( 0 == roamScanControl)
9301 {
9302 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9303 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009304 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009305#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9306 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9307 {
9308 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
9309 }
9310#endif
9311 }
9312 sme_ReleaseGlobalLock( &pMac->sme );
9313 }
9314 return status ;
9315}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009316#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_ESE) || (FEATURE_WLAN_LFR) */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009317
9318#ifdef FEATURE_WLAN_LFR
9319/*--------------------------------------------------------------------------
9320 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009321 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009322 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009323 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009324 \param hHal - The handle returned by macOpen.
9325 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
9326 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
9327 \sa
9328 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009329eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009330 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009331{
9332 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9333
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009334 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
9335 {
9336 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9337 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9338 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9339 isFastRoamIniFeatureEnabled);
9340 return eHAL_STATUS_SUCCESS;
9341 }
9342
Srinivas Girigowdade697412013-02-14 16:31:48 -08009343 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9344 "%s: FastRoamEnabled is changed from %d to %d", __func__,
9345 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9346 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009347 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009348 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009349
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009350 return eHAL_STATUS_SUCCESS;
9351}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07009352
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08009353/*--------------------------------------------------------------------------
Mukul Sharma2a271632014-10-13 14:59:01 +05309354 \brief sme_ConfigFwrRoaming() - enable/disable LFR support at runtime
9355 When Supplicant issue enabled / disable fwr based roaming on the basis
9356 of the Bssid modification in network block ( e.g. AutoJoin mody N/W block)
9357
9358 This is a synchronous call
9359 \param hHal - The handle returned by macOpen.
9360 \return eHAL_STATUS_SUCCESS - SME (enabled/disabled) offload scan successfully.
9361 Other status means SME is failed to (enabled/disabled) offload scan.
9362 \sa
9363 --------------------------------------------------------------------------*/
9364
9365eHalStatus sme_ConfigFwrRoaming(tHalHandle hHal,
9366 const v_BOOL_t isFastRoamEnabled)
9367{
9368 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9369 if (!pMac->roam.configParam.isFastRoamIniFeatureEnabled)
9370 {
9371 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9372 "%s: FastRoam is disabled through ini", __func__);
9373 return eHAL_STATUS_FAILURE;
9374 }
9375 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamEnabled);
9376 return eHAL_STATUS_SUCCESS;
9377}
9378
9379/*--------------------------------------------------------------------------
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08009380 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
9381 Enable/disable LFR MAWC support at runtime
9382 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9383 isMAWCIniFeatureEnabled.
9384 This is a synchronous call
9385 \param hHal - The handle returned by macOpen.
9386 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
9387 Other status means SME is failed to update MAWCEnabled.
9388 \sa
9389 --------------------------------------------------------------------------*/
9390eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
9391 const v_BOOL_t MAWCEnabled)
9392{
9393 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9394 eHalStatus status = eHAL_STATUS_SUCCESS;
9395
9396 status = sme_AcquireGlobalLock( &pMac->sme );
9397 if ( HAL_STATUS_SUCCESS( status ) )
9398 {
9399 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9400 "%s: MAWCEnabled is changed from %d to %d", __func__,
9401 pMac->roam.configParam.MAWCEnabled,
9402 MAWCEnabled);
9403 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
9404 sme_ReleaseGlobalLock( &pMac->sme );
9405 }
9406
9407 return status ;
9408
9409}
9410
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07009411#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9412/*--------------------------------------------------------------------------
9413 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
9414 This is a synchronuous call
9415 \param hHal - The handle returned by macOpen.
9416 \return eHAL_STATUS_SUCCESS
9417 Other status means SME is failed
9418 \sa
9419 --------------------------------------------------------------------------*/
9420
9421eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
9422 v_BOOL_t bFastRoamInConIniFeatureEnabled)
9423{
9424
9425 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9426 eHalStatus status = eHAL_STATUS_SUCCESS;
9427
9428 status = sme_AcquireGlobalLock( &pMac->sme );
9429 if ( HAL_STATUS_SUCCESS( status ) )
9430 {
9431 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
9432 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
9433 {
9434 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
9435 }
9436 sme_ReleaseGlobalLock( &pMac->sme );
9437 }
9438
9439 return status;
9440}
9441#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009442#endif /* FEATURE_WLAN_LFR */
9443
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009444#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009445/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009446 \brief sme_UpdateIsEseFeatureEnabled() - enable/disable Ese support at runtime
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009447 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009448 isEseIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009449 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009450 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009451 \return eHAL_STATUS_SUCCESS - SME update isEseIniFeatureEnabled config successfully.
9452 Other status means SME is failed to update isEseIniFeatureEnabled.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009453 \sa
9454 --------------------------------------------------------------------------*/
9455
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009456eHalStatus sme_UpdateIsEseFeatureEnabled(tHalHandle hHal,
9457 const v_BOOL_t isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009458{
9459 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9460
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009461 if (pMac->roam.configParam.isEseIniFeatureEnabled == isEseIniFeatureEnabled)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009462 {
9463 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009464 "%s: Ese Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9465 pMac->roam.configParam.isEseIniFeatureEnabled,
9466 isEseIniFeatureEnabled);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009467 return eHAL_STATUS_SUCCESS;
9468 }
9469
Srinivas Girigowdade697412013-02-14 16:31:48 -08009470 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009471 "%s: EseEnabled is changed from %d to %d", __func__,
9472 pMac->roam.configParam.isEseIniFeatureEnabled,
9473 isEseIniFeatureEnabled);
9474 pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled;
9475 csrNeighborRoamUpdateEseModeEnabled(pMac, isEseIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009476
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009477 if(TRUE == isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009478 {
9479 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009480 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07009481
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009482#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9483 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9484 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009485 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_ESE_INI_CFG_CHANGED);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009486 }
9487#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009488 return eHAL_STATUS_SUCCESS;
9489}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009490#endif /* FEATURE_WLAN_ESE */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009491
9492/*--------------------------------------------------------------------------
9493 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
9494 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9495 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009496 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009497 \param hHal - The handle returned by macOpen.
9498 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
9499 Other status means SME is failed to update fEnableFwRssiMonitoring.
9500 \sa
9501 --------------------------------------------------------------------------*/
9502
9503eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
9504 v_BOOL_t fEnableFwRssiMonitoring)
9505{
9506 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
9507
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009508 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
9509 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
9510 {
9511 halStatus = eHAL_STATUS_FAILURE;
9512 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009513 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009514 }
9515
9516 return (halStatus);
9517}
9518
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009519#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08009520/*--------------------------------------------------------------------------
9521 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
9522 This is a synchronous call
9523 \param hHal - The handle returned by macOpen.
9524 \return eHAL_STATUS_SUCCESS - SME update config successful.
9525 Other status means SME is failed to update
9526 \sa
9527 --------------------------------------------------------------------------*/
9528eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
9529 v_U8_t neighborLookupRssiThreshold)
9530{
9531 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9532 eHalStatus status = eHAL_STATUS_SUCCESS;
9533
9534 status = sme_AcquireGlobalLock( &pMac->sme );
9535 if ( HAL_STATUS_SUCCESS( status ) )
9536 {
9537 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
9538 if (HAL_STATUS_SUCCESS(status))
9539 {
9540 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309541 "LFR runtime successfully set Lookup threshold to %d"
9542 " - old value is %d - roam state is %s",
9543 neighborLookupRssiThreshold,
9544 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
9545 macTraceGetNeighbourRoamState(
9546 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009547 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
9548 neighborLookupRssiThreshold;
9549 }
9550 sme_ReleaseGlobalLock( &pMac->sme );
9551 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009552 return status;
9553}
9554
9555/*--------------------------------------------------------------------------
9556 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
9557 This is a synchronous call
9558 \param hHal - The handle returned by macOpen.
9559 \return eHAL_STATUS_SUCCESS - SME update config successful.
9560 Other status means SME is failed to update
9561 \sa
9562 --------------------------------------------------------------------------*/
9563eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
9564 v_U8_t neighborReassocRssiThreshold)
9565{
9566 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9567 eHalStatus status = eHAL_STATUS_SUCCESS;
9568
9569 status = sme_AcquireGlobalLock( &pMac->sme );
9570 if ( HAL_STATUS_SUCCESS( status ) )
9571 {
9572 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309573 "LFR runtime successfully set Reassoc threshold to %d"
9574 "- old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009575 neighborReassocRssiThreshold,
9576 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309577 macTraceGetNeighbourRoamState(
9578 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009579 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
9580 neighborReassocRssiThreshold;
9581 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
9582 neighborReassocRssiThreshold;
9583 sme_ReleaseGlobalLock( &pMac->sme );
9584 }
9585
9586 return status ;
9587}
9588
9589
9590/*--------------------------------------------------------------------------
9591 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
9592 This is a synchronous call
9593 \param hHal - The handle returned by macOpen.
9594 \return eHAL_STATUS_SUCCESS - SME update config successful.
9595 Other status means SME is failed to update
9596 \sa
9597 --------------------------------------------------------------------------*/
9598v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
9599{
9600 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9601 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
9602}
9603
9604/*--------------------------------------------------------------------------
9605 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
9606 This is a synchronous call
9607 \param hHal - The handle returned by macOpen.
9608 \return eHAL_STATUS_SUCCESS - SME update config successful.
9609 Other status means SME is failed to update
9610 \sa
9611 --------------------------------------------------------------------------*/
9612eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
9613 v_U16_t neighborScanResultsRefreshPeriod)
9614{
9615 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9616 eHalStatus status = eHAL_STATUS_SUCCESS;
9617
9618 status = sme_AcquireGlobalLock( &pMac->sme );
9619 if ( HAL_STATUS_SUCCESS( status ) )
9620 {
9621 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309622 "LFR runtime successfully set roam scan refresh period to %d"
9623 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009624 neighborScanResultsRefreshPeriod,
9625 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309626 macTraceGetNeighbourRoamState(
9627 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009628 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
9629 neighborScanResultsRefreshPeriod;
9630 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
9631 neighborScanResultsRefreshPeriod;
9632
9633 sme_ReleaseGlobalLock( &pMac->sme );
9634 }
9635
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009636#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9637 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9638 {
9639 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9640 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
9641 }
9642#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009643 return status ;
9644}
9645
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009646#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9647/*--------------------------------------------------------------------------
9648 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
9649 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9650 gRoamScanOffloadEnabled.
9651 This is a synchronous call
9652 \param hHal - The handle returned by macOpen.
9653 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9654 Other status means SME is failed to update.
9655 \sa
9656 --------------------------------------------------------------------------*/
9657
9658eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
9659 v_BOOL_t nRoamScanOffloadEnabled)
9660{
9661 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9662 eHalStatus status = eHAL_STATUS_SUCCESS;
9663
9664 status = sme_AcquireGlobalLock( &pMac->sme );
9665 if ( HAL_STATUS_SUCCESS( status ) )
9666 {
9667 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9668 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
9669 pMac->roam.configParam.isRoamOffloadScanEnabled,
9670 nRoamScanOffloadEnabled);
9671 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
9672 sme_ReleaseGlobalLock( &pMac->sme );
9673 }
9674
9675 return status ;
9676}
9677#endif
9678
Srinivas Girigowdade697412013-02-14 16:31:48 -08009679/*--------------------------------------------------------------------------
9680 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
9681 This is a synchronous call
9682 \param hHal - The handle returned by macOpen.
9683 \return v_U16_t - Neighbor scan results refresh period value
9684 \sa
9685 --------------------------------------------------------------------------*/
9686v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
9687{
9688 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9689 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
9690}
9691
9692/*--------------------------------------------------------------------------
9693 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
9694 This is a synchronuous call
9695 \param hHal - The handle returned by macOpen.
9696 \return eHAL_STATUS_SUCCESS - SME update config successful.
9697 Other status means SME is failed to update
9698 \sa
9699 --------------------------------------------------------------------------*/
9700v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
9701{
9702 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9703 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
9704}
9705
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009706/* ---------------------------------------------------------------------------
9707 \fn sme_UpdateEmptyScanRefreshPeriod
9708 \brief Update nEmptyScanRefreshPeriod
9709 This function is called through dynamic setConfig callback function
9710 to configure nEmptyScanRefreshPeriod
9711 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
9712 \param hHal - HAL handle for device
9713 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
9714 \- return Success or failure
9715 -------------------------------------------------------------------------*/
9716
9717eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
9718{
9719 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9720 eHalStatus status = eHAL_STATUS_SUCCESS;
9721
9722 status = sme_AcquireGlobalLock( &pMac->sme );
9723 if ( HAL_STATUS_SUCCESS( status ) )
9724 {
9725 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309726 "LFR runtime successfully set roam scan period to %d -"
9727 "old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009728 nEmptyScanRefreshPeriod,
9729 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309730 macTraceGetNeighbourRoamState(
9731 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009732 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9733 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9734 sme_ReleaseGlobalLock( &pMac->sme );
9735 }
9736
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009737#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9738 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9739 {
9740 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9741 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
9742 }
9743#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009744 return status ;
9745}
9746
9747/* ---------------------------------------------------------------------------
9748 \fn sme_setNeighborScanMinChanTime
9749 \brief Update nNeighborScanMinChanTime
9750 This function is called through dynamic setConfig callback function
9751 to configure gNeighborScanChannelMinTime
9752 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
9753 \param hHal - HAL handle for device
9754 \param nNeighborScanMinChanTime - Channel minimum dwell time
9755 \- return Success or failure
9756 -------------------------------------------------------------------------*/
9757eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
9758{
9759 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9760 eHalStatus status = eHAL_STATUS_SUCCESS;
9761
9762 status = sme_AcquireGlobalLock( &pMac->sme );
9763 if ( HAL_STATUS_SUCCESS( status ) )
9764 {
9765 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309766 "LFR runtime successfully set channel min dwell time to %d"
9767 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009768 nNeighborScanMinChanTime,
9769 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309770 macTraceGetNeighbourRoamState(
9771 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009772 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
9773 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
9774 sme_ReleaseGlobalLock( &pMac->sme );
9775 }
9776
9777 return status ;
9778}
9779
9780/* ---------------------------------------------------------------------------
9781 \fn sme_setNeighborScanMaxChanTime
9782 \brief Update nNeighborScanMaxChanTime
9783 This function is called through dynamic setConfig callback function
9784 to configure gNeighborScanChannelMaxTime
9785 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
9786 \param hHal - HAL handle for device
9787 \param nNeighborScanMinChanTime - Channel maximum dwell time
9788 \- return Success or failure
9789 -------------------------------------------------------------------------*/
9790eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
9791{
9792 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9793 eHalStatus status = eHAL_STATUS_SUCCESS;
9794
9795 status = sme_AcquireGlobalLock( &pMac->sme );
9796 if ( HAL_STATUS_SUCCESS( status ) )
9797 {
9798 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309799 "LFR runtime successfully set channel max dwell time to %d"
9800 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009801 nNeighborScanMaxChanTime,
9802 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309803 macTraceGetNeighbourRoamState(
9804 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009805 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
9806 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
9807 sme_ReleaseGlobalLock( &pMac->sme );
9808 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009809#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9810 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9811 {
9812 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9813 REASON_SCAN_CH_TIME_CHANGED);
9814 }
9815#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009816
9817 return status ;
9818}
9819
9820/* ---------------------------------------------------------------------------
9821 \fn sme_getNeighborScanMinChanTime
9822 \brief get neighbor scan min channel time
9823 \param hHal - The handle returned by macOpen.
9824 \return v_U16_t - channel min time value
9825 -------------------------------------------------------------------------*/
9826v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
9827{
9828 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9829 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
9830}
9831
9832/* ---------------------------------------------------------------------------
9833 \fn sme_getNeighborScanMaxChanTime
9834 \brief get neighbor scan max channel time
9835 \param hHal - The handle returned by macOpen.
9836 \return v_U16_t - channel max time value
9837 -------------------------------------------------------------------------*/
9838v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
9839{
9840 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9841 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
9842}
9843
9844/* ---------------------------------------------------------------------------
9845 \fn sme_setNeighborScanPeriod
9846 \brief Update nNeighborScanPeriod
9847 This function is called through dynamic setConfig callback function
9848 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009849 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009850 \param hHal - HAL handle for device
9851 \param nNeighborScanPeriod - neighbor scan period
9852 \- return Success or failure
9853 -------------------------------------------------------------------------*/
9854eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
9855{
9856 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9857 eHalStatus status = eHAL_STATUS_SUCCESS;
9858
9859 status = sme_AcquireGlobalLock( &pMac->sme );
9860 if ( HAL_STATUS_SUCCESS( status ) )
9861 {
9862 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309863 "LFR runtime successfully set neighbor scan period to %d"
9864 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009865 nNeighborScanPeriod,
9866 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309867 macTraceGetNeighbourRoamState(
9868 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009869 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
9870 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
9871 sme_ReleaseGlobalLock( &pMac->sme );
9872 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009873#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9874 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9875 {
9876 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9877 REASON_SCAN_HOME_TIME_CHANGED);
9878 }
9879#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009880
9881 return status ;
9882}
9883
9884/* ---------------------------------------------------------------------------
9885 \fn sme_getNeighborScanPeriod
9886 \brief get neighbor scan period
9887 \param hHal - The handle returned by macOpen.
9888 \return v_U16_t - neighbor scan period
9889 -------------------------------------------------------------------------*/
9890v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
9891{
9892 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9893 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
9894}
9895
9896#endif
9897
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009898#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009899
Srinivas Girigowdade697412013-02-14 16:31:48 -08009900/*--------------------------------------------------------------------------
9901 \brief sme_getRoamRssiDiff() - get Roam rssi diff
9902 This is a synchronous call
9903 \param hHal - The handle returned by macOpen.
9904 \return v_U16_t - Rssi diff value
9905 \sa
9906 --------------------------------------------------------------------------*/
9907v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
9908{
9909 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9910 return pMac->roam.configParam.RoamRssiDiff;
9911}
9912
9913/*--------------------------------------------------------------------------
9914 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
9915 This is a synchronous call
9916 \param hHal - The handle returned by macOpen.
9917 \return eHAL_STATUS_SUCCESS - SME update config successful.
9918 Other status means SME is failed to update
9919 \sa
9920 --------------------------------------------------------------------------*/
9921eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9922 tANI_U8 numChannels)
9923{
9924 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9925 eHalStatus status = eHAL_STATUS_SUCCESS;
9926 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009927 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +05309928 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08009929 tANI_U8 i = 0, j = 0;
9930
9931 status = sme_AcquireGlobalLock( &pMac->sme );
9932 if ( HAL_STATUS_SUCCESS( status ) )
9933 {
9934 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9935 {
9936 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
9937 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309938 if (j < sizeof(oldChannelList))
9939 {
9940 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9941 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9942 }
9943 else
9944 {
9945 break;
9946 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009947 }
9948 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009949 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009950 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009951 sme_SetRoamScanControl(hHal, 1);
9952 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009953 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009954 j = 0;
9955 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009956 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309957 if (j < sizeof(oldChannelList))
9958 {
9959 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9960 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9961 }
9962 else
9963 {
9964 break;
9965 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009966 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009967 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009968
9969 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309970 "LFR runtime successfully set roam scan channels to %s"
9971 "- old value is %s - roam state is %s",
9972 newChannelList, oldChannelList,
9973 macTraceGetNeighbourRoamState(
9974 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009975 sme_ReleaseGlobalLock( &pMac->sme );
9976 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009977#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9978 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9979 {
9980 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9981 }
9982#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009983
9984 return status ;
9985}
9986
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009987
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009988#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009989/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009990 \brief sme_SetEseRoamScanChannelList() - set ese roam scan channel list
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009991 This is a synchronuous call
9992 \param hHal - The handle returned by macOpen.
9993 \return eHAL_STATUS_SUCCESS - SME update config successful.
9994 Other status means SME is failed to update
9995 \sa
9996 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009997eHalStatus sme_SetEseRoamScanChannelList(tHalHandle hHal,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009998 tANI_U8 *pChannelList,
9999 tANI_U8 numChannels)
10000{
10001 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10002 eHalStatus status = eHAL_STATUS_SUCCESS;
10003 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
10004 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
10005 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
10006 tANI_U8 newChannelList[128] = {0};
10007 tANI_U8 i = 0, j = 0;
10008
10009 status = sme_AcquireGlobalLock( &pMac->sme );
10010 if ( HAL_STATUS_SUCCESS( status ) )
10011 {
10012 if (NULL != currChannelListInfo->ChannelList)
10013 {
10014 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
10015 {
10016 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
10017 currChannelListInfo->ChannelList[i]);
10018 }
10019 }
10020 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
10021
10022 if ( HAL_STATUS_SUCCESS( status ))
10023 {
10024 if (NULL != currChannelListInfo->ChannelList)
10025 {
10026 j = 0;
10027 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
10028 {
10029 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
10030 currChannelListInfo->ChannelList[i]);
10031 }
10032 }
10033
10034 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010035 "ESE roam scan channel list successfully set to %s - old value is %s - roam state is %s",
10036 newChannelList, oldChannelList,
10037 macTraceGetNeighbourRoamState(pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010038 }
10039 sme_ReleaseGlobalLock( &pMac->sme );
10040 }
10041#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10042 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10043 {
10044 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
10045 }
10046#endif
10047
10048 return status ;
10049}
10050#endif
10051
Srinivas Girigowdade697412013-02-14 16:31:48 -080010052/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -080010053 \brief sme_getRoamScanChannelList() - get roam scan channel list
10054 This is a synchronous call
10055 \param hHal - The handle returned by macOpen.
10056 \return eHAL_STATUS_SUCCESS - SME update config successful.
10057 Other status means SME is failed to update
10058 \sa
10059 --------------------------------------------------------------------------*/
10060eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
10061 tANI_U8 *pNumChannels)
10062{
10063 int i = 0;
10064 tANI_U8 *pOutPtr = pChannelList;
10065 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10066 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
10067 eHalStatus status = eHAL_STATUS_SUCCESS;
10068
10069 status = sme_AcquireGlobalLock( &pMac->sme );
10070 if ( HAL_STATUS_SUCCESS( status ) )
10071 {
10072 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
10073 {
10074 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
10075 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010076 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -080010077 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010078 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -080010079 }
10080
10081 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
10082 for (i = 0; i < (*pNumChannels); i++)
10083 {
10084 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
10085 }
10086 pOutPtr[i] = '\0';
10087 sme_ReleaseGlobalLock( &pMac->sme );
10088 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080010089 return status ;
10090}
10091
10092/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010093 \brief sme_getIsEseFeatureEnabled() - get Ese feature enabled or not
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010094 This is a synchronuous call
10095 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010096 \return TRUE (1) - if the Ese feature is enabled
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010097 FALSE (0) - if feature is disabled (compile or runtime)
10098 \sa
10099 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010100tANI_BOOLEAN sme_getIsEseFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -080010101{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010102#ifdef FEATURE_WLAN_ESE
Srinivas Girigowdade697412013-02-14 16:31:48 -080010103 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010104 return csrRoamIsEseIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010105#else
10106 return eANI_BOOLEAN_FALSE;
10107#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080010108}
10109
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010110/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070010111 \brief sme_GetWESMode() - get WES Mode
10112 This is a synchronous call
10113 \param hHal - The handle returned by macOpen
10114 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
10115 \sa
10116 --------------------------------------------------------------------------*/
10117v_BOOL_t sme_GetWESMode(tHalHandle hHal)
10118{
10119 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10120 return pMac->roam.configParam.isWESModeEnabled;
10121}
10122
10123/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010124 \brief sme_GetRoamScanControl() - get scan control
10125 This is a synchronous call
10126 \param hHal - The handle returned by macOpen.
10127 \return v_BOOL_t - Enabled(1)/Disabled(0)
10128 \sa
10129 --------------------------------------------------------------------------*/
10130v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
10131{
10132 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10133 return pMac->roam.configParam.nRoamScanControl;
10134}
10135#endif
10136
10137/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010138 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
10139 This is a synchronuous call
10140 \param hHal - The handle returned by macOpen.
10141 \return TRUE (1) - if the feature is enabled
10142 FALSE (0) - if feature is disabled (compile or runtime)
10143 \sa
10144 --------------------------------------------------------------------------*/
10145tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
10146{
10147#ifdef FEATURE_WLAN_LFR
10148 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10149 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
10150#else
10151 return eANI_BOOLEAN_FALSE;
10152#endif
10153}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080010154
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010155/*--------------------------------------------------------------------------
10156 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
10157 This is a synchronuous call
10158 \param hHal - The handle returned by macOpen.
10159 \return TRUE (1) - if the feature is enabled
10160 FALSE (0) - if feature is disabled (compile or runtime)
10161 \sa
10162 --------------------------------------------------------------------------*/
10163tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
10164{
10165#ifdef WLAN_FEATURE_VOWIFI_11R
10166 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10167 return pMac->roam.configParam.isFastTransitionEnabled;
10168#else
10169 return eANI_BOOLEAN_FALSE;
10170#endif
10171}
10172
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010173/* ---------------------------------------------------------------------------
10174 \fn sme_IsFeatureSupportedByFW
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010175
Kiet Lam0f320422013-11-21 19:29:17 +053010176 \brief Check if a feature is enabled by FW
10177
10178 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010179
Kiet Lam0f320422013-11-21 19:29:17 +053010180 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010181 -------------------------------------------------------------------------*/
10182tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
10183{
10184 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
10185}
Kiet Lam0f320422013-11-21 19:29:17 +053010186
10187/* ---------------------------------------------------------------------------
10188 \fn sme_IsFeatureSupportedByDriver
10189 \brief Check if a feature is enabled by Driver
10190
10191 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
10192 \- return 1/0 (TRUE/FALSE)
10193 -------------------------------------------------------------------------*/
10194
10195tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
10196{
10197 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
10198}
10199
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010200#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053010201
10202/* ---------------------------------------------------------------------------
10203 \fn sme_SendTdlsMgmtFrame
10204 \brief API to send TDLS management frames.
10205
10206 \param peerMac - peer's Mac Adress.
10207 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
10208 \- return VOS_STATUS_SUCCES
10209 -------------------------------------------------------------------------*/
10210VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
10211 tANI_U8 sessionId,
10212 tSirMacAddr peerMac,
10213 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
10214{
10215 eHalStatus status = eHAL_STATUS_SUCCESS;
10216 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10217
10218 status = sme_AcquireGlobalLock( &pMac->sme );
10219
10220 if ( HAL_STATUS_SUCCESS( status ) )
10221 {
10222 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
10223 sme_ReleaseGlobalLock( &pMac->sme );
10224 }
10225 return status ;
10226}
10227
Atul Mittalc0f739f2014-07-31 13:47:47 +053010228// tdlsoffchan
10229
10230/* ---------------------------------------------------------------------------
10231 \fn sme_SendTdlsChanSwitchReq
10232 \brief API to send TDLS management frames.
10233
10234 \param peerMac - peer's Mac Adress.
10235 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
10236 \- return VOS_STATUS_SUCCES
10237 -------------------------------------------------------------------------*/
10238VOS_STATUS sme_SendTdlsChanSwitchReq(tHalHandle hHal,
10239 tANI_U8 sessionId,
10240 tSirMacAddr peerMac,
10241 tANI_S32 tdlsOffCh,
10242 tANI_S32 tdlsOffChBwOffset,
10243 tANI_U8 tdlsSwMode)
10244{
10245 eHalStatus status = eHAL_STATUS_SUCCESS;
10246 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10247
10248 status = sme_AcquireGlobalLock( &pMac->sme );
10249
10250 if ( HAL_STATUS_SUCCESS( status ) )
10251 {
10252 status = csrTdlsSendChanSwitchReq(hHal, sessionId, peerMac,
10253 tdlsOffCh, tdlsOffChBwOffset,
10254 tdlsSwMode);
10255 }
10256 sme_ReleaseGlobalLock( &pMac->sme );
10257 return status ;
10258}
10259
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010260/* ---------------------------------------------------------------------------
10261 \fn sme_SendTdlsMgmtFrame
10262 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010263
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010264 \param peerMac - peer's Mac Adress.
10265 \param frame_type - Type of TDLS mgmt frame to be sent.
10266 \param dialog - dialog token used in the frame.
10267 \param status - status to be incuded in the frame.
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010268 \param peerCapability - peer cpabilities
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010269 \param buf - additional IEs to be included
10270 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -080010271 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010272 \- return VOS_STATUS_SUCCES
10273 -------------------------------------------------------------------------*/
10274VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010275 tANI_U8 frame_type, tANI_U8 dialog, tANI_U16 statusCode, tANI_U32 peerCapability, tANI_U8 *buf, tANI_U8 len, tANI_U8 responder)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010276{
10277 eHalStatus status = eHAL_STATUS_SUCCESS;
10278 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
10279 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10280
10281 status = sme_AcquireGlobalLock( &pMac->sme );
10282 if ( HAL_STATUS_SUCCESS( status ) )
10283 {
10284 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10285 sendTdlsReq.frameType = frame_type;
10286 sendTdlsReq.buf = buf;
10287 sendTdlsReq.len = len;
10288 sendTdlsReq.dialog = dialog;
10289 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -080010290 sendTdlsReq.responder = responder;
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010291 sendTdlsReq.peerCapability = peerCapability;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010292
10293 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
10294
10295 sme_ReleaseGlobalLock( &pMac->sme );
10296 }
10297
10298 return status ;
10299
10300}
10301/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010302 \fn sme_ChangeTdlsPeerSta
10303 \brief API to Update TDLS peer sta parameters.
10304
10305 \param peerMac - peer's Mac Adress.
10306 \param staParams - Peer Station Parameters
10307 \- return VOS_STATUS_SUCCES
10308 -------------------------------------------------------------------------*/
10309VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
10310 tCsrStaParams *pstaParams)
10311{
10312 eHalStatus status = eHAL_STATUS_SUCCESS;
10313 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10314
Sushant Kaushikd62d9782014-02-19 15:39:40 +053010315 if (NULL == pstaParams)
10316 {
10317 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10318 "%s :pstaParams is NULL",__func__);
10319 return eHAL_STATUS_FAILURE;
10320 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010321 status = sme_AcquireGlobalLock( &pMac->sme );
10322 if ( HAL_STATUS_SUCCESS( status ) )
10323 {
10324 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
10325
10326 sme_ReleaseGlobalLock( &pMac->sme );
10327 }
10328
10329 return status ;
10330
10331}
10332
10333/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010334 \fn sme_AddTdlsPeerSta
10335 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010336
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010337 \param peerMac - peer's Mac Adress.
10338 \- return VOS_STATUS_SUCCES
10339 -------------------------------------------------------------------------*/
10340VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10341{
10342 eHalStatus status = eHAL_STATUS_SUCCESS;
10343 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10344
10345 status = sme_AcquireGlobalLock( &pMac->sme );
10346 if ( HAL_STATUS_SUCCESS( status ) )
10347 {
10348 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
10349
10350 sme_ReleaseGlobalLock( &pMac->sme );
10351 }
10352
10353 return status ;
10354
10355}
10356/* ---------------------------------------------------------------------------
10357 \fn sme_DeleteTdlsPeerSta
10358 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010359
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010360 \param peerMac - peer's Mac Adress.
10361 \- return VOS_STATUS_SUCCES
10362 -------------------------------------------------------------------------*/
10363VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10364{
10365 eHalStatus status = eHAL_STATUS_SUCCESS;
10366 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10367
10368 status = sme_AcquireGlobalLock( &pMac->sme );
10369 if ( HAL_STATUS_SUCCESS( status ) )
10370 {
10371 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
10372
10373 sme_ReleaseGlobalLock( &pMac->sme );
10374 }
10375
10376 return status ;
10377
10378}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -070010379/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070010380 \fn sme_SetTdlsPowerSaveProhibited
10381 \API to set/reset the isTdlsPowerSaveProhibited.
10382
10383 \- return void
10384 -------------------------------------------------------------------------*/
10385void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
10386{
10387 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10388
10389 pMac->isTdlsPowerSaveProhibited = val;
10390 return;
10391}
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010392#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +053010393/* ---------------------------------------------------------------------------
10394 \fn sme_IsPmcBmps
10395 \API to Check if PMC state is BMPS.
10396
10397 \- return v_BOOL_t
10398 -------------------------------------------------------------------------*/
10399v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
10400{
10401 return (BMPS == pmcGetPmcState(hHal));
10402}
10403
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010404#ifdef FEATURE_WLAN_TDLS_INTERNAL
10405/*
10406 * SME API to start TDLS discovery Procedure
10407 */
10408VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10409{
10410 VOS_STATUS status = VOS_STATUS_SUCCESS;
10411 tCsrTdlsDisRequest disReq = {{0}} ;
10412 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10413 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
10414
10415 return status ;
10416
10417}
10418
10419/*
10420 * Process TDLS discovery results
10421 */
10422v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
10423 tSmeTdlsDisResult *disResult, v_U8_t listType)
10424{
10425 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
10426 tSirTdlsPeerInfo *peerInfo = NULL ;
10427 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10428 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
10429 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
10430 tListElem *pEntry = NULL ;
10431 v_U8_t peerCnt = 0 ;
10432
10433 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010434 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010435 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
10436 while(pEntry)
10437 {
10438 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
10439 tdlsPeerStaLink) ;
10440 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
10441
10442 switch(listType)
10443 {
10444 case TDLS_SETUP_LIST:
10445 {
10446 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
10447 {
Kiet Lam64c1b492013-07-12 13:56:44 +053010448 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
10449 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010450 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
10451 peerCnt++ ;
10452 }
10453 break ;
10454 }
10455 case TDLS_DIS_LIST:
10456 {
Kiet Lam64c1b492013-07-12 13:56:44 +053010457 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
10458 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010459 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
10460 peerCnt++ ;
10461 break ;
10462 }
10463 default:
10464 {
10465 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010466 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010467 break ;
10468 }
10469 }
10470
10471 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
10472 }
10473
10474 return peerCnt ;
10475
10476}
10477
10478/*
10479 * SME API to start TDLS link setup Procedure.
10480 */
10481VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10482{
10483 VOS_STATUS status = VOS_STATUS_SUCCESS;
10484 tCsrTdlsSetupRequest setupReq = {{0}} ;
10485 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10486 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
10487 return status ;
10488
10489}
10490
10491/*
10492 * SME API to start TDLS link Teardown Procedure.
10493 */
10494VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10495{
10496 VOS_STATUS status = VOS_STATUS_SUCCESS;
10497 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
10498 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10499 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
10500 return status ;
10501
10502}
10503
10504#endif /* FEATURE_WLAN_TDLS */
10505
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070010506eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
10507{
10508 eHalStatus status = eHAL_STATUS_FAILURE;
10509 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10510
10511 smsLog(pMac, LOG2, FL("enter"));
10512 status = sme_AcquireGlobalLock( &pMac->sme );
10513 if ( HAL_STATUS_SUCCESS( status ) )
10514 {
10515 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
10516 sme_ReleaseGlobalLock( &pMac->sme );
10517 }
10518 smsLog(pMac, LOG2, FL("exit status %d"), status);
10519
10520 return (status);
10521}
10522
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -070010523/*
10524 * SME API to enable/disable WLAN driver initiated SSR
10525 */
10526void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
10527{
10528 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10529 eHalStatus status = eHAL_STATUS_SUCCESS;
10530
10531 status = sme_AcquireGlobalLock(&pMac->sme);
10532 if (HAL_STATUS_SUCCESS(status))
10533 {
10534 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
10535 "SSR level is changed %d", enableSSR);
10536 /* not serializing this messsage, as this is only going
10537 * to set a variable in WDA/WDI
10538 */
10539 WDA_SetEnableSSR(enableSSR);
10540 sme_ReleaseGlobalLock(&pMac->sme);
10541 }
10542 return;
10543}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010544
10545/*
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010546 * SME API to stringify bonding mode. (hostapd convention)
10547 */
10548
10549static const char* sme_CBMode2String( tANI_U32 mode)
10550{
10551 switch (mode)
10552 {
10553 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
10554 return "HT20";
10555 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
10556 return "HT40-"; /* lower secondary channel */
10557 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
10558 return "HT40+"; /* upper secondary channel */
10559#ifdef WLAN_FEATURE_11AC
10560 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
10561 return "VHT80+40+"; /* upper secondary channels */
10562 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
10563 return "VHT80+40-"; /* 1 lower and 2 upper secondary channels */
10564 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
10565 return "VHT80-40+"; /* 2 lower and 1 upper secondary channels */
10566 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
10567 return "VHT80-40-"; /* lower secondary channels */
10568#endif
10569 default:
10570 VOS_ASSERT(0);
10571 return "Unknown";
10572 }
10573}
10574
10575/*
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010576 * SME API to determine the channel bonding mode
10577 */
10578VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
10579{
10580 tSmeConfigParams smeConfig;
10581 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10582
10583 if (
10584#ifdef WLAN_FEATURE_11AC
10585 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
10586 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
10587#endif
10588 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
krunal soni634aba32014-03-06 17:46:50 -080010589 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode &&
10590
10591 eCSR_DOT11_MODE_11a != eCsrPhyMode &&
10592 eCSR_DOT11_MODE_11a_ONLY != eCsrPhyMode &&
10593
10594 eCSR_DOT11_MODE_abg != eCsrPhyMode
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010595 )
10596 {
10597 return VOS_STATUS_SUCCESS;
10598 }
10599
Kaushik, Sushant553a06c2014-11-26 15:29:40 +053010600 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010601 sme_GetConfigParam(pMac, &smeConfig);
10602
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010603 /* If channel bonding mode is not required */
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010604#ifdef WLAN_FEATURE_AP_HT40_24G
10605 if ( !pMac->roam.configParam.channelBondingMode5GHz
10606 && !smeConfig.csrConfig.apHT40_24GEnabled ) {
10607#else
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010608 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010609#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010610 return VOS_STATUS_SUCCESS;
10611 }
10612
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010613
10614#ifdef WLAN_FEATURE_11AC
10615 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
10616 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
10617 {
10618 if ( channel== 36 || channel == 52 || channel == 100 ||
10619 channel == 116 || channel == 149 )
10620 {
10621 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010622 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010623 }
10624 else if ( channel == 40 || channel == 56 || channel == 104 ||
10625 channel == 120 || channel == 153 )
10626 {
10627 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010628 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010629 }
10630 else if ( channel == 44 || channel == 60 || channel == 108 ||
10631 channel == 124 || channel == 157 )
10632 {
10633 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010634 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010635 }
10636 else if ( channel == 48 || channel == 64 || channel == 112 ||
Leo Changd0a49842013-12-30 11:41:04 -080010637 channel == 128 || channel == 144 || channel == 161 )
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010638 {
10639 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010640 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010641 }
10642 else if ( channel == 165 )
10643 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010644 smeConfig.csrConfig.channelBondingMode5GHz =
10645 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010646 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010647
10648#ifdef WLAN_FEATURE_AP_HT40_24G
10649 if (smeConfig.csrConfig.apHT40_24GEnabled)
10650 {
10651 if (channel >= 1 && channel <= 7)
10652 smeConfig.csrConfig.channelBondingAPMode24GHz =
10653 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
10654 else if (channel >= 8 && channel <= 13)
10655 smeConfig.csrConfig.channelBondingAPMode24GHz =
10656 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
10657 else if (channel ==14)
10658 smeConfig.csrConfig.channelBondingAPMode24GHz =
10659 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10660 }
10661#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010662 }
10663#endif
10664
10665 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
10666 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
10667 {
10668 if ( channel== 40 || channel == 48 || channel == 56 ||
10669 channel == 64 || channel == 104 || channel == 112 ||
10670 channel == 120 || channel == 128 || channel == 136 ||
10671 channel == 144 || channel == 153 || channel == 161 )
10672 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010673 smeConfig.csrConfig.channelBondingMode5GHz =
10674 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010675 }
10676 else if ( channel== 36 || channel == 44 || channel == 52 ||
10677 channel == 60 || channel == 100 || channel == 108 ||
10678 channel == 116 || channel == 124 || channel == 132 ||
10679 channel == 140 || channel == 149 || channel == 157 )
10680 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010681 smeConfig.csrConfig.channelBondingMode5GHz =
10682 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010683 }
10684 else if ( channel == 165 )
10685 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010686 smeConfig.csrConfig.channelBondingMode5GHz =
10687 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010688 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010689
10690#ifdef WLAN_FEATURE_AP_HT40_24G
10691 if (smeConfig.csrConfig.apHT40_24GEnabled)
10692 {
10693 if (channel >= 1 && channel <= 7)
10694 smeConfig.csrConfig.channelBondingAPMode24GHz =
10695 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
10696 else if (channel >= 8 && channel <= 13)
10697 smeConfig.csrConfig.channelBondingAPMode24GHz =
10698 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
10699 else if (channel ==14)
10700 smeConfig.csrConfig.channelBondingAPMode24GHz =
10701 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10702 }
10703#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010704 }
krunal soni634aba32014-03-06 17:46:50 -080010705
10706 /*
10707 for 802.11a phy mode, channel bonding should be zero.
10708 From default config, it is set as PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3
10709 through csrChangeDefaultConfigParam function. We will override this
10710 value here.
10711 */
10712 if ( eCSR_DOT11_MODE_11a == eCsrPhyMode ||
10713 eCSR_DOT11_MODE_11a_ONLY == eCsrPhyMode ||
10714 eCSR_DOT11_MODE_abg == eCsrPhyMode)
10715 {
10716 smeConfig.csrConfig.channelBondingMode5GHz = 0;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010717#ifdef WLAN_FEATURE_AP_HT40_24G
10718 } else if ( eCSR_DOT11_MODE_11g_ONLY == eCsrPhyMode)
10719 smeConfig.csrConfig.channelBondingAPMode24GHz =
10720 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10721#else
krunal soni634aba32014-03-06 17:46:50 -080010722 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010723#endif
krunal soni634aba32014-03-06 17:46:50 -080010724
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010725#ifdef WLAN_FEATURE_AP_HT40_24G
10726 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10727 FL("%s cbmode selected=%d bonding mode:%s"),
10728 (channel <= 14) ? "2G" : "5G",
10729 (channel <= 14) ? smeConfig.csrConfig.channelBondingAPMode24GHz :
10730 smeConfig.csrConfig.channelBondingMode5GHz,
10731 (channel <= 14) ?
10732 sme_CBMode2String(smeConfig.csrConfig.channelBondingAPMode24GHz) :
10733 sme_CBMode2String(smeConfig.csrConfig.channelBondingMode5GHz));
10734#else
Agarwal Ashishbf98caf2014-03-25 13:29:11 +053010735 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010736 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
10737#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010738
10739 sme_UpdateConfig (pMac, &smeConfig);
10740 return VOS_STATUS_SUCCESS;
10741}
10742
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -070010743/*--------------------------------------------------------------------------
10744
10745 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
10746 \param hHal - The handle returned by macOpen.
10747 \param currDeviceMode - Current operating device mode.
10748 --------------------------------------------------------------------------*/
10749
10750void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
10751{
10752 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10753 pMac->sme.currDeviceMode = currDeviceMode;
10754 return;
10755}
10756
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -070010757#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10758/*--------------------------------------------------------------------------
10759 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
10760 from CSR.
10761 This is a synchronous call
10762 \param hHal - The handle returned by macOpen
10763 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
10764 BSSID, channel etc.)
10765 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
10766 Other status means SME is failed to send the request.
10767 \sa
10768 --------------------------------------------------------------------------*/
10769
10770eHalStatus sme_HandoffRequest(tHalHandle hHal,
10771 tCsrHandoffRequest *pHandoffInfo)
10772{
10773 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10774 eHalStatus status = eHAL_STATUS_SUCCESS;
10775
10776 status = sme_AcquireGlobalLock( &pMac->sme );
10777 if ( HAL_STATUS_SUCCESS( status ) )
10778 {
10779 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10780 "%s: invoked", __func__);
10781 status = csrHandoffRequest(pMac, pHandoffInfo);
10782 sme_ReleaseGlobalLock( &pMac->sme );
10783 }
10784
10785 return status ;
10786}
10787#endif
10788
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -070010789/*
10790 * SME API to check if there is any infra station or
10791 * P2P client is connected
10792 */
10793VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
10794{
10795 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10796 if(csrIsInfraConnected(pMac))
10797 {
10798 return VOS_STATUS_SUCCESS;
10799 }
10800 return VOS_STATUS_E_FAILURE;
10801}
10802
Agarwal Ashish57e84372014-12-05 18:26:53 +053010803/*
10804 * SME API to check if any sessoion connected.
10805 */
10806VOS_STATUS sme_is_any_session_connected(tHalHandle hHal)
10807{
10808 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10809 if(csrIsAnySessionConnected(pMac))
10810 {
10811
10812 return VOS_STATUS_SUCCESS;
10813 }
10814 return VOS_STATUS_E_FAILURE;
10815}
10816
Leo Chang9056f462013-08-01 19:21:11 -070010817
10818#ifdef FEATURE_WLAN_LPHB
10819/* ---------------------------------------------------------------------------
10820 \fn sme_LPHBConfigReq
10821 \API to make configuration LPHB within FW.
10822 \param hHal - The handle returned by macOpen
10823 \param lphdReq - LPHB request argument by client
10824 \param pCallbackfn - LPHB timeout notification callback function pointer
10825 \- return Configuration message posting status, SUCCESS or Fail
10826 -------------------------------------------------------------------------*/
10827eHalStatus sme_LPHBConfigReq
10828(
10829 tHalHandle hHal,
10830 tSirLPHBReq *lphdReq,
10831 void (*pCallbackfn)(void *pAdapter, void *indParam)
10832)
10833{
10834 eHalStatus status = eHAL_STATUS_SUCCESS;
10835 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
10836 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10837 vos_msg_t vosMessage;
10838
10839 status = sme_AcquireGlobalLock(&pMac->sme);
10840 if (eHAL_STATUS_SUCCESS == status)
10841 {
10842 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
10843 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070010844 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070010845 {
10846 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10847 "%s: Indication Call back did not registered", __func__);
10848 sme_ReleaseGlobalLock(&pMac->sme);
10849 return eHAL_STATUS_FAILURE;
10850 }
10851 else if (NULL != pCallbackfn)
10852 {
Leo Changd9df8aa2013-09-26 13:32:26 -070010853 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070010854 }
10855
10856 /* serialize the req through MC thread */
10857 vosMessage.bodyptr = lphdReq;
10858 vosMessage.type = WDA_LPHB_CONF_REQ;
10859 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
10860 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
10861 {
10862 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10863 "%s: Post Config LPHB MSG fail", __func__);
10864 status = eHAL_STATUS_FAILURE;
10865 }
10866 sme_ReleaseGlobalLock(&pMac->sme);
10867 }
10868
10869 return(status);
10870}
10871#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070010872/*--------------------------------------------------------------------------
10873 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
10874 scan parameter.
10875 This is a synchronous call
10876 \param hHal - The handle returned by macOpen
10877 \return NONE.
10878 \sa
10879 --------------------------------------------------------------------------*/
10880void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
10881 tANI_U8 nNumP2PChan)
10882{
10883 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10884
10885 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
10886 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
10887
10888 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10889 "%s: SCAN nNumStaChanCombinedConc : %d,"
10890 "nNumP2PChanCombinedConc : %d ",
10891 __func__, nNumStaChan, nNumP2PChan);
10892
10893 return;
10894
10895}
Leo Chang9056f462013-08-01 19:21:11 -070010896
Yue Mab9c86f42013-08-14 15:59:08 -070010897/* ---------------------------------------------------------------------------
10898 \fn sme_AddPeriodicTxPtrn
10899 \brief API to Periodic TX Pattern Offload feature
10900 \param hHal - The handle returned by macOpen
10901 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
10902 \return eHalStatus
10903 ---------------------------------------------------------------------------*/
10904eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
10905 *addPeriodicTxPtrnParams)
10906{
10907 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10908 eHalStatus status;
10909 vos_msg_t msg;
10910
10911 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10912 {
10913 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
10914 msg.bodyptr = addPeriodicTxPtrnParams;
10915
10916 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10917 {
10918 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10919 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
10920 __func__);
10921
10922 sme_ReleaseGlobalLock(&pMac->sme);
10923 return eHAL_STATUS_FAILURE;
10924 }
10925
10926 sme_ReleaseGlobalLock(&pMac->sme);
10927 return eHAL_STATUS_SUCCESS;
10928 }
10929
10930 return status;
10931}
10932
10933/* ---------------------------------------------------------------------------
10934 \fn sme_DelPeriodicTxPtrn
10935 \brief API to Periodic TX Pattern Offload feature
10936 \param hHal - The handle returned by macOpen
10937 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
10938 \return eHalStatus
10939 ---------------------------------------------------------------------------*/
10940eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
10941 *delPeriodicTxPtrnParams)
10942{
10943 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10944 eHalStatus status;
10945 vos_msg_t msg;
10946
10947 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10948 {
10949 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
10950 msg.bodyptr = delPeriodicTxPtrnParams;
10951
10952 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10953 {
10954 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10955 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
10956 __func__);
10957
10958 sme_ReleaseGlobalLock(&pMac->sme);
10959 return eHAL_STATUS_FAILURE;
10960 }
10961
10962 sme_ReleaseGlobalLock(&pMac->sme);
10963 return eHAL_STATUS_SUCCESS;
10964 }
10965
10966 return status;
10967}
10968
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010969void smeGetCommandQStatus( tHalHandle hHal )
10970{
10971 tSmeCmd *pTempCmd = NULL;
10972 tListElem *pEntry;
10973 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10974
10975 if (NULL == pMac)
10976 {
Kiet Lamcffc5862013-10-30 16:28:45 +053010977 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
10978 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010979 return;
10980 }
10981
10982 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
10983 if( pEntry )
10984 {
10985 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
10986 }
10987 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
10988 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
10989 if(pTempCmd)
10990 {
10991 if( eSmeCsrCommandMask & pTempCmd->command )
10992 {
10993 //CSR command is stuck. See what the reason code is for that command
10994 dumpCsrCommandInfo(pMac, pTempCmd);
10995 }
10996 } //if(pTempCmd)
10997
10998 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
10999 csrLLCount(&pMac->sme.smeCmdPendingList));
11000
11001 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
11002 csrLLCount(&pMac->roam.roamCmdPendingList));
11003
11004 return;
11005}
Rajeev79dbe4c2013-10-05 11:03:42 +053011006
11007#ifdef FEATURE_WLAN_BATCH_SCAN
11008/* ---------------------------------------------------------------------------
11009 \fn sme_SetBatchScanReq
11010 \brief API to set batch scan request in FW
11011 \param hHal - The handle returned by macOpen.
11012 \param pRequest - Pointer to the batch request.
11013 \param sessionId - session ID
11014 \param callbackRoutine - HDD callback which needs to be invoked after
11015 getting set batch scan response from FW
11016 \param callbackContext - pAdapter context
11017 \return eHalStatus
11018 ---------------------------------------------------------------------------*/
11019eHalStatus sme_SetBatchScanReq
11020(
11021 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
11022 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
11023 void *callbackContext
11024)
11025{
11026 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11027 eHalStatus status;
11028
Yue Mae36e3552014-03-05 17:06:20 -080011029 if (!pMac)
11030 {
11031 return eHAL_STATUS_FAILURE;
11032 }
11033
Rajeev79dbe4c2013-10-05 11:03:42 +053011034 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11035 {
11036 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
11037 callbackContext);
11038 sme_ReleaseGlobalLock( &pMac->sme );
11039 }
11040
11041 return status;
11042}
11043
11044/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -070011045 \fn sme_SendRateUpdateInd
11046 \brief API to Update rate
11047 \param hHal - The handle returned by macOpen
11048 \param rateUpdateParams - Pointer to rate update params
11049 \return eHalStatus
11050 ---------------------------------------------------------------------------*/
11051eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
11052{
11053 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11054 eHalStatus status;
11055 vos_msg_t msg;
11056
11057 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11058 {
11059 msg.type = WDA_RATE_UPDATE_IND;
11060 msg.bodyptr = rateUpdateParams;
11061
11062 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
11063 {
11064 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
11065 "to post WDA_SET_RMC_RATE_IND to WDA!",
11066 __func__);
11067
11068 sme_ReleaseGlobalLock(&pMac->sme);
11069 return eHAL_STATUS_FAILURE;
11070 }
11071
11072 sme_ReleaseGlobalLock(&pMac->sme);
11073 return eHAL_STATUS_SUCCESS;
11074 }
11075
11076 return status;
11077}
11078
11079/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053011080 \fn sme_TriggerBatchScanResultInd
11081 \brief API to trigger batch scan result indications from FW
11082 \param hHal - The handle returned by macOpen.
11083 \param pRequest - Pointer to get batch request.
11084 \param sessionId - session ID
11085 \param callbackRoutine - HDD callback which needs to be invoked after
11086 getting batch scan result indication from FW
11087 \param callbackContext - pAdapter context
11088 \return eHalStatus
11089 ---------------------------------------------------------------------------*/
11090eHalStatus sme_TriggerBatchScanResultInd
11091(
11092 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
11093 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
11094 void *callbackContext
11095)
11096{
11097 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11098 eHalStatus status;
11099
11100 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11101 {
11102 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
11103 callbackRoutine, callbackContext);
11104 sme_ReleaseGlobalLock( &pMac->sme );
11105 }
11106
11107 return status;
11108}
11109
11110
11111/* ---------------------------------------------------------------------------
11112 \fn sme_StopBatchScanInd
11113 \brief API to stop batch scan request in FW
11114 \param hHal - The handle returned by macOpen.
11115 \param pRequest - Pointer to the batch request.
11116 \param sessionId - session ID
11117 \return eHalStatus
11118 ---------------------------------------------------------------------------*/
11119eHalStatus sme_StopBatchScanInd
11120(
11121 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
11122)
11123{
11124 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11125 eHalStatus status;
11126
11127 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11128 {
11129 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
11130 sme_ReleaseGlobalLock( &pMac->sme );
11131 }
11132
11133 return status;
11134}
11135
11136#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080011137
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011138
Leo Chang0b0e45a2013-12-15 15:18:55 -080011139#ifdef FEATURE_WLAN_CH_AVOID
11140/* ---------------------------------------------------------------------------
11141 \fn sme_AddChAvoidCallback
11142 \brief Used to plug in callback function
11143 Which notify channel may not be used with SAP or P2PGO mode.
11144 Notification come from FW.
11145 \param hHal
11146 \param pCallbackfn : callback function pointer should be plugged in
11147 \- return eHalStatus
11148 -------------------------------------------------------------------------*/
11149eHalStatus sme_AddChAvoidCallback
11150(
11151 tHalHandle hHal,
11152 void (*pCallbackfn)(void *pAdapter, void *indParam)
11153)
11154{
11155 eHalStatus status = eHAL_STATUS_SUCCESS;
11156 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11157
11158 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
11159 "%s: Plug in CH AVOID CB", __func__);
11160
11161 status = sme_AcquireGlobalLock(&pMac->sme);
11162 if (eHAL_STATUS_SUCCESS == status)
11163 {
11164 if (NULL != pCallbackfn)
11165 {
11166 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
11167 }
11168 sme_ReleaseGlobalLock(&pMac->sme);
11169 }
11170
11171 return(status);
11172}
11173#endif /* FEATURE_WLAN_CH_AVOID */
11174
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011175void activeListCmdTimeoutHandle(void *userData)
11176{
11177 if (NULL == userData)
11178 return;
11179 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11180 "%s: Active List command timeout Cmd List Count %d", __func__,
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080011181 csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011182 smeGetCommandQStatus((tHalHandle) userData);
11183}
11184
Sunil Duttc69bccb2014-05-26 21:30:20 +053011185#ifdef WLAN_FEATURE_LINK_LAYER_STATS
11186
11187/* ---------------------------------------------------------------------------
11188 \fn sme_LLStatsSetReq
11189 \brief API to set link layer stats request to FW
11190 \param hHal - The handle returned by macOpen.
11191
11192 \Param pStatsReq - a pointer to a caller allocated object of
11193 typedef struct tSirLLStatsSetReq, signifying the parameters to link layer
11194 stats set.
11195
11196 \return eHalStatus
11197 ---------------------------------------------------------------------------*/
11198eHalStatus sme_LLStatsSetReq(tHalHandle hHal,
11199 tSirLLStatsSetReq *pLinkLayerStatsSetReq)
11200{
11201 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11202 vos_msg_t msg;
11203 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011204 tSirLLStatsSetReq *plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011205
Dino Mycledf0a5d92014-07-04 09:41:55 +053011206 plinkLayerSetReq = vos_mem_malloc(sizeof(*plinkLayerSetReq));
11207 if ( !plinkLayerSetReq)
11208 {
11209 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11210 "%s: Not able to allocate memory for "
11211 "WDA_LINK_LAYER_STATS_SET_REQ",
11212 __func__);
11213 return eHAL_STATUS_FAILURE;
11214 }
Sunil Duttc69bccb2014-05-26 21:30:20 +053011215
Dino Mycledf0a5d92014-07-04 09:41:55 +053011216 *plinkLayerSetReq = *pLinkLayerStatsSetReq;
11217
Sunil Duttc69bccb2014-05-26 21:30:20 +053011218
11219 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11220 {
11221 msg.type = WDA_LINK_LAYER_STATS_SET_REQ;
11222 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011223 msg.bodyptr = plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011224
11225 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11226 {
11227 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11228 "Not able to post SIR_HAL_LL_STATS_SET message to HAL", __func__);
11229 status = eHAL_STATUS_FAILURE;
11230 }
11231 sme_ReleaseGlobalLock( &pMac->sme );
11232 }
11233 else
11234 {
11235 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11236 "sme_AcquireGlobalLock error", __func__);
11237 }
11238 return status;
11239}
11240
11241/* ---------------------------------------------------------------------------
11242 \fn sme_LLStatsGetReq
11243 \brief API to get link layer stats request to FW
11244 \param hHal - The handle returned by macOpen.
11245
11246 \Param pStatsReq - a pointer to a caller allocated object of
11247 typedef struct tSirLLStatsGetReq, signifying the parameters to link layer
11248 stats get.
11249
11250 \return eHalStatus
11251 ---------------------------------------------------------------------------*/
11252eHalStatus sme_LLStatsGetReq(tHalHandle hHal,
11253 tSirLLStatsGetReq *pLinkLayerStatsGetReq)
11254{
11255 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11256 vos_msg_t msg;
11257 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011258 tSirLLStatsGetReq *pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011259
Dino Mycledf0a5d92014-07-04 09:41:55 +053011260 pGetStatsReq = vos_mem_malloc(sizeof(*pGetStatsReq));
11261 if ( !pGetStatsReq)
11262 {
11263 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11264 "%s: Not able to allocate memory for "
11265 "WDA_LINK_LAYER_STATS_GET_REQ",
11266 __func__);
11267 return eHAL_STATUS_FAILURE;
11268 }
11269 *pGetStatsReq = *pLinkLayerStatsGetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011270
11271 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11272 {
11273 msg.type = WDA_LINK_LAYER_STATS_GET_REQ;
11274 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011275 msg.bodyptr = pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011276 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11277 {
11278 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11279 "Not able to post SIR_HAL_LL_STATS_GET message to HAL", __func__);
11280 status = eHAL_STATUS_FAILURE;
11281 }
11282 sme_ReleaseGlobalLock( &pMac->sme );
11283 }
11284 else
11285 {
11286 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11287 "sme_AcquireGlobalLock error", __func__);
11288 }
11289 return status;
11290}
11291
11292/* ---------------------------------------------------------------------------
11293 \fn sme_LLStatsClearReq
11294 \brief API to clear link layer stats request to FW
11295 \param hHal - The handle returned by macOpen.
11296
11297 \Param pStatsReq - a pointer to a caller allocated object of
11298 typedef struct tSirLLStatsClearReq, signifying the parameters to link layer
11299 stats clear.
11300
11301 \return eHalStatus
11302 ---------------------------------------------------------------------------*/
11303eHalStatus sme_LLStatsClearReq(tHalHandle hHal,
11304 tSirLLStatsClearReq *pLinkLayerStatsClear)
11305{
11306 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11307 vos_msg_t msg;
11308 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011309 tSirLLStatsClearReq *pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011310
11311
Sunil Duttc69bccb2014-05-26 21:30:20 +053011312
Dino Mycledf0a5d92014-07-04 09:41:55 +053011313 pClearStatsReq = vos_mem_malloc(sizeof(*pClearStatsReq));
11314 if ( !pClearStatsReq)
11315 {
11316 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11317 "%s: Not able to allocate memory for "
11318 "WDA_LINK_LAYER_STATS_CLEAR_REQ",
11319 __func__);
11320 return eHAL_STATUS_FAILURE;
11321 }
11322
11323 *pClearStatsReq = *pLinkLayerStatsClear;
11324
Sunil Duttc69bccb2014-05-26 21:30:20 +053011325 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11326 {
11327 msg.type = WDA_LINK_LAYER_STATS_CLEAR_REQ;
11328 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011329 msg.bodyptr = pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011330
11331 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11332 {
11333 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11334 "Not able to post SIR_HAL_LL_STATS_CLEAR message to HAL", __func__);
11335 status = eHAL_STATUS_FAILURE;
11336 }
11337 sme_ReleaseGlobalLock( &pMac->sme );
11338 }
11339 else
11340 {
11341 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11342 "sme_AcquireGlobalLock error", __func__);
11343 }
11344
11345 return status;
11346}
11347
11348/* ---------------------------------------------------------------------------
11349 \fn sme_SetLinkLayerStatsIndCB
11350 \brief API to trigger Link Layer Statistic indications from FW
11351 \param hHal - The handle returned by macOpen.
11352 \param sessionId - session ID
11353 \param callbackRoutine - HDD callback which needs to be invoked after
11354 getting Link Layer Statistics from FW
11355 \param callbackContext - pAdapter context
11356 \return eHalStatus
11357 ---------------------------------------------------------------------------*/
11358eHalStatus sme_SetLinkLayerStatsIndCB
11359(
Dino Mycled3d50022014-07-07 12:58:25 +053011360 tHalHandle hHal,
11361 void (*callbackRoutine) (void *callbackCtx, int indType, void *pRsp,
11362 tANI_U8 *macAddr)
Sunil Duttc69bccb2014-05-26 21:30:20 +053011363)
11364{
11365 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11366 eHalStatus status;
11367
11368 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11369 {
11370 if (NULL != callbackRoutine)
11371 {
11372 pMac->sme.pLinkLayerStatsIndCallback = callbackRoutine;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011373 }
11374 sme_ReleaseGlobalLock( &pMac->sme );
11375 }
11376
11377 return status;
11378}
11379#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
11380
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080011381eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
11382{
11383 eHalStatus status = eHAL_STATUS_SUCCESS;
11384 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11385 pMac->fEnableDebugLog = set_value;
11386 return (status);
11387}
11388
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011389VOS_STATUS sme_UpdateDSCPtoUPMapping( tHalHandle hHal,
Kumar Anand82c009f2014-05-29 00:29:42 -070011390 sme_QosWmmUpType *dscpmapping,
11391 v_U8_t sessionId )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011392{
11393 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kumar Anand82c009f2014-05-29 00:29:42 -070011394 eHalStatus status = eHAL_STATUS_SUCCESS;
11395 v_U8_t i, j, peSessionId;
11396 tCsrRoamSession *pCsrSession = NULL;
11397 tpPESession pSession = NULL;
11398
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011399 status = sme_AcquireGlobalLock( &pMac->sme );
11400 if ( HAL_STATUS_SUCCESS( status ) )
11401 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011402 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
11403 {
11404 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11405 "%s: Invalid session Id %u", __func__, sessionId);
11406 sme_ReleaseGlobalLock( &pMac->sme);
11407 return eHAL_STATUS_FAILURE;
11408 }
11409 pCsrSession = CSR_GET_SESSION( pMac, sessionId );
11410
11411 if (pCsrSession == NULL)
11412 {
11413 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11414 "%s: CSR Session lookup fails %u", __func__, sessionId);
11415 sme_ReleaseGlobalLock( &pMac->sme);
11416 return eHAL_STATUS_FAILURE;
11417 }
11418
11419 pSession = peFindSessionByBssid( pMac,
11420 pCsrSession->connectedProfile.bssid, &peSessionId );
11421
11422 if (pSession == NULL)
11423 {
11424 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11425 "%s: Session lookup fails for BSSID", __func__);
11426 sme_ReleaseGlobalLock( &pMac->sme);
11427 return eHAL_STATUS_FAILURE;
11428 }
11429
11430 if ( !pSession->QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011431 {
11432 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11433 "%s: QOS Mapping IE not present", __func__);
11434 sme_ReleaseGlobalLock( &pMac->sme);
11435 return eHAL_STATUS_FAILURE;
11436 }
11437 else
11438 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011439 for (i = 0; i < SME_QOS_WMM_UP_MAX; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011440 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011441 for (j = pSession->QosMapSet.dscp_range[i][0];
11442 j <= pSession->QosMapSet.dscp_range[i][1]; j++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011443 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011444 if ((pSession->QosMapSet.dscp_range[i][0] == 255) &&
11445 (pSession->QosMapSet.dscp_range[i][1] == 255))
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011446 {
11447 dscpmapping[j]= 0;
11448 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11449 "%s: User Priority %d is not used in mapping",
11450 __func__, i);
11451 break;
11452 }
11453 else
11454 {
11455 dscpmapping[j]= i;
11456 }
11457 }
11458 }
Kumar Anand82c009f2014-05-29 00:29:42 -070011459 for (i = 0; i< pSession->QosMapSet.num_dscp_exceptions; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011460 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011461 if (pSession->QosMapSet.dscp_exceptions[i][0] != 255)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011462 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011463 dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0] ] =
11464 pSession->QosMapSet.dscp_exceptions[i][1];
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011465 }
11466 }
11467 }
11468 }
11469 sme_ReleaseGlobalLock( &pMac->sme);
11470 return status;
11471}
Agarwal Ashish5e414792014-06-08 15:25:23 +053011472
Agarwal Ashish5e414792014-06-08 15:25:23 +053011473tANI_BOOLEAN sme_Is11dCountrycode(tHalHandle hHal)
11474{
11475 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11476
11477 if (VOS_TRUE == vos_mem_compare(pMac->scan.countryCodeCurrent,
11478 pMac->scan.countryCode11d, 2))
11479 {
11480 return eANI_BOOLEAN_TRUE;
11481 }
11482 else
11483 {
11484 return eANI_BOOLEAN_FALSE;
11485 }
11486}
Dino Mycle2c198072014-06-10 10:15:52 +053011487
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011488eHalStatus sme_SpoofMacAddrReq(tHalHandle hHal, v_MACADDR_t *macaddr)
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011489{
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011490 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11491 eHalStatus status = eHAL_STATUS_SUCCESS;
11492 tSmeCmd *pMacSpoofCmd;
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011493
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011494 pMacSpoofCmd = csrGetCommandBuffer(pMac);
11495 if (pMacSpoofCmd)
11496 {
11497 pMacSpoofCmd->command = eSmeCommandMacSpoofRequest;
11498 vos_mem_set(&pMacSpoofCmd->u.macAddrSpoofCmd,
11499 sizeof(tSirSpoofMacAddrReq), 0);
11500 vos_mem_copy(pMacSpoofCmd->u.macAddrSpoofCmd.macAddr,
11501 macaddr->bytes, VOS_MAC_ADDRESS_LEN);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011502
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011503 status = csrQueueSmeCommand(pMac, pMacSpoofCmd, eANI_BOOLEAN_TRUE);
11504 if ( !HAL_STATUS_SUCCESS( status ) )
11505 {
11506 smsLog( pMac, LOGE, FL("fail to send msg status = %d\n"), status );
11507 csrReleaseCommandScan(pMac, pMacSpoofCmd);
11508 }
11509 }
11510 else
11511 {
11512 //log error
11513 smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
11514 status = eHAL_STATUS_RESOURCES;
11515 }
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011516
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011517 return (status);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011518}
11519
Dino Mycle2c198072014-06-10 10:15:52 +053011520#ifdef WLAN_FEATURE_EXTSCAN
11521/* ---------------------------------------------------------------------------
11522 \fn sme_GetValidChannelsByBand
11523 \brief SME API to fetch all valid channel filtered by band
11524 \param hHal
11525 \param wifiBand: RF band information
11526 \param aValidChannels: Array to store channel info
11527 \param len: number of channels
11528 \- return eHalStatus
11529 -------------------------------------------------------------------------*/
11530eHalStatus sme_GetValidChannelsByBand (tHalHandle hHal, tANI_U8 wifiBand,
11531 tANI_U32 *aValidChannels, tANI_U8 *pNumChannels)
11532{
11533 eHalStatus status = eHAL_STATUS_SUCCESS;
11534 tANI_U8 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
11535 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11536 tANI_U8 numChannels = 0;
11537 tANI_U8 i = 0;
11538 tANI_U32 totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
11539
11540 if (!aValidChannels || !pNumChannels) {
11541 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11542 FL("Output channel list/NumChannels is NULL"));
11543 return eHAL_STATUS_INVALID_PARAMETER;
11544 }
11545
11546 if ((wifiBand < WIFI_BAND_UNSPECIFIED) || (wifiBand >= WIFI_BAND_MAX)) {
11547 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11548 FL("Invalid wifiBand (%d)"), wifiBand);
11549 return eHAL_STATUS_INVALID_PARAMETER;
11550 }
11551
11552 status = sme_GetCfgValidChannels(hHal, &chanList[0],
11553 &totValidChannels);
11554 if (!HAL_STATUS_SUCCESS(status)) {
11555 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11556 FL("Failed to get valid channel list (err=%d)"), status);
11557 return status;
11558 }
11559
11560 switch (wifiBand) {
11561 case WIFI_BAND_UNSPECIFIED:
11562 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("Unspecified wifiBand, "
11563 "return all (%d) valid channels"), totValidChannels);
11564 numChannels = totValidChannels;
11565 for (i = 0; i < numChannels; i++)
11566 aValidChannels[i] = vos_chan_to_freq(chanList[i]);
11567 break;
11568
11569 case WIFI_BAND_BG:
11570 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("WIFI_BAND_BG (2.4 GHz)"));
11571 for (i = 0; i < totValidChannels; i++)
11572 if (CSR_IS_CHANNEL_24GHZ(chanList[i]))
11573 aValidChannels[numChannels++] =
11574 vos_chan_to_freq(chanList[i]);
11575 break;
11576
11577 case WIFI_BAND_A:
11578 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11579 FL("WIFI_BAND_A (5 GHz without DFS)"));
11580 for (i = 0; i < totValidChannels; i++)
11581 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11582 !CSR_IS_CHANNEL_DFS(chanList[i]))
11583 aValidChannels[numChannels++] =
11584 vos_chan_to_freq(chanList[i]);
11585 break;
11586
11587 case WIFI_BAND_ABG:
11588 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11589 FL("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"));
11590 for (i = 0; i < totValidChannels; i++)
11591 if ((CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11592 CSR_IS_CHANNEL_5GHZ(chanList[i])) &&
11593 !CSR_IS_CHANNEL_DFS(chanList[i]))
11594 aValidChannels[numChannels++] =
11595 vos_chan_to_freq(chanList[i]);
11596 break;
11597
11598 case WIFI_BAND_A_DFS_ONLY:
11599 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11600 FL("WIFI_BAND_A_DFS (5 GHz DFS only)"));
11601 for (i = 0; i < totValidChannels; i++)
11602 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11603 CSR_IS_CHANNEL_DFS(chanList[i]))
11604 aValidChannels[numChannels++] =
11605 vos_chan_to_freq(chanList[i]);
11606 break;
11607
11608 case WIFI_BAND_A_WITH_DFS:
11609 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11610 FL("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"));
11611 for (i = 0; i < totValidChannels; i++)
11612 if (CSR_IS_CHANNEL_5GHZ(chanList[i]))
11613 aValidChannels[numChannels++] =
11614 vos_chan_to_freq(chanList[i]);
11615 break;
11616
11617 case WIFI_BAND_ABG_WITH_DFS:
11618 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11619 FL("WIFI_BAND_ABG_WITH_DFS (2.4 GHz + 5 GHz with DFS)"));
11620 for (i = 0; i < totValidChannels; i++)
11621 if (CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11622 CSR_IS_CHANNEL_5GHZ(chanList[i]))
11623 aValidChannels[numChannels++] =
11624 vos_chan_to_freq(chanList[i]);
11625 break;
11626
11627 default:
11628 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11629 FL("Unknown wifiBand (%d))"), wifiBand);
11630 return eHAL_STATUS_INVALID_PARAMETER;
11631 break;
11632 }
11633 *pNumChannels = numChannels;
11634
11635 return status;
11636}
11637/* ---------------------------------------------------------------------------
11638 \fn sme_EXTScanGetCapabilities
11639 \brief SME API to fetch Extended Scan capabilities
11640 \param hHal
11641 \param pReq: Extended Scan capabilities structure
11642 \- return eHalStatus
11643 -------------------------------------------------------------------------*/
11644eHalStatus sme_EXTScanGetCapabilities (tHalHandle hHal,
11645 tSirGetEXTScanCapabilitiesReqParams *pReq)
11646{
11647 eHalStatus status = eHAL_STATUS_SUCCESS;
11648 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11649 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11650 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011651 tSirGetEXTScanCapabilitiesReqParams *pGetEXTScanCapabilitiesReq;
11652
11653 pGetEXTScanCapabilitiesReq =
11654 vos_mem_malloc(sizeof(*pGetEXTScanCapabilitiesReq));
11655 if ( !pGetEXTScanCapabilitiesReq)
11656 {
11657 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11658 "%s: Not able to allocate memory for "
11659 "WDA_EXTSCAN_GET_CAPABILITIES_REQ",
11660 __func__);
11661 return eHAL_STATUS_FAILURE;
11662 }
11663
11664 *pGetEXTScanCapabilitiesReq = *pReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011665
11666 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11667 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CAPABILITIES, NO_SESSION, 0));
11668 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11669 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011670 vosMessage.bodyptr = pGetEXTScanCapabilitiesReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011671 vosMessage.type = WDA_EXTSCAN_GET_CAPABILITIES_REQ;
11672 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11673 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11674 status = eHAL_STATUS_FAILURE;
11675
11676 sme_ReleaseGlobalLock(&pMac->sme);
11677 }
11678 return(status);
11679}
11680
11681/* ---------------------------------------------------------------------------
11682 \fn sme_EXTScanStart
11683 \brief SME API to issue Extended Scan start
11684 \param hHal
11685 \param pStartCmd: Extended Scan start structure
11686 \- return eHalStatus
11687 -------------------------------------------------------------------------*/
11688eHalStatus sme_EXTScanStart (tHalHandle hHal,
11689 tSirEXTScanStartReqParams *pStartCmd)
11690{
11691 eHalStatus status = eHAL_STATUS_SUCCESS;
11692 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11693 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11694 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011695 tSirEXTScanStartReqParams *pextScanStartReq;
11696
11697 pextScanStartReq = vos_mem_malloc(sizeof(*pextScanStartReq));
11698 if ( !pextScanStartReq)
11699 {
11700 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11701 "%s: Not able to allocate memory for "
11702 "WDA_EXTSCAN_START_REQ",
11703 __func__);
11704 return eHAL_STATUS_FAILURE;
11705 }
11706
11707 *pextScanStartReq = *pStartCmd;
11708
Dino Mycle2c198072014-06-10 10:15:52 +053011709
11710 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11711 TRACE_CODE_SME_RX_HDD_EXTSCAN_START, NO_SESSION, 0));
11712 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11713 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011714 vosMessage.bodyptr = pextScanStartReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011715 vosMessage.type = WDA_EXTSCAN_START_REQ;
11716 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11717 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11718 status = eHAL_STATUS_FAILURE;
11719
11720 sme_ReleaseGlobalLock(&pMac->sme);
11721 }
11722 return(status);
11723}
11724
11725/* ---------------------------------------------------------------------------
11726 \fn sme_EXTScanStop
11727 \brief SME API to issue Extended Scan stop
11728 \param hHal
11729 \param pStopReq: Extended Scan stop structure
11730 \- return eHalStatus
11731 -------------------------------------------------------------------------*/
11732eHalStatus sme_EXTScanStop(tHalHandle hHal, tSirEXTScanStopReqParams *pStopReq)
11733{
11734 eHalStatus status = eHAL_STATUS_SUCCESS;
11735 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11736 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11737 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011738 tSirEXTScanStopReqParams *pEXTScanStopReq;
11739
11740 pEXTScanStopReq = vos_mem_malloc(sizeof(*pEXTScanStopReq));
11741 if ( !pEXTScanStopReq)
11742 {
11743 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11744 "%s: Not able to allocate memory for "
11745 "WDA_EXTSCAN_STOP_REQ",
11746 __func__);
11747 return eHAL_STATUS_FAILURE;
11748 }
11749
11750 *pEXTScanStopReq = *pStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011751
11752 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11753 TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP, NO_SESSION, 0));
11754 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11755 {
11756 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011757 vosMessage.bodyptr = pEXTScanStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011758 vosMessage.type = WDA_EXTSCAN_STOP_REQ;
11759 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11760 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11761 {
11762 status = eHAL_STATUS_FAILURE;
11763 }
11764 sme_ReleaseGlobalLock(&pMac->sme);
11765 }
11766 return(status);
11767}
11768
11769/* ---------------------------------------------------------------------------
11770 \fn sme_SetBssHotlist
11771 \brief SME API to set BSSID hotlist
11772 \param hHal
11773 \param pSetHotListReq: Extended Scan set hotlist structure
11774 \- return eHalStatus
11775 -------------------------------------------------------------------------*/
11776eHalStatus sme_SetBssHotlist (tHalHandle hHal,
11777 tSirEXTScanSetBssidHotListReqParams *pSetHotListReq)
11778{
11779 eHalStatus status = eHAL_STATUS_SUCCESS;
11780 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11781 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11782 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011783 tSirEXTScanSetBssidHotListReqParams *pEXTScanSetBssidHotlistReq;
11784
11785 pEXTScanSetBssidHotlistReq =
11786 vos_mem_malloc(sizeof(*pEXTScanSetBssidHotlistReq));
11787 if ( !pEXTScanSetBssidHotlistReq)
11788 {
11789 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11790 "%s: Not able to allocate memory for "
11791 "WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ",
11792 __func__);
11793 return eHAL_STATUS_FAILURE;
11794 }
11795
11796 *pEXTScanSetBssidHotlistReq = *pSetHotListReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011797
11798 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11799 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST, NO_SESSION, 0));
11800 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11801 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011802 vosMessage.bodyptr = pEXTScanSetBssidHotlistReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011803 vosMessage.type = WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ;
11804 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11805 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11806 status = eHAL_STATUS_FAILURE;
11807
11808 sme_ReleaseGlobalLock(&pMac->sme);
11809 }
11810
11811 return(status);
11812}
11813
11814/* ---------------------------------------------------------------------------
11815 \fn sme_ResetBssHotlist
11816 \brief SME API to reset BSSID hotlist
11817 \param hHal
11818 \param pSetHotListReq: Extended Scan set hotlist structure
11819 \- return eHalStatus
11820 -------------------------------------------------------------------------*/
11821eHalStatus sme_ResetBssHotlist (tHalHandle hHal,
11822 tSirEXTScanResetBssidHotlistReqParams *pResetReq)
11823{
11824 eHalStatus status = eHAL_STATUS_SUCCESS;
11825 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11826 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11827 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011828 tSirEXTScanResetBssidHotlistReqParams *pEXTScanHotlistResetReq;
11829
11830 pEXTScanHotlistResetReq = vos_mem_malloc(sizeof(*pEXTScanHotlistResetReq));
11831 if ( !pEXTScanHotlistResetReq)
11832 {
11833 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11834 "%s: Not able to allocate memory for "
11835 "WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
11836 __func__);
11837 return eHAL_STATUS_FAILURE;
11838 }
11839
11840 *pEXTScanHotlistResetReq = *pResetReq;
11841
Dino Mycle2c198072014-06-10 10:15:52 +053011842
11843 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11844 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST, NO_SESSION, 0));
11845 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11846 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011847 vosMessage.bodyptr = pEXTScanHotlistResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011848 vosMessage.type = WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ;
11849 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11850 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11851 status = eHAL_STATUS_FAILURE;
11852
11853 sme_ReleaseGlobalLock(&pMac->sme);
11854 }
11855 return(status);
11856}
11857
11858/* ---------------------------------------------------------------------------
11859 \fn sme_SetSignificantChange
11860 \brief SME API to set significant change
11861 \param hHal
11862 \param pSetSignificantChangeReq: Extended Scan set significant change structure
11863 \- return eHalStatus
11864 -------------------------------------------------------------------------*/
11865eHalStatus sme_SetSignificantChange (tHalHandle hHal,
11866 tSirEXTScanSetSignificantChangeReqParams *pSetSignificantChangeReq)
11867{
11868 eHalStatus status = eHAL_STATUS_SUCCESS;
11869 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11870 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11871 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011872 tSirEXTScanSetSignificantChangeReqParams *pEXTScanSetSignificantReq;
11873
11874 pEXTScanSetSignificantReq = vos_mem_malloc(sizeof(*pEXTScanSetSignificantReq));
11875 if ( !pEXTScanSetSignificantReq)
11876 {
11877 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11878 "%s: Not able to allocate memory for "
11879 "WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ",
11880 __func__);
11881 return eHAL_STATUS_FAILURE;
11882 }
11883
11884 *pEXTScanSetSignificantReq = *pSetSignificantChangeReq;
11885
11886
Dino Mycle2c198072014-06-10 10:15:52 +053011887
11888 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11889 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SIGNF_CHANGE, NO_SESSION, 0));
11890 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11891 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011892 vosMessage.bodyptr = pEXTScanSetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011893 vosMessage.type = WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ;
11894 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11895 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11896 status = eHAL_STATUS_FAILURE;
11897
11898 sme_ReleaseGlobalLock(&pMac->sme);
11899 }
11900 return(status);
11901}
11902
11903/* ---------------------------------------------------------------------------
11904 \fn sme_ResetSignificantChange
11905 \brief SME API to reset significant change
11906 \param hHal
11907 \param pResetReq: Extended Scan reset significant change structure
11908 \- return eHalStatus
11909 -------------------------------------------------------------------------*/
11910eHalStatus sme_ResetSignificantChange (tHalHandle hHal,
11911 tSirEXTScanResetSignificantChangeReqParams *pResetReq)
11912{
11913 eHalStatus status = eHAL_STATUS_SUCCESS;
11914 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11915 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11916 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011917 tSirEXTScanResetSignificantChangeReqParams *pEXTScanResetSignificantReq;
11918
11919 pEXTScanResetSignificantReq =
11920 vos_mem_malloc(sizeof(*pEXTScanResetSignificantReq));
11921 if ( !pEXTScanResetSignificantReq)
11922 {
11923 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11924 "%s: Not able to allocate memory for "
11925 "WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ",
11926 __func__);
11927 return eHAL_STATUS_FAILURE;
11928 }
11929
11930 *pEXTScanResetSignificantReq = *pResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011931
11932 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11933 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SIGNF_CHANGE, NO_SESSION, 0));
11934 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11935 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011936 vosMessage.bodyptr = pEXTScanResetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011937 vosMessage.type = WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ;
11938 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11939 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11940 status = eHAL_STATUS_FAILURE;
11941
11942 sme_ReleaseGlobalLock(&pMac->sme);
11943 }
11944 return(status);
11945}
11946
11947/* ---------------------------------------------------------------------------
11948 \fn sme_getCachedResults
11949 \brief SME API to get cached results
11950 \param hHal
11951 \param pCachedResultsReq: Extended Scan get cached results structure
11952 \- return eHalStatus
11953 -------------------------------------------------------------------------*/
11954eHalStatus sme_getCachedResults (tHalHandle hHal,
11955 tSirEXTScanGetCachedResultsReqParams *pCachedResultsReq)
11956{
11957 eHalStatus status = eHAL_STATUS_SUCCESS;
11958 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11959 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11960 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011961 tSirEXTScanGetCachedResultsReqParams *pEXTScanCachedResultsReq;
11962
11963 pEXTScanCachedResultsReq =
11964 vos_mem_malloc(sizeof(*pEXTScanCachedResultsReq));
11965 if ( !pEXTScanCachedResultsReq)
11966 {
11967 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11968 "%s: Not able to allocate memory for "
11969 "WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
11970 __func__);
11971 return eHAL_STATUS_FAILURE;
11972 }
11973
11974 *pEXTScanCachedResultsReq = *pCachedResultsReq;
11975
Dino Mycle2c198072014-06-10 10:15:52 +053011976
11977 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11978 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS, NO_SESSION, 0));
11979 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11980 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011981 vosMessage.bodyptr = pEXTScanCachedResultsReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011982 vosMessage.type = WDA_EXTSCAN_GET_CACHED_RESULTS_REQ;
11983 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11984 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11985 status = eHAL_STATUS_FAILURE;
11986
11987 sme_ReleaseGlobalLock(&pMac->sme);
11988 }
11989 return(status);
11990}
11991
11992eHalStatus sme_EXTScanRegisterCallback (tHalHandle hHal,
11993 void (*pEXTScanIndCb)(void *, const tANI_U16, void *),
11994 void *callbackContext)
11995{
11996 eHalStatus status = eHAL_STATUS_SUCCESS;
11997 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11998
11999 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12000 pMac->sme.pEXTScanIndCb = pEXTScanIndCb;
12001 pMac->sme.pEXTScanCallbackContext = callbackContext;
12002 sme_ReleaseGlobalLock(&pMac->sme);
12003 }
12004 return(status);
12005}
12006
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053012007void sme_SetMiracastMode (tHalHandle hHal,tANI_U8 mode)
12008{
12009 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12010
12011 pMac->miracast_mode = mode;
12012}
Dino Mycle2c198072014-06-10 10:15:52 +053012013#endif /* WLAN_FEATURE_EXTSCAN */
c_hpothuef45bc32014-09-11 10:10:18 +053012014
12015void sme_resetCoexEevent(tHalHandle hHal)
12016{
12017 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12018
12019 if (pMac == NULL)
12020 {
12021 printk("btc: %s pMac is NULL \n",__func__);
12022 return;
12023 }
12024
12025 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12026 FL("isCoexScoIndSet: %d"), pMac->isCoexScoIndSet);
12027
12028 if (pMac->isCoexScoIndSet)
12029 {
12030 pMac->isCoexScoIndSet = 0;
12031 ccmCfgSetInt(pMac, WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC, 0,
12032 NULL, eANI_BOOLEAN_FALSE);
12033 }
12034
12035 return;
12036}
Agarwal Ashish738843c2014-09-25 12:27:56 +053012037
12038void sme_disable_dfs_channel(tHalHandle hHal, bool disbale_dfs)
12039{
12040 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12041 pMac->scan.fEnableDFSChnlScan = !disbale_dfs;
12042 csrDisableDfsChannel(pMac);
12043
12044}
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053012045
12046/* ---------------------------------------------------------------------------
12047 \fn sme_Encryptmsgsend
12048 \brief SME API to issue encrypt message request
12049 \param hHal
12050 \param pCmd: Data to be encrypted
12051 \- return eHalStatus
12052 -------------------------------------------------------------------------*/
12053eHalStatus sme_Encryptmsgsend (tHalHandle hHal,
12054 u8 *pCmd,
12055 int length,
12056 pEncryptMsgRSPCb encMsgCbk)
12057{
12058 eHalStatus status = eHAL_STATUS_SUCCESS;
12059 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12060 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12061 vos_msg_t vosMessage;
12062 u8 *pEncryptMsg;
12063
12064 pEncryptMsg = vos_mem_malloc(length);
12065 if ( !pEncryptMsg)
12066 {
12067 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12068 "%s: Not able to allocate memory for "
12069 "SIR_HAL_ENCRYPT_MSG_REQ",
12070 __func__);
12071 return eHAL_STATUS_FAILURE;
12072 }
12073
12074 vos_mem_copy(pEncryptMsg, pCmd, length);
12075
12076 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12077
12078 pMac->sme.pEncMsgInfoParams.pEncMsgCbk = encMsgCbk;
12079 pMac->sme.pEncMsgInfoParams.pUserData = hHal;
12080 /* Serialize the req through MC thread */
12081 vosMessage.bodyptr = pEncryptMsg;
12082 vosMessage.type = SIR_HAL_ENCRYPT_MSG_REQ;
12083 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
12084 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12085 status = eHAL_STATUS_FAILURE;
12086
12087 sme_ReleaseGlobalLock(&pMac->sme);
12088 }
12089 return(status);
12090}
Pradeep Reddy POTTETIf0569d72014-12-13 16:54:03 +053012091
12092/* ---------------------------------------------------------------------------
12093 \fn sme_RegisterBtCoexTDLSCallback
12094 \brief Used to plug in callback function
12095 Which notify btcoex on or off.
12096 Notification come from FW.
12097 \param hHal
12098 \param pCallbackfn : callback function pointer should be plugged in
12099 \- return eHalStatus
12100 -------------------------------------------------------------------------*/
12101eHalStatus sme_RegisterBtCoexTDLSCallback
12102(
12103 tHalHandle hHal,
12104 void (*pCallbackfn)(void *pAdapter, int )
12105)
12106{
12107 eHalStatus status = eHAL_STATUS_SUCCESS;
12108 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12109
12110 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12111 "%s: Plug in BtCoex TDLS CB", __func__);
12112
12113 status = sme_AcquireGlobalLock(&pMac->sme);
12114 if (eHAL_STATUS_SUCCESS == status)
12115 {
12116 if (NULL != pCallbackfn)
12117 {
12118 pMac->sme.pBtCoexTDLSNotification = pCallbackfn;
12119 }
12120 sme_ReleaseGlobalLock(&pMac->sme);
12121 }
12122 return(status);
12123}
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012124
12125/* ---------------------------------------------------------------------------
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012126 \fn smeNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012127
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012128 \brief This function is a wrapper to call csrNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012129
12130 \param hHal - The handle returned by macOpen.
12131
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012132 \return eANI_BOOLEAN_TRUE if reassoc in progress,
12133 eANI_BOOLEAN_FALSE otherwise
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012134---------------------------------------------------------------------------*/
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012135
12136tANI_BOOLEAN smeNeighborMiddleOfRoaming(tHalHandle hHal)
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012137{
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012138 return (csrNeighborMiddleOfRoaming(PMAC_STRUCT(hHal)));
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012139}
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012140
12141/* ---------------------------------------------------------------------------
12142
12143 \fn sme_IsTdlsOffChannelValid
12144
12145 \brief To check if the channel is valid for currently established domain
12146 This is a synchronous API.
12147
12148 \param hHal - The handle returned by macOpen.
12149 \param channel - channel to verify
12150
12151 \return TRUE/FALSE, TRUE if channel is valid
12152
12153 -------------------------------------------------------------------------------*/
12154tANI_BOOLEAN sme_IsTdlsOffChannelValid(tHalHandle hHal, tANI_U8 channel)
12155{
12156 eHalStatus status = eHAL_STATUS_FAILURE;
12157 tANI_BOOLEAN valid = FALSE;
12158 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12159
12160 status = sme_AcquireGlobalLock( &pMac->sme );
12161 if ( HAL_STATUS_SUCCESS( status ) )
12162 {
12163 /* check whether off channel is valid and non DFS */
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053012164 if (csrRoamIsChannelValid(pMac, channel))
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012165 {
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053012166 if (!CSR_IS_CHANNEL_DFS(channel))
12167 valid = TRUE;
12168 else {
12169 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12170 "%s: configured channel is DFS", __func__);
12171 }
12172 }
12173 else {
12174 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12175 "%s: configured channel is not valid", __func__);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012176 }
12177 sme_ReleaseGlobalLock( &pMac->sme );
12178 }
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053012179 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12180 "%s: current country code %c%c channel %d valid %d",
12181 __func__, pMac->scan.countryCodeCurrent[0],
12182 pMac->scan.countryCodeCurrent[1], channel, valid);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012183 return (valid);
12184}