blob: 1006302554b45311a213347a8a5a942bacff4e20 [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;
921
Jeff Johnsone7245742012-09-05 17:12:55 -0700922#ifdef FEATURE_OEM_DATA_SUPPORT
923 case eSmeCommandOemDataReq:
924 csrLLUnlock(&pMac->sme.smeCmdActiveList);
925 oemData_ProcessOemDataReqCommand(pMac, pCommand);
926 break;
927#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700928 case eSmeCommandRemainOnChannel:
929 csrLLUnlock(&pMac->sme.smeCmdActiveList);
930 p2pProcessRemainOnChannelCmd(pMac, pCommand);
931 break;
932 case eSmeCommandNoAUpdate:
933 csrLLUnlock( &pMac->sme.smeCmdActiveList );
934 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700935 case eSmeCommandEnterImps:
936 case eSmeCommandExitImps:
937 case eSmeCommandEnterBmps:
938 case eSmeCommandExitBmps:
939 case eSmeCommandEnterUapsd:
940 case eSmeCommandExitUapsd:
941 case eSmeCommandEnterWowl:
942 case eSmeCommandExitWowl:
943 csrLLUnlock( &pMac->sme.smeCmdActiveList );
944 fContinue = pmcProcessCommand( pMac, pCommand );
945 if( fContinue )
946 {
947 //The command failed, remove it
948 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
949 &pCommand->Link, LL_ACCESS_LOCK ) )
950 {
951 pmcReleaseCommand( pMac, pCommand );
952 }
953 }
954 break;
955
956 //Treat standby differently here because caller may not be able to handle
957 //the failure so we do our best here
958 case eSmeCommandEnterStandby:
959 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
960 {
961 //It can continue
962 csrLLUnlock( &pMac->sme.smeCmdActiveList );
963 fContinue = pmcProcessCommand( pMac, pCommand );
964 if( fContinue )
965 {
966 //The command failed, remove it
967 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
968 &pCommand->Link, LL_ACCESS_LOCK ) )
969 {
970 pmcReleaseCommand( pMac, pCommand );
971 }
972 }
973 }
974 else
975 {
976 //Need to issue a disconnect first before processing this command
977 tSmeCmd *pNewCmd;
978
979 //We need to re-run the command
980 fContinue = eANI_BOOLEAN_TRUE;
981 //Pull off the standby command first
982 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
983 &pCommand->Link, LL_ACCESS_NOLOCK ) )
984 {
985 csrLLUnlock( &pMac->sme.smeCmdActiveList );
986 //Need to call CSR function here because the disconnect command
987 //is handled by CSR
988 pNewCmd = csrGetCommandBuffer( pMac );
989 if( NULL != pNewCmd )
990 {
991 //Put the standby command to the head of the pending list first
992 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
993 LL_ACCESS_LOCK );
994 pNewCmd->command = eSmeCommandRoam;
995 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
996 //Put the disassoc command before the standby command
997 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
998 LL_ACCESS_LOCK );
999 }
1000 else
1001 {
1002 //Continue the command here
1003 fContinue = pmcProcessCommand( pMac, pCommand );
1004 if( fContinue )
1005 {
1006 //The command failed, remove it
1007 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1008 &pCommand->Link, LL_ACCESS_LOCK ) )
1009 {
1010 pmcReleaseCommand( pMac, pCommand );
1011 }
1012 }
1013 }
1014 }
1015 else
1016 {
1017 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001018 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001019 VOS_ASSERT(0);
1020 }
1021 }
1022 break;
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301023 case eSmeCommandPnoReq:
1024 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1025 status = smeProcessPnoCommand(pMac, pCommand);
1026 if (!HAL_STATUS_SUCCESS(status)){
1027 smsLog(pMac, LOGE,
1028 FL("failed to post SME PNO SCAN %d"), status);
1029 }
1030 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1031 &pCommand->Link, LL_ACCESS_LOCK))
1032 {
1033 csrReleaseCommand(pMac, pCommand);
1034 }
1035 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001036 case eSmeCommandAddTs:
1037 case eSmeCommandDelTs:
1038 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1039#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1040 fContinue = qosProcessCommand( pMac, pCommand );
1041 if( fContinue )
1042 {
1043 //The command failed, remove it
1044 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1045 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1046 {
1047//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1048 qosReleaseCommand( pMac, pCommand );
1049//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
1050 }
1051 }
1052#endif
1053 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001054#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001055 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001056 case eSmeCommandTdlsAddPeer:
1057 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301058 case eSmeCommandTdlsLinkEstablish:
Atul Mittalc0f739f2014-07-31 13:47:47 +05301059 case eSmeCommandTdlsChannelSwitch: // tdlsoffchan
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001060#ifdef FEATURE_WLAN_TDLS_INTERNAL
1061 case eSmeCommandTdlsDiscovery:
1062 case eSmeCommandTdlsLinkSetup:
1063 case eSmeCommandTdlsLinkTear:
1064 case eSmeCommandTdlsEnterUapsd:
1065 case eSmeCommandTdlsExitUapsd:
1066#endif
1067 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -08001068 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001069 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001070
1071 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1072 status = csrTdlsProcessCmd( pMac, pCommand );
1073 }
1074 break ;
1075#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001076
1077 default:
1078 //something is wrong
1079 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001080 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001081 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1082 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1083 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1084 smeReleaseCommand( pMac, pCommand );
1085 status = eHAL_STATUS_FAILURE;
1086 break;
1087 }
1088 if(!HAL_STATUS_SUCCESS(status))
1089 {
1090 fContinue = eANI_BOOLEAN_TRUE;
1091 }
1092 }//if(pEntry)
1093 else
1094 {
1095 //This is odd. Some one else pull off the command.
1096 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1097 }
1098 }
1099 else
1100 {
1101 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1102 }
1103 }
1104 else
1105 {
1106 //No command waiting
1107 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1108 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1109 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1110 {
1111 tANI_U32 nTime = 0;
1112
1113 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1114 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1115 {
1116 csrScanStartIdleScanTimer(pMac, nTime);
1117 }
1118 }
1119 }
1120 }
1121 else {
1122 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1123 }
1124
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301125sme_process_scan_queue:
1126 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1127 fContinue = eANI_BOOLEAN_FALSE;
1128
Jeff Johnson295189b2012-06-20 16:38:30 -07001129 return ( fContinue );
1130}
1131
1132void smeProcessPendingQueue( tpAniSirGlobal pMac )
1133{
1134 while( smeProcessCommand( pMac ) );
1135}
1136
1137
1138tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1139{
1140 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1141 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1142}
1143
1144
1145
1146//Global APIs
1147
1148/*--------------------------------------------------------------------------
1149
1150 \brief sme_Open() - Initialze all SME modules and put them at idle state
1151
1152 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1153 successfully return, all modules are at idle state ready to start.
1154
1155 smeOpen must be called before any other SME APIs can be involved.
1156 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001157 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001158 \param hHal - The handle returned by macOpen.
1159
1160 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1161
1162 Other status means SME is failed to be initialized
1163 \sa
1164
1165 --------------------------------------------------------------------------*/
1166eHalStatus sme_Open(tHalHandle hHal)
1167{
1168 eHalStatus status = eHAL_STATUS_FAILURE;
1169 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1170
1171 do {
1172 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001173 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001174 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1175 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001176 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001177 status = eHAL_STATUS_FAILURE;
1178 break;
1179 }
1180
1181 status = ccmOpen(hHal);
1182 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1183 smsLog( pMac, LOGE,
1184 "ccmOpen failed during initialization with status=%d", status );
1185 break;
1186 }
1187
1188 status = csrOpen(pMac);
1189 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1190 smsLog( pMac, LOGE,
1191 "csrOpen failed during initialization with status=%d", status );
1192 break;
1193 }
1194
1195 status = pmcOpen(hHal);
1196 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1197 smsLog( pMac, LOGE,
1198 "pmcOpen failed during initialization with status=%d", status );
1199 break;
1200 }
1201
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001202#ifdef FEATURE_WLAN_TDLS
1203 pMac->isTdlsPowerSaveProhibited = 0;
1204#endif
1205
Jeff Johnson295189b2012-06-20 16:38:30 -07001206#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1207 status = sme_QosOpen(pMac);
1208 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1209 smsLog( pMac, LOGE,
1210 "Qos open failed during initialization with status=%d", status );
1211 break;
1212 }
1213
1214 status = btcOpen(pMac);
1215 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1216 smsLog( pMac, LOGE,
1217 "btcOpen open failed during initialization with status=%d", status );
1218 break;
1219 }
1220#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001221#ifdef FEATURE_OEM_DATA_SUPPORT
1222 status = oemData_OemDataReqOpen(pMac);
1223 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1224 smsLog(pMac, LOGE,
1225 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1226 break;
1227 }
1228#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001229
1230 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1231 break;
1232
Jeff Johnson295189b2012-06-20 16:38:30 -07001233 {
1234 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1235 if ( NULL == pvosGCtx ){
1236 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1237 status = eHAL_STATUS_FAILURE;
1238 break;
1239 }
1240
1241 status = WLANSAP_Open( pvosGCtx );
1242 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1243 smsLog( pMac, LOGE,
1244 "WLANSAP_Open open failed during initialization with status=%d", status );
1245 break;
1246 }
1247 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001248#if defined WLAN_FEATURE_VOWIFI
1249 status = rrmOpen(pMac);
1250 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1251 smsLog( pMac, LOGE,
1252 "rrmOpen open failed during initialization with status=%d", status );
1253 break;
1254 }
1255#endif
1256
1257#if defined WLAN_FEATURE_VOWIFI_11R
1258 sme_FTOpen(pMac);
1259#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001260 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001261 smeTraceInit(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001262
1263 }while (0);
1264
1265 return status;
1266}
1267
Jeff Johnson295189b2012-06-20 16:38:30 -07001268/*--------------------------------------------------------------------------
1269
1270 \brief sme_set11dinfo() - Set the 11d information about valid channels
1271 and there power using information from nvRAM
1272 This function is called only for AP.
1273
Srinivas Girigowdade697412013-02-14 16:31:48 -08001274 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001275
1276 \param hHal - The handle returned by macOpen.
1277 \Param pSmeConfigParams - a pointer to a caller allocated object of
1278 typedef struct _smeConfigParams.
1279
1280 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1281
1282 Other status means SME is failed to update the config parameters.
1283 \sa
1284--------------------------------------------------------------------------*/
1285
1286eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1287{
1288 eHalStatus status = eHAL_STATUS_FAILURE;
1289 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1290
Katya Nigambcb705f2013-12-26 14:26:22 +05301291 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001292 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001293 if (NULL == pSmeConfigParams ) {
1294 smsLog( pMac, LOGE,
1295 "Empty config param structure for SME, nothing to update");
1296 return status;
1297 }
1298
1299 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1300 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001301 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001302 status );
1303 }
1304 return status;
1305}
1306
1307/*--------------------------------------------------------------------------
1308
1309 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1310
Srinivas Girigowdade697412013-02-14 16:31:48 -08001311 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001312
1313 \param hHal - The handle returned by HostapdAdapter.
1314 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1315
1316 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1317
1318 Other status means, failed to get the current regulatory domain.
1319 \sa
1320--------------------------------------------------------------------------*/
1321
1322eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1323{
1324 eHalStatus status = eHAL_STATUS_FAILURE;
1325 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1326
Katya Nigambcb705f2013-12-26 14:26:22 +05301327 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001328 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001329 if (NULL == domainIdSoftAp ) {
1330 smsLog( pMac, LOGE, "Uninitialized domain Id");
1331 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001332 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001333
1334 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1335 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001336
Jeff Johnson295189b2012-06-20 16:38:30 -07001337 return status;
1338}
1339
1340
1341eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1342{
1343 eHalStatus status = eHAL_STATUS_FAILURE;
1344 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1345
Katya Nigambcb705f2013-12-26 14:26:22 +05301346 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001347 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 if (NULL == apCntryCode ) {
1349 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1350 return status;
1351 }
1352
1353 status = csrSetRegInfo(hHal, apCntryCode );
1354 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001355 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001356 status );
1357 }
1358 return status;
1359}
1360
Jeff Johnson295189b2012-06-20 16:38:30 -07001361#ifdef FEATURE_WLAN_SCAN_PNO
1362/*--------------------------------------------------------------------------
1363
1364 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001365
1366 It is used at driver start up to inform RIVA of the default channel
1367 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001368
Srinivas Girigowdade697412013-02-14 16:31:48 -08001369 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001370
1371 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001372
Jeff Johnson295189b2012-06-20 16:38:30 -07001373 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1374
1375 Other status means SME is failed to update the channel config.
1376 \sa
1377
1378 --------------------------------------------------------------------------*/
1379eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1380{
1381 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1382
Katya Nigambcb705f2013-12-26 14:26:22 +05301383 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001384 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1385 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001386 &pMac->scan.base20MHzChannels, FALSE);
1387 return eHAL_STATUS_SUCCESS;
1388}
1389#endif // FEATURE_WLAN_SCAN_PNLO
1390
Abhishek Singhf644b272014-08-21 02:59:39 +05301391eHalStatus sme_UpdateChannelList(tHalHandle hHal)
1392{
1393 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1394 eHalStatus status = eHAL_STATUS_SUCCESS;
1395
1396 status = csrUpdateChannelList(pMac);
1397
1398 if (eHAL_STATUS_SUCCESS != status)
1399 {
1400 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1401 "failed to update the supported channel list");
1402 }
1403 return status;
1404}
1405
Jeff Johnson295189b2012-06-20 16:38:30 -07001406/*--------------------------------------------------------------------------
1407
1408 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1409
1410 The function updates some configuration for modules in SME, CCM, CSR, etc
1411 during SMEs close open sequence.
1412
1413 Modules inside SME apply the new configuration at the next transaction.
1414
Srinivas Girigowdade697412013-02-14 16:31:48 -08001415 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001416
1417 \param hHal - The handle returned by macOpen.
1418 \Param pSmeConfigParams - a pointer to a caller allocated object of
1419 typedef struct _smeConfigParams.
1420
1421 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1422
1423 Other status means SME is failed to update the config parameters.
1424 \sa
1425
1426 --------------------------------------------------------------------------*/
1427eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1428{
1429 eHalStatus status = eHAL_STATUS_FAILURE;
1430 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1431
Katya Nigambcb705f2013-12-26 14:26:22 +05301432 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001433 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001434 if (NULL == pSmeConfigParams ) {
1435 smsLog( pMac, LOGE,
1436 "Empty config param structure for SME, nothing to update");
1437 return status;
1438 }
1439
1440 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1441
1442 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001443 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001444 status );
1445 }
1446#if defined WLAN_FEATURE_P2P_INTERNAL
1447 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1448
1449 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001450 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001451 status );
1452 }
1453#endif
1454#if defined WLAN_FEATURE_VOWIFI
1455 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1456
1457 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001458 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001459 status );
1460 }
1461#endif
1462 //For SOC, CFG is set before start
1463 //We don't want to apply global CFG in connect state because that may cause some side affect
1464 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001465 csrIsAllSessionDisconnected( pMac) )
1466 {
1467 csrSetGlobalCfgs(pMac);
1468 }
1469
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301470 /* update the directed scan offload setting */
1471 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1472
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301473 if (pMac->fScanOffload)
1474 {
1475 /* If scan offload is enabled then lim has allow the sending of
1476 scan request to firmware even in powersave mode. The firmware has
1477 to take care of exiting from power save mode */
1478 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1479 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1480
1481 if (eHAL_STATUS_SUCCESS != status)
1482 {
1483 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1484 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1485 }
1486 }
krunal sonie9002db2013-11-25 14:24:17 -08001487 pMac->isCoalesingInIBSSAllowed =
1488 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001489 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301490 pMac->fDeferIMPSTime = pSmeConfigParams->fDeferIMPSTime;
Chandrasekaran, Manishekar5cb0acd2014-12-23 20:06:52 +05301491 pMac->fBtcEnableIndTimerVal = pSmeConfigParams->fBtcEnableIndTimerVal;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301492
Jeff Johnson295189b2012-06-20 16:38:30 -07001493 return status;
1494}
1495
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301496#ifdef WLAN_FEATURE_GTK_OFFLOAD
1497void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1498 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1499{
1500 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1501
1502 if (NULL == pMac)
1503 {
1504 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1505 "%s: pMac is null", __func__);
1506 return ;
1507 }
1508 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1509 {
1510 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1511 "%s: HDD callback is null", __func__);
1512 return ;
1513 }
1514 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1515 pGtkOffloadGetInfoRsp);
1516}
1517#endif
1518
Jeff Johnson295189b2012-06-20 16:38:30 -07001519/* ---------------------------------------------------------------------------
1520 \fn sme_ChangeConfigParams
1521 \brief The SME API exposed for HDD to provide config params to SME during
1522 SMEs stop -> start sequence.
1523
1524 If HDD changed the domain that will cause a reset. This function will
1525 provide the new set of 11d information for the new domain. Currrently this
1526 API provides info regarding 11d only at reset but we can extend this for
1527 other params (PMC, QoS) which needs to be initialized again at reset.
1528
Srinivas Girigowdade697412013-02-14 16:31:48 -08001529 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001530
1531 \param hHal - The handle returned by macOpen.
1532
1533 \Param
1534 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1535 currently provides 11d related information like Country code,
1536 Regulatory domain, valid channel list, Tx power per channel, a
1537 list with active/passive scan allowed per valid channel.
1538
1539 \return eHalStatus
1540 ---------------------------------------------------------------------------*/
1541eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1542 tCsrUpdateConfigParam *pUpdateConfigParam)
1543{
1544 eHalStatus status = eHAL_STATUS_FAILURE;
1545 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1546
1547 if (NULL == pUpdateConfigParam ) {
1548 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001549 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001550 return status;
1551 }
1552
1553 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1554
1555 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001556 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001557 status );
1558 }
1559
1560 return status;
1561
1562}
1563
1564/*--------------------------------------------------------------------------
1565
1566 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1567 that the NIC is ready tio run.
1568
1569 The function is called by HDD at the end of initialization stage so PE/HAL can
1570 enable the NIC to running state.
1571
Srinivas Girigowdade697412013-02-14 16:31:48 -08001572 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001573 \param hHal - The handle returned by macOpen.
1574
1575 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1576 successfully.
1577
1578 Other status means SME failed to send the message to PE.
1579 \sa
1580
1581 --------------------------------------------------------------------------*/
1582eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1583{
1584 tSirSmeReadyReq Msg;
1585 eHalStatus status = eHAL_STATUS_FAILURE;
1586 tPmcPowerState powerState;
1587 tPmcSwitchState hwWlanSwitchState;
1588 tPmcSwitchState swWlanSwitchState;
1589 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1590
Katya Nigambcb705f2013-12-26 14:26:22 +05301591 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001592 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001593 do
1594 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001595
1596 Msg.messageType = eWNI_SME_SYS_READY_IND;
1597 Msg.length = sizeof( tSirSmeReadyReq );
1598
1599 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1600 {
1601 status = eHAL_STATUS_SUCCESS;
1602 }
1603 else
1604 {
1605 smsLog( pMac, LOGE,
1606 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1607 break;
1608 }
1609
1610 status = pmcQueryPowerState( hHal, &powerState,
1611 &hwWlanSwitchState, &swWlanSwitchState );
1612 if ( ! HAL_STATUS_SUCCESS( status ) )
1613 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001614 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001615 status );
1616 break;
1617 }
1618
1619 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1620 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1621 {
1622 status = csrReady(pMac);
1623 if ( ! HAL_STATUS_SUCCESS( status ) )
1624 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001625 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001626 break;
1627 }
1628 status = pmcReady(hHal);
1629 if ( ! HAL_STATUS_SUCCESS( status ) )
1630 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001631 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001632 break;
1633 }
1634#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1635 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1636 {
1637 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001638 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001639 break;
1640 }
1641#endif
1642
1643#if defined WLAN_FEATURE_VOWIFI
1644 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1645 {
1646 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001647 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001648 break;
1649 }
1650#endif
1651 }
1652 pMac->sme.state = SME_STATE_READY;
1653 } while( 0 );
1654
1655 return status;
1656}
1657
1658/*--------------------------------------------------------------------------
1659
1660 \brief sme_Start() - Put all SME modules at ready state.
1661
1662 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1663 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001664 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001665 \param hHal - The handle returned by macOpen.
1666
1667 \return eHAL_STATUS_SUCCESS - SME is ready.
1668
1669 Other status means SME is failed to start
1670 \sa
1671
1672 --------------------------------------------------------------------------*/
1673eHalStatus sme_Start(tHalHandle hHal)
1674{
1675 eHalStatus status = eHAL_STATUS_FAILURE;
1676 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1677
1678 do
1679 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001680 status = csrStart(pMac);
1681 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001682 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001683 status );
1684 break;
1685 }
1686
1687 status = pmcStart(hHal);
1688 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001689 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001690 status );
1691 break;
1692 }
1693
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1695 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001696 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001697 status );
1698 break;
1699 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001700 pMac->sme.state = SME_STATE_START;
1701 }while (0);
1702
1703 return status;
1704}
1705
1706
1707#ifdef WLAN_FEATURE_PACKET_FILTERING
1708/******************************************************************************
1709*
1710* Name: sme_PCFilterMatchCountResponseHandler
1711*
1712* Description:
1713* Invoke Packet Coalescing Filter Match Count callback routine
1714*
1715* Parameters:
1716* hHal - HAL handle for device
1717* pMsg - Pointer to tRcvFltPktMatchRsp structure
1718*
1719* Returns: eHalStatus
1720*
1721******************************************************************************/
1722eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1723{
1724 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1725 eHalStatus status = eHAL_STATUS_SUCCESS;
1726 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1727
1728 if (NULL == pMsg)
1729 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001730 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001731 status = eHAL_STATUS_FAILURE;
1732 }
1733 else
1734 {
1735 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001736 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001737
1738 /* Call Packet Coalescing Filter Match Count callback routine. */
1739 if (pMac->pmc.FilterMatchCountCB != NULL)
1740 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1741 pRcvFltPktMatchRsp);
1742
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001743 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001744 pRcvFltPktMatchRsp->status);
1745
1746 pMac->pmc.FilterMatchCountCB = NULL;
1747 pMac->pmc.FilterMatchCountCBContext = NULL;
1748 }
1749
1750 return(status);
1751}
1752#endif // WLAN_FEATURE_PACKET_FILTERING
1753
1754
Chet Lanctot186b5732013-03-18 10:26:30 -07001755#ifdef WLAN_FEATURE_11W
1756/*------------------------------------------------------------------
1757 *
1758 * Handle the unprotected management frame indication from LIM and
1759 * forward it to HDD.
1760 *
1761 *------------------------------------------------------------------*/
1762
1763eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1764 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1765{
1766 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1767 eHalStatus status = eHAL_STATUS_SUCCESS;
1768 tCsrRoamInfo pRoamInfo = {0};
1769 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1770
1771 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1772 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1773 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1774
1775 /* forward the mgmt frame to HDD */
1776 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1777
1778 return status;
1779}
1780#endif
1781
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08001782#ifdef WLAN_FEATURE_AP_HT40_24G
1783/* ---------------------------------------------------------------------------
1784 \fn sme_HT2040CoexInfoInd
1785 \brief a Send 20/40 Coex info to SAP layer
1786
1787 \param tpSirHT2040CoexInfoInd - 20/40 Coex info param
1788 \return eHalStatus
1789 ---------------------------------------------------------------------------*/
1790
1791eHalStatus sme_HT2040CoexInfoInd( tHalHandle hHal,
1792 tpSirHT2040CoexInfoInd pSmeHT2040CoexInfoInd)
1793{
1794 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1795 eHalStatus status = eHAL_STATUS_SUCCESS;
1796 tANI_U32 SessionId = pSmeHT2040CoexInfoInd->sessionId;
1797 tCsrRoamInfo roamInfo = {0};
1798
1799 roamInfo.pSmeHT2040CoexInfoInd = pSmeHT2040CoexInfoInd;
1800
1801 smsLog(pMac, LOGW, FL("HT40MHzIntolerant: %d HT20MHzBssWidthReq: %d"),
1802 roamInfo.pSmeHT2040CoexInfoInd->HT40MHzIntolerant,
1803 roamInfo.pSmeHT2040CoexInfoInd->HT20MHzBssWidthReq);
1804
1805 smsLog(pMac, LOGW, FL("Total Intolerant Channel: %d"),
1806 roamInfo.pSmeHT2040CoexInfoInd->channel_num);
1807
1808 /* forward the 20/40 BSS Coex information to HDD */
1809 smsLog(pMac, LOGW, FL("Sending eCSR_ROAM_2040_COEX_INFO_IND"
1810 " to WLANSAP_RoamCallback "));
1811
1812 csrRoamCallCallback(pMac, SessionId, &roamInfo,
1813 0, eCSR_ROAM_2040_COEX_INFO_IND, 0);
1814 return status;
1815}
1816#endif
1817
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001818#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001819/*------------------------------------------------------------------
1820 *
1821 * Handle the tsm ie indication from LIM and forward it to HDD.
1822 *
1823 *------------------------------------------------------------------*/
1824
1825eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1826{
1827 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1828 eHalStatus status = eHAL_STATUS_SUCCESS;
1829 tCsrRoamInfo pRoamInfo = {0};
1830 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1831
1832 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1833 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1834 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1835
1836 /* forward the tsm ie information to HDD */
1837 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1838
1839 return status;
1840}
1841
1842/* ---------------------------------------------------------------------------
1843 \fn sme_SetCCKMIe
1844 \brief function to store the CCKM IE passed from supplicant and use it while packing
1845 reassociation request
1846 \param hHal - HAL handle for device
1847 \param pCckmIe - pointer to CCKM IE data
1848 \param pCckmIeLen - length of the CCKM IE
1849 \- return Success or failure
1850 -------------------------------------------------------------------------*/
1851eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1852 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1853{
1854 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1855 eHalStatus status = eHAL_STATUS_SUCCESS;
1856
1857 status = sme_AcquireGlobalLock( &pMac->sme );
1858 if ( HAL_STATUS_SUCCESS( status ) )
1859 {
1860 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1861 sme_ReleaseGlobalLock( &pMac->sme );
1862 }
1863 return status;
1864}
1865
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001866/* ---------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001867 \fn sme_SetEseBeaconRequest
1868 \brief function to set Ese beacon request parameters
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001869 \param hHal - HAL handle for device
1870 \param sessionId - Session id
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001871 \param pEseBcnReq - pointer to Ese beacon request
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001872 \- return Success or failure
1873 -------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001874eHalStatus sme_SetEseBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
1875 const tCsrEseBeaconReq* pEseBcnReq)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001876{
1877 eHalStatus status = eSIR_SUCCESS;
1878 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1879 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001880 tCsrEseBeaconReqParams *pBeaconReq = NULL;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001881 tANI_U8 counter = 0;
1882 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
1883 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
1884
1885 /* Store the info in RRM context */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001886 vos_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, sizeof(tCsrEseBeaconReq));
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001887
1888 //Prepare the request to send to SME.
1889 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
1890 if(NULL == pSmeBcnReportReq)
1891 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001892 smsLog(pMac, LOGP, "Memory Allocation Failure!!! Ese BcnReq Ind to SME");
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001893 return eSIR_FAILURE;
1894 }
1895
1896 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
1897 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
1898
1899 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
1900 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
1901 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
1902 pSmeBcnReportReq->channelInfo.channelNum = 255;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001903 pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe;
1904 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001905
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001906 for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001907 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001908 pBeaconReq = (tCsrEseBeaconReqParams *)&pEseBcnReq->bcnReq[counter];
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001909 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
1910 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
1911 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
1912 }
1913
1914 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
1915 return status;
1916}
1917
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001918#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001919
Chet Lanctot186b5732013-03-18 10:26:30 -07001920
c_hpothu92367912014-05-01 15:18:17 +05301921/* ---------------------------------------------------------------------------
1922 \fn sme_getBcnMissRate
1923 \brief function sends 'WDA_GET_BCN_MISS_RATE_REQ' to WDA layer,
1924 \param hHal - HAL handle for device.
1925 \param sessionId - session ID.
1926 \- return Success or Failure.
1927 -------------------------------------------------------------------------*/
1928
1929eHalStatus sme_getBcnMissRate(tHalHandle hHal, tANI_U8 sessionId, void *callback, void *data)
1930{
1931 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1932 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
1933 vos_msg_t vosMessage;
1934 tSirBcnMissRateReq *pMsg;
1935 tCsrRoamSession *pSession;
1936
1937 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
1938 {
1939 pSession = CSR_GET_SESSION( pMac, sessionId );
1940
1941 if (!pSession)
1942 {
1943 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
1944 sme_ReleaseGlobalLock( &pMac->sme );
1945 return eHAL_STATUS_FAILURE;
1946 }
1947
c_hpothu402de812014-07-10 15:55:45 +05301948 pMsg = (tSirBcnMissRateReq *) vos_mem_malloc(sizeof(tSirBcnMissRateReq));
c_hpothu92367912014-05-01 15:18:17 +05301949 if (NULL == pMsg)
1950 {
1951 smsLog(pMac, LOGE, FL("failed to allocated memory"));
1952 sme_ReleaseGlobalLock( &pMac->sme );
1953 return eHAL_STATUS_FAILURE;
1954 }
1955
1956 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
1957 sizeof(tSirMacAddr));
1958
1959 pMsg->msgLen = sizeof(tSirBcnMissRateReq);
1960 pMsg->callback = callback;
1961 pMsg->data = data;
1962
1963 vosMessage.type = WDA_GET_BCN_MISS_RATE_REQ;
1964 vosMessage.bodyptr = pMsg;
1965 vosMessage.reserved = 0;
1966 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
1967 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1968 {
1969 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1970 "%s: Post Set TM Level MSG fail", __func__);
1971 vos_mem_free(pMsg);
1972 sme_ReleaseGlobalLock( &pMac->sme );
1973 return eHAL_STATUS_FAILURE;
1974 }
1975 sme_ReleaseGlobalLock( &pMac->sme);
1976 return eHAL_STATUS_SUCCESS;
1977 }
1978 return eHAL_STATUS_FAILURE;
1979}
1980
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05301981eHalStatus sme_EncryptMsgResponseHandler(tHalHandle hHal,
1982 tpSirEncryptedDataRspParams pEncRspParams)
1983{
1984 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1985
1986 if (NULL == pMac)
1987 {
1988 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1989 "%s: pMac is null", __func__);
1990 return eHAL_STATUS_FAILURE;
1991 }
1992 if (pMac->sme.pEncMsgInfoParams.pEncMsgCbk == NULL)
1993 {
1994 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1995 "%s: HDD callback is null", __func__);
1996 return eHAL_STATUS_FAILURE;
1997 }
1998 pMac->sme.pEncMsgInfoParams.pEncMsgCbk(pMac->sme.pEncMsgInfoParams.pUserData,
1999 &pEncRspParams->encryptedDataRsp);
2000 return eHAL_STATUS_SUCCESS;
2001}
2002
Girish Gowlia95daca2015-02-04 20:31:31 +05302003eHalStatus sme_UpdateMaxRateInd(tHalHandle hHal,
2004 tSirSmeUpdateMaxRateParams *pSmeUpdateMaxRateParams)
2005{
2006 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2007 eHalStatus status = eHAL_STATUS_SUCCESS;
2008 tANI_U8 sessionId = pSmeUpdateMaxRateParams->smeSessionId;
2009
2010 /* forward the information to HDD */
2011 status = csrRoamCallCallback(pMac, sessionId, NULL, 0,
2012 eCSR_ROAM_UPDATE_MAX_RATE_IND,
2013 pSmeUpdateMaxRateParams->maxRateFlag);
2014 return status;
2015}
2016
Jeff Johnson295189b2012-06-20 16:38:30 -07002017/*--------------------------------------------------------------------------
2018
2019 \brief sme_ProcessMsg() - The main message processor for SME.
2020
2021 The function is called by a message dispatcher when to process a message
2022 targeted for SME.
2023
Srinivas Girigowdade697412013-02-14 16:31:48 -08002024 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002025 \param hHal - The handle returned by macOpen.
2026 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
2027
2028 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
2029
2030 Other status means SME failed to process the message to HAL.
2031 \sa
2032
2033 --------------------------------------------------------------------------*/
2034eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
2035{
2036 eHalStatus status = eHAL_STATUS_FAILURE;
2037 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2038
2039 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002040 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002041 return status;
2042 }
2043
2044 status = sme_AcquireGlobalLock( &pMac->sme );
2045 if ( HAL_STATUS_SUCCESS( status ) )
2046 {
2047 if( SME_IS_START(pMac) )
2048 {
2049 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
2050 case eWNI_PMC_ENTER_BMPS_RSP:
2051 case eWNI_PMC_EXIT_BMPS_RSP:
2052 case eWNI_PMC_EXIT_BMPS_IND:
2053 case eWNI_PMC_ENTER_IMPS_RSP:
2054 case eWNI_PMC_EXIT_IMPS_RSP:
2055 case eWNI_PMC_SMPS_STATE_IND:
2056 case eWNI_PMC_ENTER_UAPSD_RSP:
2057 case eWNI_PMC_EXIT_UAPSD_RSP:
2058 case eWNI_PMC_ENTER_WOWL_RSP:
2059 case eWNI_PMC_EXIT_WOWL_RSP:
2060 //PMC
2061 if (pMsg->bodyptr)
2062 {
2063 pmcMessageProcessor(hHal, pMsg->bodyptr);
2064 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302065 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002066 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002067 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002068 }
2069 break;
2070
2071 case WNI_CFG_SET_CNF:
2072 case WNI_CFG_DNLD_CNF:
2073 case WNI_CFG_GET_RSP:
2074 case WNI_CFG_ADD_GRP_ADDR_CNF:
2075 case WNI_CFG_DEL_GRP_ADDR_CNF:
2076 //CCM
2077 if (pMsg->bodyptr)
2078 {
2079 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
2080 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302081 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002082 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002083 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002084 }
2085 break;
2086
2087 case eWNI_SME_ADDTS_RSP:
2088 case eWNI_SME_DELTS_RSP:
2089 case eWNI_SME_DELTS_IND:
2090#ifdef WLAN_FEATURE_VOWIFI_11R
2091 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002092#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002093 //QoS
2094 if (pMsg->bodyptr)
2095 {
2096#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2097 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302098 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002099#endif
2100 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002101 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002102 }
2103 break;
2104#if defined WLAN_FEATURE_VOWIFI
2105 case eWNI_SME_NEIGHBOR_REPORT_IND:
2106 case eWNI_SME_BEACON_REPORT_REQ_IND:
2107#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002108 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07002109#endif
2110 if ( pMsg->bodyptr )
2111 {
2112 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05302113 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002114 }
2115 else
2116 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002117 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002118 }
2119 break;
2120#endif
2121
Jeff Johnsone7245742012-09-05 17:12:55 -07002122#ifdef FEATURE_OEM_DATA_SUPPORT
2123 //Handle the eWNI_SME_OEM_DATA_RSP:
2124 case eWNI_SME_OEM_DATA_RSP:
2125 if(pMsg->bodyptr)
2126 {
2127 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
2128 vos_mem_free(pMsg->bodyptr);
2129 }
2130 else
2131 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002132 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07002133 }
2134 smeProcessPendingQueue( pMac );
2135 break;
2136#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002137
2138 case eWNI_SME_ADD_STA_SELF_RSP:
2139 if(pMsg->bodyptr)
2140 {
2141 status = csrProcessAddStaSessionRsp(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 meas (eWNI_SME_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002147 }
2148 break;
2149 case eWNI_SME_DEL_STA_SELF_RSP:
2150 if(pMsg->bodyptr)
2151 {
2152 status = csrProcessDelStaSessionRsp(pMac, pMsg->bodyptr);
2153 vos_mem_free(pMsg->bodyptr);
2154 }
2155 else
2156 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002157 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002158 }
2159 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002160 case eWNI_SME_REMAIN_ON_CHN_RSP:
2161 if(pMsg->bodyptr)
2162 {
2163 status = sme_remainOnChnRsp(pMac, pMsg->bodyptr);
2164 vos_mem_free(pMsg->bodyptr);
2165 }
2166 else
2167 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002168 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_REMAIN_ON_CHN_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002169 }
2170 break;
2171 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
2172 if(pMsg->bodyptr)
2173 {
2174 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
2175 vos_mem_free(pMsg->bodyptr);
2176 }
2177 else
2178 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002179 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 -07002180 }
2181 break;
2182 case eWNI_SME_MGMT_FRM_IND:
2183 if(pMsg->bodyptr)
2184 {
2185 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
2186 vos_mem_free(pMsg->bodyptr);
2187 }
2188 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002189 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002190 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002191 }
2192 break;
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002193#ifdef WLAN_FEATURE_AP_HT40_24G
2194 case eWNI_SME_2040_COEX_IND:
2195 if(pMsg->bodyptr)
2196 {
2197 sme_HT2040CoexInfoInd(pMac, pMsg->bodyptr);
2198 vos_mem_free(pMsg->bodyptr);
2199 }
2200 else
2201 {
2202 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_2040_COEX_IND), nothing to process");
2203 }
2204 break;
2205#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 case eWNI_SME_ACTION_FRAME_SEND_CNF:
2207 if(pMsg->bodyptr)
2208 {
2209 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
2210 vos_mem_free(pMsg->bodyptr);
2211 }
2212 else
2213 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002214 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002215 }
2216 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002217 case eWNI_SME_COEX_IND:
2218 if(pMsg->bodyptr)
2219 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302220 tSirSmeCoexInd *pSmeCoexInd = (tSirSmeCoexInd *)pMsg->bodyptr;
2221
2222 if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4)
2223 {
2224 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4"));
2225 sme_RequestFullPower(hHal, NULL, NULL, eSME_REASON_OTHER);
2226 pMac->isCoexScoIndSet = 1;
2227 }
2228 else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4)
2229 {
2230 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4"));
2231 pMac->isCoexScoIndSet = 0;
2232 sme_RequestBmps(hHal, NULL, NULL);
2233 }
2234
Jeff Johnson295189b2012-06-20 16:38:30 -07002235 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
2236 vos_mem_free(pMsg->bodyptr);
2237 }
2238 else
2239 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002240 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002241 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002242 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002243
2244#ifdef FEATURE_WLAN_SCAN_PNO
2245 case eWNI_SME_PREF_NETWORK_FOUND_IND:
2246 if(pMsg->bodyptr)
2247 {
2248 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2249 vos_mem_free(pMsg->bodyptr);
2250 }
2251 else
2252 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002253 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002254 }
2255 break;
2256#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002257
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 case eWNI_SME_TX_PER_HIT_IND:
2259 if (pMac->sme.pTxPerHitCallback)
2260 {
2261 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2262 }
2263 break;
2264
2265 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002266 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002267 {
2268 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2269 vos_mem_free(pMsg->bodyptr);
2270 }
2271 else
2272 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002273 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2274 }
2275 break;
2276
2277 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2278 if (pMsg->bodyptr)
2279 {
2280 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2281 vos_mem_free(pMsg->bodyptr);
2282 }
2283 else
2284 {
2285 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002286 }
2287 break;
2288
2289#ifdef WLAN_FEATURE_PACKET_FILTERING
2290 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2291 if(pMsg->bodyptr)
2292 {
2293 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2294 vos_mem_free(pMsg->bodyptr);
2295 }
2296 else
2297 {
2298 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002299 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 }
2301 break;
2302#endif // WLAN_FEATURE_PACKET_FILTERING
2303 case eWNI_SME_PRE_SWITCH_CHL_IND:
2304 {
2305 status = sme_HandlePreChannelSwitchInd(pMac);
2306 break;
2307 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002308
Jeff Johnson295189b2012-06-20 16:38:30 -07002309 case eWNI_SME_POST_SWITCH_CHL_IND:
2310 {
2311 status = sme_HandlePostChannelSwitchInd(pMac);
2312 break;
2313 }
2314
2315#ifdef WLAN_WAKEUP_EVENTS
2316 case eWNI_SME_WAKE_REASON_IND:
2317 if(pMsg->bodyptr)
2318 {
2319 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2320 vos_mem_free(pMsg->bodyptr);
2321 }
2322 else
2323 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002324 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002325 }
2326 break;
2327#endif // WLAN_WAKEUP_EVENTS
2328
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002329#ifdef FEATURE_WLAN_TDLS
2330 /*
2331 * command rescived from PE, SME tdls msg processor shall be called
2332 * to process commands recieved from PE
2333 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002334 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2335 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002336 case eWNI_SME_TDLS_DEL_STA_RSP:
2337 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002338 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002339 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302340 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Atul Mittal60bd4292014-08-14 12:19:27 +05302341 case eWNI_SME_TDLS_CHANNEL_SWITCH_RSP:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002342#ifdef FEATURE_WLAN_TDLS_INTERNAL
2343 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
2344 case eWNI_SME_TDLS_DISCOVERY_START_IND:
2345 case eWNI_SME_TDLS_LINK_START_RSP:
2346 case eWNI_SME_TDLS_LINK_START_IND:
2347 case eWNI_SME_TDLS_TEARDOWN_RSP:
2348 case eWNI_SME_TDLS_TEARDOWN_IND:
2349 case eWNI_SME_ADD_TDLS_PEER_IND:
2350 case eWNI_SME_DELETE_TDLS_PEER_IND:
2351#endif
2352 {
2353 if (pMsg->bodyptr)
2354 {
2355 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302356 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002357 }
2358 else
2359 {
2360 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002361 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002362 }
2363 break;
2364 }
2365#endif
2366
Chet Lanctot186b5732013-03-18 10:26:30 -07002367#ifdef WLAN_FEATURE_11W
2368 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2369 if (pMsg->bodyptr)
2370 {
2371 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2372 vos_mem_free(pMsg->bodyptr);
2373 }
2374 else
2375 {
2376 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2377 }
2378 break;
2379#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002380#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002381 case eWNI_SME_TSM_IE_IND:
2382 {
2383 if (pMsg->bodyptr)
2384 {
2385 sme_TsmIeInd(pMac, pMsg->bodyptr);
2386 vos_mem_free(pMsg->bodyptr);
2387 }
2388 else
2389 {
2390 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2391 }
2392 break;
2393 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002394#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002395#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2396 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2397 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2398 break;
2399#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002400
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302401#ifdef WLAN_FEATURE_GTK_OFFLOAD
2402 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2403 if (pMsg->bodyptr)
2404 {
2405 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302406 vos_mem_zero(pMsg->bodyptr,
2407 sizeof(tSirGtkOffloadGetInfoRspParams));
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302408 vos_mem_free(pMsg->bodyptr);
2409 }
2410 else
2411 {
2412 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2413 }
2414 break ;
2415#endif
Leo Chang9056f462013-08-01 19:21:11 -07002416
2417#ifdef FEATURE_WLAN_LPHB
2418 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002419 case eWNI_SME_LPHB_IND:
2420 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002421 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002422 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002423 }
2424 vos_mem_free(pMsg->bodyptr);
2425
2426 break;
2427#endif /* FEATURE_WLAN_LPHB */
2428
Leo Chang0b0e45a2013-12-15 15:18:55 -08002429#ifdef FEATURE_WLAN_CH_AVOID
2430 /* LPHB timeout indication arrived, send IND to client */
2431 case eWNI_SME_CH_AVOID_IND:
2432 if (pMac->sme.pChAvoidNotificationCb)
2433 {
2434 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2435 "%s: CH avoid notification", __func__);
2436 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2437 }
2438 vos_mem_free(pMsg->bodyptr);
2439
2440 break;
2441#endif /* FEATURE_WLAN_CH_AVOID */
2442
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302443 case eWNI_SME_ENCRYPT_MSG_RSP:
2444 if (pMsg->bodyptr)
2445 {
2446 sme_EncryptMsgResponseHandler(pMac, pMsg->bodyptr);
2447 vos_mem_free(pMsg->bodyptr);
2448 }
2449 else
2450 {
2451 smsLog(pMac, LOGE,
2452 "Empty rsp message for (eWNI_SME_ENCRYPT_MSG_RSP),"
2453 " nothing to process");
2454 }
2455 break ;
2456
Girish Gowlia95daca2015-02-04 20:31:31 +05302457 case eWNI_SME_UPDATE_MAX_RATE_IND:
2458 if (pMsg->bodyptr)
2459 {
2460 sme_UpdateMaxRateInd(pMac, pMsg->bodyptr);
2461 vos_mem_free(pMsg->bodyptr);
2462 }
2463 else
2464 {
2465 smsLog(pMac, LOGE,
2466 "Empty message for (eWNI_SME_UPDATE_MAX_RATE_IND),"
2467 " nothing to process");
2468 }
2469 break;
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302470
Jeff Johnson295189b2012-06-20 16:38:30 -07002471 default:
2472
2473 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2474 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2475 {
2476 //CSR
2477 if (pMsg->bodyptr)
2478 {
2479 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302480 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002481 }
2482 else
2483 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002484 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002485 }
2486 }
2487 else
2488 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002489 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002490 pMsg->type);
2491 if (pMsg->bodyptr)
2492 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302493 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002494 }
2495 }
2496 }//switch
2497 } //SME_IS_START
2498 else
2499 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002500 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002501 if (pMsg->bodyptr)
2502 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302503 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002504 }
2505 }
2506 sme_ReleaseGlobalLock( &pMac->sme );
2507 }
2508 else
2509 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002510 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002511 if (pMsg->bodyptr)
2512 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302513 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002514 }
2515 }
2516
2517 return status;
2518}
2519
2520
2521//No need to hold the global lock here because this function can only be called
2522//after sme_Stop.
2523v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2524{
2525 if( pMsg )
2526 {
2527 if (pMsg->bodyptr)
2528 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302529 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002530 }
2531 }
2532
2533}
2534
2535
2536/*--------------------------------------------------------------------------
2537
2538 \brief sme_Stop() - Stop all SME modules and put them at idle state
2539
2540 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2541 return, all modules are at idle state ready to start.
2542
Srinivas Girigowdade697412013-02-14 16:31:48 -08002543 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002544 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302545 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002546
2547 \return eHAL_STATUS_SUCCESS - SME is stopped.
2548
2549 Other status means SME is failed to stop but caller should still
2550 consider SME is stopped.
2551 \sa
2552
2553 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302554eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002555{
2556 eHalStatus status = eHAL_STATUS_FAILURE;
2557 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2558 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2559
Jeff Johnson295189b2012-06-20 16:38:30 -07002560 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2561 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002562 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002563 status );
2564 fail_status = status;
2565 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002566
2567 p2pStop(hHal);
2568
Kiet Lama72a2322013-11-15 11:18:11 +05302569 status = pmcStop(hHal);
2570 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2571 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2572 status );
2573 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002574 }
2575
Kiet Lama72a2322013-11-15 11:18:11 +05302576 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002577 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002578 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002579 status );
2580 fail_status = status;
2581 }
2582
2583 ccmStop(hHal);
2584
2585 purgeSmeCmdList(pMac);
2586
2587 if (!HAL_STATUS_SUCCESS( fail_status )) {
2588 status = fail_status;
2589 }
2590
2591 pMac->sme.state = SME_STATE_STOP;
2592
2593 return status;
2594}
2595
2596/*--------------------------------------------------------------------------
2597
2598 \brief sme_Close() - Release all SME modules and their resources.
2599
2600 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2601 return, all modules are at closed state.
2602
2603 No SME APIs can be involved after smeClose except smeOpen.
2604 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002605 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002606 \param hHal - The handle returned by macOpen
2607
2608 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2609
2610 Other status means SME is failed to be closed but caller still cannot
2611 call any other SME functions except smeOpen.
2612 \sa
2613
2614 --------------------------------------------------------------------------*/
2615eHalStatus sme_Close(tHalHandle hHal)
2616{
2617 eHalStatus status = eHAL_STATUS_FAILURE;
2618 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2619 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2620
2621 status = csrClose(pMac);
2622 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002623 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002624 status );
2625 fail_status = status;
2626 }
2627
Jeff Johnson295189b2012-06-20 16:38:30 -07002628 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2629 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002630 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002631 status );
2632 fail_status = status;
2633 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002634
2635#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2636 status = btcClose(hHal);
2637 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002638 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002639 status );
2640 fail_status = status;
2641 }
2642
2643 status = sme_QosClose(pMac);
2644 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002645 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002646 status );
2647 fail_status = status;
2648 }
2649#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002650#ifdef FEATURE_OEM_DATA_SUPPORT
2651 status = oemData_OemDataReqClose(hHal);
2652 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002653 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002654 status );
2655 fail_status = status;
2656 }
2657#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002658
2659 status = ccmClose(hHal);
2660 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002661 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002662 status );
2663 fail_status = status;
2664 }
2665
2666 status = pmcClose(hHal);
2667 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002668 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002669 status );
2670 fail_status = status;
2671 }
2672#if defined WLAN_FEATURE_VOWIFI
2673 status = rrmClose(hHal);
2674 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002675 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002676 status );
2677 fail_status = status;
2678 }
2679#endif
2680
2681#if defined WLAN_FEATURE_VOWIFI_11R
2682 sme_FTClose(hHal);
2683#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002684 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002685
2686 freeSmeCmdList(pMac);
2687
2688 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2689 {
2690 fail_status = eHAL_STATUS_FAILURE;
2691 }
2692
2693 if (!HAL_STATUS_SUCCESS( fail_status )) {
2694 status = fail_status;
2695 }
2696
2697 pMac->sme.state = SME_STATE_STOP;
2698
2699 return status;
2700}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002701#ifdef FEATURE_WLAN_LFR
2702tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2703{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002704#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002705 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2706 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2707 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2708 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2709 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2710 return eANI_BOOLEAN_FALSE;
2711 default:
2712 return eANI_BOOLEAN_TRUE;
2713 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002714#else
2715 /*
2716 * TODO: always return TRUE for now until
2717 * we figure out why we could be stuck in
2718 * one of the roaming states forever.
2719 */
2720 return eANI_BOOLEAN_TRUE;
2721#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002722}
2723#endif
c_hpothu58901462014-11-01 16:44:34 +05302724
2725/* ---------------------------------------------------------------------------
2726 \fn sco_isScanAllowed
2727 \brief check for scan interface connection status
2728 \param pMac - Pointer to the global MAC parameter structure
2729 \param pScanReq - scan request structure.
2730
2731 \return tANI_BOOLEAN TRUE to allow scan otherwise FALSE
2732 ---------------------------------------------------------------------------*/
2733tANI_BOOLEAN sco_isScanAllowed(tpAniSirGlobal pMac, tCsrScanRequest *pscanReq)
2734{
2735 tANI_BOOLEAN ret;
2736
2737 if (pscanReq->p2pSearch)
2738 ret = csrIsP2pSessionConnected(pMac);
2739 else
2740 ret = csrIsStaSessionConnected(pMac);
2741
2742 return !ret;
2743}
2744
Jeff Johnson295189b2012-06-20 16:38:30 -07002745/* ---------------------------------------------------------------------------
2746 \fn sme_ScanRequest
2747 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002748 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002749 \param pScanRequestID - pointer to an object to get back the request ID
2750 \param callback - a callback function that scan calls upon finish, will not
2751 be called if csrScanRequest returns error
2752 \param pContext - a pointer passed in for the callback
2753 \return eHalStatus
2754 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002755eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2756 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002757 csrScanCompleteCallback callback, void *pContext)
2758{
2759 eHalStatus status = eHAL_STATUS_FAILURE;
2760 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05302761 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002762 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002763 smsLog(pMac, LOG2, FL("enter"));
2764 do
2765 {
c_hpothu304c0522014-09-30 10:22:57 +05302766 if(pMac->scan.fScanEnable &&
c_hpothu58901462014-11-01 16:44:34 +05302767 (pMac->isCoexScoIndSet ? sco_isScanAllowed(pMac, pscanReq) : TRUE))
Jeff Johnson295189b2012-06-20 16:38:30 -07002768 {
2769 status = sme_AcquireGlobalLock( &pMac->sme );
2770 if ( HAL_STATUS_SUCCESS( status ) )
2771 {
2772 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002773#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002774 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002775 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002776#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002777 status = csrScanRequest( hHal, sessionId, pscanReq,
2778 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05302779 if ( !HAL_STATUS_SUCCESS( status ) )
2780 {
2781 smsLog(pMac, LOGE, FL("csrScanRequest failed"
2782 " SId=%d"), sessionId);
2783 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002784#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002785 }
2786 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002787 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302788 smsLog(pMac, LOGE, FL("Scan denied in state %s"
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302789 "(sub-state %s)"),
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302790 macTraceGetNeighbourRoamState(
2791 pMac->roam.neighborRoamInfo.neighborRoamState),
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302792 macTraceGetcsrRoamSubState(
2793 pMac->roam.curSubState[sessionId]));
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002794 /*HandOff is in progress. So schedule this scan later*/
2795 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002796 }
2797#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002798 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002799
Jeff Johnson295189b2012-06-20 16:38:30 -07002800 sme_ReleaseGlobalLock( &pMac->sme );
2801 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002802 else
2803 {
2804 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2805 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002806 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002807 else
2808 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302809 smsLog(pMac, LOGE, FL("fScanEnable %d isCoexScoIndSet: %d "),
2810 pMac->scan.fScanEnable, pMac->isCoexScoIndSet);
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002811 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002812 } while( 0 );
2813
2814 return (status);
2815
2816
2817}
2818
2819/* ---------------------------------------------------------------------------
2820 \fn sme_ScanGetResult
2821 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002822 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002823 \param pFilter - If pFilter is NULL, all cached results are returned
2824 \param phResult - an object for the result.
2825 \return eHalStatus
2826 ---------------------------------------------------------------------------*/
2827eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2828 tScanResultHandle *phResult)
2829{
2830 eHalStatus status = eHAL_STATUS_FAILURE;
2831 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2832
Katya Nigambcb705f2013-12-26 14:26:22 +05302833 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002834 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002835 smsLog(pMac, LOG2, FL("enter"));
2836 status = sme_AcquireGlobalLock( &pMac->sme );
2837 if ( HAL_STATUS_SUCCESS( status ) )
2838 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002839 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002840 sme_ReleaseGlobalLock( &pMac->sme );
2841 }
2842 smsLog(pMac, LOG2, FL("exit status %d"), status);
2843
2844 return (status);
2845}
2846
2847
2848/* ---------------------------------------------------------------------------
2849 \fn sme_ScanFlushResult
2850 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002851 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002852 \return eHalStatus
2853 ---------------------------------------------------------------------------*/
2854eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2855{
2856 eHalStatus status = eHAL_STATUS_FAILURE;
2857 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2858
Katya Nigambcb705f2013-12-26 14:26:22 +05302859 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002860 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002861 status = sme_AcquireGlobalLock( &pMac->sme );
2862 if ( HAL_STATUS_SUCCESS( status ) )
2863 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002864 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002865 sme_ReleaseGlobalLock( &pMac->sme );
2866 }
2867
2868 return (status);
2869}
2870
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05302871/* ---------------------------------------------------------------------------
2872 \fn sme_FilterScanResults
2873 \brief a wrapper function to request CSR to clear scan results.
2874 This is a synchronous call
2875 \return eHalStatus
2876 ---------------------------------------------------------------------------*/
2877eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
2878{
2879 eHalStatus status = eHAL_STATUS_SUCCESS;
2880 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2881
2882 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2883 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
2884 status = sme_AcquireGlobalLock( &pMac->sme );
2885 if ( HAL_STATUS_SUCCESS( status ) )
2886 {
2887 csrScanFilterResults(pMac);
2888 sme_ReleaseGlobalLock( &pMac->sme );
2889 }
2890
2891 return (status);
2892}
2893
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002894eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2895{
2896 eHalStatus status = eHAL_STATUS_FAILURE;
2897 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2898
Katya Nigambcb705f2013-12-26 14:26:22 +05302899 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002900 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002901 status = sme_AcquireGlobalLock( &pMac->sme );
2902 if ( HAL_STATUS_SUCCESS( status ) )
2903 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302904 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002905 sme_ReleaseGlobalLock( &pMac->sme );
2906 }
2907
2908 return (status);
2909}
Jeff Johnson295189b2012-06-20 16:38:30 -07002910
2911/* ---------------------------------------------------------------------------
2912 \fn sme_ScanResultGetFirst
2913 \brief a wrapper function to request CSR to returns the first element of
2914 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002915 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002916 \param hScanResult - returned from csrScanGetResult
2917 \return tCsrScanResultInfo * - NULL if no result
2918 ---------------------------------------------------------------------------*/
2919tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2920 tScanResultHandle hScanResult)
2921{
2922 eHalStatus status = eHAL_STATUS_FAILURE;
2923 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2924 tCsrScanResultInfo *pRet = NULL;
2925
Katya Nigambcb705f2013-12-26 14:26:22 +05302926 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002927 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002928 status = sme_AcquireGlobalLock( &pMac->sme );
2929 if ( HAL_STATUS_SUCCESS( status ) )
2930 {
2931 pRet = csrScanResultGetFirst( pMac, hScanResult );
2932 sme_ReleaseGlobalLock( &pMac->sme );
2933 }
2934
2935 return (pRet);
2936}
2937
2938
2939/* ---------------------------------------------------------------------------
2940 \fn sme_ScanResultGetNext
2941 \brief a wrapper function to request CSR to returns the next element of
2942 scan result. It can be called without calling csrScanResultGetFirst
2943 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002944 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002945 \param hScanResult - returned from csrScanGetResult
2946 \return Null if no result or reach the end
2947 ---------------------------------------------------------------------------*/
2948tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2949 tScanResultHandle hScanResult)
2950{
2951 eHalStatus status = eHAL_STATUS_FAILURE;
2952 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2953 tCsrScanResultInfo *pRet = NULL;
2954
Katya Nigambcb705f2013-12-26 14:26:22 +05302955 MTRACE(vos_trace(VOS_MODULE_ID_SME ,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002956 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002957 status = sme_AcquireGlobalLock( &pMac->sme );
2958 if ( HAL_STATUS_SUCCESS( status ) )
2959 {
2960 pRet = csrScanResultGetNext( pMac, hScanResult );
2961 sme_ReleaseGlobalLock( &pMac->sme );
2962 }
2963
2964 return (pRet);
2965}
2966
2967
2968/* ---------------------------------------------------------------------------
2969 \fn sme_ScanSetBGScanparams
2970 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002971 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002972 \param pScanReq - BG scan request structure
2973 \return eHalStatus
2974 ---------------------------------------------------------------------------*/
2975eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2976{
2977 eHalStatus status = eHAL_STATUS_FAILURE;
2978 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2979
2980 if( NULL != pScanReq )
2981 {
2982 status = sme_AcquireGlobalLock( &pMac->sme );
2983 if ( HAL_STATUS_SUCCESS( status ) )
2984 {
2985 status = csrScanSetBGScanparams( hHal, pScanReq );
2986 sme_ReleaseGlobalLock( &pMac->sme );
2987 }
2988 }
2989
2990 return (status);
2991}
2992
2993
2994/* ---------------------------------------------------------------------------
2995 \fn sme_ScanResultPurge
2996 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
2997 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08002998 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002999 \param hScanResult - returned from csrScanGetResult. hScanResult is
3000 considered gone by
3001 calling this function and even before this function reutrns.
3002 \return eHalStatus
3003 ---------------------------------------------------------------------------*/
3004eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
3005{
3006 eHalStatus status = eHAL_STATUS_FAILURE;
3007 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3008
Katya Nigambcb705f2013-12-26 14:26:22 +05303009 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003010 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003011 status = sme_AcquireGlobalLock( &pMac->sme );
3012 if ( HAL_STATUS_SUCCESS( status ) )
3013 {
3014 status = csrScanResultPurge( hHal, hScanResult );
3015 sme_ReleaseGlobalLock( &pMac->sme );
3016 }
3017
3018 return (status);
3019}
3020
3021/* ---------------------------------------------------------------------------
3022 \fn sme_ScanGetPMKIDCandidateList
3023 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003024 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003025 \param pPmkidList - caller allocated buffer point to an array of
3026 tPmkidCandidateInfo
3027 \param pNumItems - pointer to a variable that has the number of
3028 tPmkidCandidateInfo allocated when retruning, this is
3029 either the number needed or number of items put into
3030 pPmkidList
3031 \return eHalStatus - when fail, it usually means the buffer allocated is not
3032 big enough and pNumItems
3033 has the number of tPmkidCandidateInfo.
3034 \Note: pNumItems is a number of tPmkidCandidateInfo,
3035 not sizeof(tPmkidCandidateInfo) * something
3036 ---------------------------------------------------------------------------*/
3037eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003038 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07003039 tANI_U32 *pNumItems )
3040{
3041 eHalStatus status = eHAL_STATUS_FAILURE;
3042 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3043
3044 status = sme_AcquireGlobalLock( &pMac->sme );
3045 if ( HAL_STATUS_SUCCESS( status ) )
3046 {
3047 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
3048 sme_ReleaseGlobalLock( &pMac->sme );
3049 }
3050
3051 return (status);
3052}
3053
3054/*----------------------------------------------------------------------------
3055 \fn sme_RoamRegisterLinkQualityIndCallback
3056
3057 \brief
3058 a wrapper function to allow HDD to register a callback handler with CSR for
3059 link quality indications.
3060
3061 Only one callback may be registered at any time.
3062 In order to deregister the callback, a NULL cback may be provided.
3063
3064 Registration happens in the task context of the caller.
3065
3066 \param callback - Call back being registered
3067 \param pContext - user data
3068
3069 DEPENDENCIES: After CSR open
3070
3071 \return eHalStatus
3072-----------------------------------------------------------------------------*/
3073eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
3074 csrRoamLinkQualityIndCallback callback,
3075 void *pContext)
3076{
3077 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
3078}
3079
3080/* ---------------------------------------------------------------------------
3081 \fn sme_RoamRegisterCallback
3082 \brief a wrapper function to allow HDD to register a callback with CSR.
3083 Unlike scan, roam has one callback for all the roam requests
3084 \param callback - a callback function that roam calls upon when state changes
3085 \param pContext - a pointer passed in for the callback
3086 \return eHalStatus
3087 ---------------------------------------------------------------------------*/
3088eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
3089 csrRoamCompleteCallback callback,
3090 void *pContext)
3091{
3092 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
3093}
3094
3095eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
3096{
3097 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3098 return pMac->roam.configParam.phyMode;
3099}
3100
3101/* ---------------------------------------------------------------------------
Peng Xu117eab42014-09-25 13:33:27 +05303102 \fn sme_GetChannelBondingMode5G
3103 \brief get the channel bonding mode for 5G band
3104 \param hHal - HAL handle
3105 \return channel bonding mode for 5G
3106 ---------------------------------------------------------------------------*/
3107tANI_U32 sme_GetChannelBondingMode5G(tHalHandle hHal)
3108{
3109 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3110 tSmeConfigParams smeConfig;
3111
3112 sme_GetConfigParam(pMac, &smeConfig);
3113
3114 return smeConfig.csrConfig.channelBondingMode5GHz;
3115}
3116
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303117#ifdef WLAN_FEATURE_AP_HT40_24G
Peng Xu117eab42014-09-25 13:33:27 +05303118/* ---------------------------------------------------------------------------
3119 \fn sme_GetChannelBondingMode24G
3120 \brief get the channel bonding mode for 2.4G band
3121 \param hHal - HAL handle
3122 \return channel bonding mode for 2.4G
3123 ---------------------------------------------------------------------------*/
3124tANI_U32 sme_GetChannelBondingMode24G(tHalHandle hHal)
3125{
3126 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3127 tSmeConfigParams smeConfig;
3128
3129 sme_GetConfigParam(pMac, &smeConfig);
3130
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303131 return smeConfig.csrConfig.channelBondingAPMode24GHz;
Peng Xu117eab42014-09-25 13:33:27 +05303132}
3133
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303134/* ---------------------------------------------------------------------------
3135 \fn sme_UpdateChannelBondingMode24G
3136 \brief update the channel bonding mode for 2.4G band
3137 \param hHal - HAL handle
3138 \param cbMode - channel bonding mode
3139 \return
3140 ---------------------------------------------------------------------------*/
3141void sme_UpdateChannelBondingMode24G(tHalHandle hHal, tANI_U8 cbMode)
3142{
3143 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3144 tSmeConfigParams smeConfig;
3145
3146 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
3147 sme_GetConfigParam(pMac, &smeConfig);
3148 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3149 FL("Previous Channel Bonding : = %d"),
3150 smeConfig.csrConfig.channelBondingAPMode24GHz);
3151
3152 smeConfig.csrConfig.channelBondingAPMode24GHz = cbMode;
3153 sme_UpdateConfig(hHal, &smeConfig);
3154 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3155 FL("New Channel Bonding : = %d"),
3156 sme_GetChannelBondingMode24G(hHal));
3157 return;
3158}
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05303159
3160/* ---------------------------------------------------------------------------
3161
3162 \fn sme_SetHT2040Mode
3163
3164 \brief To update HT Operation beacon IE & Channel Bonding.
3165
3166 \param
3167
3168 \return eHalStatus SUCCESS
3169 FAILURE or RESOURCES
3170 The API finished and failed.
3171
3172 -------------------------------------------------------------------------------*/
3173eHalStatus sme_SetHT2040Mode(tHalHandle hHal, tANI_U8 sessionId, tANI_U8 cbMode)
3174{
3175 eHalStatus status = eHAL_STATUS_FAILURE;
3176 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3177
3178 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3179 FL("Channel Bonding =%d"),
3180 cbMode);
3181
3182 status = sme_AcquireGlobalLock(&pMac->sme);
3183 if (HAL_STATUS_SUCCESS(status))
3184 {
3185 status = csrSetHT2040Mode(pMac, sessionId, cbMode);
3186 sme_ReleaseGlobalLock(&pMac->sme );
3187 }
3188 return (status);
3189}
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303190#endif
Peng Xu117eab42014-09-25 13:33:27 +05303191
3192/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003193 \fn sme_RoamConnect
3194 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08003195 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003196 \param sessionId - the sessionId returned by sme_OpenSession.
3197 \param pProfile - description of the network to which to connect
3198 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
3199 from csrScanGetResult
3200 \param pRoamId - to get back the request ID
3201 \return eHalStatus
3202 ---------------------------------------------------------------------------*/
3203eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3204 tANI_U32 *pRoamId)
3205{
3206 eHalStatus status = eHAL_STATUS_FAILURE;
3207 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3208
Yue Mae36e3552014-03-05 17:06:20 -08003209 if (!pMac)
3210 {
3211 return eHAL_STATUS_FAILURE;
3212 }
3213
Katya Nigambcb705f2013-12-26 14:26:22 +05303214 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003215 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003216 smsLog(pMac, LOG2, FL("enter"));
3217 status = sme_AcquireGlobalLock( &pMac->sme );
3218 if ( HAL_STATUS_SUCCESS( status ) )
3219 {
3220 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3221 {
3222 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
3223 }
3224 else
3225 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003226 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003227 status = eHAL_STATUS_INVALID_PARAMETER;
3228 }
3229 sme_ReleaseGlobalLock( &pMac->sme );
3230 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003231 else
3232 {
3233 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
3234 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003235
3236 return (status);
3237}
3238
3239/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05303240
3241 \fn sme_SetPhyMode
3242
3243 \brief Changes the PhyMode.
3244
3245 \param hHal - The handle returned by macOpen.
3246
3247 \param phyMode new phyMode which is to set
3248
3249 \return eHalStatus SUCCESS.
3250
3251 -------------------------------------------------------------------------------*/
3252eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
3253{
3254 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3255
3256 if (NULL == pMac)
3257 {
3258 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3259 "%s: invalid context", __func__);
3260 return eHAL_STATUS_FAILURE;
3261 }
3262
3263 pMac->roam.configParam.phyMode = phyMode;
3264 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
3265 pMac->roam.configParam.phyMode,
3266 pMac->roam.configParam.ProprietaryRatesEnabled);
3267
3268 return eHAL_STATUS_SUCCESS;
3269}
3270
3271/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003272 \fn sme_RoamReassoc
3273 \brief a wrapper function to request CSR to inititiate a re-association
3274 \param pProfile - can be NULL to join the currently connected AP. In that
3275 case modProfileFields should carry the modified field(s) which could trigger
3276 reassoc
3277 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
3278 that might need modification dynamically once STA is up & running and this
3279 could trigger a reassoc
3280 \param pRoamId - to get back the request ID
3281 \return eHalStatus
3282 -------------------------------------------------------------------------------*/
3283eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3284 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003285 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07003286{
3287 eHalStatus status = eHAL_STATUS_FAILURE;
3288 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3289
Katya Nigambcb705f2013-12-26 14:26:22 +05303290 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003291 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003292 smsLog(pMac, LOG2, FL("enter"));
3293 status = sme_AcquireGlobalLock( &pMac->sme );
3294 if ( HAL_STATUS_SUCCESS( status ) )
3295 {
3296 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3297 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003298 if((NULL == pProfile) && (fForce == 1))
3299 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07003300 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
3301 /* to force the AP initiate fresh 802.1x authentication need to clear
3302 * the PMKID cache for that set the following boolean. this is needed
3303 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
3304 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003305 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
3306 }
3307 else
3308 {
3309 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003310 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003311 }
3312 else
3313 {
3314 status = eHAL_STATUS_INVALID_PARAMETER;
3315 }
3316 sme_ReleaseGlobalLock( &pMac->sme );
3317 }
3318
3319 return (status);
3320}
3321
3322/* ---------------------------------------------------------------------------
3323 \fn sme_RoamConnectToLastProfile
3324 \brief a wrapper function to request CSR to disconnect and reconnect with
3325 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08003326 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003327 \return eHalStatus. It returns fail if currently connected
3328 ---------------------------------------------------------------------------*/
3329eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
3330{
3331 eHalStatus status = eHAL_STATUS_FAILURE;
3332 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3333
3334 status = sme_AcquireGlobalLock( &pMac->sme );
3335 if ( HAL_STATUS_SUCCESS( status ) )
3336 {
3337 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3338 {
3339 status = csrRoamConnectToLastProfile( pMac, sessionId );
3340 }
3341 else
3342 {
3343 status = eHAL_STATUS_INVALID_PARAMETER;
3344 }
3345 sme_ReleaseGlobalLock( &pMac->sme );
3346 }
3347
3348 return (status);
3349}
3350
3351/* ---------------------------------------------------------------------------
3352 \fn sme_RoamDisconnect
3353 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08003354 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003355 \param reason -- To indicate the reason for disconnecting. Currently, only
3356 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
3357 \return eHalStatus
3358 ---------------------------------------------------------------------------*/
3359eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
3360{
3361 eHalStatus status = eHAL_STATUS_FAILURE;
3362 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3363
Katya Nigambcb705f2013-12-26 14:26:22 +05303364 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003365 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003366 smsLog(pMac, LOG2, FL("enter"));
3367 status = sme_AcquireGlobalLock( &pMac->sme );
3368 if ( HAL_STATUS_SUCCESS( status ) )
3369 {
3370 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3371 {
3372 status = csrRoamDisconnect( pMac, sessionId, reason );
3373 }
3374 else
3375 {
3376 status = eHAL_STATUS_INVALID_PARAMETER;
3377 }
3378 sme_ReleaseGlobalLock( &pMac->sme );
3379 }
3380
3381 return (status);
3382}
3383
Jeff Johnson295189b2012-06-20 16:38:30 -07003384/* ---------------------------------------------------------------------------
3385 \fn sme_RoamStopBss
3386 \brief To stop BSS for Soft AP. This is an asynchronous API.
3387 \param hHal - Global structure
3388 \param sessionId - sessionId of SoftAP
3389 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3390 -------------------------------------------------------------------------------*/
3391eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3392{
3393 eHalStatus status = eHAL_STATUS_FAILURE;
3394 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3395
3396 smsLog(pMac, LOG2, FL("enter"));
3397 status = sme_AcquireGlobalLock( &pMac->sme );
3398 if ( HAL_STATUS_SUCCESS( status ) )
3399 {
3400 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3401 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303402 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003403 }
3404 else
3405 {
3406 status = eHAL_STATUS_INVALID_PARAMETER;
3407 }
3408 sme_ReleaseGlobalLock( &pMac->sme );
3409 }
3410
3411 return (status);
3412}
3413
3414/* ---------------------------------------------------------------------------
3415 \fn sme_RoamDisconnectSta
3416 \brief To disassociate a station. This is an asynchronous API.
3417 \param hHal - Global structure
3418 \param sessionId - sessionId of SoftAP
3419 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3420 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3421 -------------------------------------------------------------------------------*/
3422eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
3423 tANI_U8 *pPeerMacAddr)
3424{
3425 eHalStatus status = eHAL_STATUS_FAILURE;
3426 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3427
3428 if ( NULL == pMac )
3429 {
3430 VOS_ASSERT(0);
3431 return status;
3432 }
3433
3434 status = sme_AcquireGlobalLock( &pMac->sme );
3435 if ( HAL_STATUS_SUCCESS( status ) )
3436 {
3437 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3438 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003439 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303440 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003441 }
3442 else
3443 {
3444 status = eHAL_STATUS_INVALID_PARAMETER;
3445 }
3446 sme_ReleaseGlobalLock( &pMac->sme );
3447 }
3448
3449 return (status);
3450}
3451
3452/* ---------------------------------------------------------------------------
3453 \fn sme_RoamDeauthSta
3454 \brief To disassociate a station. This is an asynchronous API.
3455 \param hHal - Global structure
3456 \param sessionId - sessionId of SoftAP
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303457 \param pDelStaParams -Pointer to parameters of the station to deauthenticate
Jeff Johnson295189b2012-06-20 16:38:30 -07003458 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3459 -------------------------------------------------------------------------------*/
3460eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303461 struct tagCsrDelStaParams *pDelStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003462{
3463 eHalStatus status = eHAL_STATUS_FAILURE;
3464 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3465
3466 if ( NULL == pMac )
3467 {
3468 VOS_ASSERT(0);
3469 return status;
3470 }
3471
3472 status = sme_AcquireGlobalLock( &pMac->sme );
3473 if ( HAL_STATUS_SUCCESS( status ) )
3474 {
3475 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3476 {
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303477 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003478 }
3479 else
3480 {
3481 status = eHAL_STATUS_INVALID_PARAMETER;
3482 }
3483 sme_ReleaseGlobalLock( &pMac->sme );
3484 }
3485
3486 return (status);
3487}
3488
3489/* ---------------------------------------------------------------------------
3490 \fn sme_RoamTKIPCounterMeasures
3491 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3492 \param sessionId - sessionId of SoftAP
3493 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3494 \return eHalStatus
3495 -------------------------------------------------------------------------------*/
3496eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3497 tANI_BOOLEAN bEnable)
3498{
3499 eHalStatus status = eHAL_STATUS_FAILURE;
3500 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3501
3502 if ( NULL == pMac )
3503 {
3504 VOS_ASSERT(0);
3505 return status;
3506 }
3507
3508 status = sme_AcquireGlobalLock( &pMac->sme );
3509 if ( HAL_STATUS_SUCCESS( status ) )
3510 {
3511 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3512 {
3513 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3514 }
3515 else
3516 {
3517 status = eHAL_STATUS_INVALID_PARAMETER;
3518 }
3519 sme_ReleaseGlobalLock( &pMac->sme );
3520 }
3521
3522 return (status);
3523}
3524
3525/* ---------------------------------------------------------------------------
3526 \fn sme_RoamGetAssociatedStas
3527 \brief To probe the list of associated stations from various modules of CORE stack.
3528 \This is an asynchronous API.
3529 \param sessionId - sessionId of SoftAP
3530 \param modId - Module from whom list of associtated stations is to be probed.
3531 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3532 \param pUsrContext - Opaque HDD context
3533 \param pfnSapEventCallback - Sap event callback in HDD
3534 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3535 \return eHalStatus
3536 -------------------------------------------------------------------------------*/
3537eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3538 VOS_MODULE_ID modId, void *pUsrContext,
3539 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3540{
3541 eHalStatus status = eHAL_STATUS_FAILURE;
3542 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3543
3544 if ( NULL == pMac )
3545 {
3546 VOS_ASSERT(0);
3547 return status;
3548 }
3549
3550 status = sme_AcquireGlobalLock( &pMac->sme );
3551 if ( HAL_STATUS_SUCCESS( status ) )
3552 {
3553 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3554 {
3555 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3556 }
3557 else
3558 {
3559 status = eHAL_STATUS_INVALID_PARAMETER;
3560 }
3561 sme_ReleaseGlobalLock( &pMac->sme );
3562 }
3563
3564 return (status);
3565}
3566
3567/* ---------------------------------------------------------------------------
3568 \fn sme_RoamGetWpsSessionOverlap
3569 \brief To get the WPS PBC session overlap information.
3570 \This is an asynchronous API.
3571 \param sessionId - sessionId of SoftAP
3572 \param pUsrContext - Opaque HDD context
3573 \param pfnSapEventCallback - Sap event callback in HDD
3574 \pRemoveMac - pointer to Mac address which needs to be removed from session
3575 \return eHalStatus
3576 -------------------------------------------------------------------------------*/
3577eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003578 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07003579 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3580{
3581 eHalStatus status = eHAL_STATUS_FAILURE;
3582 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3583
3584 if ( NULL == pMac )
3585 {
3586 VOS_ASSERT(0);
3587 return status;
3588 }
3589
3590 status = sme_AcquireGlobalLock( &pMac->sme );
3591 if ( HAL_STATUS_SUCCESS( status ) )
3592 {
3593 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3594 {
3595 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3596 }
3597 else
3598 {
3599 status = eHAL_STATUS_INVALID_PARAMETER;
3600 }
3601 sme_ReleaseGlobalLock( &pMac->sme );
3602 }
3603
3604 return (status);
3605}
3606
Jeff Johnson295189b2012-06-20 16:38:30 -07003607
3608/* ---------------------------------------------------------------------------
3609 \fn sme_RoamGetConnectState
3610 \brief a wrapper function to request CSR to return the current connect state
3611 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003612 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003613 \return eHalStatus
3614 ---------------------------------------------------------------------------*/
3615eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3616{
3617 eHalStatus status = eHAL_STATUS_FAILURE;
3618 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3619
3620 status = sme_AcquireGlobalLock( &pMac->sme );
3621 if ( HAL_STATUS_SUCCESS( status ) )
3622 {
3623 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3624 {
3625 status = csrRoamGetConnectState( pMac, sessionId, pState );
3626 }
3627 else
3628 {
3629 status = eHAL_STATUS_INVALID_PARAMETER;
3630 }
3631 sme_ReleaseGlobalLock( &pMac->sme );
3632 }
3633
3634 return (status);
3635}
3636
3637/* ---------------------------------------------------------------------------
3638 \fn sme_RoamGetConnectProfile
3639 \brief a wrapper function to request CSR to return the current connect
3640 profile. Caller must call csrRoamFreeConnectProfile after it is done
3641 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003642 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003643 \param pProfile - pointer to a caller allocated structure
3644 tCsrRoamConnectedProfile
3645 \return eHalStatus. Failure if not connected
3646 ---------------------------------------------------------------------------*/
3647eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3648 tCsrRoamConnectedProfile *pProfile)
3649{
3650 eHalStatus status = eHAL_STATUS_FAILURE;
3651 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3652
Katya Nigambcb705f2013-12-26 14:26:22 +05303653 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003654 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003655 status = sme_AcquireGlobalLock( &pMac->sme );
3656 if ( HAL_STATUS_SUCCESS( status ) )
3657 {
3658 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3659 {
3660 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3661 }
3662 else
3663 {
3664 status = eHAL_STATUS_INVALID_PARAMETER;
3665 }
3666 sme_ReleaseGlobalLock( &pMac->sme );
3667 }
3668
3669 return (status);
3670}
3671
3672/* ---------------------------------------------------------------------------
3673 \fn sme_RoamFreeConnectProfile
3674 \brief a wrapper function to request CSR to free and reinitialize the
3675 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003676 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003677 \param pProfile - pointer to a caller allocated structure
3678 tCsrRoamConnectedProfile
3679 \return eHalStatus.
3680 ---------------------------------------------------------------------------*/
3681eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3682 tCsrRoamConnectedProfile *pProfile)
3683{
3684 eHalStatus status = eHAL_STATUS_FAILURE;
3685 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3686
Katya Nigambcb705f2013-12-26 14:26:22 +05303687 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003688 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003689 status = sme_AcquireGlobalLock( &pMac->sme );
3690 if ( HAL_STATUS_SUCCESS( status ) )
3691 {
3692 status = csrRoamFreeConnectProfile( pMac, pProfile );
3693 sme_ReleaseGlobalLock( &pMac->sme );
3694 }
3695
3696 return (status);
3697}
3698
3699/* ---------------------------------------------------------------------------
3700 \fn sme_RoamSetPMKIDCache
3701 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003702 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003703 \param pPMKIDCache - caller allocated buffer point to an array of
3704 tPmkidCacheInfo
3705 \param numItems - a variable that has the number of tPmkidCacheInfo
3706 allocated when retruning, this is either the number needed
3707 or number of items put into pPMKIDCache
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303708 \param update_entire_cache - this bool value specifies if the entire pmkid
3709 cache should be overwritten or should it be
3710 updated entry by entry.
Jeff Johnson295189b2012-06-20 16:38:30 -07003711 \return eHalStatus - when fail, it usually means the buffer allocated is not
3712 big enough and pNumItems has the number of
3713 tPmkidCacheInfo.
3714 \Note: pNumItems is a number of tPmkidCacheInfo,
3715 not sizeof(tPmkidCacheInfo) * something
3716 ---------------------------------------------------------------------------*/
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303717eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId,
3718 tPmkidCacheInfo *pPMKIDCache,
3719 tANI_U32 numItems,
3720 tANI_BOOLEAN update_entire_cache )
Jeff Johnson295189b2012-06-20 16:38:30 -07003721{
3722 eHalStatus status = eHAL_STATUS_FAILURE;
3723 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3724
Katya Nigambcb705f2013-12-26 14:26:22 +05303725 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003726 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003727 status = sme_AcquireGlobalLock( &pMac->sme );
3728 if ( HAL_STATUS_SUCCESS( status ) )
3729 {
3730 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3731 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303732 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache,
3733 numItems, update_entire_cache );
Jeff Johnson295189b2012-06-20 16:38:30 -07003734 }
3735 else
3736 {
3737 status = eHAL_STATUS_INVALID_PARAMETER;
3738 }
3739 sme_ReleaseGlobalLock( &pMac->sme );
3740 }
3741
3742 return (status);
3743}
3744
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303745eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId,
3746 tANI_U8 *pBSSId,
3747 tANI_BOOLEAN flush_cache )
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003748{
3749 eHalStatus status = eHAL_STATUS_FAILURE;
3750 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3751 status = sme_AcquireGlobalLock( &pMac->sme );
3752 if ( HAL_STATUS_SUCCESS( status ) )
3753 {
3754 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3755 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303756 status = csrRoamDelPMKIDfromCache( pMac, sessionId,
3757 pBSSId, flush_cache );
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003758 }
3759 else
3760 {
3761 status = eHAL_STATUS_INVALID_PARAMETER;
3762 }
3763 sme_ReleaseGlobalLock( &pMac->sme );
3764 }
3765 return (status);
3766}
Wilson Yang47b58192013-12-11 11:40:19 -08003767
Jeff Johnson295189b2012-06-20 16:38:30 -07003768/* ---------------------------------------------------------------------------
3769 \fn sme_RoamGetSecurityReqIE
3770 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3771 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003772 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003773 \param pLen - caller allocated memory that has the length of pBuf as input.
3774 Upon returned, *pLen has the needed or IE length in pBuf.
3775 \param pBuf - Caller allocated memory that contain the IE field, if any,
3776 upon return
3777 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3778 \return eHalStatus - when fail, it usually means the buffer allocated is not
3779 big enough
3780 ---------------------------------------------------------------------------*/
3781eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3782 tANI_U8 *pBuf, eCsrSecurityType secType)
3783{
3784 eHalStatus status = eHAL_STATUS_FAILURE;
3785 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3786
3787 status = sme_AcquireGlobalLock( &pMac->sme );
3788 if ( HAL_STATUS_SUCCESS( status ) )
3789 {
3790 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3791 {
3792 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3793 }
3794 else
3795 {
3796 status = eHAL_STATUS_INVALID_PARAMETER;
3797 }
3798 sme_ReleaseGlobalLock( &pMac->sme );
3799 }
3800
3801 return (status);
3802}
3803
3804/* ---------------------------------------------------------------------------
3805 \fn sme_RoamGetSecurityRspIE
3806 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3807 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003808 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003809 \param pLen - caller allocated memory that has the length of pBuf as input.
3810 Upon returned, *pLen has the needed or IE length in pBuf.
3811 \param pBuf - Caller allocated memory that contain the IE field, if any,
3812 upon return
3813 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3814 \return eHalStatus - when fail, it usually means the buffer allocated is not
3815 big enough
3816 ---------------------------------------------------------------------------*/
3817eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3818 tANI_U8 *pBuf, eCsrSecurityType secType)
3819{
3820 eHalStatus status = eHAL_STATUS_FAILURE;
3821 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3822
3823 status = sme_AcquireGlobalLock( &pMac->sme );
3824 if ( HAL_STATUS_SUCCESS( status ) )
3825 {
3826 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3827 {
3828 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3829 }
3830 else
3831 {
3832 status = eHAL_STATUS_INVALID_PARAMETER;
3833 }
3834 sme_ReleaseGlobalLock( &pMac->sme );
3835 }
3836
3837 return (status);
3838
3839}
3840
3841
3842/* ---------------------------------------------------------------------------
3843 \fn sme_RoamGetNumPMKIDCache
3844 \brief a wrapper function to request CSR to return number of PMKID cache
3845 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003846 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003847 \return tANI_U32 - the number of PMKID cache entries
3848 ---------------------------------------------------------------------------*/
3849tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3850{
3851 eHalStatus status = eHAL_STATUS_FAILURE;
3852 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3853 tANI_U32 numPmkidCache = 0;
3854
3855 status = sme_AcquireGlobalLock( &pMac->sme );
3856 if ( HAL_STATUS_SUCCESS( status ) )
3857 {
3858 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3859 {
3860 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3861 status = eHAL_STATUS_SUCCESS;
3862 }
3863 else
3864 {
3865 status = eHAL_STATUS_INVALID_PARAMETER;
3866 }
3867 sme_ReleaseGlobalLock( &pMac->sme );
3868 }
3869
3870 return (numPmkidCache);
3871}
3872
3873/* ---------------------------------------------------------------------------
3874 \fn sme_RoamGetPMKIDCache
3875 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003876 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003877 \param pNum - caller allocated memory that has the space of the number of
3878 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3879 needed or actually number in tPmkidCacheInfo.
3880 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3881 any, upon return
3882 \return eHalStatus - when fail, it usually means the buffer allocated is not
3883 big enough
3884 ---------------------------------------------------------------------------*/
3885eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3886 tPmkidCacheInfo *pPmkidCache)
3887{
3888 eHalStatus status = eHAL_STATUS_FAILURE;
3889 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3890
3891 status = sme_AcquireGlobalLock( &pMac->sme );
3892 if ( HAL_STATUS_SUCCESS( status ) )
3893 {
3894 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3895 {
3896 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3897 }
3898 else
3899 {
3900 status = eHAL_STATUS_INVALID_PARAMETER;
3901 }
3902 sme_ReleaseGlobalLock( &pMac->sme );
3903 }
3904
3905 return (status);
3906}
3907
3908
3909/* ---------------------------------------------------------------------------
3910 \fn sme_GetConfigParam
3911 \brief a wrapper function that HDD calls to get the global settings
3912 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003913 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003914 \param pParam - caller allocated memory
3915 \return eHalStatus
3916 ---------------------------------------------------------------------------*/
3917eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3918{
3919 eHalStatus status = eHAL_STATUS_FAILURE;
3920 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3921
Katya Nigambcb705f2013-12-26 14:26:22 +05303922 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003923 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003924 status = sme_AcquireGlobalLock( &pMac->sme );
3925 if ( HAL_STATUS_SUCCESS( status ) )
3926 {
3927 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3928 if (status != eHAL_STATUS_SUCCESS)
3929 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003930 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003931 sme_ReleaseGlobalLock( &pMac->sme );
3932 return status;
3933 }
3934#if defined WLAN_FEATURE_P2P_INTERNAL
3935 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3936 if (status != eHAL_STATUS_SUCCESS)
3937 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003938 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003939 sme_ReleaseGlobalLock( &pMac->sme );
3940 return status;
3941 }
3942#endif
3943 sme_ReleaseGlobalLock( &pMac->sme );
3944 }
3945
3946 return (status);
3947}
3948
3949/* ---------------------------------------------------------------------------
3950 \fn sme_CfgSetInt
3951 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003952 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003953 \param cfgId - Configuration Parameter ID (type) for STA.
3954 \param ccmValue - The information related to Configuration Parameter ID
3955 which needs to be saved in CFG
3956 \param callback - To be registered by CSR with CCM. Once the CFG done with
3957 saving the information in the database, it notifies CCM &
3958 then the callback will be invoked to notify.
3959 \param toBeSaved - To save the request for future reference
3960 \return eHalStatus
3961 ---------------------------------------------------------------------------*/
3962eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3963 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3964{
3965 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3966}
3967
3968/* ---------------------------------------------------------------------------
3969 \fn sme_CfgSetStr
3970 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003971 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003972 \param cfgId - Configuration Parameter ID (type) for STA.
3973 \param pStr - Pointer to the byte array which carries the information needs
3974 to be saved in CFG
3975 \param length - Length of the data to be saved
3976 \param callback - To be registered by CSR with CCM. Once the CFG done with
3977 saving the information in the database, it notifies CCM &
3978 then the callback will be invoked to notify.
3979 \param toBeSaved - To save the request for future reference
3980 \return eHalStatus
3981 ---------------------------------------------------------------------------*/
3982eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3983 tANI_U32 length, tCcmCfgSetCallback callback,
3984 eAniBoolean toBeSaved)
3985{
3986 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3987}
3988
3989/* ---------------------------------------------------------------------------
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05303990 \fn sme_GetModifyProfileFields
3991 \brief HDD or SME - QOS calls this function to get the current values of
3992 connected profile fields, changing which can cause reassoc.
3993 This function must be called after CFG is downloaded and STA is in connected
3994 state. Also, make sure to call this function to get the current profile
3995 fields before calling the reassoc. So that pModifyProfileFields will have
3996 all the latest values plus the one(s) has been updated as part of reassoc
3997 request.
3998 \param pModifyProfileFields - pointer to the connected profile fields
3999 changing which can cause reassoc
4000
4001 \return eHalStatus
4002 -------------------------------------------------------------------------------*/
4003eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
4004 tCsrRoamModifyProfileFields * pModifyProfileFields)
4005{
4006 eHalStatus status = eHAL_STATUS_FAILURE;
4007 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4008
4009 MTRACE(vos_trace(VOS_MODULE_ID_SME,
4010 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
4011 status = sme_AcquireGlobalLock( &pMac->sme );
4012 if ( HAL_STATUS_SUCCESS( status ) )
4013 {
4014 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4015 {
4016 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
4017 }
4018 else
4019 {
4020 status = eHAL_STATUS_INVALID_PARAMETER;
4021 }
4022 sme_ReleaseGlobalLock( &pMac->sme );
4023 }
4024
4025 return (status);
4026}
4027
4028/* ---------------------------------------------------------------------------
Sandeep Puligilla332ea912014-02-04 00:16:24 +05304029 \fn sme_HT40StopOBSSScan
4030 \brief HDD or SME - Command to stop the OBSS scan
4031 THis is implemented only for debugging purpose.
4032 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
4033 \param sessionId - sessionId
4034 changing which can cause reassoc
4035
4036 \return eHalStatus
4037 -------------------------------------------------------------------------------*/
4038eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
4039{
4040 eHalStatus status = eHAL_STATUS_FAILURE;
4041 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4042
4043 smsLog(pMac, LOG2, FL("enter"));
4044 status = sme_AcquireGlobalLock( &pMac->sme );
4045 if ( HAL_STATUS_SUCCESS( status ) )
4046 {
4047 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4048 {
4049 csrHT40StopOBSSScan( pMac, sessionId );
4050 }
4051 else
4052 {
4053 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4054 "%s: Invalid session sessionId %d", __func__,sessionId);
4055 status = eHAL_STATUS_INVALID_PARAMETER;
4056 }
4057 sme_ReleaseGlobalLock( &pMac->sme );
4058 }
4059 return (status);
4060}
4061
Jeff Johnson295189b2012-06-20 16:38:30 -07004062/*--------------------------------------------------------------------------
4063 \fn sme_SetConfigPowerSave
4064 \brief Wrapper fn to change power save configuration in SME (PMC) module.
4065 For BMPS related configuration, this function also updates the CFG
4066 and sends a message to FW to pick up the new values. Note: Calling
4067 this function only updates the configuration and does not enable
4068 the specified power save mode.
4069 \param hHal - The handle returned by macOpen.
4070 \param psMode - Power Saving mode being modified
4071 \param pConfigParams - a pointer to a caller allocated object of type
4072 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4073 \return eHalStatus
4074 --------------------------------------------------------------------------*/
4075eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4076 void *pConfigParams)
4077{
4078 eHalStatus status = eHAL_STATUS_FAILURE;
4079 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4080
Katya Nigambcb705f2013-12-26 14:26:22 +05304081 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004082 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004083 if (NULL == pConfigParams ) {
4084 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4085 "nothing to update");
4086 return eHAL_STATUS_FAILURE;
4087 }
4088
4089 status = sme_AcquireGlobalLock( &pMac->sme );
4090 if ( HAL_STATUS_SUCCESS( status ) )
4091 {
4092 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
4093 sme_ReleaseGlobalLock( &pMac->sme );
4094 }
4095
4096 return (status);
4097}
4098
4099/*--------------------------------------------------------------------------
4100 \fn sme_GetConfigPowerSave
4101 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
4102 \param hHal - The handle returned by macOpen.
4103 \param psMode - Power Saving mode
4104 \param pConfigParams - a pointer to a caller allocated object of type
4105 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4106 \return eHalStatus
4107 --------------------------------------------------------------------------*/
4108eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4109 void *pConfigParams)
4110{
4111 eHalStatus status = eHAL_STATUS_FAILURE;
4112 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4113
Katya Nigambcb705f2013-12-26 14:26:22 +05304114 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004115 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004116 if (NULL == pConfigParams ) {
4117 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4118 "nothing to update");
4119 return eHAL_STATUS_FAILURE;
4120 }
4121
4122 status = sme_AcquireGlobalLock( &pMac->sme );
4123 if ( HAL_STATUS_SUCCESS( status ) )
4124 {
4125 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
4126 sme_ReleaseGlobalLock( &pMac->sme );
4127 }
4128
4129 return (status);
4130}
4131
4132/* ---------------------------------------------------------------------------
4133 \fn sme_SignalPowerEvent
4134 \brief Signals to PMC that a power event has occurred. Used for putting
4135 the chip into deep sleep mode.
4136 \param hHal - The handle returned by macOpen.
4137 \param event - the event that has occurred
4138 \return eHalStatus
4139 ---------------------------------------------------------------------------*/
4140eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
4141{
4142 eHalStatus status = eHAL_STATUS_FAILURE;
4143 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4144
4145 status = sme_AcquireGlobalLock( &pMac->sme );
4146 if ( HAL_STATUS_SUCCESS( status ) )
4147 {
4148 status = pmcSignalPowerEvent(hHal, event);
4149 sme_ReleaseGlobalLock( &pMac->sme );
4150 }
4151
4152 return (status);
4153}
4154
4155/* ---------------------------------------------------------------------------
4156 \fn sme_EnablePowerSave
4157 \brief Enables one of the power saving modes.
4158 \param hHal - The handle returned by macOpen.
4159 \param psMode - The power saving mode to enable. If BMPS mode is enabled
4160 while the chip is operating in Full Power, PMC will start
4161 a timer that will try to put the chip in BMPS mode after
4162 expiry.
4163 \return eHalStatus
4164 ---------------------------------------------------------------------------*/
4165eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4166{
4167 eHalStatus status = eHAL_STATUS_FAILURE;
4168 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4169
Katya Nigambcb705f2013-12-26 14:26:22 +05304170 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004171 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004172 status = sme_AcquireGlobalLock( &pMac->sme );
4173 if ( HAL_STATUS_SUCCESS( status ) )
4174 {
4175 status = pmcEnablePowerSave(hHal, psMode);
4176 sme_ReleaseGlobalLock( &pMac->sme );
4177 }
4178
4179 return (status);
4180}
4181
4182/* ---------------------------------------------------------------------------
4183 \fn sme_DisablePowerSave
4184 \brief Disables one of the power saving modes.
4185 \param hHal - The handle returned by macOpen.
4186 \param psMode - The power saving mode to disable. Disabling does not imply
4187 that device will be brought out of the current PS mode. This
4188 is purely a configuration API.
4189 \return eHalStatus
4190 ---------------------------------------------------------------------------*/
4191eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4192{
4193 eHalStatus status = eHAL_STATUS_FAILURE;
4194 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4195
Katya Nigambcb705f2013-12-26 14:26:22 +05304196 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004197 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004198 status = sme_AcquireGlobalLock( &pMac->sme );
4199 if ( HAL_STATUS_SUCCESS( status ) )
4200 {
4201 status = pmcDisablePowerSave(hHal, psMode);
4202 sme_ReleaseGlobalLock( &pMac->sme );
4203 }
4204
4205 return (status);
4206 }
4207
4208/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05304209+ \fn sme_SetHostPowerSave
4210+ \brief Enables BMPS logic to be controlled by User level apps
4211+ \param hHal - The handle returned by macOpen.
4212+ \param psMode - The power saving mode to disable. Disabling does not imply
4213+ that device will be brought out of the current PS mode. This
4214+ is purely a configuration API.
4215+ \return eHalStatus
4216+ ---------------------------------------------------------------------------*/
4217eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
4218{
4219 eHalStatus status = eHAL_STATUS_FAILURE;
4220 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4221
4222 pMac->pmc.isHostPsEn = psMode;
4223
4224 return (status);
4225}
4226
4227/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004228 \fn sme_StartAutoBmpsTimer
4229 \brief Starts a timer that periodically polls all the registered
4230 module for entry into Bmps mode. This timer is started only if BMPS is
4231 enabled and whenever the device is in full power.
4232 \param hHal - The handle returned by macOpen.
4233 \return eHalStatus
4234 ---------------------------------------------------------------------------*/
4235eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
4236{
4237 eHalStatus status = eHAL_STATUS_FAILURE;
4238 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4239
Katya Nigambcb705f2013-12-26 14:26:22 +05304240 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004241 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004242 status = sme_AcquireGlobalLock( &pMac->sme );
4243 if ( HAL_STATUS_SUCCESS( status ) )
4244 {
4245 status = pmcStartAutoBmpsTimer(hHal);
4246 sme_ReleaseGlobalLock( &pMac->sme );
4247 }
4248
4249 return (status);
4250}
4251/* ---------------------------------------------------------------------------
4252 \fn sme_StopAutoBmpsTimer
4253 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
4254 Stopping the timer does not cause a device state change. Only the timer
4255 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
4256 \param hHal - The handle returned by macOpen.
4257 \return eHalStatus
4258 ---------------------------------------------------------------------------*/
4259eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
4260{
4261 eHalStatus status = eHAL_STATUS_FAILURE;
4262 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4263
Katya Nigambcb705f2013-12-26 14:26:22 +05304264 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004265 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004266 status = sme_AcquireGlobalLock( &pMac->sme );
4267 if ( HAL_STATUS_SUCCESS( status ) )
4268 {
4269 status = pmcStopAutoBmpsTimer(hHal);
4270 sme_ReleaseGlobalLock( &pMac->sme );
4271 }
4272
4273 return (status);
4274}
4275/* ---------------------------------------------------------------------------
4276 \fn sme_QueryPowerState
4277 \brief Returns the current power state of the device.
4278 \param hHal - The handle returned by macOpen.
4279 \param pPowerState - pointer to location to return power state (LOW or HIGH)
4280 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
4281 \return eHalStatus
4282 ---------------------------------------------------------------------------*/
4283eHalStatus sme_QueryPowerState (
4284 tHalHandle hHal,
4285 tPmcPowerState *pPowerState,
4286 tPmcSwitchState *pSwWlanSwitchState)
4287{
4288 eHalStatus status = eHAL_STATUS_FAILURE;
4289 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4290
4291 status = sme_AcquireGlobalLock( &pMac->sme );
4292 if ( HAL_STATUS_SUCCESS( status ) )
4293 {
4294 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
4295 sme_ReleaseGlobalLock( &pMac->sme );
4296 }
4297
4298 return (status);
4299}
4300
4301/* ---------------------------------------------------------------------------
4302 \fn sme_IsPowerSaveEnabled
4303 \brief Checks if the device is able to enter a particular power save mode
4304 This does not imply that the device is in a particular PS mode
4305 \param hHal - The handle returned by macOpen.
4306 \param psMode - the power saving mode
4307 \return eHalStatus
4308 ---------------------------------------------------------------------------*/
4309tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
4310{
4311 eHalStatus status = eHAL_STATUS_FAILURE;
4312 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4313 tANI_BOOLEAN result = false;
4314
Katya Nigambcb705f2013-12-26 14:26:22 +05304315 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004316 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004317 status = sme_AcquireGlobalLock( &pMac->sme );
4318 if ( HAL_STATUS_SUCCESS( status ) )
4319 {
4320 result = pmcIsPowerSaveEnabled(hHal, psMode);
4321 sme_ReleaseGlobalLock( &pMac->sme );
4322 return result;
4323 }
4324
4325 return false;
4326}
4327
4328/* ---------------------------------------------------------------------------
4329 \fn sme_RequestFullPower
4330 \brief Request that the device be brought to full power state. When the
4331 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
4332 is enabled. On timer expiry PMC will attempt to put the device in
4333 BMPS mode if following holds true:
4334 - BMPS mode is enabled
4335 - Polling of all modules through the Power Save Check routine passes
4336 - STA is associated to an access point
4337 \param hHal - The handle returned by macOpen.
4338 \param - callbackRoutine Callback routine invoked in case of success/failure
4339 \return eHalStatus - status
4340 eHAL_STATUS_SUCCESS - device brought to full power state
4341 eHAL_STATUS_FAILURE - device cannot be brought to full power state
4342 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
4343 ---------------------------------------------------------------------------*/
4344eHalStatus sme_RequestFullPower (
4345 tHalHandle hHal,
4346 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4347 void *callbackContext,
4348 tRequestFullPowerReason fullPowerReason)
4349{
4350 eHalStatus status = eHAL_STATUS_FAILURE;
4351 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4352
Katya Nigambcb705f2013-12-26 14:26:22 +05304353 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004354 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07004355 status = sme_AcquireGlobalLock( &pMac->sme );
4356 if ( HAL_STATUS_SUCCESS( status ) )
4357 {
4358 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
4359 sme_ReleaseGlobalLock( &pMac->sme );
4360 }
4361
4362 return (status);
4363}
4364
4365/* ---------------------------------------------------------------------------
4366 \fn sme_RequestBmps
4367 \brief Request that the device be put in BMPS state. Request will be
4368 accepted only if BMPS mode is enabled and power save check routine
4369 passes.
4370 \param hHal - The handle returned by macOpen.
4371 \param - callbackRoutine Callback routine invoked in case of success/failure
4372 \return eHalStatus
4373 eHAL_STATUS_SUCCESS - device is in BMPS state
4374 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
4375 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
4376 ---------------------------------------------------------------------------*/
4377eHalStatus sme_RequestBmps (
4378 tHalHandle hHal,
4379 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4380 void *callbackContext)
4381{
4382 eHalStatus status = eHAL_STATUS_FAILURE;
4383 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4384
Katya Nigambcb705f2013-12-26 14:26:22 +05304385 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004386 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004387 status = sme_AcquireGlobalLock( &pMac->sme );
4388 if ( HAL_STATUS_SUCCESS( status ) )
4389 {
4390 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
4391 sme_ReleaseGlobalLock( &pMac->sme );
4392 }
4393
4394 return (status);
4395}
4396
4397
4398/* ---------------------------------------------------------------------------
4399 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004400 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4401 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004402 \param hHal - The handle returned by macOpen.
4403 ---------------------------------------------------------------------------*/
4404void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4405{
4406 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4407
Katya Nigambcb705f2013-12-26 14:26:22 +05304408 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004409 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004410 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4411 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4412}
4413
4414
4415/* ---------------------------------------------------------------------------
4416 \fn sme_StartUapsd
4417 \brief Request that the device be put in UAPSD state. If the device is in
4418 Full Power it will be put in BMPS mode first and then into UAPSD
4419 mode.
4420 \param hHal - The handle returned by macOpen.
4421 \param - callbackRoutine Callback routine invoked in case of success/failure
4422 eHAL_STATUS_SUCCESS - device is in UAPSD state
4423 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4424 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4425 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4426 \return eHalStatus
4427 ---------------------------------------------------------------------------*/
4428eHalStatus sme_StartUapsd (
4429 tHalHandle hHal,
4430 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4431 void *callbackContext)
4432{
4433 eHalStatus status = eHAL_STATUS_FAILURE;
4434 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4435
4436 status = sme_AcquireGlobalLock( &pMac->sme );
4437 if ( HAL_STATUS_SUCCESS( status ) )
4438 {
4439 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4440 sme_ReleaseGlobalLock( &pMac->sme );
4441 }
4442
4443 return (status);
4444 }
4445
4446/* ---------------------------------------------------------------------------
4447 \fn sme_StopUapsd
4448 \brief Request that the device be put out of UAPSD state. Device will be
4449 put in in BMPS state after stop UAPSD completes.
4450 \param hHal - The handle returned by macOpen.
4451 \return eHalStatus
4452 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4453 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4454 ---------------------------------------------------------------------------*/
4455eHalStatus sme_StopUapsd (tHalHandle hHal)
4456{
4457 eHalStatus status = eHAL_STATUS_FAILURE;
4458 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4459
4460 status = sme_AcquireGlobalLock( &pMac->sme );
4461 if ( HAL_STATUS_SUCCESS( status ) )
4462 {
4463 status = pmcStopUapsd(hHal);
4464 sme_ReleaseGlobalLock( &pMac->sme );
4465 }
4466
4467 return (status);
4468}
4469
4470/* ---------------------------------------------------------------------------
4471 \fn sme_RequestStandby
4472 \brief Request that the device be put in standby. It is HDD's responsibility
4473 to bring the chip to full power and do a disassoc before calling
4474 this API.
4475 \param hHal - The handle returned by macOpen.
4476 \param - callbackRoutine Callback routine invoked in case of success/failure
4477 \return eHalStatus
4478 eHAL_STATUS_SUCCESS - device is in Standby mode
4479 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4480 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4481 ---------------------------------------------------------------------------*/
4482eHalStatus sme_RequestStandby (
4483 tHalHandle hHal,
4484 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4485 void *callbackContext)
4486{
4487 eHalStatus status = eHAL_STATUS_FAILURE;
4488 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4489
Katya Nigambcb705f2013-12-26 14:26:22 +05304490 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004491 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05304492 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004493 status = sme_AcquireGlobalLock( &pMac->sme );
4494 if ( HAL_STATUS_SUCCESS( status ) )
4495 {
4496 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
4497 sme_ReleaseGlobalLock( &pMac->sme );
4498 }
4499
4500 return (status);
4501}
4502
4503/* ---------------------------------------------------------------------------
4504 \fn sme_RegisterPowerSaveCheck
4505 \brief Register a power save check routine that is called whenever
4506 the device is about to enter one of the power save modes.
4507 \param hHal - The handle returned by macOpen.
4508 \param checkRoutine - Power save check routine to be registered
4509 \return eHalStatus
4510 eHAL_STATUS_SUCCESS - successfully registered
4511 eHAL_STATUS_FAILURE - not successfully registered
4512 ---------------------------------------------------------------------------*/
4513eHalStatus sme_RegisterPowerSaveCheck (
4514 tHalHandle hHal,
4515 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4516{
4517 eHalStatus status = eHAL_STATUS_FAILURE;
4518 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4519
4520 status = sme_AcquireGlobalLock( &pMac->sme );
4521 if ( HAL_STATUS_SUCCESS( status ) )
4522 {
4523 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4524 sme_ReleaseGlobalLock( &pMac->sme );
4525 }
4526
4527 return (status);
4528}
4529
4530/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05304531 \fn sme_Register11dScanDoneCallback
4532 \brief Register a routine of type csrScanCompleteCallback which is
4533 called whenever an 11d scan is done
4534 \param hHal - The handle returned by macOpen.
4535 \param callback - 11d scan complete routine to be registered
4536 \return eHalStatus
4537 ---------------------------------------------------------------------------*/
4538eHalStatus sme_Register11dScanDoneCallback (
4539 tHalHandle hHal,
4540 csrScanCompleteCallback callback)
4541{
4542 eHalStatus status = eHAL_STATUS_SUCCESS;
4543 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4544
4545 pMac->scan.callback11dScanDone = callback;
4546
4547 return (status);
4548}
4549
4550/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004551 \fn sme_DeregisterPowerSaveCheck
4552 \brief Deregister a power save check routine
4553 \param hHal - The handle returned by macOpen.
4554 \param checkRoutine - Power save check routine to be deregistered
4555 \return eHalStatus
4556 eHAL_STATUS_SUCCESS - successfully deregistered
4557 eHAL_STATUS_FAILURE - not successfully deregistered
4558 ---------------------------------------------------------------------------*/
4559eHalStatus sme_DeregisterPowerSaveCheck (
4560 tHalHandle hHal,
4561 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4562{
4563 eHalStatus status = eHAL_STATUS_FAILURE;
4564 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4565
4566 status = sme_AcquireGlobalLock( &pMac->sme );
4567 if ( HAL_STATUS_SUCCESS( status ) )
4568 {
4569 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4570 sme_ReleaseGlobalLock( &pMac->sme );
4571 }
4572
4573 return (status);
4574}
4575
4576/* ---------------------------------------------------------------------------
4577 \fn sme_RegisterDeviceStateUpdateInd
4578 \brief Register a callback routine that is called whenever
4579 the device enters a new device state (Full Power, BMPS, UAPSD)
4580 \param hHal - The handle returned by macOpen.
4581 \param callbackRoutine - Callback routine to be registered
4582 \param callbackContext - Cookie to be passed back during callback
4583 \return eHalStatus
4584 eHAL_STATUS_SUCCESS - successfully registered
4585 eHAL_STATUS_FAILURE - not successfully registered
4586 ---------------------------------------------------------------------------*/
4587eHalStatus sme_RegisterDeviceStateUpdateInd (
4588 tHalHandle hHal,
4589 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4590 void *callbackContext)
4591{
4592 eHalStatus status = eHAL_STATUS_FAILURE;
4593 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4594
4595 status = sme_AcquireGlobalLock( &pMac->sme );
4596 if ( HAL_STATUS_SUCCESS( status ) )
4597 {
4598 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4599 sme_ReleaseGlobalLock( &pMac->sme );
4600 }
4601
4602 return (status);
4603}
4604
4605/* ---------------------------------------------------------------------------
4606 \fn sme_DeregisterDeviceStateUpdateInd
4607 \brief Deregister a routine that was registered for device state changes
4608 \param hHal - The handle returned by macOpen.
4609 \param callbackRoutine - Callback routine to be deregistered
4610 \return eHalStatus
4611 eHAL_STATUS_SUCCESS - successfully deregistered
4612 eHAL_STATUS_FAILURE - not successfully deregistered
4613 ---------------------------------------------------------------------------*/
4614eHalStatus sme_DeregisterDeviceStateUpdateInd (
4615 tHalHandle hHal,
4616 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4617{
4618 eHalStatus status = eHAL_STATUS_FAILURE;
4619 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4620
4621 status = sme_AcquireGlobalLock( &pMac->sme );
4622 if ( HAL_STATUS_SUCCESS( status ) )
4623 {
4624 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4625 sme_ReleaseGlobalLock( &pMac->sme );
4626 }
4627
4628 return (status);
4629}
4630
4631/* ---------------------------------------------------------------------------
4632 \fn sme_WowlAddBcastPattern
4633 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4634 do a pattern match on these patterns when Wowl is enabled during BMPS
4635 mode. Note that Firmware performs the pattern matching only on
4636 broadcast frames and while Libra is in BMPS mode.
4637 \param hHal - The handle returned by macOpen.
4638 \param pattern - Pattern to be added
4639 \return eHalStatus
4640 eHAL_STATUS_FAILURE Cannot add pattern
4641 eHAL_STATUS_SUCCESS Request accepted.
4642 ---------------------------------------------------------------------------*/
4643eHalStatus sme_WowlAddBcastPattern (
4644 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004645 tpSirWowlAddBcastPtrn pattern,
4646 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004647{
4648 eHalStatus status = eHAL_STATUS_FAILURE;
4649 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304650 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004651 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004652 status = sme_AcquireGlobalLock( &pMac->sme );
4653 if ( HAL_STATUS_SUCCESS( status ) )
4654 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004655 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004656 sme_ReleaseGlobalLock( &pMac->sme );
4657 }
4658
4659 return (status);
4660}
4661
4662/* ---------------------------------------------------------------------------
4663 \fn sme_WowlDelBcastPattern
4664 \brief Delete a pattern that was added for Pattern Byte Matching.
4665 \param hHal - The handle returned by macOpen.
4666 \param pattern - Pattern to be deleted
4667 \return eHalStatus
4668 eHAL_STATUS_FAILURE Cannot delete pattern
4669 eHAL_STATUS_SUCCESS Request accepted.
4670 ---------------------------------------------------------------------------*/
4671eHalStatus sme_WowlDelBcastPattern (
4672 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004673 tpSirWowlDelBcastPtrn pattern,
4674 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004675{
4676 eHalStatus status = eHAL_STATUS_FAILURE;
4677 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304678 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004679 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004680 status = sme_AcquireGlobalLock( &pMac->sme );
4681 if ( HAL_STATUS_SUCCESS( status ) )
4682 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004683 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004684 sme_ReleaseGlobalLock( &pMac->sme );
4685 }
4686
4687 return (status);
4688}
4689
4690/* ---------------------------------------------------------------------------
4691 \fn sme_EnterWowl
4692 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4693 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4694 SME will will cache the information that WOWL has been enabled and
4695 attempt to put the device in BMPS. On entry into BMPS, SME will
4696 enable the WOWL mode.
4697 Note 1: If we exit BMPS mode (someone requests full power), we
4698 will NOT resume WOWL when we go back to BMPS again. Request for full
4699 power (while in WOWL mode) means disable WOWL and go to full power.
4700 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4701 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4702 are required. Currently there is no requirement or use case to support
4703 UAPSD and WOWL at the same time.
4704
4705 \param hHal - The handle returned by macOpen.
4706 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4707 Used for success/failure notification by SME
4708 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4709 at the time of callback.
4710 \param wakeReasonIndCB - Callback routine provided by HDD.
4711 Used for Wake Reason Indication by SME
4712 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4713 at the time of callback.
4714 \return eHalStatus
4715 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4716 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4717 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4718 BMPS mode is entered.
4719 ---------------------------------------------------------------------------*/
4720eHalStatus sme_EnterWowl (
4721 tHalHandle hHal,
4722 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4723 void *enterWowlCallbackContext,
4724#ifdef WLAN_WAKEUP_EVENTS
4725 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4726 void *wakeIndicationCBContext,
4727#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004728 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004729{
4730 eHalStatus status = eHAL_STATUS_FAILURE;
4731 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304732 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004733 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004734 status = sme_AcquireGlobalLock( &pMac->sme );
4735 if ( HAL_STATUS_SUCCESS( status ) )
4736 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004737 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004738#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004739 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004740#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004741 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004742 sme_ReleaseGlobalLock( &pMac->sme );
4743 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004744 return (status);
4745}
4746/* ---------------------------------------------------------------------------
4747 \fn sme_ExitWowl
4748 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4749 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4750 mode.
4751 \param hHal - The handle returned by macOpen.
4752 \return eHalStatus
4753 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4754 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4755 ---------------------------------------------------------------------------*/
c_hpothu01484c02014-05-16 14:05:15 +05304756eHalStatus sme_ExitWowl (tHalHandle hHal, tWowlExitSource wowlExitSrc)
Jeff Johnson295189b2012-06-20 16:38:30 -07004757{
4758 eHalStatus status = eHAL_STATUS_FAILURE;
4759 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304760 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004761 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004762 status = sme_AcquireGlobalLock( &pMac->sme );
4763 if ( HAL_STATUS_SUCCESS( status ) )
4764 {
c_hpothu01484c02014-05-16 14:05:15 +05304765 status = pmcExitWowl (hHal, wowlExitSrc);
Jeff Johnson295189b2012-06-20 16:38:30 -07004766 sme_ReleaseGlobalLock( &pMac->sme );
4767 }
4768
4769 return (status);
4770}
4771
4772/* ---------------------------------------------------------------------------
4773
4774 \fn sme_RoamSetKey
4775
4776 \brief To set encryption key. This function should be called only when connected
4777 This is an asynchronous API.
4778
4779 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4780
4781 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4782
4783 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4784
4785 FAILURE or RESOURCES The API finished and failed.
4786
4787 -------------------------------------------------------------------------------*/
4788eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4789{
4790 eHalStatus status = eHAL_STATUS_FAILURE;
4791 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4792 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004793 tANI_U32 i;
4794 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004795
Katya Nigambcb705f2013-12-26 14:26:22 +05304796 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004797 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004798 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4799 {
4800 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4801 return eHAL_STATUS_FAILURE;
4802 }
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304803 /*Once Setkey is done, we can go in BMPS*/
4804 if(pSetKey->keyLength)
Abhishek Singh65d939e2014-04-25 13:33:07 +05304805 {
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304806 pMac->pmc.remainInPowerActiveTillDHCP = FALSE;
Abhishek Singh65d939e2014-04-25 13:33:07 +05304807 smsLog(pMac, LOG1, FL("Reset remainInPowerActiveTillDHCP"
4808 " to allow BMPS"));
4809 }
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004810
Jeff Johnson295189b2012-06-20 16:38:30 -07004811 status = sme_AcquireGlobalLock( &pMac->sme );
4812 if ( HAL_STATUS_SUCCESS( status ) )
4813 {
4814 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4815 if(pRoamId)
4816 {
4817 *pRoamId = roamId;
4818 }
4819
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004820 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004821
4822 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004823 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004824
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004825 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004826
4827 pSession = CSR_GET_SESSION(pMac, sessionId);
4828
Jeff Johnson32d95a32012-09-10 13:15:23 -07004829 if(!pSession)
4830 {
4831 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004832 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004833 return eHAL_STATUS_FAILURE;
4834 }
4835
Jeff Johnson295189b2012-06-20 16:38:30 -07004836 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4837 {
4838 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4839 {
4840 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4841 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4842 {
4843 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4844 }
4845 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4846 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4847 {
4848 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4849 }
4850 }
4851 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004852
4853 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4854 sme_ReleaseGlobalLock( &pMac->sme );
4855 }
Girish Gowli1c2fc802015-01-19 16:18:07 +05304856 if (pMac->roam.configParam.roamDelayStatsEnabled)
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05304857 {
Girish Gowli1c2fc802015-01-19 16:18:07 +05304858 //Store sent PTK key time
4859 if(pSetKey->keyDirection == eSIR_TX_RX)
4860 {
4861 vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
4862 }
4863 else if(pSetKey->keyDirection == eSIR_RX_ONLY)
4864 {
4865 vos_record_roam_event(e_HDD_SET_GTK_REQ, NULL, 0);
4866 }
4867 else
4868 {
4869 return (status);
4870 }
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05304871 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004872
4873 return (status);
4874}
4875
4876
4877/* ---------------------------------------------------------------------------
4878
4879 \fn sme_RoamRemoveKey
4880
4881 \brief To set encryption key. This is an asynchronous API.
4882
4883 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4884
4885 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4886
4887 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4888
4889 FAILURE or RESOURCES The API finished and failed.
4890
4891 -------------------------------------------------------------------------------*/
4892eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4893 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4894{
4895 eHalStatus status = eHAL_STATUS_FAILURE;
4896 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4897 tANI_U32 roamId;
4898
Katya Nigambcb705f2013-12-26 14:26:22 +05304899 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004900 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004901 status = sme_AcquireGlobalLock( &pMac->sme );
4902 if ( HAL_STATUS_SUCCESS( status ) )
4903 {
4904 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4905 if(pRoamId)
4906 {
4907 *pRoamId = roamId;
4908 }
4909 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4910 sme_ReleaseGlobalLock( &pMac->sme );
4911 }
4912
4913 return (status);
4914}
4915
4916/* ---------------------------------------------------------------------------
4917 \fn sme_GetRssi
4918 \brief a wrapper function that client calls to register a callback to get RSSI
4919
4920 \param callback - SME sends back the requested stats using the callback
4921 \param staId - The station ID for which the stats is requested for
4922 \param pContext - user context to be passed back along with the callback
4923 \param pVosContext - vos context
4924 \return eHalStatus
4925 ---------------------------------------------------------------------------*/
4926eHalStatus sme_GetRssi(tHalHandle hHal,
4927 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004928 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07004929 void *pContext, void* pVosContext)
4930{
4931 eHalStatus status = eHAL_STATUS_FAILURE;
4932 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4933
4934 status = sme_AcquireGlobalLock( &pMac->sme );
4935 if ( HAL_STATUS_SUCCESS( status ) )
4936 {
4937 status = csrGetRssi( pMac, callback,
4938 staId, bssId, pContext, pVosContext);
4939 sme_ReleaseGlobalLock( &pMac->sme );
4940 }
4941 return (status);
4942}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304943
4944/* ---------------------------------------------------------------------------
4945 \fn sme_GetSnr
4946 \brief a wrapper function that client calls to register a callback to
4947 get SNR
4948
4949 \param callback - SME sends back the requested stats using the callback
4950 \param staId - The station ID for which the stats is requested for
4951 \param pContext - user context to be passed back along with the callback
4952 \param pVosContext - vos context
4953 \return eHalStatus
4954 ---------------------------------------------------------------------------*/
4955eHalStatus sme_GetSnr(tHalHandle hHal,
4956 tCsrSnrCallback callback,
4957 tANI_U8 staId, tCsrBssid bssId,
4958 void *pContext)
4959{
4960 eHalStatus status = eHAL_STATUS_FAILURE;
4961 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4962
4963 status = sme_AcquireGlobalLock( &pMac->sme );
4964 if ( HAL_STATUS_SUCCESS( status ) )
4965 {
4966 status = csrGetSnr(pMac, callback,
4967 staId, bssId, pContext);
4968 sme_ReleaseGlobalLock( &pMac->sme );
4969 }
4970 return status;
4971}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004972#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004973/* ---------------------------------------------------------------------------
4974 \fn sme_GetRoamRssi
4975 \brief a wrapper function that client calls to register a callback to get Roam RSSI
4976
4977 \param callback - SME sends back the requested stats using the callback
4978 \param staId - The station ID for which the stats is requested for
4979 \param pContext - user context to be passed back along with the callback
4980 \param pVosContext - vos context
4981 \return eHalStatus
4982 ---------------------------------------------------------------------------*/
4983eHalStatus sme_GetRoamRssi(tHalHandle hHal,
4984 tCsrRssiCallback callback,
4985 tANI_U8 staId, tCsrBssid bssId,
4986 void *pContext, void* pVosContext)
4987{
4988 eHalStatus status = eHAL_STATUS_FAILURE;
4989 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4990
4991 status = sme_AcquireGlobalLock( &pMac->sme );
4992 if ( HAL_STATUS_SUCCESS( status ) )
4993 {
4994 status = csrGetRoamRssi( pMac, callback,
4995 staId, bssId, pContext, pVosContext);
4996 sme_ReleaseGlobalLock( &pMac->sme );
4997 }
4998 return (status);
4999}
5000#endif
5001
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005002#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005003/* ---------------------------------------------------------------------------
5004 \fn sme_GetTsmStats
5005 \brief a wrapper function that client calls to register a callback to get TSM Stats
5006
5007 \param callback - SME sends back the requested stats using the callback
5008 \param staId - The station ID for which the stats is requested for
5009 \param pContext - user context to be passed back along with the callback
5010 \param pVosContext - vos context
5011 \return eHalStatus
5012 ---------------------------------------------------------------------------*/
5013eHalStatus sme_GetTsmStats(tHalHandle hHal,
5014 tCsrTsmStatsCallback callback,
5015 tANI_U8 staId, tCsrBssid bssId,
5016 void *pContext, void* pVosContext, tANI_U8 tid)
5017{
5018 eHalStatus status = eHAL_STATUS_FAILURE;
5019 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5020
5021 status = sme_AcquireGlobalLock( &pMac->sme );
5022 if ( HAL_STATUS_SUCCESS( status ) )
5023 {
5024 status = csrGetTsmStats( pMac, callback,
5025 staId, bssId, pContext, pVosContext, tid);
5026 sme_ReleaseGlobalLock( &pMac->sme );
5027 }
5028 return (status);
5029}
5030#endif
5031
5032
Jeff Johnson295189b2012-06-20 16:38:30 -07005033/* ---------------------------------------------------------------------------
5034 \fn sme_GetStatistics
5035 \brief a wrapper function that client calls to register a callback to get
5036 different PHY level statistics from CSR.
5037
5038 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
5039 \param statsMask - The different category/categories of stats requester is looking for
5040 \param callback - SME sends back the requested stats using the callback
5041 \param periodicity - If requester needs periodic update in millisec, 0 means
5042 it's an one time request
5043 \param cache - If requester is happy with cached stats
5044 \param staId - The station ID for which the stats is requested for
5045 \param pContext - user context to be passed back along with the callback
5046 \return eHalStatus
5047 ---------------------------------------------------------------------------*/
5048eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
5049 tANI_U32 statsMask,
5050 tCsrStatsCallback callback,
5051 tANI_U32 periodicity, tANI_BOOLEAN cache,
5052 tANI_U8 staId, void *pContext)
5053{
5054 eHalStatus status = eHAL_STATUS_FAILURE;
5055 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5056
Katya Nigambcb705f2013-12-26 14:26:22 +05305057 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005058 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07005059 status = sme_AcquireGlobalLock( &pMac->sme );
5060 if ( HAL_STATUS_SUCCESS( status ) )
5061 {
5062 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
5063 periodicity, cache, staId, pContext);
5064 sme_ReleaseGlobalLock( &pMac->sme );
5065 }
5066
5067 return (status);
5068
5069}
5070
Abhishek Singh08aa7762014-12-16 13:59:03 +05305071eHalStatus sme_GetFwStats(tHalHandle hHal, tANI_U32 stats,
5072 void *pContext, tSirFWStatsCallback callback)
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305073{
5074 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5075 vos_msg_t msg;
5076 tSirFWStatsGetReq *pGetFWStatsReq;
5077
5078 smsLog(pMac, LOG1, FL(" ENTER stats = %d "),stats);
5079
5080 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
5081 {
5082 pGetFWStatsReq = (tSirFWStatsGetReq *)vos_mem_malloc(sizeof(tSirFWStatsGetReq));
5083 if ( NULL == pGetFWStatsReq)
5084 {
5085 smsLog(pMac, LOGE, FL("Not able to allocate memory for "
5086 "WDA_FW_STATS_GET_REQ"));
5087 sme_ReleaseGlobalLock( &pMac->sme );
5088 return eHAL_STATUS_FAILURE;
5089 }
5090 pGetFWStatsReq->stats = stats;
5091 pGetFWStatsReq->callback = (tSirFWStatsCallback)callback;
Abhishek Singh08aa7762014-12-16 13:59:03 +05305092 pGetFWStatsReq->data = pContext;
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305093
5094 msg.type = WDA_FW_STATS_GET_REQ;
5095 msg.reserved = 0;
5096 msg.bodyptr = pGetFWStatsReq;
5097 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
5098 {
5099 smsLog(pMac, LOGE,
5100 FL("Not able to post WDA_FW_STATS_GET_REQ message to HAL"));
5101 vos_mem_free(pGetFWStatsReq);
5102 sme_ReleaseGlobalLock( &pMac->sme );
5103 return eHAL_STATUS_FAILURE;
5104 }
5105 sme_ReleaseGlobalLock( &pMac->sme );
5106 return eHAL_STATUS_SUCCESS;
5107 }
5108 return eHAL_STATUS_FAILURE;
5109}
5110
Jeff Johnson295189b2012-06-20 16:38:30 -07005111/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305112 \fn smeGetTLSTAState
5113 \helper function to get the TL STA State whenever the function is called.
5114
5115 \param staId - The staID to be passed to the TL
5116 to get the relevant TL STA State
5117 \return the state as tANI_U16
5118 ---------------------------------------------------------------------------*/
5119tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
5120{
5121 tANI_U16 tlSTAState = TL_INIT_STATE;
5122 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5123 eHalStatus status = eHAL_STATUS_FAILURE;
5124
5125 status = sme_AcquireGlobalLock( &pMac->sme );
5126 if ( HAL_STATUS_SUCCESS( status ) )
5127 {
5128 tlSTAState = csrGetTLSTAState( pMac, staId);
5129 sme_ReleaseGlobalLock( &pMac->sme );
5130 }
5131
5132 return tlSTAState;
5133}
5134
5135/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005136
5137 \fn sme_GetCountryCode
5138
5139 \brief To return the current country code. If no country code is applied, default country code is
5140 used to fill the buffer.
5141 If 11d supported is turned off, an error is return and the last applied/default country code is used.
5142 This is a synchronous API.
5143
5144 \param pBuf - pointer to a caller allocated buffer for returned country code.
5145
5146 \param pbLen For input, this parameter indicates how big is the buffer.
5147 Upon return, this parameter has the number of bytes for country. If pBuf
5148 doesn't have enough space, this function returns
5149 fail status and this parameter contains the number that is needed.
5150
5151 \return eHalStatus SUCCESS.
5152
5153 FAILURE or RESOURCES The API finished and failed.
5154
5155 -------------------------------------------------------------------------------*/
5156eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
5157{
5158 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5159
Katya Nigambcb705f2013-12-26 14:26:22 +05305160 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005161 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
5162
Jeff Johnson295189b2012-06-20 16:38:30 -07005163 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
5164}
5165
5166
5167/* ---------------------------------------------------------------------------
5168
5169 \fn sme_SetCountryCode
5170
5171 \brief To change the current/default country code.
5172 If 11d supported is turned off, an error is return.
5173 This is a synchronous API.
5174
5175 \param pCountry - pointer to a caller allocated buffer for the country code.
5176
5177 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
5178 whether a reset is required.
5179
5180 \return eHalStatus SUCCESS.
5181
5182 FAILURE or RESOURCES The API finished and failed.
5183
5184 -------------------------------------------------------------------------------*/
5185eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
5186{
5187 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5188
Katya Nigambcb705f2013-12-26 14:26:22 +05305189 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005190 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005191 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
5192}
5193
5194
5195/* ---------------------------------------------------------------------------
5196 \fn sme_ResetCountryCodeInformation
5197 \brief this function is to reset the country code current being used back to EEPROM default
5198 this includes channel list and power setting. This is a synchronous API.
5199 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5200 a restart is needed to apply the change
5201 \return eHalStatus
5202 -------------------------------------------------------------------------------*/
5203eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
5204{
5205 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5206
5207 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
5208}
5209
5210
5211/* ---------------------------------------------------------------------------
5212 \fn sme_GetSupportedCountryCode
5213 \brief this function is to get a list of the country code current being supported
5214 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
5215 this has the country code list. 3 bytes for each country code. This may be NULL if
5216 caller wants to know the needed byte count.
5217 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
5218 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
5219 \return eHalStatus
5220 -------------------------------------------------------------------------------*/
5221eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
5222{
5223 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5224
5225 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
5226}
5227
5228
5229/* ---------------------------------------------------------------------------
5230 \fn sme_GetCurrentRegulatoryDomain
5231 \brief this function is to get the current regulatory domain. This is a synchronous API.
5232 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5233 SME. The function fails if 11d support is turned off.
5234 \param pDomain - Caller allocated buffer to return the current domain.
5235 \return eHalStatus SUCCESS.
5236
5237 FAILURE or RESOURCES The API finished and failed.
5238 -------------------------------------------------------------------------------*/
5239eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
5240{
5241 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5242 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5243
5244 if( pDomain )
5245 {
5246 if( csrIs11dSupported( pMac ) )
5247 {
5248 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
5249 status = eHAL_STATUS_SUCCESS;
5250 }
5251 else
5252 {
5253 status = eHAL_STATUS_FAILURE;
5254 }
5255 }
5256
5257 return ( status );
5258}
5259
5260
5261/* ---------------------------------------------------------------------------
5262 \fn sme_SetRegulatoryDomain
5263 \brief this function is to set the current regulatory domain.
5264 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5265 SME. This is a synchronous API.
5266 \param domainId - indicate the domain (defined in the driver) needs to set to.
5267 See v_REGDOMAIN_t for definition
5268 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5269 a restart is needed to apply the change
5270 \return eHalStatus
5271 -------------------------------------------------------------------------------*/
5272eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
5273{
5274 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5275
5276 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
5277}
5278
5279
5280/* ---------------------------------------------------------------------------
5281
5282 \fn sme_GetRegulatoryDomainForCountry
5283
5284 \brief To return a regulatory domain base on a country code. This is a synchronous API.
5285
5286 \param pCountry - pointer to a caller allocated buffer for input country code.
5287
5288 \param pDomainId Upon successful return, it is the domain that country belongs to.
5289 If it is NULL, returning success means that the country code is known.
5290
5291 \return eHalStatus SUCCESS.
5292
5293 FAILURE or RESOURCES The API finished and failed.
5294
5295 -------------------------------------------------------------------------------*/
5296eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
5297{
5298 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5299
Kiet Lam6c583332013-10-14 05:37:09 +05305300 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
5301 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07005302}
5303
5304
5305
5306
5307/* ---------------------------------------------------------------------------
5308
5309 \fn sme_GetSupportedRegulatoryDomains
5310
5311 \brief To return a list of supported regulatory domains. This is a synchronous API.
5312
5313 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
5314
5315 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
5316 Upon return, this parameter has the number for supported domains. If pDomains
5317 doesn't have enough space for all the supported domains, this function returns
5318 fail status and this parameter contains the number that is needed.
5319
5320 \return eHalStatus SUCCESS.
5321
5322 FAILURE or RESOURCES The API finished and failed.
5323
5324 -------------------------------------------------------------------------------*/
5325eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
5326{
5327 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5328
5329 //We support all domains for now
5330 if( pNumDomains )
5331 {
5332 if( NUM_REG_DOMAINS <= *pNumDomains )
5333 {
5334 status = eHAL_STATUS_SUCCESS;
5335 }
5336 *pNumDomains = NUM_REG_DOMAINS;
5337 }
5338 if( HAL_STATUS_SUCCESS( status ) )
5339 {
5340 if( pDomains )
5341 {
5342 pDomains[0] = REGDOMAIN_FCC;
5343 pDomains[1] = REGDOMAIN_ETSI;
5344 pDomains[2] = REGDOMAIN_JAPAN;
5345 pDomains[3] = REGDOMAIN_WORLD;
5346 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
5347 pDomains[5] = REGDOMAIN_APAC;
5348 pDomains[6] = REGDOMAIN_KOREA;
5349 pDomains[7] = REGDOMAIN_HI_5GHZ;
5350 pDomains[8] = REGDOMAIN_NO_5GHZ;
5351 }
5352 else
5353 {
5354 status = eHAL_STATUS_INVALID_PARAMETER;
5355 }
5356 }
5357
5358 return ( status );
5359}
5360
5361
5362//some support functions
5363tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
5364{
5365 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5366
5367 return ( csrIs11dSupported( pMac ) );
5368}
5369
5370
5371tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
5372{
5373 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5374
5375 return ( csrIs11hSupported( pMac ) );
5376}
5377
5378
5379tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
5380{
5381 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5382
5383 return ( csrIsWmmSupported( pMac ) );
5384}
5385
5386//Upper layer to get the list of the base channels to scan for passively 11d info from csr
5387eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
5388{
5389 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5390
5391 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
5392}
5393
5394/* ---------------------------------------------------------------------------
5395
5396 \fn sme_ChangeCountryCode
5397
5398 \brief Change Country code from upperlayer during WLAN driver operation.
5399 This is a synchronous API.
5400
5401 \param hHal - The handle returned by macOpen.
5402
5403 \param pCountry New Country Code String
5404
Abhishek Singha306a442013-11-07 18:39:01 +05305405 \param sendRegHint If we want to send reg hint to nl80211
5406
Jeff Johnson295189b2012-06-20 16:38:30 -07005407 \return eHalStatus SUCCESS.
5408
5409 FAILURE or RESOURCES The API finished and failed.
5410
5411 -------------------------------------------------------------------------------*/
5412eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
5413 tSmeChangeCountryCallback callback,
5414 tANI_U8 *pCountry,
5415 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305416 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05305417 tAniBool countryFromUserSpace,
5418 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07005419{
5420 eHalStatus status = eHAL_STATUS_FAILURE;
5421 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5422 vos_msg_t msg;
5423 tAniChangeCountryCodeReq *pMsg;
5424
Katya Nigambcb705f2013-12-26 14:26:22 +05305425 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005426 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005427 status = sme_AcquireGlobalLock( &pMac->sme );
5428 if ( HAL_STATUS_SUCCESS( status ) )
5429 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005430 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08005431
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05305432 if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) &&
Amar Singhal97a2d992013-11-19 10:58:07 -08005433 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
5434 {
5435
5436 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
5437
5438 sme_ReleaseGlobalLock( &pMac->sme );
5439 status = eHAL_STATUS_FAILURE;
5440 return status;
5441 }
5442
Kiet Lam64c1b492013-07-12 13:56:44 +05305443 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
5444 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07005445 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005446 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005447 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05305448 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005449 }
5450
5451 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
5452 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05305453 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305454 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05305455 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07005456 pMsg->changeCCCallback = callback;
5457 pMsg->pDevContext = pContext;
5458 pMsg->pVosContext = pVosContext;
5459
5460 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
5461 msg.bodyptr = pMsg;
5462 msg.reserved = 0;
5463
5464 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5465 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005466 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305467 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005468 status = eHAL_STATUS_FAILURE;
5469 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005470 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005471 sme_ReleaseGlobalLock( &pMac->sme );
5472 }
5473
5474 return (status);
5475}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005476
5477/*--------------------------------------------------------------------------
5478
5479 \fn sme_GenericChangeCountryCode
5480
5481 \brief Change Country code from upperlayer during WLAN driver operation.
5482 This is a synchronous API.
5483
5484 \param hHal - The handle returned by macOpen.
5485
5486 \param pCountry New Country Code String
5487
5488 \param reg_domain regulatory domain
5489
5490 \return eHalStatus SUCCESS.
5491
5492 FAILURE or RESOURCES The API finished and failed.
5493
5494-----------------------------------------------------------------------------*/
5495eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
5496 tANI_U8 *pCountry,
5497 v_REGDOMAIN_t reg_domain)
5498{
5499 eHalStatus status = eHAL_STATUS_FAILURE;
5500 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5501 vos_msg_t msg;
5502 tAniGenericChangeCountryCodeReq *pMsg;
5503
Kiet Lamcffc5862013-10-30 16:28:45 +05305504 if (NULL == pMac)
5505 {
5506 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5507 "%s: pMac is null", __func__);
5508 return status;
5509 }
5510
Amar Singhal0d15bd52013-10-12 23:13:13 -07005511 status = sme_AcquireGlobalLock( &pMac->sme );
5512 if ( HAL_STATUS_SUCCESS( status ) )
5513 {
5514 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05305515 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
5516 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07005517 {
5518 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
5519 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05305520 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07005521 }
5522
5523 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
5524 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08005525 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Dino Mycle6c77a962014-08-19 15:34:23 +05305526
5527 pMsg->countryCode[2] = ' '; /* For ASCII space */
5528
Amar Singhal0d15bd52013-10-12 23:13:13 -07005529 pMsg->domain_index = reg_domain;
5530
5531 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
5532 msg.bodyptr = pMsg;
5533 msg.reserved = 0;
5534
5535 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5536 {
5537 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05305538 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005539 status = eHAL_STATUS_FAILURE;
5540 }
5541 smsLog(pMac, LOG1, FL(" returned"));
5542 sme_ReleaseGlobalLock( &pMac->sme );
5543 }
5544
5545 return (status);
5546}
Mihir Shetee1093ba2014-01-21 20:13:32 +05305547
5548/* ---------------------------------------------------------------------------
5549
5550 \fn sme_InitChannels
5551
5552 \brief Used to initialize CSR channel lists while driver loading
5553
5554 \param hHal - global pMac structure
5555
5556 \return eHalStatus SUCCESS.
5557
5558 FAILURE or RESOURCES The API finished and failed.
5559
5560 -------------------------------------------------------------------------------*/
5561eHalStatus sme_InitChannels(tHalHandle hHal)
5562{
5563 eHalStatus status = eHAL_STATUS_FAILURE;
5564 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5565
5566 if (NULL == pMac)
5567 {
5568 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5569 "%s: pMac is null", __func__);
5570 return status;
5571 }
5572
Vinay Krishna Erannab9295ae2014-05-09 13:43:23 +05305573 status = csrInitChannels(pMac);
5574
Mihir Shetee1093ba2014-01-21 20:13:32 +05305575 return status;
5576}
5577
Mihir Shete04206452014-11-20 17:50:58 +05305578#ifdef CONFIG_ENABLE_LINUX_REG
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305579/*-------------------------------------------------------------------------
5580 \fn sme_InitChannelsForCC
5581
5582 \brief Used to issue regulatory hint to user
5583
5584 \param hHal - global pMac structure
5585
5586 \return eHalStatus SUCCESS.
5587
5588 FAILURE or RESOURCES The API finished and failed.
5589--------------------------------------------------------------------------*/
5590
Agarwal Ashish6db9d532014-09-30 18:19:10 +05305591eHalStatus sme_InitChannelsForCC(tHalHandle hHal, driver_load_type init)
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305592{
5593 eHalStatus status = eHAL_STATUS_FAILURE;
5594 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5595
5596 if (NULL == pMac)
5597 {
5598 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5599 "%s: pMac is null", __func__);
5600 return status;
5601 }
Agarwal Ashish6db9d532014-09-30 18:19:10 +05305602 status = csrInitChannelsForCC(pMac, init);
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305603
5604 return status;
5605}
Mihir Shete04206452014-11-20 17:50:58 +05305606#endif
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305607
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305608/* ---------------------------------------------------------------------------
5609
5610 \fn sme_DHCPStartInd
5611
5612 \brief API to signal the FW about the DHCP Start event.
5613
5614 \param hHal - HAL handle for device.
5615
5616 \param device_mode - mode(AP,SAP etc) of the device.
5617
5618 \param macAddr - MAC address of the device.
5619
5620 \return eHalStatus SUCCESS.
5621
5622 FAILURE or RESOURCES The API finished and failed.
5623 --------------------------------------------------------------------------*/
5624eHalStatus sme_DHCPStartInd( tHalHandle hHal,
5625 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305626 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305627{
5628 eHalStatus status;
5629 VOS_STATUS vosStatus;
5630 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5631 vos_msg_t vosMessage;
5632 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305633 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305634
5635 status = sme_AcquireGlobalLock(&pMac->sme);
5636 if ( eHAL_STATUS_SUCCESS == status)
5637 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305638 pSession = CSR_GET_SESSION( pMac, sessionId );
5639
5640 if (!pSession)
5641 {
5642 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5643 sme_ReleaseGlobalLock( &pMac->sme );
5644 return eHAL_STATUS_FAILURE;
5645 }
5646
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305647 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5648 if (NULL == pMsg)
5649 {
5650 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5651 "%s: Not able to allocate memory for dhcp start", __func__);
5652 sme_ReleaseGlobalLock( &pMac->sme );
5653 return eHAL_STATUS_FAILURE;
5654 }
5655 pMsg->msgType = WDA_DHCP_START_IND;
5656 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5657 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305658 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5659 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305660 vosMessage.type = WDA_DHCP_START_IND;
5661 vosMessage.bodyptr = pMsg;
5662 vosMessage.reserved = 0;
5663
5664 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5665 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5666 {
5667 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5668 "%s: Post DHCP Start MSG fail", __func__);
5669 vos_mem_free(pMsg);
5670 status = eHAL_STATUS_FAILURE;
5671 }
5672 sme_ReleaseGlobalLock( &pMac->sme );
5673 }
5674 return (status);
5675}
5676/* ---------------------------------------------------------------------------
5677 \fn sme_DHCPStopInd
5678
5679 \brief API to signal the FW about the DHCP complete event.
5680
5681 \param hHal - HAL handle for device.
5682
5683 \param device_mode - mode(AP, SAP etc) of the device.
5684
5685 \param macAddr - MAC address of the device.
5686
5687 \return eHalStatus SUCCESS.
5688 FAILURE or RESOURCES The API finished and failed.
5689 --------------------------------------------------------------------------*/
5690eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5691 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305692 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305693{
5694 eHalStatus status;
5695 VOS_STATUS vosStatus;
5696 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5697 vos_msg_t vosMessage;
5698 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305699 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305700
5701 status = sme_AcquireGlobalLock(&pMac->sme);
5702 if ( eHAL_STATUS_SUCCESS == status)
5703 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305704 pSession = CSR_GET_SESSION( pMac, sessionId );
5705
5706 if (!pSession)
5707 {
5708 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5709 sme_ReleaseGlobalLock( &pMac->sme );
5710 return eHAL_STATUS_FAILURE;
5711 }
5712
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305713 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5714 if (NULL == pMsg)
5715 {
5716 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5717 "%s: Not able to allocate memory for dhcp stop", __func__);
5718 sme_ReleaseGlobalLock( &pMac->sme );
5719 return eHAL_STATUS_FAILURE;
5720 }
5721
5722 pMsg->msgType = WDA_DHCP_STOP_IND;
5723 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5724 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305725 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5726 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305727
5728 vosMessage.type = WDA_DHCP_STOP_IND;
5729 vosMessage.bodyptr = pMsg;
5730 vosMessage.reserved = 0;
5731
5732 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5733 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5734 {
5735 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5736 "%s: Post DHCP Stop MSG fail", __func__);
5737 vos_mem_free(pMsg);
5738 status = eHAL_STATUS_FAILURE;
5739 }
5740
5741 sme_ReleaseGlobalLock( &pMac->sme );
5742 }
5743 return (status);
5744}
5745
Jeff Johnson295189b2012-06-20 16:38:30 -07005746
5747/* ---------------------------------------------------------------------------
5748 \fn sme_BtcSignalBtEvent
5749 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
5750 BT event type and the current operating mode of Libra (full power,
5751 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
5752 would be employed.
5753 \param hHal - The handle returned by macOpen.
5754 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
5755 Caller owns the memory and is responsible for freeing it.
5756 \return VOS_STATUS
5757 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
5758 if BTC execution mode is set to BTC_WLAN_ONLY
5759 or BTC_PTA_ONLY.
5760 VOS_STATUS_SUCCESS BT Event passed to HAL
5761 ---------------------------------------------------------------------------*/
5762VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
5763{
5764 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005765
Jeff Johnson295189b2012-06-20 16:38:30 -07005766#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5767 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5768
Katya Nigambcb705f2013-12-26 14:26:22 +05305769 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005770 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005771 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5772 {
5773 status = btcSignalBTEvent (hHal, pBtEvent);
5774 sme_ReleaseGlobalLock( &pMac->sme );
5775 }
5776#endif
5777 return (status);
5778}
5779
5780/* ---------------------------------------------------------------------------
5781 \fn sme_BtcSetConfig
5782 \brief API to change the current Bluetooth Coexistence (BTC) configuration
5783 This function should be invoked only after CFG download has completed.
5784 Calling it after sme_HDDReadyInd is recommended.
5785 \param hHal - The handle returned by macOpen.
5786 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
5787 Caller owns the memory and is responsible for freeing it.
5788 \return VOS_STATUS
5789 VOS_STATUS_E_FAILURE Config not passed to HAL.
5790 VOS_STATUS_SUCCESS Config passed to HAL
5791 ---------------------------------------------------------------------------*/
5792VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5793{
5794 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5795#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5796 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305797 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005798 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005799 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5800 {
5801 status = btcSetConfig (hHal, pSmeBtcConfig);
5802 sme_ReleaseGlobalLock( &pMac->sme );
5803 }
5804#endif
5805 return (status);
5806}
5807
5808/* ---------------------------------------------------------------------------
5809 \fn sme_BtcGetConfig
5810 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
5811 \param hHal - The handle returned by macOpen.
5812 \param pSmeBtcConfig - Pointer to a caller allocated object of type
5813 tSmeBtcConfig. Caller owns the memory and is responsible
5814 for freeing it.
5815 \return VOS_STATUS
5816 VOS_STATUS_E_FAILURE - failure
5817 VOS_STATUS_SUCCESS success
5818 ---------------------------------------------------------------------------*/
5819VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5820{
5821 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5822#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5823 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5824
Katya Nigambcb705f2013-12-26 14:26:22 +05305825 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005826 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005827 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5828 {
5829 status = btcGetConfig (hHal, pSmeBtcConfig);
5830 sme_ReleaseGlobalLock( &pMac->sme );
5831 }
5832#endif
5833 return (status);
5834}
5835/* ---------------------------------------------------------------------------
5836 \fn sme_SetCfgPrivacy
5837 \brief API to set configure privacy parameters
5838 \param hHal - The handle returned by macOpen.
5839 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005840 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07005841
5842 \return void
5843 ---------------------------------------------------------------------------*/
5844void sme_SetCfgPrivacy( tHalHandle hHal,
5845 tCsrRoamProfile *pProfile,
5846 tANI_BOOLEAN fPrivacy
5847 )
5848{
5849 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305850 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005851 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005852 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5853 {
5854 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5855 sme_ReleaseGlobalLock( &pMac->sme );
5856 }
5857}
5858
5859#if defined WLAN_FEATURE_VOWIFI
5860/* ---------------------------------------------------------------------------
5861 \fn sme_NeighborReportRequest
5862 \brief API to request neighbor report.
5863 \param hHal - The handle returned by macOpen.
5864 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5865 tRrmNeighborReq. Caller owns the memory and is responsible
5866 for freeing it.
5867 \return VOS_STATUS
5868 VOS_STATUS_E_FAILURE - failure
5869 VOS_STATUS_SUCCESS success
5870 ---------------------------------------------------------------------------*/
5871VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5872 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5873{
5874 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5875 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305876 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005877 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005878
5879 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5880 {
5881 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5882 sme_ReleaseGlobalLock( &pMac->sme );
5883 }
5884
5885 return (status);
5886}
5887#endif
5888
5889//The following are debug APIs to support direct read/write register/memory
5890//They are placed in SME because HW cannot be access when in LOW_POWER state
5891//AND not connected. The knowledge and synchronization is done in SME
5892
5893//sme_DbgReadRegister
5894//Caller needs to validate the input values
5895VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
5896{
5897 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5898 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005899 tPmcPowerState PowerState;
5900 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05305901 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005902 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005903
5904 /* 1) To make Quarky work in FTM mode **************************************/
5905
5906 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5907 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005908 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005909 {
5910 return VOS_STATUS_SUCCESS;
5911 }
5912 return VOS_STATUS_E_FAILURE;
5913 }
5914
5915 /* 2) NON FTM mode driver *************************************************/
5916
5917 /* Acquire SME global lock */
5918 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5919 {
5920 return VOS_STATUS_E_FAILURE;
5921 }
5922
5923 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5924 {
5925 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5926 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5927 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005928 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005929 {
5930 status = VOS_STATUS_SUCCESS;
5931 }
5932 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005933 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005934 status = VOS_STATUS_E_FAILURE;
5935 }
5936 }
5937 else
5938 {
5939 status = VOS_STATUS_E_FAILURE;
5940 }
5941 }
5942
5943 /* This is a hack for Qualky/pttWniSocket
5944 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5945 if ( VOS_STATUS_SUCCESS != status )
5946 {
5947 *pRegValue = 0xDEADBEEF;
5948 status = VOS_STATUS_SUCCESS;
5949 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005950
Jeff Johnson295189b2012-06-20 16:38:30 -07005951 /* Release SME global lock */
5952 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005953
Jeff Johnson295189b2012-06-20 16:38:30 -07005954 return (status);
5955}
5956
5957
5958//sme_DbgWriteRegister
5959//Caller needs to validate the input values
5960VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
5961{
5962 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5963 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005964 tPmcPowerState PowerState;
5965 tANI_U32 sessionId = 0;
5966
5967 /* 1) To make Quarky work in FTM mode **************************************/
5968
Katya Nigambcb705f2013-12-26 14:26:22 +05305969 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005970 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005971 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5972 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005973 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005974 {
5975 return VOS_STATUS_SUCCESS;
5976 }
5977 return VOS_STATUS_E_FAILURE;
5978 }
5979
5980 /* 2) NON FTM mode driver *************************************************/
5981
5982 /* Acquire SME global lock */
5983 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5984 {
5985 return VOS_STATUS_E_FAILURE;
5986 }
5987
5988 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5989 {
5990 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5991 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5992 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005993 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005994 {
5995 status = VOS_STATUS_SUCCESS;
5996 }
5997 else
5998 {
5999 status = VOS_STATUS_E_FAILURE;
6000 }
6001 }
6002 else
6003 {
6004 status = VOS_STATUS_E_FAILURE;
6005 }
6006 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006007
Jeff Johnson295189b2012-06-20 16:38:30 -07006008 /* Release SME global lock */
6009 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006010
Jeff Johnson295189b2012-06-20 16:38:30 -07006011 return (status);
6012}
6013
6014
6015
6016//sme_DbgReadMemory
6017//Caller needs to validate the input values
6018//pBuf caller allocated buffer has the length of nLen
6019VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6020{
6021 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6022 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07006023 tPmcPowerState PowerState;
6024 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08006025 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
6026 tANI_U32 arg1 = memAddr;
6027 tANI_U32 arg2 = nLen/4;
6028 tANI_U32 arg3 = 4;
6029 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006030 /* 1) To make Quarky work in FTM mode **************************************/
6031
Katya Nigambcb705f2013-12-26 14:26:22 +05306032 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006033 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006034 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6035 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306036 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006037 {
6038 return VOS_STATUS_SUCCESS;
6039 }
6040 return VOS_STATUS_E_FAILURE;
6041 }
6042
6043 /* 2) NON FTM mode driver *************************************************/
6044
6045 /* Acquire SME global lock */
6046 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6047 {
6048 return VOS_STATUS_E_FAILURE;
6049 }
6050
6051 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6052 {
6053 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6054 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6055 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306056 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006057 {
6058 status = VOS_STATUS_SUCCESS;
6059 }
6060 else
6061 {
6062 status = VOS_STATUS_E_FAILURE;
6063 }
6064 }
6065 else
6066 {
6067 status = VOS_STATUS_E_FAILURE;
6068 }
6069 }
6070
6071 /* This is a hack for Qualky/pttWniSocket
6072 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
6073 if (VOS_STATUS_SUCCESS != status)
6074 {
6075 vos_mem_set(pBuf, nLen, 0xCD);
6076 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006077 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006078 }
6079
6080 /* Release SME lock */
6081 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006082
Jeff Johnson295189b2012-06-20 16:38:30 -07006083 return (status);
6084}
6085
6086
6087//sme_DbgWriteMemory
6088//Caller needs to validate the input values
6089VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6090{
6091 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6092 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006093 tPmcPowerState PowerState;
6094 tANI_U32 sessionId = 0;
6095
6096 /* 1) To make Quarky work in FTM mode **************************************/
6097
Katya Nigambcb705f2013-12-26 14:26:22 +05306098 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006099 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006100 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6101 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006102 {
6103 return VOS_STATUS_SUCCESS;
6104 }
6105 return VOS_STATUS_E_FAILURE;
6106 }
6107
6108 /* 2) NON FTM mode driver *************************************************/
6109
6110 /* Acquire SME global lock */
6111 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6112 {
6113 return VOS_STATUS_E_FAILURE;
6114 }
6115
6116 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6117 {
6118 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6119 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6120 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006121 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07006122 {
6123 status = VOS_STATUS_SUCCESS;
6124 }
6125 else
6126 {
6127 status = VOS_STATUS_E_FAILURE;
6128 }
6129 }
6130 else
6131 {
6132 status = VOS_STATUS_E_FAILURE;
6133 }
6134 }
6135
6136 /* Release Global lock */
6137 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006138
Jeff Johnson295189b2012-06-20 16:38:30 -07006139 return (status);
6140}
6141
6142
Katya Nigam70d68332013-09-16 16:49:45 +05306143void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
6144{
6145 VOS_TRACE_LEVEL vosDebugLevel;
6146 char logBuffer[LOG_SIZE];
6147 va_list marker;
6148
6149 /* getting proper Debug level */
6150 vosDebugLevel = getVosDebugLevel(loglevel);
6151
6152 /* extracting arguments from pstring */
6153 va_start( marker, pString );
6154 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
6155
6156 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
6157 va_end( marker );
6158}
6159
6160
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006161void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07006162{
6163#ifdef WLAN_DEBUG
6164 // Verify against current log level
6165 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
6166 return;
6167 else
6168 {
6169 va_list marker;
6170
6171 va_start( marker, pString ); /* Initialize variable arguments. */
6172
6173 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
6174
6175 va_end( marker ); /* Reset variable arguments. */
6176 }
6177#endif
6178}
Jeff Johnson295189b2012-06-20 16:38:30 -07006179
Jeff Johnson295189b2012-06-20 16:38:30 -07006180/* ---------------------------------------------------------------------------
6181 \fn sme_GetWcnssWlanCompiledVersion
6182 \brief This API returns the version of the WCNSS WLAN API with
6183 which the HOST driver was built
6184 \param hHal - The handle returned by macOpen.
6185 \param pVersion - Points to the Version structure to be filled
6186 \return VOS_STATUS
6187 VOS_STATUS_E_INVAL - failure
6188 VOS_STATUS_SUCCESS success
6189 ---------------------------------------------------------------------------*/
6190VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
6191 tSirVersionType *pVersion)
6192{
6193 VOS_STATUS status = VOS_STATUS_SUCCESS;
6194 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6195 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6196
6197 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6198 {
6199 if( pVersion != NULL )
6200 {
6201 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
6202 }
6203 else
6204 {
6205 status = VOS_STATUS_E_INVAL;
6206 }
6207 sme_ReleaseGlobalLock( &pMac->sme );
6208 }
6209
6210 return (status);
6211}
6212
6213
6214/* ---------------------------------------------------------------------------
6215 \fn sme_GetWcnssWlanReportedVersion
6216 \brief This API returns the version of the WCNSS WLAN API with
6217 which the WCNSS driver reports it was built
6218 \param hHal - The handle returned by macOpen.
6219 \param pVersion - Points to the Version structure to be filled
6220 \return VOS_STATUS
6221 VOS_STATUS_E_INVAL - failure
6222 VOS_STATUS_SUCCESS success
6223 ---------------------------------------------------------------------------*/
6224VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
6225 tSirVersionType *pVersion)
6226{
6227 VOS_STATUS status = VOS_STATUS_SUCCESS;
6228 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6229 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6230
6231 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6232 {
6233 if( pVersion != NULL )
6234 {
6235 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
6236 }
6237 else
6238 {
6239 status = VOS_STATUS_E_INVAL;
6240 }
6241 sme_ReleaseGlobalLock( &pMac->sme );
6242 }
6243
6244 return (status);
6245}
6246
6247
6248/* ---------------------------------------------------------------------------
6249 \fn sme_GetWcnssSoftwareVersion
6250 \brief This API returns the version string of the WCNSS driver
6251 \param hHal - The handle returned by macOpen.
6252 \param pVersion - Points to the Version string buffer to be filled
6253 \param versionBufferSize - THe size of the Version string buffer
6254 \return VOS_STATUS
6255 VOS_STATUS_E_INVAL - failure
6256 VOS_STATUS_SUCCESS success
6257 ---------------------------------------------------------------------------*/
6258VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
6259 tANI_U8 *pVersion,
6260 tANI_U32 versionBufferSize)
6261{
6262 VOS_STATUS status = VOS_STATUS_SUCCESS;
6263 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6264 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6265
6266 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6267 {
6268 if( pVersion != NULL )
6269 {
6270 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
6271 versionBufferSize);
6272 }
6273 else
6274 {
6275 status = VOS_STATUS_E_INVAL;
6276 }
6277 sme_ReleaseGlobalLock( &pMac->sme );
6278 }
6279
6280 return (status);
6281}
6282
6283
6284/* ---------------------------------------------------------------------------
6285 \fn sme_GetWcnssHardwareVersion
6286 \brief This API returns the version string of the WCNSS hardware
6287 \param hHal - The handle returned by macOpen.
6288 \param pVersion - Points to the Version string buffer to be filled
6289 \param versionBufferSize - THe size of the Version string buffer
6290 \return VOS_STATUS
6291 VOS_STATUS_E_INVAL - failure
6292 VOS_STATUS_SUCCESS success
6293 ---------------------------------------------------------------------------*/
6294VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
6295 tANI_U8 *pVersion,
6296 tANI_U32 versionBufferSize)
6297{
6298 VOS_STATUS status = VOS_STATUS_SUCCESS;
6299 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6300 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6301
6302 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6303 {
6304 if( pVersion != NULL )
6305 {
6306 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
6307 versionBufferSize);
6308 }
6309 else
6310 {
6311 status = VOS_STATUS_E_INVAL;
6312 }
6313 sme_ReleaseGlobalLock( &pMac->sme );
6314 }
6315
6316 return (status);
6317}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08006318
Jeff Johnson295189b2012-06-20 16:38:30 -07006319
6320#ifdef FEATURE_WLAN_WAPI
6321/* ---------------------------------------------------------------------------
6322 \fn sme_RoamSetBKIDCache
6323 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
6324 candidate list.
6325 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6326 it is opened (by calling halOpen).
6327 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
6328 \param numItems - a variable that has the number of tBkidCacheInfo allocated
6329 when retruning, this is the number of items put into pBKIDCache
6330 \return eHalStatus - when fail, it usually means the buffer allocated is not
6331 big enough and pNumItems has the number of tBkidCacheInfo.
6332 ---------------------------------------------------------------------------*/
6333eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
6334 tANI_U32 numItems )
6335{
6336 eHalStatus status = eHAL_STATUS_FAILURE;
6337 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6338
6339 status = sme_AcquireGlobalLock( &pMac->sme );
6340 if ( HAL_STATUS_SUCCESS( status ) )
6341 {
6342 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
6343 sme_ReleaseGlobalLock( &pMac->sme );
6344 }
6345
6346 return (status);
6347}
6348
6349/* ---------------------------------------------------------------------------
6350 \fn sme_RoamGetBKIDCache
6351 \brief The SME API exposed to HDD to allow HDD to request SME to return its
6352 BKID cache.
6353 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6354 it is opened (by calling halOpen).
6355 \param pNum - caller allocated memory that has the space of the number of
6356 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
6357 in SME cache.
6358 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
6359 upon return
6360 \return eHalStatus - when fail, it usually means the buffer allocated is not
6361 big enough.
6362 ---------------------------------------------------------------------------*/
6363eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
6364 tBkidCacheInfo *pBkidCache)
6365{
6366 eHalStatus status = eHAL_STATUS_FAILURE;
6367 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6368
6369 status = sme_AcquireGlobalLock( &pMac->sme );
6370 if ( HAL_STATUS_SUCCESS( status ) )
6371 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006372 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006373 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
6374 sme_ReleaseGlobalLock( &pMac->sme );
6375 }
6376
6377 return (status);
6378}
6379
6380/* ---------------------------------------------------------------------------
6381 \fn sme_RoamGetNumBKIDCache
6382 \brief The SME API exposed to HDD to allow HDD to request SME to return the
6383 number of BKID cache entries.
6384 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6385 it is opened (by calling halOpen).
6386 \return tANI_U32 - the number of BKID cache entries.
6387 ---------------------------------------------------------------------------*/
6388tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
6389{
6390 eHalStatus status = eHAL_STATUS_FAILURE;
6391 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6392 tANI_U32 numBkidCache = 0;
6393
6394 status = sme_AcquireGlobalLock( &pMac->sme );
6395 if ( HAL_STATUS_SUCCESS( status ) )
6396 {
6397 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
6398 sme_ReleaseGlobalLock( &pMac->sme );
6399 }
6400
6401 return (numBkidCache);
6402}
6403
6404/* ---------------------------------------------------------------------------
6405 \fn sme_ScanGetBKIDCandidateList
6406 \brief a wrapper function to return the BKID candidate list
6407 \param pBkidList - caller allocated buffer point to an array of
6408 tBkidCandidateInfo
6409 \param pNumItems - pointer to a variable that has the number of
6410 tBkidCandidateInfo allocated when retruning, this is
6411 either the number needed or number of items put into
6412 pPmkidList
6413 \return eHalStatus - when fail, it usually means the buffer allocated is not
6414 big enough and pNumItems
6415 has the number of tBkidCandidateInfo.
6416 \Note: pNumItems is a number of tBkidCandidateInfo,
6417 not sizeof(tBkidCandidateInfo) * something
6418 ---------------------------------------------------------------------------*/
6419eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
6420 tBkidCandidateInfo *pBkidList,
6421 tANI_U32 *pNumItems )
6422{
6423 eHalStatus status = eHAL_STATUS_FAILURE;
6424 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6425
6426 status = sme_AcquireGlobalLock( &pMac->sme );
6427 if ( HAL_STATUS_SUCCESS( status ) )
6428 {
6429 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
6430 sme_ReleaseGlobalLock( &pMac->sme );
6431 }
6432
6433 return (status);
6434}
6435#endif /* FEATURE_WLAN_WAPI */
6436
Jeff Johnsone7245742012-09-05 17:12:55 -07006437#ifdef FEATURE_OEM_DATA_SUPPORT
6438
6439/*****************************************************************************
6440 OEM DATA related modifications and function additions
6441 *****************************************************************************/
6442
6443/* ---------------------------------------------------------------------------
6444 \fn sme_getOemDataRsp
6445 \brief a wrapper function to obtain the OEM DATA RSP
6446 \param pOemDataRsp - A pointer to the response object
6447 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006448 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006449 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006450eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006451 tOemDataRsp **pOemDataRsp)
6452{
6453 eHalStatus status = eHAL_STATUS_SUCCESS;
6454 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6455
6456 do
6457 {
6458 //acquire the lock for the sme object
6459 status = sme_AcquireGlobalLock(&pMac->sme);
6460
6461 if(!HAL_STATUS_SUCCESS(status))
6462 {
6463 break;
6464 }
6465
6466 if(pMac->oemData.pOemDataRsp != NULL)
6467 {
6468 *pOemDataRsp = pMac->oemData.pOemDataRsp;
6469 }
6470 else
6471 {
6472 status = eHAL_STATUS_FAILURE;
6473 }
6474
6475 //release the lock for the sme object
6476 sme_ReleaseGlobalLock( &pMac->sme );
6477
6478 } while(0);
6479
6480 return status;
6481}
6482
6483/* ---------------------------------------------------------------------------
6484 \fn sme_OemDataReq
6485 \brief a wrapper function for OEM DATA REQ
6486 \param sessionId - session id to be used.
6487 \param pOemDataReqId - pointer to an object to get back the request ID
6488 \param callback - a callback function that is called upon finish
6489 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006490 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006491 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006492eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006493 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006494 tOemDataReqConfig *pOemDataReqConfig,
6495 tANI_U32 *pOemDataReqID,
6496 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07006497 void *pContext)
6498{
6499 eHalStatus status = eHAL_STATUS_SUCCESS;
6500 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6501
6502 do
6503 {
6504 //acquire the lock for the sme object
6505 status = sme_AcquireGlobalLock(&pMac->sme);
6506 if(HAL_STATUS_SUCCESS(status))
6507 {
6508 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
6509
6510 if(pOemDataReqID)
6511 {
6512 *pOemDataReqID = lOemDataReqId;
6513 }
6514 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006515 {
6516 sme_ReleaseGlobalLock( &pMac->sme );
6517 return eHAL_STATUS_FAILURE;
6518 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006519
6520 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
6521
6522 //release the lock for the sme object
6523 sme_ReleaseGlobalLock( &pMac->sme );
6524 }
6525 } while(0);
6526
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006527 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006528
6529 return(status);
6530}
6531
6532#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006533
6534/*--------------------------------------------------------------------------
6535
6536 \brief sme_OpenSession() - Open a session for scan/roam operation.
6537
6538 This is a synchronous API.
6539
6540
6541 \param hHal - The handle returned by macOpen.
6542 \param callback - A pointer to the function caller specifies for roam/connect status indication
6543 \param pContext - The context passed with callback
6544 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
6545 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
6546
6547 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
6548
6549 Other status means SME is failed to open the session.
6550 eHAL_STATUS_RESOURCES - no more session available.
6551 \sa
6552
6553 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006554eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
6555 void *pContext, tANI_U8 *pSelfMacAddr,
6556 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006557{
6558 eHalStatus status;
6559 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6560
6561 if( NULL == pbSessionId )
6562 {
6563 status = eHAL_STATUS_INVALID_PARAMETER;
6564 }
6565 else
6566 {
6567 status = sme_AcquireGlobalLock( &pMac->sme );
6568 if ( HAL_STATUS_SUCCESS( status ) )
6569 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006570 status = csrRoamOpenSession(pMac, callback, pContext,
6571 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006572
6573 sme_ReleaseGlobalLock( &pMac->sme );
6574 }
6575 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006576 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05306577 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006578 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006579
6580 return ( status );
6581}
6582
6583
6584/*--------------------------------------------------------------------------
6585
6586 \brief sme_CloseSession() - Open a session for scan/roam operation.
6587
6588 This is a synchronous API.
6589
6590
6591 \param hHal - The handle returned by macOpen.
6592
6593 \param sessionId - A previous opened session's ID.
6594
6595 \return eHAL_STATUS_SUCCESS - session is closed.
6596
6597 Other status means SME is failed to open the session.
6598 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
6599 \sa
6600
6601 --------------------------------------------------------------------------*/
6602eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
6603 csrRoamSessionCloseCallback callback, void *pContext)
6604{
6605 eHalStatus status;
6606 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6607
Katya Nigambcb705f2013-12-26 14:26:22 +05306608 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006609 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006610 status = sme_AcquireGlobalLock( &pMac->sme );
6611 if ( HAL_STATUS_SUCCESS( status ) )
6612 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006613 status = csrRoamCloseSession( pMac, sessionId, FALSE,
Jeff Johnson295189b2012-06-20 16:38:30 -07006614 callback, pContext );
6615
6616 sme_ReleaseGlobalLock( &pMac->sme );
6617 }
6618
6619 return ( status );
6620}
6621
Jeff Johnson295189b2012-06-20 16:38:30 -07006622/* ---------------------------------------------------------------------------
6623
6624 \fn sme_RoamUpdateAPWPSIE
6625
6626 \brief To update AP's WPS IE. This function should be called after SME AP session is created
6627 This is an asynchronous API.
6628
6629 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
6630
6631 \return eHalStatus – SUCCESS –
6632
6633 FAILURE or RESOURCES – The API finished and failed.
6634
6635 -------------------------------------------------------------------------------*/
6636eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
6637{
6638
6639 eHalStatus status = eHAL_STATUS_FAILURE;
6640 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6641
6642 status = sme_AcquireGlobalLock( &pMac->sme );
6643 if ( HAL_STATUS_SUCCESS( status ) )
6644 {
6645
6646 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
6647
6648 sme_ReleaseGlobalLock( &pMac->sme );
6649 }
6650
6651 return (status);
6652}
6653/* ---------------------------------------------------------------------------
6654
6655 \fn sme_RoamUpdateAPWPARSNIEs
6656
6657 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
6658 This is an asynchronous API.
6659
6660 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
6661
6662 \return eHalStatus – SUCCESS –
6663
6664 FAILURE or RESOURCES – The API finished and failed.
6665
6666 -------------------------------------------------------------------------------*/
6667eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
6668{
6669
6670 eHalStatus status = eHAL_STATUS_FAILURE;
6671 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6672
6673 status = sme_AcquireGlobalLock( &pMac->sme );
6674 if ( HAL_STATUS_SUCCESS( status ) )
6675 {
6676
6677 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
6678
6679 sme_ReleaseGlobalLock( &pMac->sme );
6680 }
6681
6682 return (status);
6683}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006684/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006685
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006686 \fn sme_ChangeMCCBeaconInterval
6687
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006688 \brief To update P2P-GO beaconInterval. This function should be called after
6689 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006690 This is an asynchronous API.
6691
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006692 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006693
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006694 \return eHalStatus SUCCESS
6695 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006696 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006697
6698 -------------------------------------------------------------------------------*/
6699eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
6700{
6701 eHalStatus status = eHAL_STATUS_FAILURE;
6702 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6703
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006704 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006705 status = sme_AcquireGlobalLock( &pMac->sme );
6706 if ( HAL_STATUS_SUCCESS( status ) )
6707 {
6708 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
6709 sme_ReleaseGlobalLock( &pMac->sme );
6710 }
6711 return (status);
6712}
Jeff Johnson295189b2012-06-20 16:38:30 -07006713
6714/*-------------------------------------------------------------------------------*
6715
6716 \fn sme_sendBTAmpEvent
6717
6718 \brief to receive the coex priorty request from BT-AMP PAL
6719 and send the BT_AMP link state to HAL
6720
6721 \param btAmpEvent - btAmpEvent
6722
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08006723 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07006724
6725 FAILURE: API failed
6726
6727-------------------------------------------------------------------------------*/
6728
6729eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
6730{
6731 vos_msg_t msg;
6732 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
6733 eHalStatus status = eHAL_STATUS_FAILURE;
6734
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08006735 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07006736 if (NULL == ptrSmeBtAmpEvent)
6737 {
6738 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006739 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006740 return status;
6741 }
6742
6743 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
6744 msg.type = WDA_SIGNAL_BTAMP_EVENT;
6745 msg.reserved = 0;
6746 msg.bodyptr = ptrSmeBtAmpEvent;
6747
6748 //status = halFW_SendBTAmpEventMesg(pMac, event);
6749
6750 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
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 post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006754 vos_mem_free(ptrSmeBtAmpEvent);
6755 return status;
6756 }
6757
6758 return eHAL_STATUS_SUCCESS;
6759
6760}
6761
6762/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306763 \fn smeIssueFastRoamNeighborAPEvent
6764 \brief API to trigger fast BSS roam independent of RSSI triggers
6765 \param hHal - The handle returned by macOpen.
6766 \param bssid - Pointer to the BSSID to roam to.
6767 \param fastRoamTrig - Trigger to Scan or roam
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306768 \param channel - channel number on which fastroam is requested
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306769 \return eHalStatus
6770 ---------------------------------------------------------------------------*/
6771eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
6772 tANI_U8 *bssid,
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306773 tSmeFastRoamTrigger fastRoamTrig,
6774 tANI_U8 channel)
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306775{
6776 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6777 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
6778 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6779 eHalStatus status = eHAL_STATUS_SUCCESS;
6780
6781 status = sme_AcquireGlobalLock( &pMac->sme );
6782 if ( HAL_STATUS_SUCCESS( status ) )
6783 {
6784 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6785 "%s: invoked", __func__);
6786
6787 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
6788 {
6789 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
6790 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
6791 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6792 (void *)bssid, sizeof(tSirMacAddr));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306793 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID"
Arif Hussaina7c8e412013-11-20 11:06:42 -08006794 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306795 /*
6796 * As FastReassoc is based on assumption that roamable AP should be
6797 * present into the occupied channel list.We shd add i/p channel
6798 * in occupied channel list if roamable-ap(BSSID in fastreassoc cmd)
6799 * aged out prior to connection and there is no scan from aged out
6800 * to till connection indication.
6801 */
6802 csrAddChannelToOccupiedChannelList(pMac, channel);
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306803 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
6804 if (VOS_STATUS_SUCCESS != vosStatus)
6805 {
6806 smsLog(pMac, LOGE,
6807 FL("CFG Channel list scan state failed with status %d "),
6808 vosStatus);
6809 }
6810 }
6811 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
6812 {
6813 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6814 (void *)bssid, sizeof(tSirMacAddr));
6815 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08006816 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
6817 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306818
6819 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
6820 0,
6821 pMac,
6822 0);
6823
6824 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6825 {
6826 smsLog(pMac,
6827 LOGE,
6828 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
6829 vosStatus);
6830 }
6831 }
6832 sme_ReleaseGlobalLock( &pMac->sme );
6833 }
6834 return vosStatus;
6835}
6836/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006837 \fn sme_SetHostOffload
6838 \brief API to set the host offload feature.
6839 \param hHal - The handle returned by macOpen.
6840 \param pRequest - Pointer to the offload request.
6841 \return eHalStatus
6842 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006843eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006844 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006845{
6846 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07006847 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006848
Katya Nigambcb705f2013-12-26 14:26:22 +05306849 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006850 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006851 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6852 {
6853#ifdef WLAN_NS_OFFLOAD
6854 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
6855 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006856 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006857 }
6858 else
6859#endif //WLAN_NS_OFFLOAD
6860 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006861 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006862 }
6863 sme_ReleaseGlobalLock( &pMac->sme );
6864 }
6865
6866 return (status);
6867}
6868
6869#ifdef WLAN_FEATURE_GTK_OFFLOAD
6870/* ---------------------------------------------------------------------------
6871 \fn sme_SetGTKOffload
6872 \brief API to set GTK offload information.
6873 \param hHal - The handle returned by macOpen.
6874 \param pRequest - Pointer to the GTK offload request.
6875 \return eHalStatus
6876 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006877eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006878 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006879{
6880 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6881 eHalStatus status;
6882
Katya Nigambcb705f2013-12-26 14:26:22 +05306883 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006884 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006885 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6886 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006887 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006888 sme_ReleaseGlobalLock( &pMac->sme );
6889 }
6890
6891 return (status);
6892}
6893
6894/* ---------------------------------------------------------------------------
6895 \fn sme_GetGTKOffload
6896 \brief API to get GTK offload information.
6897 \param hHal - The handle returned by macOpen.
6898 \param pRequest - Pointer to the GTK offload response.
6899 \return eHalStatus
6900 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006901eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006902 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07006903{
6904 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6905 eHalStatus status;
6906
Katya Nigambcb705f2013-12-26 14:26:22 +05306907 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006908 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006909 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6910 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006911 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006912 sme_ReleaseGlobalLock( &pMac->sme );
6913 }
6914
6915 return (status);
6916}
6917#endif // WLAN_FEATURE_GTK_OFFLOAD
6918
6919/* ---------------------------------------------------------------------------
6920 \fn sme_SetKeepAlive
6921 \brief API to set the Keep Alive feature.
6922 \param hHal - The handle returned by macOpen.
6923 \param pRequest - Pointer to the Keep Alive request.
6924 \return eHalStatus
6925 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006926eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006927 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006928{
6929 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6930 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07006931 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6932 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006933 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006934 sme_ReleaseGlobalLock( &pMac->sme );
6935 }
6936
6937 return (status);
6938}
6939
6940#ifdef FEATURE_WLAN_SCAN_PNO
6941/* ---------------------------------------------------------------------------
6942 \fn sme_SetPreferredNetworkList
6943 \brief API to set the Preferred Network List Offload feature.
6944 \param hHal - The handle returned by macOpen.
6945 \param pRequest - Pointer to the offload request.
6946 \return eHalStatus
6947 ---------------------------------------------------------------------------*/
6948eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
6949{
6950 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6951 eHalStatus status;
6952
6953 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6954 {
6955 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
6956 sme_ReleaseGlobalLock( &pMac->sme );
6957 }
6958
6959 return (status);
6960}
6961
6962eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
6963{
6964 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6965 eHalStatus status;
6966
6967 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6968 {
6969 pmcSetRssiFilter(hHal, rssiThreshold);
6970 sme_ReleaseGlobalLock( &pMac->sme );
6971 }
6972
6973 return (status);
6974}
6975
6976#endif // FEATURE_WLAN_SCAN_PNO
6977
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006978eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07006979{
6980 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6981 eHalStatus status;
6982
Katya Nigambcb705f2013-12-26 14:26:22 +05306983 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006984 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006985 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6986 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006987 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07006988 sme_ReleaseGlobalLock( &pMac->sme );
6989 }
6990
6991 return (status);
6992}
6993
6994/* ---------------------------------------------------------------------------
6995 \fn sme_AbortMacScan
6996 \brief API to cancel MAC scan.
6997 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05306998 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05306999 \param reason - Reason to abort the scan.
c_hpothua3d45d52015-01-05 14:11:17 +05307000 \return tSirAbortScanStatus Abort scan status
Jeff Johnson295189b2012-06-20 16:38:30 -07007001 ---------------------------------------------------------------------------*/
c_hpothua3d45d52015-01-05 14:11:17 +05307002tSirAbortScanStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
7003 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07007004{
c_hpothua3d45d52015-01-05 14:11:17 +05307005 tSirAbortScanStatus scanAbortStatus = eSIR_ABORT_SCAN_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007006 eHalStatus status;
7007 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7008
Katya Nigambcb705f2013-12-26 14:26:22 +05307009 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007010 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007011 status = sme_AcquireGlobalLock( &pMac->sme );
7012 if ( HAL_STATUS_SUCCESS( status ) )
7013 {
c_hpothua3d45d52015-01-05 14:11:17 +05307014 scanAbortStatus = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007015
Jeff Johnson295189b2012-06-20 16:38:30 -07007016 sme_ReleaseGlobalLock( &pMac->sme );
7017 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007018
c_hpothua3d45d52015-01-05 14:11:17 +05307019 return ( scanAbortStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07007020}
7021
7022/* ----------------------------------------------------------------------------
7023 \fn sme_GetOperationChannel
7024 \brief API to get current channel on which STA is parked
7025 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007026 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07007027 \returns eHAL_STATUS_SUCCESS
7028 eHAL_STATUS_FAILURE
7029-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007030eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007031{
Jeff Johnson295189b2012-06-20 16:38:30 -07007032 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7033 tCsrRoamSession *pSession;
7034
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007035 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07007036 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007037 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007038
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007039 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007040 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007041 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007042 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
7043 {
7044 *pChannel =pSession->connectedProfile.operationChannel;
7045 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007046 }
7047 }
7048 return eHAL_STATUS_FAILURE;
7049}// sme_GetOperationChannel ends here
7050
Jeff Johnson295189b2012-06-20 16:38:30 -07007051/* ---------------------------------------------------------------------------
7052
7053 \fn sme_RegisterMgtFrame
7054
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007055 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007056 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007057 \param matchData - data which needs to be matched before passing frame
7058 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007059 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007060 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007061 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007062eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007063 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7064{
7065 eHalStatus status = eHAL_STATUS_SUCCESS;
7066 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7067
Katya Nigambcb705f2013-12-26 14:26:22 +05307068 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007069 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007070 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7071 {
7072 tSirRegisterMgmtFrame *pMsg;
7073 tANI_U16 len;
7074 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007075
7076 if(!pSession)
7077 {
7078 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007079 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007080 return eHAL_STATUS_FAILURE;
7081 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007082
Jeff Johnson295189b2012-06-20 16:38:30 -07007083 if( !pSession->sessionActive )
7084 {
7085 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007086 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007087 sme_ReleaseGlobalLock( &pMac->sme );
7088 return eHAL_STATUS_FAILURE;
7089 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007090
Jeff Johnson295189b2012-06-20 16:38:30 -07007091 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7092
Kiet Lam64c1b492013-07-12 13:56:44 +05307093 pMsg = vos_mem_malloc(len);
7094 if ( NULL == pMsg )
7095 status = eHAL_STATUS_FAILURE;
7096 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007097 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307098 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007099 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
7100 pMsg->length = len;
7101 pMsg->sessionId = sessionId;
7102 pMsg->registerFrame = VOS_TRUE;
7103 pMsg->frameType = frameType;
7104 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307105 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007106 status = palSendMBMessage(pMac->hHdd, pMsg);
7107 }
7108 sme_ReleaseGlobalLock( &pMac->sme );
7109 }
7110 return status;
7111}
7112
7113/* ---------------------------------------------------------------------------
7114
7115 \fn sme_DeregisterMgtFrame
7116
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007117 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007118 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007119 \param matchData - data which needs to be matched before passing frame
7120 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007121 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007122 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007123 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007124eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007125 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7126{
7127 eHalStatus status = eHAL_STATUS_SUCCESS;
7128 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7129
Katya Nigambcb705f2013-12-26 14:26:22 +05307130 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007131 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007132 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7133 {
7134 tSirRegisterMgmtFrame *pMsg;
7135 tANI_U16 len;
7136 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007137
7138 if(!pSession)
7139 {
7140 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007141 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007142 return eHAL_STATUS_FAILURE;
7143 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007144
7145 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07007146 {
7147 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007148 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007149 sme_ReleaseGlobalLock( &pMac->sme );
7150 return eHAL_STATUS_FAILURE;
7151 }
7152
7153 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7154
Kiet Lam64c1b492013-07-12 13:56:44 +05307155 pMsg = vos_mem_malloc(len);
7156 if ( NULL == pMsg )
7157 status = eHAL_STATUS_FAILURE;
7158 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007159 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307160 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007161 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007162 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07007163 pMsg->registerFrame = VOS_FALSE;
7164 pMsg->frameType = frameType;
7165 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307166 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007167 status = palSendMBMessage(pMac->hHdd, pMsg);
7168 }
7169 sme_ReleaseGlobalLock( &pMac->sme );
7170 }
7171 return status;
7172}
7173
7174/* ---------------------------------------------------------------------------
7175 \fn sme_RemainOnChannel
7176 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
7177 \param hHal - The handle returned by macOpen.
7178 \param pRequest - channel
7179 \param duration - duration in ms
7180 \param callback - HDD registered callback to process reaminOnChannelRsp
7181 \param context - HDD Callback param
7182 \return eHalStatus
7183 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07007184eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
7185 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307186 remainOnChanCallback callback,
7187 void *pContext,
7188 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07007189{
7190 eHalStatus status = eHAL_STATUS_SUCCESS;
7191 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7192
Katya Nigambcb705f2013-12-26 14:26:22 +05307193 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007194 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007195 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7196 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307197 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
7198 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07007199#ifdef WLAN_FEATURE_P2P_INTERNAL
7200 , eP2PRemainOnChnReasonUnknown
7201#endif
7202 );
7203 sme_ReleaseGlobalLock( &pMac->sme );
7204 }
7205 return(status);
7206}
7207
7208/* ---------------------------------------------------------------------------
7209 \fn sme_ReportProbeReq
7210 \brief API to enable/disable forwarding of probeReq to apps in p2p.
7211 \param hHal - The handle returned by macOpen.
7212 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
7213 \return eHalStatus
7214 ---------------------------------------------------------------------------*/
7215
7216#ifndef WLAN_FEATURE_CONCURRENT_P2P
7217eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
7218{
7219 eHalStatus status = eHAL_STATUS_SUCCESS;
7220 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7221
7222 do
7223 {
7224 //acquire the lock for the sme object
7225 status = sme_AcquireGlobalLock(&pMac->sme);
7226 if(HAL_STATUS_SUCCESS(status))
7227 {
7228 /* call set in context */
7229 pMac->p2pContext.probeReqForwarding = flag;
7230 //release the lock for the sme object
7231 sme_ReleaseGlobalLock( &pMac->sme );
7232 }
7233 } while(0);
7234
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007235 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007236
7237 return(status);
7238}
7239
7240/* ---------------------------------------------------------------------------
7241 \fn sme_updateP2pIe
7242 \brief API to set the P2p Ie in p2p context
7243 \param hHal - The handle returned by macOpen.
7244 \param p2pIe - Ptr to p2pIe from HDD.
7245 \param p2pIeLength: length of p2pIe
7246 \return eHalStatus
7247 ---------------------------------------------------------------------------*/
7248
7249eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
7250{
7251 eHalStatus status = eHAL_STATUS_SUCCESS;
7252 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7253
7254 //acquire the lock for the sme object
7255 status = sme_AcquireGlobalLock(&pMac->sme);
7256 if(HAL_STATUS_SUCCESS(status))
7257 {
7258 if(NULL != pMac->p2pContext.probeRspIe){
7259 vos_mem_free(pMac->p2pContext.probeRspIe);
7260 pMac->p2pContext.probeRspIeLength = 0;
7261 }
7262
7263 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
7264 if (NULL == pMac->p2pContext.probeRspIe)
7265 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007266 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007267 pMac->p2pContext.probeRspIeLength = 0;
7268 status = eHAL_STATUS_FAILURE;
7269 }
7270 else
7271 {
7272 pMac->p2pContext.probeRspIeLength = p2pIeLength;
7273
7274 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
7275 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007276 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07007277 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
7278 p2pIeLength);
7279 }
7280
7281 //release the lock for the sme object
7282 sme_ReleaseGlobalLock( &pMac->sme );
7283 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007284
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007285 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007286
7287 return(status);
7288}
7289#endif
7290
7291/* ---------------------------------------------------------------------------
7292 \fn sme_sendAction
7293 \brief API to send action frame from supplicant.
7294 \param hHal - The handle returned by macOpen.
7295 \return eHalStatus
7296 ---------------------------------------------------------------------------*/
7297
7298eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007299 const tANI_U8 *pBuf, tANI_U32 len,
7300 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07007301{
7302 eHalStatus status = eHAL_STATUS_SUCCESS;
7303 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7304
Katya Nigambcb705f2013-12-26 14:26:22 +05307305 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007306 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007307 //acquire the lock for the sme object
7308 status = sme_AcquireGlobalLock(&pMac->sme);
7309 if(HAL_STATUS_SUCCESS(status))
7310 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007311 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07007312 //release the lock for the sme object
7313 sme_ReleaseGlobalLock( &pMac->sme );
7314 }
7315
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007316 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007317
7318 return(status);
7319}
7320
7321eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
7322{
7323 eHalStatus status = eHAL_STATUS_SUCCESS;
7324 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7325
Katya Nigambcb705f2013-12-26 14:26:22 +05307326 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007327 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007328 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7329 {
7330 status = p2pCancelRemainOnChannel (hHal, sessionId);
7331 sme_ReleaseGlobalLock( &pMac->sme );
7332 }
7333 return(status);
7334}
7335
7336//Power Save Related
7337eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
7338{
7339 eHalStatus status = eHAL_STATUS_SUCCESS;
7340 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7341
7342 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7343 {
7344 status = p2pSetPs (hHal, data);
7345 sme_ReleaseGlobalLock( &pMac->sme );
7346 }
7347 return(status);
7348}
7349
Jeff Johnson295189b2012-06-20 16:38:30 -07007350
7351/* ---------------------------------------------------------------------------
7352
7353 \fn sme_ConfigureRxpFilter
7354
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007355 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07007356 SME will pass this request to lower mac to set/reset the filter on RXP for
7357 multicast & broadcast traffic.
7358
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007359 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007360
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007361 hHal - The handle returned by macOpen.
7362
Jeff Johnson295189b2012-06-20 16:38:30 -07007363 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
7364 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
7365 on this param. In future we can use this as a mask to set various types of
7366 filters as suggested below:
7367 FILTER_ALL_MULTICAST:
7368 FILTER_ALL_BROADCAST:
7369 FILTER_ALL_MULTICAST_BROADCAST:
7370
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007371
7372 \return eHalStatus
7373
7374
Jeff Johnson295189b2012-06-20 16:38:30 -07007375--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007376eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007377 tpSirWlanSetRxpFilters wlanRxpFilterParam)
7378{
7379 eHalStatus status = eHAL_STATUS_SUCCESS;
7380 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7381 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7382 vos_msg_t vosMessage;
7383
Katya Nigambcb705f2013-12-26 14:26:22 +05307384 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007385 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007386 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7387 {
7388 /* serialize the req through MC thread */
7389 vosMessage.bodyptr = wlanRxpFilterParam;
7390 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
7391 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7392 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7393 {
7394 status = eHAL_STATUS_FAILURE;
7395 }
7396 sme_ReleaseGlobalLock( &pMac->sme );
7397 }
7398 return(status);
7399}
7400
Jeff Johnson295189b2012-06-20 16:38:30 -07007401/* ---------------------------------------------------------------------------
7402
7403 \fn sme_ConfigureSuspendInd
7404
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007405 \brief
7406 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007407 be suspended
7408
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007409 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007410
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007411 hHal - The handle returned by macOpen.
7412
Jeff Johnson295189b2012-06-20 16:38:30 -07007413 wlanSuspendParam- Depicts the wlan suspend params
7414
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007415
7416 \return eHalStatus
7417
7418
Jeff Johnson295189b2012-06-20 16:38:30 -07007419--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007420eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007421 tpSirWlanSuspendParam wlanSuspendParam)
7422{
7423 eHalStatus status = eHAL_STATUS_SUCCESS;
7424 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7425 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7426 vos_msg_t vosMessage;
7427
Katya Nigambcb705f2013-12-26 14:26:22 +05307428 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007429 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007430 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7431 {
7432 /* serialize the req through MC thread */
7433 vosMessage.bodyptr = wlanSuspendParam;
7434 vosMessage.type = WDA_WLAN_SUSPEND_IND;
7435 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7436 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7437 {
7438 status = eHAL_STATUS_FAILURE;
7439 }
7440 sme_ReleaseGlobalLock( &pMac->sme );
7441 }
7442 return(status);
7443}
7444
7445/* ---------------------------------------------------------------------------
7446
7447 \fn sme_ConfigureResumeReq
7448
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007449 \brief
7450 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007451 be Resumed
7452
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007453 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007454
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007455 hHal - The handle returned by macOpen.
7456
Jeff Johnson295189b2012-06-20 16:38:30 -07007457 wlanResumeParam- Depicts the wlan resume params
7458
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007459
7460 \return eHalStatus
7461
7462
Jeff Johnson295189b2012-06-20 16:38:30 -07007463--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007464eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007465 tpSirWlanResumeParam wlanResumeParam)
7466{
7467 eHalStatus status = eHAL_STATUS_SUCCESS;
7468 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7469 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7470 vos_msg_t vosMessage;
7471
Katya Nigambcb705f2013-12-26 14:26:22 +05307472 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007473 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007474 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7475 {
7476 /* serialize the req through MC thread */
7477 vosMessage.bodyptr = wlanResumeParam;
7478 vosMessage.type = WDA_WLAN_RESUME_REQ;
7479 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7480 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7481 {
7482 status = eHAL_STATUS_FAILURE;
7483 }
7484 sme_ReleaseGlobalLock( &pMac->sme );
7485 }
7486 return(status);
7487}
7488
Jeff Johnson295189b2012-06-20 16:38:30 -07007489/* ---------------------------------------------------------------------------
7490
7491 \fn sme_GetInfraSessionId
7492
7493 \brief To get the session ID for infra session, if connected
7494 This is a synchronous API.
7495
7496 \param hHal - The handle returned by macOpen.
7497
7498 \return sessionid, -1 if infra session is not connected
7499
7500 -------------------------------------------------------------------------------*/
7501tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
7502{
7503 eHalStatus status = eHAL_STATUS_FAILURE;
7504 tANI_S8 sessionid = -1;
7505 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007506
Jeff Johnson295189b2012-06-20 16:38:30 -07007507 status = sme_AcquireGlobalLock( &pMac->sme );
7508 if ( HAL_STATUS_SUCCESS( status ) )
7509 {
7510
7511 sessionid = csrGetInfraSessionId( pMac);
7512
7513 sme_ReleaseGlobalLock( &pMac->sme );
7514 }
7515
7516 return (sessionid);
7517}
7518
7519/* ---------------------------------------------------------------------------
7520
7521 \fn sme_GetInfraOperationChannel
7522
7523 \brief To get the operating channel for infra session, if connected
7524 This is a synchronous API.
7525
7526 \param hHal - The handle returned by macOpen.
7527 \param sessionId - the sessionId returned by sme_OpenSession.
7528
7529 \return operating channel, 0 if infra session is not connected
7530
7531 -------------------------------------------------------------------------------*/
7532tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
7533{
7534 eHalStatus status = eHAL_STATUS_FAILURE;
7535 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7536 tANI_U8 channel = 0;
7537 status = sme_AcquireGlobalLock( &pMac->sme );
7538 if ( HAL_STATUS_SUCCESS( status ) )
7539 {
7540
7541 channel = csrGetInfraOperationChannel( pMac, sessionId);
7542
7543 sme_ReleaseGlobalLock( &pMac->sme );
7544 }
7545
7546 return (channel);
7547}
7548
7549//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 -07007550//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07007551tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
7552{
7553 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007554 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07007555 tANI_U8 channel = 0;
7556 status = sme_AcquireGlobalLock( &pMac->sme );
7557 if ( HAL_STATUS_SUCCESS( status ) )
7558 {
7559
7560 channel = csrGetConcurrentOperationChannel( pMac );
7561 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007562 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07007563 sme_ReleaseGlobalLock( &pMac->sme );
7564 }
7565
7566 return (channel);
7567}
7568
7569#ifdef FEATURE_WLAN_SCAN_PNO
7570/******************************************************************************
7571*
7572* Name: sme_PreferredNetworkFoundInd
7573*
7574* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007575* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07007576*
7577* Parameters:
7578* hHal - HAL handle for device
7579* pMsg - found network description
7580*
7581* Returns: eHalStatus
7582*
7583******************************************************************************/
7584eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
7585{
7586 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7587 eHalStatus status = eHAL_STATUS_SUCCESS;
7588 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07007589 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
7590 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007591
7592 if (NULL == pMsg)
7593 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007594 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007595 status = eHAL_STATUS_FAILURE;
7596 }
7597 else
7598 {
7599 if (pPrefNetworkFoundInd->ssId.length > 0)
7600 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07007601 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
7602 pPrefNetworkFoundInd->ssId.length);
7603 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
7604 dumpSsId[ssIdLength] = 0;
Abhishek Singh195c03e2014-05-14 17:21:30 +05307605 smsLog(pMac, LOG1, FL(" SSID=%s frame length %d"),
7606 dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07007607
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05307608 /* Flush scan results, So as to avoid indication/updation of
7609 * stale entries, which may not have aged out during APPS collapse
7610 */
7611 sme_ScanFlushResult(hHal,0);
7612
Srikant Kuppa066904f2013-05-07 13:56:02 -07007613 //Save the frame to scan result
7614 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
7615 {
7616 //we may have a frame
7617 status = csrScanSavePreferredNetworkFound(pMac,
7618 pPrefNetworkFoundInd);
7619 if (!HAL_STATUS_SUCCESS(status))
7620 {
7621 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
7622 }
7623 }
7624 else
7625 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08007626 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07007627 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07007628 }
7629
Srikant Kuppa066904f2013-05-07 13:56:02 -07007630 /* Call Preferred Netowrk Found Indication callback routine. */
7631 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
7632 {
7633 pMac->pmc.prefNetwFoundCB(
7634 pMac->pmc.preferredNetworkFoundIndCallbackContext,
7635 pPrefNetworkFoundInd);
7636 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007637 }
7638 else
7639 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007640 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007641 status = eHAL_STATUS_FAILURE;
7642 }
7643 }
7644
7645
7646 return(status);
7647}
7648
7649#endif // FEATURE_WLAN_SCAN_PNO
7650
7651
7652eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
7653{
7654 eHalStatus status = eHAL_STATUS_FAILURE;
7655 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007656
Jeff Johnson295189b2012-06-20 16:38:30 -07007657 status = sme_AcquireGlobalLock( &pMac->sme );
7658 if ( HAL_STATUS_SUCCESS( status ) )
7659 {
7660 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
7661 sme_ReleaseGlobalLock( &pMac->sme );
7662 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007663
Jeff Johnson295189b2012-06-20 16:38:30 -07007664 return (status);
7665}
7666
7667
7668/* ---------------------------------------------------------------------------
7669
7670 \fn sme_SetTxPerTracking
7671
7672 \brief Set Tx PER tracking configuration parameters
7673
7674 \param hHal - The handle returned by macOpen.
7675 \param pTxPerTrackingConf - Tx PER configuration parameters
7676
7677 \return eHalStatus
7678
7679 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007680eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
7681 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07007682 void *pCallbackContext,
7683 tpSirTxPerTrackingParam pTxPerTrackingParam)
7684{
7685 vos_msg_t msg;
7686 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
7687 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7688
7689 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7690 {
7691 pMac->sme.pTxPerHitCallback = pCallbackfn;
7692 pMac->sme.pTxPerHitCbContext = pCallbackContext;
7693 sme_ReleaseGlobalLock( &pMac->sme );
7694 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007695
Jeff Johnson295189b2012-06-20 16:38:30 -07007696 // free this memory in failure case or WDA request callback function
7697 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
7698 if (NULL == pTxPerTrackingParamReq)
7699 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007700 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 -07007701 return eHAL_STATUS_FAILURE;
7702 }
7703
Kiet Lam64c1b492013-07-12 13:56:44 +05307704 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
7705 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07007706 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
7707 msg.reserved = 0;
7708 msg.bodyptr = pTxPerTrackingParamReq;
7709
7710 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7711 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007712 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 -07007713 vos_mem_free(pTxPerTrackingParamReq);
7714 return eHAL_STATUS_FAILURE;
7715 }
7716
7717 return eHAL_STATUS_SUCCESS;
7718}
7719
7720/* ---------------------------------------------------------------------------
7721
7722 \fn sme_HandleChangeCountryCode
7723
7724 \brief Change Country code, Reg Domain and channel list
7725
7726 \details Country Code Priority
7727 0 = 11D > Configured Country > NV
7728 1 = Configured Country > 11D > NV
7729 If Supplicant country code is priority than 11d is disabled.
7730 If 11D is enabled, we update the country code after every scan.
7731 Hence when Supplicant country code is priority, we don't need 11D info.
7732 Country code from Supplicant is set as current courtry code.
7733 User can send reset command XX (instead of country code) to reset the
7734 country code to default values which is read from NV.
7735 In case of reset, 11D is enabled and default NV code is Set as current country code
7736 If 11D is priority,
7737 Than Supplicant country code code is set to default code. But 11D code is set as current country code
7738
7739 \param pMac - The handle returned by macOpen.
7740 \param pMsgBuf - MSG Buffer
7741
7742 \return eHalStatus
7743
7744 -------------------------------------------------------------------------------*/
7745eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7746{
7747 eHalStatus status = eHAL_STATUS_SUCCESS;
7748 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007749 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07007750 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7751 static uNvTables nvTables;
7752 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
7753
7754
7755 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
7756 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
7757 {
7758 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7759
7760 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
7761
7762 /* read the country code from NV and use it */
7763 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
7764 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307765 vos_mem_copy(pMsg->countryCode,
7766 nvTables.defaultCountryTable.countryCode,
7767 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007768 }
7769 else
7770 {
7771 status = eHAL_STATUS_FAILURE;
7772 return status;
7773 }
Abhishek Singh4d6b54c2014-10-14 12:31:00 +05307774 /* Update the 11d country to default country from NV bin so that when
7775 * callback is received for this default country, driver will not
7776 * disable the 11d taking it as valid country by user.
7777 */
7778 smsLog(pMac, LOG1,
7779 FL("Set default country code (%c%c) from NV as invalid country received"),
7780 pMsg->countryCode[0],pMsg->countryCode[1]);
7781 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
7782 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007783 }
7784 else
7785 {
7786 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05307787 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
7788 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07007789 {
7790 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7791 }
7792 }
7793
7794 /* WEXT set country code means
7795 * 11D should be supported?
7796 * 11D Channel should be enforced?
7797 * 11D Country code should be matched?
7798 * 11D Reg Domian should be matched?
7799 * Country string changed */
7800 if(pMac->roam.configParam.Is11dSupportEnabled &&
7801 pMac->roam.configParam.fEnforce11dChannels &&
7802 pMac->roam.configParam.fEnforceCountryCodeMatch &&
7803 pMac->roam.configParam.fEnforceDefaultDomain &&
7804 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
7805 {
7806 /* All 11D related options are already enabled
7807 * Country string is not changed
7808 * Do not need do anything for country code change request */
7809 return eHAL_STATUS_SUCCESS;
7810 }
7811
7812 /* Set Current Country code and Current Regulatory domain */
7813 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
7814 if(eHAL_STATUS_SUCCESS != status)
7815 {
7816 /* Supplicant country code failed. So give 11D priority */
7817 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7818 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007819 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007820 }
7821
Jeff Johnson295189b2012-06-20 16:38:30 -07007822 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05307823 vos_mem_copy(pMac->scan.countryCodeDefault,
7824 pMac->scan.countryCodeCurrent,
7825 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007826
7827 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05307828 status = csrGetRegulatoryDomainForCountry(pMac,
7829 pMac->scan.countryCodeCurrent,
7830 (v_REGDOMAIN_t *) &domainIdIoctl,
7831 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07007832 if ( status != eHAL_STATUS_SUCCESS )
7833 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007834 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007835 return status;
7836 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08007837 else if (REGDOMAIN_WORLD == domainIdIoctl)
7838 {
7839 /* Supplicant country code is invalid, so we are on world mode now. So
7840 give 11D chance to update */
7841 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7842 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
7843 }
7844
Jeff Johnson295189b2012-06-20 16:38:30 -07007845
Abhishek Singha306a442013-11-07 18:39:01 +05307846 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07007847
7848 if ( status != eHAL_STATUS_SUCCESS )
7849 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007850 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007851 return status;
7852 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007853 else
7854 {
7855 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7856 //set again if we find AP with 11d info during scan
Sachin Ahujacb64fc82015-01-12 17:01:05 +05307857 status = csrSetRegulatoryDomain(pMac, domainIdIoctl, NULL);
7858 if (status != eHAL_STATUS_SUCCESS)
7859 {
7860 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
7861 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007862 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
7863 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007864 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007865 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7866 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7867 }
7868 }
Kiet Lam6c583332013-10-14 05:37:09 +05307869#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07007870 /* set to default domain ID */
7871 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7872
7873 /* get the channels based on new cc */
7874 status = csrInitGetChannels( pMac );
7875
7876 if ( status != eHAL_STATUS_SUCCESS )
7877 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007878 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007879 return status;
7880 }
7881
7882 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08007883 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307884 /* Country code Changed, Purge Only scan result
7885 * which does not have channel number belong to 11d
7886 * channel list
7887 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307888 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307889
Kiet Lam6c583332013-10-14 05:37:09 +05307890#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007891 if( pMsg->changeCCCallback )
7892 {
7893 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
7894 }
7895
7896 return eHAL_STATUS_SUCCESS;
7897}
7898
Amar Singhal0d15bd52013-10-12 23:13:13 -07007899/* ---------------------------------------------------------------------------
7900
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007901 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07007902
7903 \brief Change Country code, Reg Domain and channel list
7904
7905 If Supplicant country code is priority than 11d is disabled.
7906 If 11D is enabled, we update the country code after every scan.
7907 Hence when Supplicant country code is priority, we don't need 11D info.
7908 Country code from Supplicant is set as current country code.
7909
7910 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007911 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07007912
7913 \return eHalStatus
7914
7915 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007916eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
7917 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007918{
7919 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007920 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05307921 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007922
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007923 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007924 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7925
Kiet Lam6c583332013-10-14 05:37:09 +05307926 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
7927 VOS_COUNTRY_CODE_LEN) == 0)
7928 {
7929 is11dCountry = VOS_TRUE;
7930 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007931
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307932 /* Set the country code given by userspace when 11dOriginal is FALSE
7933 * when 11doriginal is True,is11dCountry =0 and
7934 * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
7935 * and return failure
7936 */
7937 if (pMac->roam.configParam.Is11dSupportEnabledOriginal == true)
Amar Singhal97a2d992013-11-19 10:58:07 -08007938 {
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05307939 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)&&
7940 (!pMac->roam.configParam.fEnforceCountryCode) )
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307941 {
Amar Singhal97a2d992013-11-19 10:58:07 -08007942
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307943 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
Amar Singhal97a2d992013-11-19 10:58:07 -08007944
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307945 status = csrGetRegulatoryDomainForCountry(pMac,
Amar Singhal97a2d992013-11-19 10:58:07 -08007946 pMac->scan.countryCode11d,
7947 (v_REGDOMAIN_t *) &reg_domain_id,
7948 COUNTRY_IE);
7949
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307950 return eHAL_STATUS_FAILURE;
7951 }
Amar Singhal97a2d992013-11-19 10:58:07 -08007952 }
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05307953 pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007954 /* if Supplicant country code has priority, disable 11d */
Kiet Lam6c583332013-10-14 05:37:09 +05307955 if (!is11dCountry && pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007956 {
7957 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
Agarwal Ashishcd9b8e62014-07-21 19:48:24 +05307958 smsLog( pMac, LOG1, FL(" 11d is being disabled"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007959 }
7960
Kiet Lamf2f201e2013-11-16 21:24:16 +05307961 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07007962 WNI_CFG_COUNTRY_CODE_LEN);
7963
Sachin Ahujacb64fc82015-01-12 17:01:05 +05307964 status = csrSetRegulatoryDomain(pMac, reg_domain_id, NULL);
7965 if (status != eHAL_STATUS_SUCCESS)
7966 {
7967 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
7968 }
Abhishek Singha306a442013-11-07 18:39:01 +05307969 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07007970
Kiet Lam6c583332013-10-14 05:37:09 +05307971 if (VOS_FALSE == is11dCountry )
7972 {
7973 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05307974 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05307975 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
7976 /* set to default domain ID */
7977 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7978 }
7979
Amar Singhal0d15bd52013-10-12 23:13:13 -07007980 if ( status != eHAL_STATUS_SUCCESS )
7981 {
7982 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05307983 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007984 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007985 else
7986 {
7987 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7988 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007989 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
7990 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007991 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007992 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007993 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7994 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7995 }
7996 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007997
Amar Singhal0d15bd52013-10-12 23:13:13 -07007998 /* get the channels based on new cc */
7999 status = csrInitGetChannels(pMac);
8000
8001 if ( status != eHAL_STATUS_SUCCESS )
8002 {
8003 smsLog( pMac, LOGE, FL(" fail to get Channels "));
8004 return status;
8005 }
8006
8007 /* reset info based on new cc, and we are done */
8008 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05308009 if (VOS_TRUE == is11dCountry)
8010 {
Kiet Lam6c583332013-10-14 05:37:09 +05308011 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
8012 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
8013 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308014 /* Country code Changed, Purge Only scan result
8015 * which does not have channel number belong to 11d
8016 * channel list
8017 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308018 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05308019 // Do active scans after the country is set by User hints or Country IE
8020 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
Sushant Kaushik1d732562014-05-21 14:15:37 +05308021 sme_DisconnectConnectedSessions(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008022 smsLog(pMac, LOG1, FL(" returned"));
8023 return eHAL_STATUS_SUCCESS;
8024}
8025
8026/* ---------------------------------------------------------------------------
8027
Kiet Lamcffc5862013-10-30 16:28:45 +05308028 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008029
8030 \brief Update Country code in the driver if set by kernel as world
8031
8032 If 11D is enabled, we update the country code after every scan & notify kernel.
8033 This is to make sure kernel & driver are in sync in case of CC found in
8034 driver but not in kernel database
8035
8036 \param pMac - The handle returned by macOpen.
8037 \param pMsg - Carrying new CC set in kernel
8038
8039 \return eHalStatus
8040
8041 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05308042eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008043{
Kiet Lamcffc5862013-10-30 16:28:45 +05308044 eHalStatus status;
8045
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008046 smsLog(pMac, LOG1, FL(" called"));
8047
8048 //this is to make sure kernel & driver are in sync in case of CC found in
8049 //driver but not in kernel database
8050 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
8051 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08008052 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05308053 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008054 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05308055 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08008056 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008057 }
Kiet Lamcffc5862013-10-30 16:28:45 +05308058
Abhishek Singha306a442013-11-07 18:39:01 +05308059 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05308060
8061 if ( status != eHAL_STATUS_SUCCESS )
8062 {
8063 smsLog( pMac, LOGE, FL(" fail to set regId") );
8064 return status;
8065 }
8066 else
8067 {
Sachin Ahujacb64fc82015-01-12 17:01:05 +05308068 status = csrSetRegulatoryDomain(pMac, REGDOMAIN_WORLD, NULL);
8069 if (status != eHAL_STATUS_SUCCESS)
8070 {
8071 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
8072 }
Kiet Lamcffc5862013-10-30 16:28:45 +05308073 status = csrInitGetChannels(pMac);
8074 if ( status != eHAL_STATUS_SUCCESS )
8075 {
8076 smsLog( pMac, LOGE, FL(" fail to get Channels "));
8077 }
8078 else
8079 {
8080 csrInitChannelList(pMac);
8081 }
8082 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308083 /* Country code Changed, Purge Only scan result
8084 * which does not have channel number belong to 11d
8085 * channel list
8086 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308087 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008088 smsLog(pMac, LOG1, FL(" returned"));
8089 return eHAL_STATUS_SUCCESS;
8090}
8091
8092/* ---------------------------------------------------------------------------
8093
Sushant Kaushik1d732562014-05-21 14:15:37 +05308094 \fn sme_DisconnectConnectedSessions
8095
8096 \brief Disconnect STA and P2P client session if channel is not supported
8097
8098 If new country code does not support the channel on which STA/P2P client
8099 is connetced, it sends the disconnect to the AP/P2P GO
8100
8101 \param pMac - The handle returned by macOpen
8102
8103 \return eHalStatus
8104
8105 -------------------------------------------------------------------------------*/
8106
8107void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac)
8108{
8109 v_U8_t i, sessionId, isChanFound = false;
8110 tANI_U8 currChannel;
8111
8112 for (sessionId=0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
8113 {
8114 if (csrIsSessionClientAndConnected(pMac, sessionId))
8115 {
8116 isChanFound = false;
8117 //Session is connected.Check the channel
8118 currChannel = csrGetInfraOperationChannel(pMac, sessionId);
8119 smsLog(pMac, LOGW, "Current Operating channel : %d, session :%d",
8120 currChannel, sessionId);
8121 for (i=0; i < pMac->scan.base20MHzChannels.numChannels; i++)
8122 {
8123 if (pMac->scan.base20MHzChannels.channelList[i] == currChannel)
8124 {
8125 isChanFound = true;
8126 break;
8127 }
8128 }
8129
8130 if (!isChanFound)
8131 {
8132 for (i=0; i < pMac->scan.base40MHzChannels.numChannels; i++)
8133 {
8134 if (pMac->scan.base40MHzChannels.channelList[i] == currChannel)
8135 {
8136 isChanFound = true;
8137 break;
8138 }
8139 }
8140 }
8141 if (!isChanFound)
8142 {
8143 smsLog(pMac, LOGW, "%s : Disconnect Session :%d", __func__, sessionId);
8144 csrRoamDisconnect(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
8145 }
8146 }
8147 }
8148}
8149/* ---------------------------------------------------------------------------
8150
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008151 \fn sme_HandleGenericChangeCountryCode
8152
8153 \brief Change Country code, Reg Domain and channel list
8154
8155 If Supplicant country code is priority than 11d is disabled.
8156 If 11D is enabled, we update the country code after every scan.
8157 Hence when Supplicant country code is priority, we don't need 11D info.
8158 Country code from kernel is set as current country code.
8159
8160 \param pMac - The handle returned by macOpen.
8161 \param pMsgBuf - message buffer
8162
8163 \return eHalStatus
8164
8165 -------------------------------------------------------------------------------*/
8166eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
8167{
8168 tAniGenericChangeCountryCodeReq *pMsg;
8169 v_REGDOMAIN_t reg_domain_id;
8170
8171 smsLog(pMac, LOG1, FL(" called"));
8172 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
8173 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
8174
8175 if (REGDOMAIN_COUNT == reg_domain_id)
8176 {
Kiet Lamcffc5862013-10-30 16:28:45 +05308177 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008178 }
8179 else
8180 {
8181 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
8182 }
8183 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07008184 return eHAL_STATUS_SUCCESS;
8185}
8186
Jeff Johnson295189b2012-06-20 16:38:30 -07008187#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08008188eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07008189{
8190 tpSirRcvFltMcAddrList pRequestBuf;
8191 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008192 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07008193 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008194
8195 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05308196 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008197 pMulticastAddrs->ulMulticastAddrCnt,
8198 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07008199
8200 /*
8201 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08008202 */
8203 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
8204 csrIsConnStateInfra(pMac, sessionId))
8205 {
8206 pSession = CSR_GET_SESSION( pMac, sessionId );
8207 }
Jeff Johnsone7245742012-09-05 17:12:55 -07008208
8209 if(pSession == NULL )
8210 {
8211 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008212 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07008213 return eHAL_STATUS_FAILURE;
8214 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08008215
Jeff Johnson295189b2012-06-20 16:38:30 -07008216 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
8217 if (NULL == pRequestBuf)
8218 {
8219 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008220 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008221 return eHAL_STATUS_FAILED_ALLOC;
8222 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08008223
8224 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
8225 {
8226 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
8227 "indication as we are not connected", __func__);
8228 vos_mem_free(pRequestBuf);
8229 return eHAL_STATUS_FAILURE;
8230 }
8231
Jeff Johnson295189b2012-06-20 16:38:30 -07008232 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
8233
Kiet Lam64c1b492013-07-12 13:56:44 +05308234 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
8235 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008236 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
8237 sizeof(tSirMacAddr));
8238
Jeff Johnson295189b2012-06-20 16:38:30 -07008239 msg.type = WDA_8023_MULTICAST_LIST_REQ;
8240 msg.reserved = 0;
8241 msg.bodyptr = pRequestBuf;
8242 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8243 {
8244 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008245 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008246 vos_mem_free(pRequestBuf);
8247 return eHAL_STATUS_FAILURE;
8248 }
8249
8250 return eHAL_STATUS_SUCCESS;
8251}
8252
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008253eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07008254 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008255{
8256 tpSirRcvPktFilterCfgType pRequestBuf;
8257 v_SINT_t allocSize;
8258 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008259 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8260 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07008261 v_U8_t idx=0;
8262
8263 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008264 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008265 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008266
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07008267 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008268
Jeff Johnson295189b2012-06-20 16:38:30 -07008269 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008270
8271 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008272 {
8273 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008274 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008275 return eHAL_STATUS_FAILED_ALLOC;
8276 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008277
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008278 if( NULL == pSession )
8279 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008280 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008281 vos_mem_free(pRequestBuf);
8282 return eHAL_STATUS_FAILURE;
8283 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008284
Kiet Lam64c1b492013-07-12 13:56:44 +05308285 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
8286 sizeof(tSirMacAddr));
8287 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
8288 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008289 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
8290
Jeff Johnson295189b2012-06-20 16:38:30 -07008291 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
8292 msg.reserved = 0;
8293 msg.bodyptr = pRequestBuf;
8294
8295 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008296 "FT %d FID %d ",
8297 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07008298
8299 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008300 "params %d CT %d",
8301 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07008302
8303 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
8304 {
8305
8306 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008307 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07008308 pRequestBuf->paramsData[idx].protocolLayer,
8309 pRequestBuf->paramsData[idx].cmpFlag);
8310
8311 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008312 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008313 pRequestBuf->paramsData[idx].dataOffset,
8314 pRequestBuf->paramsData[idx].dataLength);
8315
8316 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008317 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008318 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008319 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008320 pRequestBuf->paramsData[idx].compareData[2],
8321 pRequestBuf->paramsData[idx].compareData[3],
8322 pRequestBuf->paramsData[idx].compareData[4],
8323 pRequestBuf->paramsData[idx].compareData[5]);
8324
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008325 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008326 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008327 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008328 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008329 pRequestBuf->paramsData[idx].dataMask[2],
8330 pRequestBuf->paramsData[idx].dataMask[3],
8331 pRequestBuf->paramsData[idx].dataMask[4],
8332 pRequestBuf->paramsData[idx].dataMask[5]);
8333
8334 }
8335
8336 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8337 {
8338 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008339 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008340 vos_mem_free(pRequestBuf);
8341 return eHAL_STATUS_FAILURE;
8342 }
8343
8344 return eHAL_STATUS_SUCCESS;
8345}
8346
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008347eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008348 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008349 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008350 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008351{
8352 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8353 eHalStatus status;
8354
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008355 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008356
8357 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
8358 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008359 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07008360 sme_ReleaseGlobalLock( &pMac->sme );
8361 }
8362
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008363 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008364
8365 return (status);
8366}
8367
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008368eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07008369 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008370{
8371 tpSirRcvFltPktClearParam pRequestBuf;
8372 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008373 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8374 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07008375
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008376 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008377 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008378
Jeff Johnson295189b2012-06-20 16:38:30 -07008379 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008380 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008381 {
8382 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8383 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008384 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008385 return eHAL_STATUS_FAILED_ALLOC;
8386 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008387 if( NULL == pSession )
8388 {
8389 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008390 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008391 vos_mem_free(pRequestBuf);
8392 return eHAL_STATUS_FAILURE;
8393 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008394
Kiet Lam64c1b492013-07-12 13:56:44 +05308395 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
8396 sizeof(tSirMacAddr));
8397 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
8398 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008399
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008400 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
8401
Jeff Johnson295189b2012-06-20 16:38:30 -07008402 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
8403 msg.reserved = 0;
8404 msg.bodyptr = pRequestBuf;
8405 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8406 {
8407 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008408 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008409 vos_mem_free(pRequestBuf);
8410 return eHAL_STATUS_FAILURE;
8411 }
8412
8413 return eHAL_STATUS_SUCCESS;
8414}
8415#endif // WLAN_FEATURE_PACKET_FILTERING
8416
8417/* ---------------------------------------------------------------------------
8418 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008419 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07008420 channel switch.
8421 \param callbackContext
8422 \param status
8423 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008424void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07008425 eHalStatus status)
8426{
8427 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
8428 tSirMbMsg *pMsg;
8429 tANI_U16 msgLen;
8430
8431 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05308432 pMsg = vos_mem_malloc(msgLen);
8433 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07008434 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308435 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008436 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
8437 pMsg->msgLen = pal_cpu_to_be16(msgLen);
8438 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008439 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008440
8441 return;
8442}
8443
8444/* ---------------------------------------------------------------------------
8445 \fn sme_HandlePreChannelSwitchInd
8446 \brief Processes the indcation from PE for pre-channel switch.
8447 \param hHal
8448 \- The handle returned by macOpen. return eHalStatus
8449 ---------------------------------------------------------------------------*/
8450eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
8451{
8452 eHalStatus status = eHAL_STATUS_FAILURE;
8453 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8454 status = sme_AcquireGlobalLock( &pMac->sme );
8455 if ( HAL_STATUS_SUCCESS( status ) )
8456 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008457 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
8458 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07008459 sme_ReleaseGlobalLock( &pMac->sme );
8460 }
8461
8462 return (status);
8463}
8464
8465/* ---------------------------------------------------------------------------
8466 \fn sme_HandlePostChannelSwitchInd
8467 \brief Processes the indcation from PE for post-channel switch.
8468 \param hHal
8469 \- The handle returned by macOpen. return eHalStatus
8470 ---------------------------------------------------------------------------*/
8471eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
8472{
8473 eHalStatus status = eHAL_STATUS_FAILURE;
8474 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8475
8476 status = sme_AcquireGlobalLock( &pMac->sme );
8477 if ( HAL_STATUS_SUCCESS( status ) )
8478 {
8479 status = pmcRequestBmps(hHal, NULL, NULL);
8480 sme_ReleaseGlobalLock( &pMac->sme );
8481 }
8482
8483 return (status);
8484}
8485
8486/* ---------------------------------------------------------------------------
8487
8488 \fn sme_IsChannelValid
8489
8490 \brief To check if the channel is valid for currently established domain
8491 This is a synchronous API.
8492
8493 \param hHal - The handle returned by macOpen.
8494 \param channel - channel to verify
8495
8496 \return TRUE/FALSE, TRUE if channel is valid
8497
8498 -------------------------------------------------------------------------------*/
8499tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
8500{
8501 eHalStatus status = eHAL_STATUS_FAILURE;
8502 tANI_BOOLEAN valid = FALSE;
8503 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008504
Jeff Johnson295189b2012-06-20 16:38:30 -07008505 status = sme_AcquireGlobalLock( &pMac->sme );
8506 if ( HAL_STATUS_SUCCESS( status ) )
8507 {
8508
8509 valid = csrRoamIsChannelValid( pMac, channel);
8510
8511 sme_ReleaseGlobalLock( &pMac->sme );
8512 }
8513
8514 return (valid);
8515}
8516
8517/* ---------------------------------------------------------------------------
8518 \fn sme_SetFreqBand
8519 \brief Used to set frequency band.
8520 \param hHal
8521 \eBand band value to be configured
8522 \- return eHalStatus
8523 -------------------------------------------------------------------------*/
8524eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
8525{
8526 eHalStatus status = eHAL_STATUS_FAILURE;
8527 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8528
8529 status = sme_AcquireGlobalLock( &pMac->sme );
8530 if ( HAL_STATUS_SUCCESS( status ) )
8531 {
8532 status = csrSetBand(hHal, eBand);
8533 sme_ReleaseGlobalLock( &pMac->sme );
8534 }
8535 return status;
8536}
8537
8538/* ---------------------------------------------------------------------------
8539 \fn sme_GetFreqBand
8540 \brief Used to get the current band settings.
8541 \param hHal
8542 \pBand pointer to hold band value
8543 \- return eHalStatus
8544 -------------------------------------------------------------------------*/
8545eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
8546{
8547 eHalStatus status = eHAL_STATUS_FAILURE;
8548 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8549
8550 status = sme_AcquireGlobalLock( &pMac->sme );
8551 if ( HAL_STATUS_SUCCESS( status ) )
8552 {
8553 *pBand = csrGetCurrentBand( hHal );
8554 sme_ReleaseGlobalLock( &pMac->sme );
8555 }
8556 return status;
8557}
8558
8559#ifdef WLAN_WAKEUP_EVENTS
8560/******************************************************************************
8561 \fn sme_WakeReasonIndCallback
8562
8563 \brief
8564 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
8565
8566 \param hHal - HAL handle for device
8567 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
8568
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008569 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008570******************************************************************************/
8571eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
8572{
8573 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8574 eHalStatus status = eHAL_STATUS_SUCCESS;
8575 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
8576
8577 if (NULL == pMsg)
8578 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008579 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008580 status = eHAL_STATUS_FAILURE;
8581 }
8582 else
8583 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008584 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07008585
8586 /* Call Wake Reason Indication callback routine. */
8587 if (pMac->pmc.wakeReasonIndCB != NULL)
8588 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008589
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008590 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07008591 }
8592
8593 return(status);
8594}
8595#endif // WLAN_WAKEUP_EVENTS
8596
8597
8598/* ---------------------------------------------------------------------------
8599
8600 \fn sme_SetMaxTxPower
8601
8602 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
8603 not persist over reboots.
8604
8605 \param hHal
8606 \param pBssid BSSID to set the power cap for
8607 \param pBssid pSelfMacAddress self MAC Address
8608 \param pBssid power to set in dB
8609 \- return eHalStatus
8610
8611 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008612eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07008613 tSirMacAddr pSelfMacAddress, v_S7_t dB)
8614{
8615 vos_msg_t msg;
8616 tpMaxTxPowerParams pMaxTxParams = NULL;
Katya Nigambcb705f2013-12-26 14:26:22 +05308617 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008618 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008619 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
8620 if (NULL == pMaxTxParams)
8621 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008622 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 -07008623 return eHAL_STATUS_FAILURE;
8624 }
8625
8626 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05308627 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07008628 SIR_MAC_ADDR_LENGTH);
8629 pMaxTxParams->power = dB;
8630
8631 msg.type = WDA_SET_MAX_TX_POWER_REQ;
8632 msg.reserved = 0;
8633 msg.bodyptr = pMaxTxParams;
8634
8635 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8636 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008637 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 -07008638 vos_mem_free(pMaxTxParams);
8639 return eHAL_STATUS_FAILURE;
8640 }
8641
8642 return eHAL_STATUS_SUCCESS;
8643}
8644
Jeff Johnson295189b2012-06-20 16:38:30 -07008645/* ---------------------------------------------------------------------------
8646
Arif Hussaina5ebce02013-08-09 15:09:58 -07008647 \fn sme_SetMaxTxPowerPerBand
8648
8649 \brief Set the Maximum Transmit Power specific to band dynamically.
8650 Note: this setting will not persist over reboots.
8651
8652 \param band
8653 \param power to set in dB
8654 \- return eHalStatus
8655
8656 ----------------------------------------------------------------------------*/
8657eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
8658{
8659 vos_msg_t msg;
8660 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
8661
8662 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
8663 if (NULL == pMaxTxPowerPerBandParams)
8664 {
8665 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8666 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
8667 __func__);
8668 return eHAL_STATUS_FAILURE;
8669 }
8670
8671 pMaxTxPowerPerBandParams->power = dB;
8672 pMaxTxPowerPerBandParams->bandInfo = band;
8673
8674 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
8675 msg.reserved = 0;
8676 msg.bodyptr = pMaxTxPowerPerBandParams;
8677
8678 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8679 {
8680 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8681 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
8682 __func__);
8683 vos_mem_free(pMaxTxPowerPerBandParams);
8684 return eHAL_STATUS_FAILURE;
8685 }
8686
8687 return eHAL_STATUS_SUCCESS;
8688}
8689
8690/* ---------------------------------------------------------------------------
8691
schang86c22c42013-03-13 18:41:24 -07008692 \fn sme_SetTxPower
8693
8694 \brief Set Transmit Power dynamically. Note: this setting will
8695 not persist over reboots.
8696
8697 \param hHal
8698 \param sessionId Target Session ID
8699 \param mW power to set in mW
8700 \- return eHalStatus
8701
8702 -------------------------------------------------------------------------------*/
8703eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
8704{
8705
8706 eHalStatus status = eHAL_STATUS_FAILURE;
8707 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8708
Katya Nigambcb705f2013-12-26 14:26:22 +05308709 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008710 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07008711 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
8712 status = sme_AcquireGlobalLock(&pMac->sme);
8713 if (HAL_STATUS_SUCCESS(status))
8714 {
8715 status = csrSetTxPower(pMac, sessionId, mW);
8716 sme_ReleaseGlobalLock(&pMac->sme);
8717 }
8718 return status;
8719}
8720
8721/* ---------------------------------------------------------------------------
8722
Jeff Johnson295189b2012-06-20 16:38:30 -07008723 \fn sme_HideSSID
8724
8725 \brief hide/show SSID dynamically. Note: this setting will
8726 not persist over reboots.
8727
8728 \param hHal
8729 \param sessionId
8730 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
8731 \- return eHalStatus
8732
8733 -------------------------------------------------------------------------------*/
8734eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
8735{
8736 eHalStatus status = eHAL_STATUS_SUCCESS;
8737 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8738 tANI_U16 len;
8739
8740 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8741 {
8742 tpSirUpdateParams pMsg;
8743 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008744
8745 if(!pSession)
8746 {
8747 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008748 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008749 return eHAL_STATUS_FAILURE;
8750 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008751
8752 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07008753 VOS_ASSERT(0);
8754
8755 /* Create the message and send to lim */
8756 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05308757 pMsg = vos_mem_malloc(len);
8758 if ( NULL == pMsg )
8759 status = eHAL_STATUS_FAILURE;
8760 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008761 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308762 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008763 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
8764 pMsg->length = len;
8765 /* Data starts from here */
8766 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008767 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07008768 status = palSendMBMessage(pMac->hHdd, pMsg);
8769 }
8770 sme_ReleaseGlobalLock( &pMac->sme );
8771 }
8772 return status;
8773}
Jeff Johnson295189b2012-06-20 16:38:30 -07008774
8775/* ---------------------------------------------------------------------------
8776
8777 \fn sme_SetTmLevel
8778 \brief Set Thermal Mitigation Level to RIVA
8779 \param hHal - The handle returned by macOpen.
8780 \param newTMLevel - new Thermal Mitigation Level
8781 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008782 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008783 ---------------------------------------------------------------------------*/
8784eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
8785{
8786 eHalStatus status = eHAL_STATUS_SUCCESS;
8787 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8788 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8789 vos_msg_t vosMessage;
8790 tAniSetTmLevelReq *setTmLevelReq = NULL;
8791
Katya Nigambcb705f2013-12-26 14:26:22 +05308792 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008793 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008794 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8795 {
8796 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05308797 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07008798 {
8799 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008800 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008801 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07008802 return eHAL_STATUS_FAILURE;
8803 }
8804
8805 setTmLevelReq->tmMode = tmMode;
8806 setTmLevelReq->newTmLevel = newTMLevel;
8807
8808 /* serialize the req through MC thread */
8809 vosMessage.bodyptr = setTmLevelReq;
8810 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
8811 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8812 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8813 {
8814 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008815 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008816 vos_mem_free(setTmLevelReq);
8817 status = eHAL_STATUS_FAILURE;
8818 }
8819 sme_ReleaseGlobalLock( &pMac->sme );
8820 }
8821 return(status);
8822}
8823
8824/*---------------------------------------------------------------------------
8825
8826 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
8827 Host and FW.
8828
8829 \param hHal - HAL handle for device
8830
8831 \return NONE
8832
8833---------------------------------------------------------------------------*/
8834void sme_featureCapsExchange( tHalHandle hHal)
8835{
8836 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05308837 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008838 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008839 WDA_featureCapsExchange(vosContext);
8840}
Jeff Johnsond13512a2012-07-17 11:42:19 -07008841
Yathish9f22e662012-12-10 14:21:35 -08008842/*---------------------------------------------------------------------------
8843
8844 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
8845 in Host.
8846
8847 \param hHal - HAL handle for device
8848
8849 \return NONE
8850
8851---------------------------------------------------------------------------*/
8852void sme_disableFeatureCapablity(tANI_U8 feature_index)
8853{
8854 WDA_disableCapablityFeature(feature_index);
8855}
8856
Jeff Johnsond13512a2012-07-17 11:42:19 -07008857/* ---------------------------------------------------------------------------
8858
8859 \fn sme_GetDefaultCountryCode
8860
8861 \brief Get the default country code from NV
8862
8863 \param hHal
8864 \param pCountry
8865 \- return eHalStatus
8866
8867 -------------------------------------------------------------------------------*/
8868eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
8869{
8870 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308871 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008872 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008873 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
8874}
8875
8876/* ---------------------------------------------------------------------------
8877
8878 \fn sme_GetCurrentCountryCode
8879
8880 \brief Get the current country code
8881
8882 \param hHal
8883 \param pCountry
8884 \- return eHalStatus
8885
8886 -------------------------------------------------------------------------------*/
8887eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
8888{
8889 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308890 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008891 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008892 return csrGetCurrentCountryCode(pMac, pCountry);
8893}
8894
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008895/* ---------------------------------------------------------------------------
8896 \fn sme_transportDebug
8897 \brief Dynamically monitoring Transport channels
8898 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07008899 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08008900 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008901 \param toggleStallDetect Enable stall detect feature
8902 This feature will take effect to data performance
8903 Not integrate till fully verification
8904 \- return NONE
8905 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07008906void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008907{
schang6295e542013-03-12 15:31:23 -07008908 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8909
8910 if (NULL == pMac)
8911 {
8912 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8913 "%s: invalid context", __func__);
8914 return;
8915 }
8916 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07008917}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008918
Kiran4a17ebe2013-01-31 10:43:43 -08008919/* ---------------------------------------------------------------------------
8920 \fn sme_ResetPowerValuesFor5G
8921 \brief Reset the power values for 5G band with NV power values.
8922 \param hHal - HAL handle for device
8923 \- return NONE
8924 -------------------------------------------------------------------------*/
8925void sme_ResetPowerValuesFor5G (tHalHandle hHal)
8926{
8927 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +05308928 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008929 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08008930 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
8931 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
8932}
8933
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008934#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008935/* ---------------------------------------------------------------------------
8936 \fn sme_UpdateRoamPrefer5GHz
8937 \brief enable/disable Roam prefer 5G runtime option
8938 This function is called through dynamic setConfig callback function
8939 to configure the Roam prefer 5G runtime option
8940 \param hHal - HAL handle for device
8941 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
8942 \- return Success or failure
8943 -------------------------------------------------------------------------*/
8944
8945eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
8946{
8947 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008948 eHalStatus status = eHAL_STATUS_SUCCESS;
8949
Katya Nigambcb705f2013-12-26 14:26:22 +05308950 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008951 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008952 status = sme_AcquireGlobalLock( &pMac->sme );
8953 if ( HAL_STATUS_SUCCESS( status ) )
8954 {
8955 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8956 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
8957 pMac->roam.configParam.nRoamPrefer5GHz,
8958 nRoamPrefer5GHz);
8959 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
8960 sme_ReleaseGlobalLock( &pMac->sme );
8961 }
8962
8963 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008964}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008965
8966/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008967 \fn sme_setRoamIntraBand
8968 \brief enable/disable Intra band roaming
8969 This function is called through dynamic setConfig callback function
8970 to configure the intra band roaming
8971 \param hHal - HAL handle for device
8972 \param nRoamIntraBand Enable/Disable Intra band roaming
8973 \- return Success or failure
8974 -------------------------------------------------------------------------*/
8975eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
8976{
8977 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8978 eHalStatus status = eHAL_STATUS_SUCCESS;
8979
Katya Nigambcb705f2013-12-26 14:26:22 +05308980 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008981 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008982 status = sme_AcquireGlobalLock( &pMac->sme );
8983 if ( HAL_STATUS_SUCCESS( status ) )
8984 {
8985 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8986 "%s: gRoamIntraBand is changed from %d to %d", __func__,
8987 pMac->roam.configParam.nRoamIntraBand,
8988 nRoamIntraBand);
8989 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
8990 sme_ReleaseGlobalLock( &pMac->sme );
8991 }
8992
8993 return status ;
8994}
8995
8996/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07008997 \fn sme_UpdateRoamScanNProbes
8998 \brief function to update roam scan N probes
8999 This function is called through dynamic setConfig callback function
9000 to update roam scan N probes
9001 \param hHal - HAL handle for device
9002 \param nProbes number of probe requests to be sent out
9003 \- return Success or failure
9004 -------------------------------------------------------------------------*/
9005eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
9006{
9007 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9008 eHalStatus status = eHAL_STATUS_SUCCESS;
9009
9010 status = sme_AcquireGlobalLock( &pMac->sme );
9011 if ( HAL_STATUS_SUCCESS( status ) )
9012 {
9013 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9014 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
9015 pMac->roam.configParam.nProbes,
9016 nProbes);
9017 pMac->roam.configParam.nProbes = nProbes;
9018 sme_ReleaseGlobalLock( &pMac->sme );
9019 }
9020#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9021 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9022 {
9023 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9024 REASON_NPROBES_CHANGED);
9025 }
9026#endif
9027 return status ;
9028}
9029
9030/* ---------------------------------------------------------------------------
9031 \fn sme_UpdateRoamScanHomeAwayTime
9032 \brief function to update roam scan Home away time
9033 This function is called through dynamic setConfig callback function
9034 to update roam scan home away time
9035 \param hHal - HAL handle for device
9036 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009037 \param bSendOffloadCmd If TRUE then send offload command to firmware
9038 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009039 \- return Success or failure
9040 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009041eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
9042 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009043{
9044 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9045 eHalStatus status = eHAL_STATUS_SUCCESS;
9046
9047 status = sme_AcquireGlobalLock( &pMac->sme );
9048 if ( HAL_STATUS_SUCCESS( status ) )
9049 {
9050 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9051 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
9052 pMac->roam.configParam.nRoamScanHomeAwayTime,
9053 nRoamScanHomeAwayTime);
9054 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
9055 sme_ReleaseGlobalLock( &pMac->sme );
9056 }
9057
9058#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009059 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009060 {
9061 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9062 REASON_HOME_AWAY_TIME_CHANGED);
9063 }
9064#endif
9065 return status;
9066}
9067
9068
9069/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009070 \fn sme_getRoamIntraBand
9071 \brief get Intra band roaming
9072 \param hHal - HAL handle for device
9073 \- return Success or failure
9074 -------------------------------------------------------------------------*/
9075v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
9076{
9077 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05309078 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009079 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009080 return pMac->roam.configParam.nRoamIntraBand;
9081}
9082
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009083/* ---------------------------------------------------------------------------
9084 \fn sme_getRoamScanNProbes
9085 \brief get N Probes
9086 \param hHal - HAL handle for device
9087 \- return Success or failure
9088 -------------------------------------------------------------------------*/
9089v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
9090{
9091 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9092 return pMac->roam.configParam.nProbes;
9093}
9094
9095/* ---------------------------------------------------------------------------
9096 \fn sme_getRoamScanHomeAwayTime
9097 \brief get Roam scan home away time
9098 \param hHal - HAL handle for device
9099 \- return Success or failure
9100 -------------------------------------------------------------------------*/
9101v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
9102{
9103 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9104 return pMac->roam.configParam.nRoamScanHomeAwayTime;
9105}
9106
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009107
9108/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009109 \fn sme_UpdateImmediateRoamRssiDiff
9110 \brief Update nImmediateRoamRssiDiff
9111 This function is called through dynamic setConfig callback function
9112 to configure nImmediateRoamRssiDiff
9113 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
9114 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009115 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009116 candidate and current AP.
9117 \- return Success or failure
9118 -------------------------------------------------------------------------*/
9119
9120eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
9121{
9122 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08009123 eHalStatus status = eHAL_STATUS_SUCCESS;
9124
Katya Nigambcb705f2013-12-26 14:26:22 +05309125 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009126 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009127 status = sme_AcquireGlobalLock( &pMac->sme );
9128 if ( HAL_STATUS_SUCCESS( status ) )
9129 {
9130 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309131 "LFR runtime successfully set immediate roam rssi diff to"
9132 "%d - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009133 nImmediateRoamRssiDiff,
9134 pMac->roam.configParam.nImmediateRoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309135 macTraceGetNeighbourRoamState(
9136 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009137 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
9138 sme_ReleaseGlobalLock( &pMac->sme );
9139 }
9140
9141 return status ;
9142}
9143
9144/* ---------------------------------------------------------------------------
9145 \fn sme_UpdateRoamRssiDiff
9146 \brief Update RoamRssiDiff
9147 This function is called through dynamic setConfig callback function
9148 to configure RoamRssiDiff
9149 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
9150 \param hHal - HAL handle for device
9151 \param RoamRssiDiff - minimum rssi difference between potential
9152 candidate and current AP.
9153 \- return Success or failure
9154 -------------------------------------------------------------------------*/
9155
9156eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
9157{
9158 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9159 eHalStatus status = eHAL_STATUS_SUCCESS;
9160
9161 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +05309162 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009163 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009164 if ( HAL_STATUS_SUCCESS( status ) )
9165 {
9166 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309167 "LFR runtime successfully set roam rssi diff to %d"
9168 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009169 RoamRssiDiff,
9170 pMac->roam.configParam.RoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309171 macTraceGetNeighbourRoamState(
9172 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009173 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
9174 sme_ReleaseGlobalLock( &pMac->sme );
9175 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009176#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9177 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9178 {
9179 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
9180 }
9181#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009182 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009183}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009184
9185/*--------------------------------------------------------------------------
9186 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009187 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009188 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009189 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009190 \param hHal - The handle returned by macOpen.
9191 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
9192 Other status means SME is failed to update isFastTransitionEnabled.
9193 \sa
9194 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009195eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009196 v_BOOL_t isFastTransitionEnabled)
9197{
9198 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08009199 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009200
Katya Nigambcb705f2013-12-26 14:26:22 +05309201 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009202 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009203 status = sme_AcquireGlobalLock( &pMac->sme );
9204 if ( HAL_STATUS_SUCCESS( status ) )
9205 {
9206 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9207 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
9208 pMac->roam.configParam.isFastTransitionEnabled,
9209 isFastTransitionEnabled);
9210 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
9211 sme_ReleaseGlobalLock( &pMac->sme );
9212 }
9213
9214 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009215}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009216
9217/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009218 \fn sme_UpdateWESMode
9219 \brief Update WES Mode
9220 This function is called through dynamic setConfig callback function
9221 to configure isWESModeEnabled
9222 \param hHal - HAL handle for device
9223 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
9224 Other status means SME is failed to update isWESModeEnabled.
9225 -------------------------------------------------------------------------*/
9226
9227eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
9228{
9229 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9230 eHalStatus status = eHAL_STATUS_SUCCESS;
9231
9232 status = sme_AcquireGlobalLock( &pMac->sme );
9233 if ( HAL_STATUS_SUCCESS( status ) )
9234 {
9235 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309236 "LFR runtime successfully set WES Mode to %d"
9237 "- old value is %d - roam state is %s",
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009238 isWESModeEnabled,
9239 pMac->roam.configParam.isWESModeEnabled,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309240 macTraceGetNeighbourRoamState(
9241 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009242 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
9243 sme_ReleaseGlobalLock( &pMac->sme );
9244 }
9245
9246 return status ;
9247}
9248
9249/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009250 \fn sme_SetRoamScanControl
9251 \brief Set roam scan control
9252 This function is called to set roam scan control
9253 if roam scan control is set to 0, roaming scan cache is cleared
9254 any value other than 0 is treated as invalid value
9255 \param hHal - HAL handle for device
9256 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9257 Other status means SME failure to update
9258 -------------------------------------------------------------------------*/
9259eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
9260{
9261 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9262 eHalStatus status = eHAL_STATUS_SUCCESS;
9263
Katya Nigambcb705f2013-12-26 14:26:22 +05309264 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009265 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009266 status = sme_AcquireGlobalLock( &pMac->sme );
9267 if ( HAL_STATUS_SUCCESS( status ) )
9268 {
9269 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309270 "LFR runtime successfully set roam scan control to %d"
9271 " - old value is %d - roam state is %s",
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009272 roamScanControl,
9273 pMac->roam.configParam.nRoamScanControl,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309274 macTraceGetNeighbourRoamState(
9275 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009276 pMac->roam.configParam.nRoamScanControl = roamScanControl;
9277 if ( 0 == roamScanControl)
9278 {
9279 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9280 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009281 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009282#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9283 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9284 {
9285 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
9286 }
9287#endif
9288 }
9289 sme_ReleaseGlobalLock( &pMac->sme );
9290 }
9291 return status ;
9292}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009293#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_ESE) || (FEATURE_WLAN_LFR) */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009294
9295#ifdef FEATURE_WLAN_LFR
9296/*--------------------------------------------------------------------------
9297 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009298 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009299 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009300 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009301 \param hHal - The handle returned by macOpen.
9302 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
9303 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
9304 \sa
9305 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009306eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009307 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009308{
9309 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9310
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009311 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
9312 {
9313 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9314 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9315 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9316 isFastRoamIniFeatureEnabled);
9317 return eHAL_STATUS_SUCCESS;
9318 }
9319
Srinivas Girigowdade697412013-02-14 16:31:48 -08009320 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9321 "%s: FastRoamEnabled is changed from %d to %d", __func__,
9322 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9323 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009324 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009325 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009326
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009327 return eHAL_STATUS_SUCCESS;
9328}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07009329
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08009330/*--------------------------------------------------------------------------
Mukul Sharma2a271632014-10-13 14:59:01 +05309331 \brief sme_ConfigFwrRoaming() - enable/disable LFR support at runtime
9332 When Supplicant issue enabled / disable fwr based roaming on the basis
9333 of the Bssid modification in network block ( e.g. AutoJoin mody N/W block)
9334
9335 This is a synchronous call
9336 \param hHal - The handle returned by macOpen.
9337 \return eHAL_STATUS_SUCCESS - SME (enabled/disabled) offload scan successfully.
9338 Other status means SME is failed to (enabled/disabled) offload scan.
9339 \sa
9340 --------------------------------------------------------------------------*/
9341
9342eHalStatus sme_ConfigFwrRoaming(tHalHandle hHal,
9343 const v_BOOL_t isFastRoamEnabled)
9344{
9345 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9346 if (!pMac->roam.configParam.isFastRoamIniFeatureEnabled)
9347 {
9348 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9349 "%s: FastRoam is disabled through ini", __func__);
9350 return eHAL_STATUS_FAILURE;
9351 }
9352 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamEnabled);
9353 return eHAL_STATUS_SUCCESS;
9354}
9355
9356/*--------------------------------------------------------------------------
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08009357 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
9358 Enable/disable LFR MAWC support at runtime
9359 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9360 isMAWCIniFeatureEnabled.
9361 This is a synchronous call
9362 \param hHal - The handle returned by macOpen.
9363 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
9364 Other status means SME is failed to update MAWCEnabled.
9365 \sa
9366 --------------------------------------------------------------------------*/
9367eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
9368 const v_BOOL_t MAWCEnabled)
9369{
9370 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9371 eHalStatus status = eHAL_STATUS_SUCCESS;
9372
9373 status = sme_AcquireGlobalLock( &pMac->sme );
9374 if ( HAL_STATUS_SUCCESS( status ) )
9375 {
9376 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9377 "%s: MAWCEnabled is changed from %d to %d", __func__,
9378 pMac->roam.configParam.MAWCEnabled,
9379 MAWCEnabled);
9380 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
9381 sme_ReleaseGlobalLock( &pMac->sme );
9382 }
9383
9384 return status ;
9385
9386}
9387
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07009388#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9389/*--------------------------------------------------------------------------
9390 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
9391 This is a synchronuous call
9392 \param hHal - The handle returned by macOpen.
9393 \return eHAL_STATUS_SUCCESS
9394 Other status means SME is failed
9395 \sa
9396 --------------------------------------------------------------------------*/
9397
9398eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
9399 v_BOOL_t bFastRoamInConIniFeatureEnabled)
9400{
9401
9402 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9403 eHalStatus status = eHAL_STATUS_SUCCESS;
9404
9405 status = sme_AcquireGlobalLock( &pMac->sme );
9406 if ( HAL_STATUS_SUCCESS( status ) )
9407 {
9408 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
9409 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
9410 {
9411 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
9412 }
9413 sme_ReleaseGlobalLock( &pMac->sme );
9414 }
9415
9416 return status;
9417}
9418#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009419#endif /* FEATURE_WLAN_LFR */
9420
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009421#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009422/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009423 \brief sme_UpdateIsEseFeatureEnabled() - enable/disable Ese support at runtime
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009424 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009425 isEseIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009426 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009427 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009428 \return eHAL_STATUS_SUCCESS - SME update isEseIniFeatureEnabled config successfully.
9429 Other status means SME is failed to update isEseIniFeatureEnabled.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009430 \sa
9431 --------------------------------------------------------------------------*/
9432
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009433eHalStatus sme_UpdateIsEseFeatureEnabled(tHalHandle hHal,
9434 const v_BOOL_t isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009435{
9436 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9437
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009438 if (pMac->roam.configParam.isEseIniFeatureEnabled == isEseIniFeatureEnabled)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009439 {
9440 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009441 "%s: Ese Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9442 pMac->roam.configParam.isEseIniFeatureEnabled,
9443 isEseIniFeatureEnabled);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009444 return eHAL_STATUS_SUCCESS;
9445 }
9446
Srinivas Girigowdade697412013-02-14 16:31:48 -08009447 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009448 "%s: EseEnabled is changed from %d to %d", __func__,
9449 pMac->roam.configParam.isEseIniFeatureEnabled,
9450 isEseIniFeatureEnabled);
9451 pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled;
9452 csrNeighborRoamUpdateEseModeEnabled(pMac, isEseIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009453
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009454 if(TRUE == isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009455 {
9456 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009457 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07009458
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009459#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9460 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9461 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009462 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_ESE_INI_CFG_CHANGED);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009463 }
9464#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009465 return eHAL_STATUS_SUCCESS;
9466}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009467#endif /* FEATURE_WLAN_ESE */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009468
9469/*--------------------------------------------------------------------------
9470 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
9471 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9472 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009473 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009474 \param hHal - The handle returned by macOpen.
9475 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
9476 Other status means SME is failed to update fEnableFwRssiMonitoring.
9477 \sa
9478 --------------------------------------------------------------------------*/
9479
9480eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
9481 v_BOOL_t fEnableFwRssiMonitoring)
9482{
9483 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
9484
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009485 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
9486 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
9487 {
9488 halStatus = eHAL_STATUS_FAILURE;
9489 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009490 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009491 }
9492
9493 return (halStatus);
9494}
9495
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009496#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08009497/*--------------------------------------------------------------------------
9498 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
9499 This is a synchronous call
9500 \param hHal - The handle returned by macOpen.
9501 \return eHAL_STATUS_SUCCESS - SME update config successful.
9502 Other status means SME is failed to update
9503 \sa
9504 --------------------------------------------------------------------------*/
9505eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
9506 v_U8_t neighborLookupRssiThreshold)
9507{
9508 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9509 eHalStatus status = eHAL_STATUS_SUCCESS;
9510
9511 status = sme_AcquireGlobalLock( &pMac->sme );
9512 if ( HAL_STATUS_SUCCESS( status ) )
9513 {
9514 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
9515 if (HAL_STATUS_SUCCESS(status))
9516 {
9517 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309518 "LFR runtime successfully set Lookup threshold to %d"
9519 " - old value is %d - roam state is %s",
9520 neighborLookupRssiThreshold,
9521 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
9522 macTraceGetNeighbourRoamState(
9523 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009524 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
9525 neighborLookupRssiThreshold;
9526 }
9527 sme_ReleaseGlobalLock( &pMac->sme );
9528 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009529 return status;
9530}
9531
9532/*--------------------------------------------------------------------------
9533 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
9534 This is a synchronous call
9535 \param hHal - The handle returned by macOpen.
9536 \return eHAL_STATUS_SUCCESS - SME update config successful.
9537 Other status means SME is failed to update
9538 \sa
9539 --------------------------------------------------------------------------*/
9540eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
9541 v_U8_t neighborReassocRssiThreshold)
9542{
9543 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9544 eHalStatus status = eHAL_STATUS_SUCCESS;
9545
9546 status = sme_AcquireGlobalLock( &pMac->sme );
9547 if ( HAL_STATUS_SUCCESS( status ) )
9548 {
9549 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309550 "LFR runtime successfully set Reassoc threshold to %d"
9551 "- old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009552 neighborReassocRssiThreshold,
9553 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309554 macTraceGetNeighbourRoamState(
9555 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009556 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
9557 neighborReassocRssiThreshold;
9558 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
9559 neighborReassocRssiThreshold;
9560 sme_ReleaseGlobalLock( &pMac->sme );
9561 }
9562
9563 return status ;
9564}
9565
9566
9567/*--------------------------------------------------------------------------
9568 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
9569 This is a synchronous call
9570 \param hHal - The handle returned by macOpen.
9571 \return eHAL_STATUS_SUCCESS - SME update config successful.
9572 Other status means SME is failed to update
9573 \sa
9574 --------------------------------------------------------------------------*/
9575v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
9576{
9577 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9578 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
9579}
9580
9581/*--------------------------------------------------------------------------
9582 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
9583 This is a synchronous call
9584 \param hHal - The handle returned by macOpen.
9585 \return eHAL_STATUS_SUCCESS - SME update config successful.
9586 Other status means SME is failed to update
9587 \sa
9588 --------------------------------------------------------------------------*/
9589eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
9590 v_U16_t neighborScanResultsRefreshPeriod)
9591{
9592 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9593 eHalStatus status = eHAL_STATUS_SUCCESS;
9594
9595 status = sme_AcquireGlobalLock( &pMac->sme );
9596 if ( HAL_STATUS_SUCCESS( status ) )
9597 {
9598 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309599 "LFR runtime successfully set roam scan refresh period to %d"
9600 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009601 neighborScanResultsRefreshPeriod,
9602 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309603 macTraceGetNeighbourRoamState(
9604 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009605 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
9606 neighborScanResultsRefreshPeriod;
9607 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
9608 neighborScanResultsRefreshPeriod;
9609
9610 sme_ReleaseGlobalLock( &pMac->sme );
9611 }
9612
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009613#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9614 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9615 {
9616 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9617 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
9618 }
9619#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009620 return status ;
9621}
9622
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009623#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9624/*--------------------------------------------------------------------------
9625 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
9626 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9627 gRoamScanOffloadEnabled.
9628 This is a synchronous call
9629 \param hHal - The handle returned by macOpen.
9630 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9631 Other status means SME is failed to update.
9632 \sa
9633 --------------------------------------------------------------------------*/
9634
9635eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
9636 v_BOOL_t nRoamScanOffloadEnabled)
9637{
9638 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9639 eHalStatus status = eHAL_STATUS_SUCCESS;
9640
9641 status = sme_AcquireGlobalLock( &pMac->sme );
9642 if ( HAL_STATUS_SUCCESS( status ) )
9643 {
9644 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9645 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
9646 pMac->roam.configParam.isRoamOffloadScanEnabled,
9647 nRoamScanOffloadEnabled);
9648 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
9649 sme_ReleaseGlobalLock( &pMac->sme );
9650 }
9651
9652 return status ;
9653}
9654#endif
9655
Srinivas Girigowdade697412013-02-14 16:31:48 -08009656/*--------------------------------------------------------------------------
9657 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
9658 This is a synchronous call
9659 \param hHal - The handle returned by macOpen.
9660 \return v_U16_t - Neighbor scan results refresh period value
9661 \sa
9662 --------------------------------------------------------------------------*/
9663v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
9664{
9665 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9666 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
9667}
9668
9669/*--------------------------------------------------------------------------
9670 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
9671 This is a synchronuous call
9672 \param hHal - The handle returned by macOpen.
9673 \return eHAL_STATUS_SUCCESS - SME update config successful.
9674 Other status means SME is failed to update
9675 \sa
9676 --------------------------------------------------------------------------*/
9677v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
9678{
9679 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9680 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
9681}
9682
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009683/* ---------------------------------------------------------------------------
9684 \fn sme_UpdateEmptyScanRefreshPeriod
9685 \brief Update nEmptyScanRefreshPeriod
9686 This function is called through dynamic setConfig callback function
9687 to configure nEmptyScanRefreshPeriod
9688 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
9689 \param hHal - HAL handle for device
9690 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
9691 \- return Success or failure
9692 -------------------------------------------------------------------------*/
9693
9694eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
9695{
9696 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9697 eHalStatus status = eHAL_STATUS_SUCCESS;
9698
9699 status = sme_AcquireGlobalLock( &pMac->sme );
9700 if ( HAL_STATUS_SUCCESS( status ) )
9701 {
9702 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309703 "LFR runtime successfully set roam scan period to %d -"
9704 "old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009705 nEmptyScanRefreshPeriod,
9706 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309707 macTraceGetNeighbourRoamState(
9708 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009709 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9710 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9711 sme_ReleaseGlobalLock( &pMac->sme );
9712 }
9713
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009714#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9715 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9716 {
9717 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9718 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
9719 }
9720#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009721 return status ;
9722}
9723
9724/* ---------------------------------------------------------------------------
9725 \fn sme_setNeighborScanMinChanTime
9726 \brief Update nNeighborScanMinChanTime
9727 This function is called through dynamic setConfig callback function
9728 to configure gNeighborScanChannelMinTime
9729 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
9730 \param hHal - HAL handle for device
9731 \param nNeighborScanMinChanTime - Channel minimum dwell time
9732 \- return Success or failure
9733 -------------------------------------------------------------------------*/
9734eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
9735{
9736 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9737 eHalStatus status = eHAL_STATUS_SUCCESS;
9738
9739 status = sme_AcquireGlobalLock( &pMac->sme );
9740 if ( HAL_STATUS_SUCCESS( status ) )
9741 {
9742 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309743 "LFR runtime successfully set channel min dwell time to %d"
9744 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009745 nNeighborScanMinChanTime,
9746 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309747 macTraceGetNeighbourRoamState(
9748 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009749 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
9750 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
9751 sme_ReleaseGlobalLock( &pMac->sme );
9752 }
9753
9754 return status ;
9755}
9756
9757/* ---------------------------------------------------------------------------
9758 \fn sme_setNeighborScanMaxChanTime
9759 \brief Update nNeighborScanMaxChanTime
9760 This function is called through dynamic setConfig callback function
9761 to configure gNeighborScanChannelMaxTime
9762 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
9763 \param hHal - HAL handle for device
9764 \param nNeighborScanMinChanTime - Channel maximum dwell time
9765 \- return Success or failure
9766 -------------------------------------------------------------------------*/
9767eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
9768{
9769 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9770 eHalStatus status = eHAL_STATUS_SUCCESS;
9771
9772 status = sme_AcquireGlobalLock( &pMac->sme );
9773 if ( HAL_STATUS_SUCCESS( status ) )
9774 {
9775 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309776 "LFR runtime successfully set channel max dwell time to %d"
9777 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009778 nNeighborScanMaxChanTime,
9779 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309780 macTraceGetNeighbourRoamState(
9781 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009782 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
9783 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
9784 sme_ReleaseGlobalLock( &pMac->sme );
9785 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009786#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9787 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9788 {
9789 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9790 REASON_SCAN_CH_TIME_CHANGED);
9791 }
9792#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009793
9794 return status ;
9795}
9796
9797/* ---------------------------------------------------------------------------
9798 \fn sme_getNeighborScanMinChanTime
9799 \brief get neighbor scan min channel time
9800 \param hHal - The handle returned by macOpen.
9801 \return v_U16_t - channel min time value
9802 -------------------------------------------------------------------------*/
9803v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
9804{
9805 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9806 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
9807}
9808
9809/* ---------------------------------------------------------------------------
9810 \fn sme_getNeighborScanMaxChanTime
9811 \brief get neighbor scan max channel time
9812 \param hHal - The handle returned by macOpen.
9813 \return v_U16_t - channel max time value
9814 -------------------------------------------------------------------------*/
9815v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
9816{
9817 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9818 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
9819}
9820
9821/* ---------------------------------------------------------------------------
9822 \fn sme_setNeighborScanPeriod
9823 \brief Update nNeighborScanPeriod
9824 This function is called through dynamic setConfig callback function
9825 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009826 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009827 \param hHal - HAL handle for device
9828 \param nNeighborScanPeriod - neighbor scan period
9829 \- return Success or failure
9830 -------------------------------------------------------------------------*/
9831eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
9832{
9833 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9834 eHalStatus status = eHAL_STATUS_SUCCESS;
9835
9836 status = sme_AcquireGlobalLock( &pMac->sme );
9837 if ( HAL_STATUS_SUCCESS( status ) )
9838 {
9839 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309840 "LFR runtime successfully set neighbor scan period to %d"
9841 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009842 nNeighborScanPeriod,
9843 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309844 macTraceGetNeighbourRoamState(
9845 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009846 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
9847 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
9848 sme_ReleaseGlobalLock( &pMac->sme );
9849 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009850#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9851 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9852 {
9853 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9854 REASON_SCAN_HOME_TIME_CHANGED);
9855 }
9856#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009857
9858 return status ;
9859}
9860
9861/* ---------------------------------------------------------------------------
9862 \fn sme_getNeighborScanPeriod
9863 \brief get neighbor scan period
9864 \param hHal - The handle returned by macOpen.
9865 \return v_U16_t - neighbor scan period
9866 -------------------------------------------------------------------------*/
9867v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
9868{
9869 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9870 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
9871}
9872
9873#endif
9874
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009875#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009876
Srinivas Girigowdade697412013-02-14 16:31:48 -08009877/*--------------------------------------------------------------------------
9878 \brief sme_getRoamRssiDiff() - get Roam rssi diff
9879 This is a synchronous call
9880 \param hHal - The handle returned by macOpen.
9881 \return v_U16_t - Rssi diff value
9882 \sa
9883 --------------------------------------------------------------------------*/
9884v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
9885{
9886 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9887 return pMac->roam.configParam.RoamRssiDiff;
9888}
9889
9890/*--------------------------------------------------------------------------
9891 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
9892 This is a synchronous call
9893 \param hHal - The handle returned by macOpen.
9894 \return eHAL_STATUS_SUCCESS - SME update config successful.
9895 Other status means SME is failed to update
9896 \sa
9897 --------------------------------------------------------------------------*/
9898eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9899 tANI_U8 numChannels)
9900{
9901 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9902 eHalStatus status = eHAL_STATUS_SUCCESS;
9903 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009904 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +05309905 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08009906 tANI_U8 i = 0, j = 0;
9907
9908 status = sme_AcquireGlobalLock( &pMac->sme );
9909 if ( HAL_STATUS_SUCCESS( status ) )
9910 {
9911 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9912 {
9913 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
9914 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309915 if (j < sizeof(oldChannelList))
9916 {
9917 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9918 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9919 }
9920 else
9921 {
9922 break;
9923 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009924 }
9925 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009926 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009927 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009928 sme_SetRoamScanControl(hHal, 1);
9929 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009930 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009931 j = 0;
9932 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009933 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309934 if (j < sizeof(oldChannelList))
9935 {
9936 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9937 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9938 }
9939 else
9940 {
9941 break;
9942 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009943 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009944 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009945
9946 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309947 "LFR runtime successfully set roam scan channels to %s"
9948 "- old value is %s - roam state is %s",
9949 newChannelList, oldChannelList,
9950 macTraceGetNeighbourRoamState(
9951 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009952 sme_ReleaseGlobalLock( &pMac->sme );
9953 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009954#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9955 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9956 {
9957 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9958 }
9959#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009960
9961 return status ;
9962}
9963
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009964
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009965#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009966/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009967 \brief sme_SetEseRoamScanChannelList() - set ese roam scan channel list
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009968 This is a synchronuous call
9969 \param hHal - The handle returned by macOpen.
9970 \return eHAL_STATUS_SUCCESS - SME update config successful.
9971 Other status means SME is failed to update
9972 \sa
9973 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009974eHalStatus sme_SetEseRoamScanChannelList(tHalHandle hHal,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009975 tANI_U8 *pChannelList,
9976 tANI_U8 numChannels)
9977{
9978 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9979 eHalStatus status = eHAL_STATUS_SUCCESS;
9980 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9981 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
9982 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
9983 tANI_U8 newChannelList[128] = {0};
9984 tANI_U8 i = 0, j = 0;
9985
9986 status = sme_AcquireGlobalLock( &pMac->sme );
9987 if ( HAL_STATUS_SUCCESS( status ) )
9988 {
9989 if (NULL != currChannelListInfo->ChannelList)
9990 {
9991 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
9992 {
9993 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9994 currChannelListInfo->ChannelList[i]);
9995 }
9996 }
9997 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
9998
9999 if ( HAL_STATUS_SUCCESS( status ))
10000 {
10001 if (NULL != currChannelListInfo->ChannelList)
10002 {
10003 j = 0;
10004 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
10005 {
10006 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
10007 currChannelListInfo->ChannelList[i]);
10008 }
10009 }
10010
10011 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010012 "ESE roam scan channel list successfully set to %s - old value is %s - roam state is %s",
10013 newChannelList, oldChannelList,
10014 macTraceGetNeighbourRoamState(pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010015 }
10016 sme_ReleaseGlobalLock( &pMac->sme );
10017 }
10018#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10019 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10020 {
10021 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
10022 }
10023#endif
10024
10025 return status ;
10026}
10027#endif
10028
Srinivas Girigowdade697412013-02-14 16:31:48 -080010029/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -080010030 \brief sme_getRoamScanChannelList() - get roam scan channel list
10031 This is a synchronous call
10032 \param hHal - The handle returned by macOpen.
10033 \return eHAL_STATUS_SUCCESS - SME update config successful.
10034 Other status means SME is failed to update
10035 \sa
10036 --------------------------------------------------------------------------*/
10037eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
10038 tANI_U8 *pNumChannels)
10039{
10040 int i = 0;
10041 tANI_U8 *pOutPtr = pChannelList;
10042 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10043 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
10044 eHalStatus status = eHAL_STATUS_SUCCESS;
10045
10046 status = sme_AcquireGlobalLock( &pMac->sme );
10047 if ( HAL_STATUS_SUCCESS( status ) )
10048 {
10049 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
10050 {
10051 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
10052 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010053 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -080010054 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010055 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -080010056 }
10057
10058 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
10059 for (i = 0; i < (*pNumChannels); i++)
10060 {
10061 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
10062 }
10063 pOutPtr[i] = '\0';
10064 sme_ReleaseGlobalLock( &pMac->sme );
10065 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080010066 return status ;
10067}
10068
10069/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010070 \brief sme_getIsEseFeatureEnabled() - get Ese feature enabled or not
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010071 This is a synchronuous call
10072 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010073 \return TRUE (1) - if the Ese feature is enabled
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010074 FALSE (0) - if feature is disabled (compile or runtime)
10075 \sa
10076 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010077tANI_BOOLEAN sme_getIsEseFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -080010078{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010079#ifdef FEATURE_WLAN_ESE
Srinivas Girigowdade697412013-02-14 16:31:48 -080010080 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010081 return csrRoamIsEseIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010082#else
10083 return eANI_BOOLEAN_FALSE;
10084#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080010085}
10086
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010087/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070010088 \brief sme_GetWESMode() - get WES Mode
10089 This is a synchronous call
10090 \param hHal - The handle returned by macOpen
10091 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
10092 \sa
10093 --------------------------------------------------------------------------*/
10094v_BOOL_t sme_GetWESMode(tHalHandle hHal)
10095{
10096 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10097 return pMac->roam.configParam.isWESModeEnabled;
10098}
10099
10100/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010101 \brief sme_GetRoamScanControl() - get scan control
10102 This is a synchronous call
10103 \param hHal - The handle returned by macOpen.
10104 \return v_BOOL_t - Enabled(1)/Disabled(0)
10105 \sa
10106 --------------------------------------------------------------------------*/
10107v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
10108{
10109 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10110 return pMac->roam.configParam.nRoamScanControl;
10111}
10112#endif
10113
10114/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010115 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
10116 This is a synchronuous call
10117 \param hHal - The handle returned by macOpen.
10118 \return TRUE (1) - if the feature is enabled
10119 FALSE (0) - if feature is disabled (compile or runtime)
10120 \sa
10121 --------------------------------------------------------------------------*/
10122tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
10123{
10124#ifdef FEATURE_WLAN_LFR
10125 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10126 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
10127#else
10128 return eANI_BOOLEAN_FALSE;
10129#endif
10130}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080010131
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010132/*--------------------------------------------------------------------------
10133 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
10134 This is a synchronuous call
10135 \param hHal - The handle returned by macOpen.
10136 \return TRUE (1) - if the feature is enabled
10137 FALSE (0) - if feature is disabled (compile or runtime)
10138 \sa
10139 --------------------------------------------------------------------------*/
10140tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
10141{
10142#ifdef WLAN_FEATURE_VOWIFI_11R
10143 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10144 return pMac->roam.configParam.isFastTransitionEnabled;
10145#else
10146 return eANI_BOOLEAN_FALSE;
10147#endif
10148}
10149
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010150/* ---------------------------------------------------------------------------
10151 \fn sme_IsFeatureSupportedByFW
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010152
Kiet Lam0f320422013-11-21 19:29:17 +053010153 \brief Check if a feature is enabled by FW
10154
10155 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010156
Kiet Lam0f320422013-11-21 19:29:17 +053010157 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010158 -------------------------------------------------------------------------*/
10159tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
10160{
10161 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
10162}
Kiet Lam0f320422013-11-21 19:29:17 +053010163
10164/* ---------------------------------------------------------------------------
10165 \fn sme_IsFeatureSupportedByDriver
10166 \brief Check if a feature is enabled by Driver
10167
10168 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
10169 \- return 1/0 (TRUE/FALSE)
10170 -------------------------------------------------------------------------*/
10171
10172tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
10173{
10174 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
10175}
10176
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010177#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053010178
10179/* ---------------------------------------------------------------------------
10180 \fn sme_SendTdlsMgmtFrame
10181 \brief API to send TDLS management frames.
10182
10183 \param peerMac - peer's Mac Adress.
10184 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
10185 \- return VOS_STATUS_SUCCES
10186 -------------------------------------------------------------------------*/
10187VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
10188 tANI_U8 sessionId,
10189 tSirMacAddr peerMac,
10190 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
10191{
10192 eHalStatus status = eHAL_STATUS_SUCCESS;
10193 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10194
10195 status = sme_AcquireGlobalLock( &pMac->sme );
10196
10197 if ( HAL_STATUS_SUCCESS( status ) )
10198 {
10199 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
10200 sme_ReleaseGlobalLock( &pMac->sme );
10201 }
10202 return status ;
10203}
10204
Atul Mittalc0f739f2014-07-31 13:47:47 +053010205// tdlsoffchan
10206
10207/* ---------------------------------------------------------------------------
10208 \fn sme_SendTdlsChanSwitchReq
10209 \brief API to send TDLS management frames.
10210
10211 \param peerMac - peer's Mac Adress.
10212 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
10213 \- return VOS_STATUS_SUCCES
10214 -------------------------------------------------------------------------*/
10215VOS_STATUS sme_SendTdlsChanSwitchReq(tHalHandle hHal,
10216 tANI_U8 sessionId,
10217 tSirMacAddr peerMac,
10218 tANI_S32 tdlsOffCh,
10219 tANI_S32 tdlsOffChBwOffset,
10220 tANI_U8 tdlsSwMode)
10221{
10222 eHalStatus status = eHAL_STATUS_SUCCESS;
10223 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10224
10225 status = sme_AcquireGlobalLock( &pMac->sme );
10226
10227 if ( HAL_STATUS_SUCCESS( status ) )
10228 {
10229 status = csrTdlsSendChanSwitchReq(hHal, sessionId, peerMac,
10230 tdlsOffCh, tdlsOffChBwOffset,
10231 tdlsSwMode);
10232 }
10233 sme_ReleaseGlobalLock( &pMac->sme );
10234 return status ;
10235}
10236
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010237/* ---------------------------------------------------------------------------
10238 \fn sme_SendTdlsMgmtFrame
10239 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010240
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010241 \param peerMac - peer's Mac Adress.
10242 \param frame_type - Type of TDLS mgmt frame to be sent.
10243 \param dialog - dialog token used in the frame.
10244 \param status - status to be incuded in the frame.
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010245 \param peerCapability - peer cpabilities
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010246 \param buf - additional IEs to be included
10247 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -080010248 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010249 \- return VOS_STATUS_SUCCES
10250 -------------------------------------------------------------------------*/
10251VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010252 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 -080010253{
10254 eHalStatus status = eHAL_STATUS_SUCCESS;
10255 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
10256 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10257
10258 status = sme_AcquireGlobalLock( &pMac->sme );
10259 if ( HAL_STATUS_SUCCESS( status ) )
10260 {
10261 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10262 sendTdlsReq.frameType = frame_type;
10263 sendTdlsReq.buf = buf;
10264 sendTdlsReq.len = len;
10265 sendTdlsReq.dialog = dialog;
10266 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -080010267 sendTdlsReq.responder = responder;
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010268 sendTdlsReq.peerCapability = peerCapability;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010269
10270 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
10271
10272 sme_ReleaseGlobalLock( &pMac->sme );
10273 }
10274
10275 return status ;
10276
10277}
10278/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010279 \fn sme_ChangeTdlsPeerSta
10280 \brief API to Update TDLS peer sta parameters.
10281
10282 \param peerMac - peer's Mac Adress.
10283 \param staParams - Peer Station Parameters
10284 \- return VOS_STATUS_SUCCES
10285 -------------------------------------------------------------------------*/
10286VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
10287 tCsrStaParams *pstaParams)
10288{
10289 eHalStatus status = eHAL_STATUS_SUCCESS;
10290 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10291
Sushant Kaushikd62d9782014-02-19 15:39:40 +053010292 if (NULL == pstaParams)
10293 {
10294 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10295 "%s :pstaParams is NULL",__func__);
10296 return eHAL_STATUS_FAILURE;
10297 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010298 status = sme_AcquireGlobalLock( &pMac->sme );
10299 if ( HAL_STATUS_SUCCESS( status ) )
10300 {
10301 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
10302
10303 sme_ReleaseGlobalLock( &pMac->sme );
10304 }
10305
10306 return status ;
10307
10308}
10309
10310/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010311 \fn sme_AddTdlsPeerSta
10312 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010313
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010314 \param peerMac - peer's Mac Adress.
10315 \- return VOS_STATUS_SUCCES
10316 -------------------------------------------------------------------------*/
10317VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10318{
10319 eHalStatus status = eHAL_STATUS_SUCCESS;
10320 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10321
10322 status = sme_AcquireGlobalLock( &pMac->sme );
10323 if ( HAL_STATUS_SUCCESS( status ) )
10324 {
10325 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
10326
10327 sme_ReleaseGlobalLock( &pMac->sme );
10328 }
10329
10330 return status ;
10331
10332}
10333/* ---------------------------------------------------------------------------
10334 \fn sme_DeleteTdlsPeerSta
10335 \brief API to Delete 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_DeleteTdlsPeerSta(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 = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
10349
10350 sme_ReleaseGlobalLock( &pMac->sme );
10351 }
10352
10353 return status ;
10354
10355}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -070010356/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070010357 \fn sme_SetTdlsPowerSaveProhibited
10358 \API to set/reset the isTdlsPowerSaveProhibited.
10359
10360 \- return void
10361 -------------------------------------------------------------------------*/
10362void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
10363{
10364 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10365
10366 pMac->isTdlsPowerSaveProhibited = val;
10367 return;
10368}
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010369#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +053010370/* ---------------------------------------------------------------------------
10371 \fn sme_IsPmcBmps
10372 \API to Check if PMC state is BMPS.
10373
10374 \- return v_BOOL_t
10375 -------------------------------------------------------------------------*/
10376v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
10377{
10378 return (BMPS == pmcGetPmcState(hHal));
10379}
10380
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010381#ifdef FEATURE_WLAN_TDLS_INTERNAL
10382/*
10383 * SME API to start TDLS discovery Procedure
10384 */
10385VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10386{
10387 VOS_STATUS status = VOS_STATUS_SUCCESS;
10388 tCsrTdlsDisRequest disReq = {{0}} ;
10389 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10390 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
10391
10392 return status ;
10393
10394}
10395
10396/*
10397 * Process TDLS discovery results
10398 */
10399v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
10400 tSmeTdlsDisResult *disResult, v_U8_t listType)
10401{
10402 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
10403 tSirTdlsPeerInfo *peerInfo = NULL ;
10404 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10405 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
10406 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
10407 tListElem *pEntry = NULL ;
10408 v_U8_t peerCnt = 0 ;
10409
10410 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010411 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010412 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
10413 while(pEntry)
10414 {
10415 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
10416 tdlsPeerStaLink) ;
10417 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
10418
10419 switch(listType)
10420 {
10421 case TDLS_SETUP_LIST:
10422 {
10423 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
10424 {
Kiet Lam64c1b492013-07-12 13:56:44 +053010425 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
10426 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010427 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
10428 peerCnt++ ;
10429 }
10430 break ;
10431 }
10432 case TDLS_DIS_LIST:
10433 {
Kiet Lam64c1b492013-07-12 13:56:44 +053010434 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
10435 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010436 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
10437 peerCnt++ ;
10438 break ;
10439 }
10440 default:
10441 {
10442 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010443 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010444 break ;
10445 }
10446 }
10447
10448 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
10449 }
10450
10451 return peerCnt ;
10452
10453}
10454
10455/*
10456 * SME API to start TDLS link setup Procedure.
10457 */
10458VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10459{
10460 VOS_STATUS status = VOS_STATUS_SUCCESS;
10461 tCsrTdlsSetupRequest setupReq = {{0}} ;
10462 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10463 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
10464 return status ;
10465
10466}
10467
10468/*
10469 * SME API to start TDLS link Teardown Procedure.
10470 */
10471VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10472{
10473 VOS_STATUS status = VOS_STATUS_SUCCESS;
10474 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
10475 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10476 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
10477 return status ;
10478
10479}
10480
10481#endif /* FEATURE_WLAN_TDLS */
10482
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070010483eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
10484{
10485 eHalStatus status = eHAL_STATUS_FAILURE;
10486 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10487
10488 smsLog(pMac, LOG2, FL("enter"));
10489 status = sme_AcquireGlobalLock( &pMac->sme );
10490 if ( HAL_STATUS_SUCCESS( status ) )
10491 {
10492 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
10493 sme_ReleaseGlobalLock( &pMac->sme );
10494 }
10495 smsLog(pMac, LOG2, FL("exit status %d"), status);
10496
10497 return (status);
10498}
10499
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -070010500/*
10501 * SME API to enable/disable WLAN driver initiated SSR
10502 */
10503void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
10504{
10505 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10506 eHalStatus status = eHAL_STATUS_SUCCESS;
10507
10508 status = sme_AcquireGlobalLock(&pMac->sme);
10509 if (HAL_STATUS_SUCCESS(status))
10510 {
10511 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
10512 "SSR level is changed %d", enableSSR);
10513 /* not serializing this messsage, as this is only going
10514 * to set a variable in WDA/WDI
10515 */
10516 WDA_SetEnableSSR(enableSSR);
10517 sme_ReleaseGlobalLock(&pMac->sme);
10518 }
10519 return;
10520}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010521
10522/*
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010523 * SME API to stringify bonding mode. (hostapd convention)
10524 */
10525
10526static const char* sme_CBMode2String( tANI_U32 mode)
10527{
10528 switch (mode)
10529 {
10530 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
10531 return "HT20";
10532 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
10533 return "HT40-"; /* lower secondary channel */
10534 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
10535 return "HT40+"; /* upper secondary channel */
10536#ifdef WLAN_FEATURE_11AC
10537 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
10538 return "VHT80+40+"; /* upper secondary channels */
10539 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
10540 return "VHT80+40-"; /* 1 lower and 2 upper secondary channels */
10541 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
10542 return "VHT80-40+"; /* 2 lower and 1 upper secondary channels */
10543 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
10544 return "VHT80-40-"; /* lower secondary channels */
10545#endif
10546 default:
10547 VOS_ASSERT(0);
10548 return "Unknown";
10549 }
10550}
10551
10552/*
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010553 * SME API to determine the channel bonding mode
10554 */
10555VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
10556{
10557 tSmeConfigParams smeConfig;
10558 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10559
10560 if (
10561#ifdef WLAN_FEATURE_11AC
10562 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
10563 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
10564#endif
10565 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
krunal soni634aba32014-03-06 17:46:50 -080010566 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode &&
10567
10568 eCSR_DOT11_MODE_11a != eCsrPhyMode &&
10569 eCSR_DOT11_MODE_11a_ONLY != eCsrPhyMode &&
10570
10571 eCSR_DOT11_MODE_abg != eCsrPhyMode
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010572 )
10573 {
10574 return VOS_STATUS_SUCCESS;
10575 }
10576
Kaushik, Sushant553a06c2014-11-26 15:29:40 +053010577 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010578 sme_GetConfigParam(pMac, &smeConfig);
10579
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010580 /* If channel bonding mode is not required */
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010581#ifdef WLAN_FEATURE_AP_HT40_24G
10582 if ( !pMac->roam.configParam.channelBondingMode5GHz
10583 && !smeConfig.csrConfig.apHT40_24GEnabled ) {
10584#else
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010585 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010586#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010587 return VOS_STATUS_SUCCESS;
10588 }
10589
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010590
10591#ifdef WLAN_FEATURE_11AC
10592 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
10593 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
10594 {
10595 if ( channel== 36 || channel == 52 || channel == 100 ||
10596 channel == 116 || channel == 149 )
10597 {
10598 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010599 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010600 }
10601 else if ( channel == 40 || channel == 56 || channel == 104 ||
10602 channel == 120 || channel == 153 )
10603 {
10604 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010605 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010606 }
10607 else if ( channel == 44 || channel == 60 || channel == 108 ||
10608 channel == 124 || channel == 157 )
10609 {
10610 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010611 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010612 }
10613 else if ( channel == 48 || channel == 64 || channel == 112 ||
Leo Changd0a49842013-12-30 11:41:04 -080010614 channel == 128 || channel == 144 || channel == 161 )
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010615 {
10616 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010617 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010618 }
10619 else if ( channel == 165 )
10620 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010621 smeConfig.csrConfig.channelBondingMode5GHz =
10622 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010623 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010624
10625#ifdef WLAN_FEATURE_AP_HT40_24G
10626 if (smeConfig.csrConfig.apHT40_24GEnabled)
10627 {
10628 if (channel >= 1 && channel <= 7)
10629 smeConfig.csrConfig.channelBondingAPMode24GHz =
10630 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
10631 else if (channel >= 8 && channel <= 13)
10632 smeConfig.csrConfig.channelBondingAPMode24GHz =
10633 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
10634 else if (channel ==14)
10635 smeConfig.csrConfig.channelBondingAPMode24GHz =
10636 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10637 }
10638#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010639 }
10640#endif
10641
10642 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
10643 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
10644 {
10645 if ( channel== 40 || channel == 48 || channel == 56 ||
10646 channel == 64 || channel == 104 || channel == 112 ||
10647 channel == 120 || channel == 128 || channel == 136 ||
10648 channel == 144 || channel == 153 || channel == 161 )
10649 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010650 smeConfig.csrConfig.channelBondingMode5GHz =
10651 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010652 }
10653 else if ( channel== 36 || channel == 44 || channel == 52 ||
10654 channel == 60 || channel == 100 || channel == 108 ||
10655 channel == 116 || channel == 124 || channel == 132 ||
10656 channel == 140 || channel == 149 || channel == 157 )
10657 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010658 smeConfig.csrConfig.channelBondingMode5GHz =
10659 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010660 }
10661 else if ( channel == 165 )
10662 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010663 smeConfig.csrConfig.channelBondingMode5GHz =
10664 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010665 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010666
10667#ifdef WLAN_FEATURE_AP_HT40_24G
10668 if (smeConfig.csrConfig.apHT40_24GEnabled)
10669 {
10670 if (channel >= 1 && channel <= 7)
10671 smeConfig.csrConfig.channelBondingAPMode24GHz =
10672 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
10673 else if (channel >= 8 && channel <= 13)
10674 smeConfig.csrConfig.channelBondingAPMode24GHz =
10675 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
10676 else if (channel ==14)
10677 smeConfig.csrConfig.channelBondingAPMode24GHz =
10678 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10679 }
10680#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010681 }
krunal soni634aba32014-03-06 17:46:50 -080010682
10683 /*
10684 for 802.11a phy mode, channel bonding should be zero.
10685 From default config, it is set as PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3
10686 through csrChangeDefaultConfigParam function. We will override this
10687 value here.
10688 */
10689 if ( eCSR_DOT11_MODE_11a == eCsrPhyMode ||
10690 eCSR_DOT11_MODE_11a_ONLY == eCsrPhyMode ||
10691 eCSR_DOT11_MODE_abg == eCsrPhyMode)
10692 {
10693 smeConfig.csrConfig.channelBondingMode5GHz = 0;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010694#ifdef WLAN_FEATURE_AP_HT40_24G
10695 } else if ( eCSR_DOT11_MODE_11g_ONLY == eCsrPhyMode)
10696 smeConfig.csrConfig.channelBondingAPMode24GHz =
10697 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10698#else
krunal soni634aba32014-03-06 17:46:50 -080010699 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010700#endif
krunal soni634aba32014-03-06 17:46:50 -080010701
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010702#ifdef WLAN_FEATURE_AP_HT40_24G
10703 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10704 FL("%s cbmode selected=%d bonding mode:%s"),
10705 (channel <= 14) ? "2G" : "5G",
10706 (channel <= 14) ? smeConfig.csrConfig.channelBondingAPMode24GHz :
10707 smeConfig.csrConfig.channelBondingMode5GHz,
10708 (channel <= 14) ?
10709 sme_CBMode2String(smeConfig.csrConfig.channelBondingAPMode24GHz) :
10710 sme_CBMode2String(smeConfig.csrConfig.channelBondingMode5GHz));
10711#else
Agarwal Ashishbf98caf2014-03-25 13:29:11 +053010712 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010713 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
10714#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010715
10716 sme_UpdateConfig (pMac, &smeConfig);
10717 return VOS_STATUS_SUCCESS;
10718}
10719
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -070010720/*--------------------------------------------------------------------------
10721
10722 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
10723 \param hHal - The handle returned by macOpen.
10724 \param currDeviceMode - Current operating device mode.
10725 --------------------------------------------------------------------------*/
10726
10727void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
10728{
10729 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10730 pMac->sme.currDeviceMode = currDeviceMode;
10731 return;
10732}
10733
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -070010734#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10735/*--------------------------------------------------------------------------
10736 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
10737 from CSR.
10738 This is a synchronous call
10739 \param hHal - The handle returned by macOpen
10740 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
10741 BSSID, channel etc.)
10742 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
10743 Other status means SME is failed to send the request.
10744 \sa
10745 --------------------------------------------------------------------------*/
10746
10747eHalStatus sme_HandoffRequest(tHalHandle hHal,
10748 tCsrHandoffRequest *pHandoffInfo)
10749{
10750 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10751 eHalStatus status = eHAL_STATUS_SUCCESS;
10752
10753 status = sme_AcquireGlobalLock( &pMac->sme );
10754 if ( HAL_STATUS_SUCCESS( status ) )
10755 {
10756 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10757 "%s: invoked", __func__);
10758 status = csrHandoffRequest(pMac, pHandoffInfo);
10759 sme_ReleaseGlobalLock( &pMac->sme );
10760 }
10761
10762 return status ;
10763}
10764#endif
10765
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -070010766/*
10767 * SME API to check if there is any infra station or
10768 * P2P client is connected
10769 */
10770VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
10771{
10772 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10773 if(csrIsInfraConnected(pMac))
10774 {
10775 return VOS_STATUS_SUCCESS;
10776 }
10777 return VOS_STATUS_E_FAILURE;
10778}
10779
Agarwal Ashish57e84372014-12-05 18:26:53 +053010780/*
10781 * SME API to check if any sessoion connected.
10782 */
10783VOS_STATUS sme_is_any_session_connected(tHalHandle hHal)
10784{
10785 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10786 if(csrIsAnySessionConnected(pMac))
10787 {
10788
10789 return VOS_STATUS_SUCCESS;
10790 }
10791 return VOS_STATUS_E_FAILURE;
10792}
10793
Leo Chang9056f462013-08-01 19:21:11 -070010794
10795#ifdef FEATURE_WLAN_LPHB
10796/* ---------------------------------------------------------------------------
10797 \fn sme_LPHBConfigReq
10798 \API to make configuration LPHB within FW.
10799 \param hHal - The handle returned by macOpen
10800 \param lphdReq - LPHB request argument by client
10801 \param pCallbackfn - LPHB timeout notification callback function pointer
10802 \- return Configuration message posting status, SUCCESS or Fail
10803 -------------------------------------------------------------------------*/
10804eHalStatus sme_LPHBConfigReq
10805(
10806 tHalHandle hHal,
10807 tSirLPHBReq *lphdReq,
10808 void (*pCallbackfn)(void *pAdapter, void *indParam)
10809)
10810{
10811 eHalStatus status = eHAL_STATUS_SUCCESS;
10812 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
10813 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10814 vos_msg_t vosMessage;
10815
10816 status = sme_AcquireGlobalLock(&pMac->sme);
10817 if (eHAL_STATUS_SUCCESS == status)
10818 {
10819 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
10820 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070010821 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070010822 {
10823 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10824 "%s: Indication Call back did not registered", __func__);
10825 sme_ReleaseGlobalLock(&pMac->sme);
10826 return eHAL_STATUS_FAILURE;
10827 }
10828 else if (NULL != pCallbackfn)
10829 {
Leo Changd9df8aa2013-09-26 13:32:26 -070010830 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070010831 }
10832
10833 /* serialize the req through MC thread */
10834 vosMessage.bodyptr = lphdReq;
10835 vosMessage.type = WDA_LPHB_CONF_REQ;
10836 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
10837 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
10838 {
10839 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10840 "%s: Post Config LPHB MSG fail", __func__);
10841 status = eHAL_STATUS_FAILURE;
10842 }
10843 sme_ReleaseGlobalLock(&pMac->sme);
10844 }
10845
10846 return(status);
10847}
10848#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070010849/*--------------------------------------------------------------------------
10850 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
10851 scan parameter.
10852 This is a synchronous call
10853 \param hHal - The handle returned by macOpen
10854 \return NONE.
10855 \sa
10856 --------------------------------------------------------------------------*/
10857void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
10858 tANI_U8 nNumP2PChan)
10859{
10860 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10861
10862 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
10863 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
10864
10865 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10866 "%s: SCAN nNumStaChanCombinedConc : %d,"
10867 "nNumP2PChanCombinedConc : %d ",
10868 __func__, nNumStaChan, nNumP2PChan);
10869
10870 return;
10871
10872}
Leo Chang9056f462013-08-01 19:21:11 -070010873
Yue Mab9c86f42013-08-14 15:59:08 -070010874/* ---------------------------------------------------------------------------
10875 \fn sme_AddPeriodicTxPtrn
10876 \brief API to Periodic TX Pattern Offload feature
10877 \param hHal - The handle returned by macOpen
10878 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
10879 \return eHalStatus
10880 ---------------------------------------------------------------------------*/
10881eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
10882 *addPeriodicTxPtrnParams)
10883{
10884 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10885 eHalStatus status;
10886 vos_msg_t msg;
10887
10888 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10889 {
10890 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
10891 msg.bodyptr = addPeriodicTxPtrnParams;
10892
10893 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10894 {
10895 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10896 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
10897 __func__);
10898
10899 sme_ReleaseGlobalLock(&pMac->sme);
10900 return eHAL_STATUS_FAILURE;
10901 }
10902
10903 sme_ReleaseGlobalLock(&pMac->sme);
10904 return eHAL_STATUS_SUCCESS;
10905 }
10906
10907 return status;
10908}
10909
10910/* ---------------------------------------------------------------------------
10911 \fn sme_DelPeriodicTxPtrn
10912 \brief API to Periodic TX Pattern Offload feature
10913 \param hHal - The handle returned by macOpen
10914 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
10915 \return eHalStatus
10916 ---------------------------------------------------------------------------*/
10917eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
10918 *delPeriodicTxPtrnParams)
10919{
10920 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10921 eHalStatus status;
10922 vos_msg_t msg;
10923
10924 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10925 {
10926 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
10927 msg.bodyptr = delPeriodicTxPtrnParams;
10928
10929 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10930 {
10931 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10932 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
10933 __func__);
10934
10935 sme_ReleaseGlobalLock(&pMac->sme);
10936 return eHAL_STATUS_FAILURE;
10937 }
10938
10939 sme_ReleaseGlobalLock(&pMac->sme);
10940 return eHAL_STATUS_SUCCESS;
10941 }
10942
10943 return status;
10944}
10945
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010946void smeGetCommandQStatus( tHalHandle hHal )
10947{
10948 tSmeCmd *pTempCmd = NULL;
10949 tListElem *pEntry;
10950 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10951
10952 if (NULL == pMac)
10953 {
Kiet Lamcffc5862013-10-30 16:28:45 +053010954 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
10955 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010956 return;
10957 }
10958
10959 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
10960 if( pEntry )
10961 {
10962 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
10963 }
10964 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
10965 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
10966 if(pTempCmd)
10967 {
10968 if( eSmeCsrCommandMask & pTempCmd->command )
10969 {
10970 //CSR command is stuck. See what the reason code is for that command
10971 dumpCsrCommandInfo(pMac, pTempCmd);
10972 }
10973 } //if(pTempCmd)
10974
10975 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
10976 csrLLCount(&pMac->sme.smeCmdPendingList));
10977
10978 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
10979 csrLLCount(&pMac->roam.roamCmdPendingList));
10980
10981 return;
10982}
Rajeev79dbe4c2013-10-05 11:03:42 +053010983
10984#ifdef FEATURE_WLAN_BATCH_SCAN
10985/* ---------------------------------------------------------------------------
10986 \fn sme_SetBatchScanReq
10987 \brief API to set batch scan request in FW
10988 \param hHal - The handle returned by macOpen.
10989 \param pRequest - Pointer to the batch request.
10990 \param sessionId - session ID
10991 \param callbackRoutine - HDD callback which needs to be invoked after
10992 getting set batch scan response from FW
10993 \param callbackContext - pAdapter context
10994 \return eHalStatus
10995 ---------------------------------------------------------------------------*/
10996eHalStatus sme_SetBatchScanReq
10997(
10998 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
10999 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
11000 void *callbackContext
11001)
11002{
11003 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11004 eHalStatus status;
11005
Yue Mae36e3552014-03-05 17:06:20 -080011006 if (!pMac)
11007 {
11008 return eHAL_STATUS_FAILURE;
11009 }
11010
Rajeev79dbe4c2013-10-05 11:03:42 +053011011 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11012 {
11013 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
11014 callbackContext);
11015 sme_ReleaseGlobalLock( &pMac->sme );
11016 }
11017
11018 return status;
11019}
11020
11021/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -070011022 \fn sme_SendRateUpdateInd
11023 \brief API to Update rate
11024 \param hHal - The handle returned by macOpen
11025 \param rateUpdateParams - Pointer to rate update params
11026 \return eHalStatus
11027 ---------------------------------------------------------------------------*/
11028eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
11029{
11030 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11031 eHalStatus status;
11032 vos_msg_t msg;
11033
11034 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11035 {
11036 msg.type = WDA_RATE_UPDATE_IND;
11037 msg.bodyptr = rateUpdateParams;
11038
11039 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
11040 {
11041 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
11042 "to post WDA_SET_RMC_RATE_IND to WDA!",
11043 __func__);
11044
11045 sme_ReleaseGlobalLock(&pMac->sme);
11046 return eHAL_STATUS_FAILURE;
11047 }
11048
11049 sme_ReleaseGlobalLock(&pMac->sme);
11050 return eHAL_STATUS_SUCCESS;
11051 }
11052
11053 return status;
11054}
11055
11056/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053011057 \fn sme_TriggerBatchScanResultInd
11058 \brief API to trigger batch scan result indications from FW
11059 \param hHal - The handle returned by macOpen.
11060 \param pRequest - Pointer to get batch request.
11061 \param sessionId - session ID
11062 \param callbackRoutine - HDD callback which needs to be invoked after
11063 getting batch scan result indication from FW
11064 \param callbackContext - pAdapter context
11065 \return eHalStatus
11066 ---------------------------------------------------------------------------*/
11067eHalStatus sme_TriggerBatchScanResultInd
11068(
11069 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
11070 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
11071 void *callbackContext
11072)
11073{
11074 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11075 eHalStatus status;
11076
11077 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11078 {
11079 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
11080 callbackRoutine, callbackContext);
11081 sme_ReleaseGlobalLock( &pMac->sme );
11082 }
11083
11084 return status;
11085}
11086
11087
11088/* ---------------------------------------------------------------------------
11089 \fn sme_StopBatchScanInd
11090 \brief API to stop batch scan request in FW
11091 \param hHal - The handle returned by macOpen.
11092 \param pRequest - Pointer to the batch request.
11093 \param sessionId - session ID
11094 \return eHalStatus
11095 ---------------------------------------------------------------------------*/
11096eHalStatus sme_StopBatchScanInd
11097(
11098 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
11099)
11100{
11101 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11102 eHalStatus status;
11103
11104 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11105 {
11106 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
11107 sme_ReleaseGlobalLock( &pMac->sme );
11108 }
11109
11110 return status;
11111}
11112
11113#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080011114
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011115
Leo Chang0b0e45a2013-12-15 15:18:55 -080011116#ifdef FEATURE_WLAN_CH_AVOID
11117/* ---------------------------------------------------------------------------
11118 \fn sme_AddChAvoidCallback
11119 \brief Used to plug in callback function
11120 Which notify channel may not be used with SAP or P2PGO mode.
11121 Notification come from FW.
11122 \param hHal
11123 \param pCallbackfn : callback function pointer should be plugged in
11124 \- return eHalStatus
11125 -------------------------------------------------------------------------*/
11126eHalStatus sme_AddChAvoidCallback
11127(
11128 tHalHandle hHal,
11129 void (*pCallbackfn)(void *pAdapter, void *indParam)
11130)
11131{
11132 eHalStatus status = eHAL_STATUS_SUCCESS;
11133 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11134
11135 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
11136 "%s: Plug in CH AVOID CB", __func__);
11137
11138 status = sme_AcquireGlobalLock(&pMac->sme);
11139 if (eHAL_STATUS_SUCCESS == status)
11140 {
11141 if (NULL != pCallbackfn)
11142 {
11143 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
11144 }
11145 sme_ReleaseGlobalLock(&pMac->sme);
11146 }
11147
11148 return(status);
11149}
11150#endif /* FEATURE_WLAN_CH_AVOID */
11151
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011152void activeListCmdTimeoutHandle(void *userData)
11153{
11154 if (NULL == userData)
11155 return;
11156 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11157 "%s: Active List command timeout Cmd List Count %d", __func__,
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080011158 csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011159 smeGetCommandQStatus((tHalHandle) userData);
11160}
11161
Sunil Duttc69bccb2014-05-26 21:30:20 +053011162#ifdef WLAN_FEATURE_LINK_LAYER_STATS
11163
11164/* ---------------------------------------------------------------------------
11165 \fn sme_LLStatsSetReq
11166 \brief API to set link layer stats request to FW
11167 \param hHal - The handle returned by macOpen.
11168
11169 \Param pStatsReq - a pointer to a caller allocated object of
11170 typedef struct tSirLLStatsSetReq, signifying the parameters to link layer
11171 stats set.
11172
11173 \return eHalStatus
11174 ---------------------------------------------------------------------------*/
11175eHalStatus sme_LLStatsSetReq(tHalHandle hHal,
11176 tSirLLStatsSetReq *pLinkLayerStatsSetReq)
11177{
11178 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11179 vos_msg_t msg;
11180 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011181 tSirLLStatsSetReq *plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011182
Dino Mycledf0a5d92014-07-04 09:41:55 +053011183 plinkLayerSetReq = vos_mem_malloc(sizeof(*plinkLayerSetReq));
11184 if ( !plinkLayerSetReq)
11185 {
11186 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11187 "%s: Not able to allocate memory for "
11188 "WDA_LINK_LAYER_STATS_SET_REQ",
11189 __func__);
11190 return eHAL_STATUS_FAILURE;
11191 }
Sunil Duttc69bccb2014-05-26 21:30:20 +053011192
Dino Mycledf0a5d92014-07-04 09:41:55 +053011193 *plinkLayerSetReq = *pLinkLayerStatsSetReq;
11194
Sunil Duttc69bccb2014-05-26 21:30:20 +053011195
11196 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11197 {
11198 msg.type = WDA_LINK_LAYER_STATS_SET_REQ;
11199 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011200 msg.bodyptr = plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011201
11202 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11203 {
11204 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11205 "Not able to post SIR_HAL_LL_STATS_SET message to HAL", __func__);
11206 status = eHAL_STATUS_FAILURE;
11207 }
11208 sme_ReleaseGlobalLock( &pMac->sme );
11209 }
11210 else
11211 {
11212 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11213 "sme_AcquireGlobalLock error", __func__);
11214 }
11215 return status;
11216}
11217
11218/* ---------------------------------------------------------------------------
11219 \fn sme_LLStatsGetReq
11220 \brief API to get link layer stats request to FW
11221 \param hHal - The handle returned by macOpen.
11222
11223 \Param pStatsReq - a pointer to a caller allocated object of
11224 typedef struct tSirLLStatsGetReq, signifying the parameters to link layer
11225 stats get.
11226
11227 \return eHalStatus
11228 ---------------------------------------------------------------------------*/
11229eHalStatus sme_LLStatsGetReq(tHalHandle hHal,
11230 tSirLLStatsGetReq *pLinkLayerStatsGetReq)
11231{
11232 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11233 vos_msg_t msg;
11234 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011235 tSirLLStatsGetReq *pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011236
Dino Mycledf0a5d92014-07-04 09:41:55 +053011237 pGetStatsReq = vos_mem_malloc(sizeof(*pGetStatsReq));
11238 if ( !pGetStatsReq)
11239 {
11240 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11241 "%s: Not able to allocate memory for "
11242 "WDA_LINK_LAYER_STATS_GET_REQ",
11243 __func__);
11244 return eHAL_STATUS_FAILURE;
11245 }
11246 *pGetStatsReq = *pLinkLayerStatsGetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011247
11248 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11249 {
11250 msg.type = WDA_LINK_LAYER_STATS_GET_REQ;
11251 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011252 msg.bodyptr = pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011253 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11254 {
11255 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11256 "Not able to post SIR_HAL_LL_STATS_GET message to HAL", __func__);
11257 status = eHAL_STATUS_FAILURE;
11258 }
11259 sme_ReleaseGlobalLock( &pMac->sme );
11260 }
11261 else
11262 {
11263 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11264 "sme_AcquireGlobalLock error", __func__);
11265 }
11266 return status;
11267}
11268
11269/* ---------------------------------------------------------------------------
11270 \fn sme_LLStatsClearReq
11271 \brief API to clear link layer stats request to FW
11272 \param hHal - The handle returned by macOpen.
11273
11274 \Param pStatsReq - a pointer to a caller allocated object of
11275 typedef struct tSirLLStatsClearReq, signifying the parameters to link layer
11276 stats clear.
11277
11278 \return eHalStatus
11279 ---------------------------------------------------------------------------*/
11280eHalStatus sme_LLStatsClearReq(tHalHandle hHal,
11281 tSirLLStatsClearReq *pLinkLayerStatsClear)
11282{
11283 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11284 vos_msg_t msg;
11285 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011286 tSirLLStatsClearReq *pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011287
11288
Sunil Duttc69bccb2014-05-26 21:30:20 +053011289
Dino Mycledf0a5d92014-07-04 09:41:55 +053011290 pClearStatsReq = vos_mem_malloc(sizeof(*pClearStatsReq));
11291 if ( !pClearStatsReq)
11292 {
11293 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11294 "%s: Not able to allocate memory for "
11295 "WDA_LINK_LAYER_STATS_CLEAR_REQ",
11296 __func__);
11297 return eHAL_STATUS_FAILURE;
11298 }
11299
11300 *pClearStatsReq = *pLinkLayerStatsClear;
11301
Sunil Duttc69bccb2014-05-26 21:30:20 +053011302 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11303 {
11304 msg.type = WDA_LINK_LAYER_STATS_CLEAR_REQ;
11305 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011306 msg.bodyptr = pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011307
11308 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11309 {
11310 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11311 "Not able to post SIR_HAL_LL_STATS_CLEAR message to HAL", __func__);
11312 status = eHAL_STATUS_FAILURE;
11313 }
11314 sme_ReleaseGlobalLock( &pMac->sme );
11315 }
11316 else
11317 {
11318 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11319 "sme_AcquireGlobalLock error", __func__);
11320 }
11321
11322 return status;
11323}
11324
11325/* ---------------------------------------------------------------------------
11326 \fn sme_SetLinkLayerStatsIndCB
11327 \brief API to trigger Link Layer Statistic indications from FW
11328 \param hHal - The handle returned by macOpen.
11329 \param sessionId - session ID
11330 \param callbackRoutine - HDD callback which needs to be invoked after
11331 getting Link Layer Statistics from FW
11332 \param callbackContext - pAdapter context
11333 \return eHalStatus
11334 ---------------------------------------------------------------------------*/
11335eHalStatus sme_SetLinkLayerStatsIndCB
11336(
Dino Mycled3d50022014-07-07 12:58:25 +053011337 tHalHandle hHal,
11338 void (*callbackRoutine) (void *callbackCtx, int indType, void *pRsp,
11339 tANI_U8 *macAddr)
Sunil Duttc69bccb2014-05-26 21:30:20 +053011340)
11341{
11342 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11343 eHalStatus status;
11344
11345 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11346 {
11347 if (NULL != callbackRoutine)
11348 {
11349 pMac->sme.pLinkLayerStatsIndCallback = callbackRoutine;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011350 }
11351 sme_ReleaseGlobalLock( &pMac->sme );
11352 }
11353
11354 return status;
11355}
11356#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
11357
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080011358eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
11359{
11360 eHalStatus status = eHAL_STATUS_SUCCESS;
11361 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11362 pMac->fEnableDebugLog = set_value;
11363 return (status);
11364}
11365
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011366VOS_STATUS sme_UpdateDSCPtoUPMapping( tHalHandle hHal,
Kumar Anand82c009f2014-05-29 00:29:42 -070011367 sme_QosWmmUpType *dscpmapping,
11368 v_U8_t sessionId )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011369{
11370 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kumar Anand82c009f2014-05-29 00:29:42 -070011371 eHalStatus status = eHAL_STATUS_SUCCESS;
11372 v_U8_t i, j, peSessionId;
11373 tCsrRoamSession *pCsrSession = NULL;
11374 tpPESession pSession = NULL;
11375
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011376 status = sme_AcquireGlobalLock( &pMac->sme );
11377 if ( HAL_STATUS_SUCCESS( status ) )
11378 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011379 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
11380 {
11381 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11382 "%s: Invalid session Id %u", __func__, sessionId);
11383 sme_ReleaseGlobalLock( &pMac->sme);
11384 return eHAL_STATUS_FAILURE;
11385 }
11386 pCsrSession = CSR_GET_SESSION( pMac, sessionId );
11387
11388 if (pCsrSession == NULL)
11389 {
11390 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11391 "%s: CSR Session lookup fails %u", __func__, sessionId);
11392 sme_ReleaseGlobalLock( &pMac->sme);
11393 return eHAL_STATUS_FAILURE;
11394 }
11395
11396 pSession = peFindSessionByBssid( pMac,
11397 pCsrSession->connectedProfile.bssid, &peSessionId );
11398
11399 if (pSession == NULL)
11400 {
11401 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11402 "%s: Session lookup fails for BSSID", __func__);
11403 sme_ReleaseGlobalLock( &pMac->sme);
11404 return eHAL_STATUS_FAILURE;
11405 }
11406
11407 if ( !pSession->QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011408 {
11409 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11410 "%s: QOS Mapping IE not present", __func__);
11411 sme_ReleaseGlobalLock( &pMac->sme);
11412 return eHAL_STATUS_FAILURE;
11413 }
11414 else
11415 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011416 for (i = 0; i < SME_QOS_WMM_UP_MAX; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011417 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011418 for (j = pSession->QosMapSet.dscp_range[i][0];
11419 j <= pSession->QosMapSet.dscp_range[i][1]; j++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011420 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011421 if ((pSession->QosMapSet.dscp_range[i][0] == 255) &&
11422 (pSession->QosMapSet.dscp_range[i][1] == 255))
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011423 {
11424 dscpmapping[j]= 0;
11425 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11426 "%s: User Priority %d is not used in mapping",
11427 __func__, i);
11428 break;
11429 }
11430 else
11431 {
11432 dscpmapping[j]= i;
11433 }
11434 }
11435 }
Kumar Anand82c009f2014-05-29 00:29:42 -070011436 for (i = 0; i< pSession->QosMapSet.num_dscp_exceptions; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011437 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011438 if (pSession->QosMapSet.dscp_exceptions[i][0] != 255)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011439 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011440 dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0] ] =
11441 pSession->QosMapSet.dscp_exceptions[i][1];
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011442 }
11443 }
11444 }
11445 }
11446 sme_ReleaseGlobalLock( &pMac->sme);
11447 return status;
11448}
Agarwal Ashish5e414792014-06-08 15:25:23 +053011449
Agarwal Ashish5e414792014-06-08 15:25:23 +053011450tANI_BOOLEAN sme_Is11dCountrycode(tHalHandle hHal)
11451{
11452 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11453
11454 if (VOS_TRUE == vos_mem_compare(pMac->scan.countryCodeCurrent,
11455 pMac->scan.countryCode11d, 2))
11456 {
11457 return eANI_BOOLEAN_TRUE;
11458 }
11459 else
11460 {
11461 return eANI_BOOLEAN_FALSE;
11462 }
11463}
Dino Mycle2c198072014-06-10 10:15:52 +053011464
Siddharth Bhal76972212014-10-15 16:22:51 +053011465tANI_BOOLEAN sme_SpoofMacAddrReq(tHalHandle hHal, v_MACADDR_t *macaddr)
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011466{
11467 eHalStatus status = eHAL_STATUS_SUCCESS;
11468 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11469 tANI_U16 len;
11470
11471 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
11472 {
11473 tpSirSpoofMacAddrReq pMsg;
11474
11475 /* Create the message and send to lim */
11476 len = sizeof(tSirSpoofMacAddrReq);
11477 pMsg = vos_mem_malloc(len);
11478 if ( NULL == pMsg )
11479 status = eHAL_STATUS_FAILURE;
11480 else
11481 {
11482 vos_mem_set(pMsg, sizeof(tSirSpoofMacAddrReq), 0);
11483 pMsg->messageType = eWNI_SME_MAC_SPOOF_ADDR_IND;
11484 pMsg->length = len;
11485 /* Data starts from here */
11486 vos_mem_copy(pMsg->macAddr, macaddr->bytes, VOS_MAC_ADDRESS_LEN);
11487
11488 status = palSendMBMessage(pMac->hHdd, pMsg);
11489 }
11490 sme_ReleaseGlobalLock( &pMac->sme );
11491 }
11492 return status;
11493}
11494
Dino Mycle2c198072014-06-10 10:15:52 +053011495#ifdef WLAN_FEATURE_EXTSCAN
11496/* ---------------------------------------------------------------------------
11497 \fn sme_GetValidChannelsByBand
11498 \brief SME API to fetch all valid channel filtered by band
11499 \param hHal
11500 \param wifiBand: RF band information
11501 \param aValidChannels: Array to store channel info
11502 \param len: number of channels
11503 \- return eHalStatus
11504 -------------------------------------------------------------------------*/
11505eHalStatus sme_GetValidChannelsByBand (tHalHandle hHal, tANI_U8 wifiBand,
11506 tANI_U32 *aValidChannels, tANI_U8 *pNumChannels)
11507{
11508 eHalStatus status = eHAL_STATUS_SUCCESS;
11509 tANI_U8 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
11510 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11511 tANI_U8 numChannels = 0;
11512 tANI_U8 i = 0;
11513 tANI_U32 totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
11514
11515 if (!aValidChannels || !pNumChannels) {
11516 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11517 FL("Output channel list/NumChannels is NULL"));
11518 return eHAL_STATUS_INVALID_PARAMETER;
11519 }
11520
11521 if ((wifiBand < WIFI_BAND_UNSPECIFIED) || (wifiBand >= WIFI_BAND_MAX)) {
11522 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11523 FL("Invalid wifiBand (%d)"), wifiBand);
11524 return eHAL_STATUS_INVALID_PARAMETER;
11525 }
11526
11527 status = sme_GetCfgValidChannels(hHal, &chanList[0],
11528 &totValidChannels);
11529 if (!HAL_STATUS_SUCCESS(status)) {
11530 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11531 FL("Failed to get valid channel list (err=%d)"), status);
11532 return status;
11533 }
11534
11535 switch (wifiBand) {
11536 case WIFI_BAND_UNSPECIFIED:
11537 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("Unspecified wifiBand, "
11538 "return all (%d) valid channels"), totValidChannels);
11539 numChannels = totValidChannels;
11540 for (i = 0; i < numChannels; i++)
11541 aValidChannels[i] = vos_chan_to_freq(chanList[i]);
11542 break;
11543
11544 case WIFI_BAND_BG:
11545 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("WIFI_BAND_BG (2.4 GHz)"));
11546 for (i = 0; i < totValidChannels; i++)
11547 if (CSR_IS_CHANNEL_24GHZ(chanList[i]))
11548 aValidChannels[numChannels++] =
11549 vos_chan_to_freq(chanList[i]);
11550 break;
11551
11552 case WIFI_BAND_A:
11553 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11554 FL("WIFI_BAND_A (5 GHz without DFS)"));
11555 for (i = 0; i < totValidChannels; i++)
11556 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11557 !CSR_IS_CHANNEL_DFS(chanList[i]))
11558 aValidChannels[numChannels++] =
11559 vos_chan_to_freq(chanList[i]);
11560 break;
11561
11562 case WIFI_BAND_ABG:
11563 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11564 FL("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"));
11565 for (i = 0; i < totValidChannels; i++)
11566 if ((CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11567 CSR_IS_CHANNEL_5GHZ(chanList[i])) &&
11568 !CSR_IS_CHANNEL_DFS(chanList[i]))
11569 aValidChannels[numChannels++] =
11570 vos_chan_to_freq(chanList[i]);
11571 break;
11572
11573 case WIFI_BAND_A_DFS_ONLY:
11574 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11575 FL("WIFI_BAND_A_DFS (5 GHz DFS only)"));
11576 for (i = 0; i < totValidChannels; i++)
11577 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11578 CSR_IS_CHANNEL_DFS(chanList[i]))
11579 aValidChannels[numChannels++] =
11580 vos_chan_to_freq(chanList[i]);
11581 break;
11582
11583 case WIFI_BAND_A_WITH_DFS:
11584 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11585 FL("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"));
11586 for (i = 0; i < totValidChannels; i++)
11587 if (CSR_IS_CHANNEL_5GHZ(chanList[i]))
11588 aValidChannels[numChannels++] =
11589 vos_chan_to_freq(chanList[i]);
11590 break;
11591
11592 case WIFI_BAND_ABG_WITH_DFS:
11593 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11594 FL("WIFI_BAND_ABG_WITH_DFS (2.4 GHz + 5 GHz with DFS)"));
11595 for (i = 0; i < totValidChannels; i++)
11596 if (CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11597 CSR_IS_CHANNEL_5GHZ(chanList[i]))
11598 aValidChannels[numChannels++] =
11599 vos_chan_to_freq(chanList[i]);
11600 break;
11601
11602 default:
11603 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11604 FL("Unknown wifiBand (%d))"), wifiBand);
11605 return eHAL_STATUS_INVALID_PARAMETER;
11606 break;
11607 }
11608 *pNumChannels = numChannels;
11609
11610 return status;
11611}
11612/* ---------------------------------------------------------------------------
11613 \fn sme_EXTScanGetCapabilities
11614 \brief SME API to fetch Extended Scan capabilities
11615 \param hHal
11616 \param pReq: Extended Scan capabilities structure
11617 \- return eHalStatus
11618 -------------------------------------------------------------------------*/
11619eHalStatus sme_EXTScanGetCapabilities (tHalHandle hHal,
11620 tSirGetEXTScanCapabilitiesReqParams *pReq)
11621{
11622 eHalStatus status = eHAL_STATUS_SUCCESS;
11623 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11624 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11625 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011626 tSirGetEXTScanCapabilitiesReqParams *pGetEXTScanCapabilitiesReq;
11627
11628 pGetEXTScanCapabilitiesReq =
11629 vos_mem_malloc(sizeof(*pGetEXTScanCapabilitiesReq));
11630 if ( !pGetEXTScanCapabilitiesReq)
11631 {
11632 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11633 "%s: Not able to allocate memory for "
11634 "WDA_EXTSCAN_GET_CAPABILITIES_REQ",
11635 __func__);
11636 return eHAL_STATUS_FAILURE;
11637 }
11638
11639 *pGetEXTScanCapabilitiesReq = *pReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011640
11641 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11642 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CAPABILITIES, NO_SESSION, 0));
11643 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11644 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011645 vosMessage.bodyptr = pGetEXTScanCapabilitiesReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011646 vosMessage.type = WDA_EXTSCAN_GET_CAPABILITIES_REQ;
11647 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11648 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11649 status = eHAL_STATUS_FAILURE;
11650
11651 sme_ReleaseGlobalLock(&pMac->sme);
11652 }
11653 return(status);
11654}
11655
11656/* ---------------------------------------------------------------------------
11657 \fn sme_EXTScanStart
11658 \brief SME API to issue Extended Scan start
11659 \param hHal
11660 \param pStartCmd: Extended Scan start structure
11661 \- return eHalStatus
11662 -------------------------------------------------------------------------*/
11663eHalStatus sme_EXTScanStart (tHalHandle hHal,
11664 tSirEXTScanStartReqParams *pStartCmd)
11665{
11666 eHalStatus status = eHAL_STATUS_SUCCESS;
11667 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11668 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11669 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011670 tSirEXTScanStartReqParams *pextScanStartReq;
11671
11672 pextScanStartReq = vos_mem_malloc(sizeof(*pextScanStartReq));
11673 if ( !pextScanStartReq)
11674 {
11675 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11676 "%s: Not able to allocate memory for "
11677 "WDA_EXTSCAN_START_REQ",
11678 __func__);
11679 return eHAL_STATUS_FAILURE;
11680 }
11681
11682 *pextScanStartReq = *pStartCmd;
11683
Dino Mycle2c198072014-06-10 10:15:52 +053011684
11685 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11686 TRACE_CODE_SME_RX_HDD_EXTSCAN_START, NO_SESSION, 0));
11687 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11688 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011689 vosMessage.bodyptr = pextScanStartReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011690 vosMessage.type = WDA_EXTSCAN_START_REQ;
11691 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11692 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11693 status = eHAL_STATUS_FAILURE;
11694
11695 sme_ReleaseGlobalLock(&pMac->sme);
11696 }
11697 return(status);
11698}
11699
11700/* ---------------------------------------------------------------------------
11701 \fn sme_EXTScanStop
11702 \brief SME API to issue Extended Scan stop
11703 \param hHal
11704 \param pStopReq: Extended Scan stop structure
11705 \- return eHalStatus
11706 -------------------------------------------------------------------------*/
11707eHalStatus sme_EXTScanStop(tHalHandle hHal, tSirEXTScanStopReqParams *pStopReq)
11708{
11709 eHalStatus status = eHAL_STATUS_SUCCESS;
11710 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11711 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11712 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011713 tSirEXTScanStopReqParams *pEXTScanStopReq;
11714
11715 pEXTScanStopReq = vos_mem_malloc(sizeof(*pEXTScanStopReq));
11716 if ( !pEXTScanStopReq)
11717 {
11718 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11719 "%s: Not able to allocate memory for "
11720 "WDA_EXTSCAN_STOP_REQ",
11721 __func__);
11722 return eHAL_STATUS_FAILURE;
11723 }
11724
11725 *pEXTScanStopReq = *pStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011726
11727 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11728 TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP, NO_SESSION, 0));
11729 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11730 {
11731 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011732 vosMessage.bodyptr = pEXTScanStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011733 vosMessage.type = WDA_EXTSCAN_STOP_REQ;
11734 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11735 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11736 {
11737 status = eHAL_STATUS_FAILURE;
11738 }
11739 sme_ReleaseGlobalLock(&pMac->sme);
11740 }
11741 return(status);
11742}
11743
11744/* ---------------------------------------------------------------------------
11745 \fn sme_SetBssHotlist
11746 \brief SME API to set BSSID hotlist
11747 \param hHal
11748 \param pSetHotListReq: Extended Scan set hotlist structure
11749 \- return eHalStatus
11750 -------------------------------------------------------------------------*/
11751eHalStatus sme_SetBssHotlist (tHalHandle hHal,
11752 tSirEXTScanSetBssidHotListReqParams *pSetHotListReq)
11753{
11754 eHalStatus status = eHAL_STATUS_SUCCESS;
11755 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11756 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11757 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011758 tSirEXTScanSetBssidHotListReqParams *pEXTScanSetBssidHotlistReq;
11759
11760 pEXTScanSetBssidHotlistReq =
11761 vos_mem_malloc(sizeof(*pEXTScanSetBssidHotlistReq));
11762 if ( !pEXTScanSetBssidHotlistReq)
11763 {
11764 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11765 "%s: Not able to allocate memory for "
11766 "WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ",
11767 __func__);
11768 return eHAL_STATUS_FAILURE;
11769 }
11770
11771 *pEXTScanSetBssidHotlistReq = *pSetHotListReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011772
11773 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11774 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST, NO_SESSION, 0));
11775 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11776 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011777 vosMessage.bodyptr = pEXTScanSetBssidHotlistReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011778 vosMessage.type = WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ;
11779 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11780 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11781 status = eHAL_STATUS_FAILURE;
11782
11783 sme_ReleaseGlobalLock(&pMac->sme);
11784 }
11785
11786 return(status);
11787}
11788
11789/* ---------------------------------------------------------------------------
11790 \fn sme_ResetBssHotlist
11791 \brief SME API to reset BSSID hotlist
11792 \param hHal
11793 \param pSetHotListReq: Extended Scan set hotlist structure
11794 \- return eHalStatus
11795 -------------------------------------------------------------------------*/
11796eHalStatus sme_ResetBssHotlist (tHalHandle hHal,
11797 tSirEXTScanResetBssidHotlistReqParams *pResetReq)
11798{
11799 eHalStatus status = eHAL_STATUS_SUCCESS;
11800 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11801 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11802 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011803 tSirEXTScanResetBssidHotlistReqParams *pEXTScanHotlistResetReq;
11804
11805 pEXTScanHotlistResetReq = vos_mem_malloc(sizeof(*pEXTScanHotlistResetReq));
11806 if ( !pEXTScanHotlistResetReq)
11807 {
11808 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11809 "%s: Not able to allocate memory for "
11810 "WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
11811 __func__);
11812 return eHAL_STATUS_FAILURE;
11813 }
11814
11815 *pEXTScanHotlistResetReq = *pResetReq;
11816
Dino Mycle2c198072014-06-10 10:15:52 +053011817
11818 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11819 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST, NO_SESSION, 0));
11820 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11821 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011822 vosMessage.bodyptr = pEXTScanHotlistResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011823 vosMessage.type = WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ;
11824 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11825 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11826 status = eHAL_STATUS_FAILURE;
11827
11828 sme_ReleaseGlobalLock(&pMac->sme);
11829 }
11830 return(status);
11831}
11832
11833/* ---------------------------------------------------------------------------
11834 \fn sme_SetSignificantChange
11835 \brief SME API to set significant change
11836 \param hHal
11837 \param pSetSignificantChangeReq: Extended Scan set significant change structure
11838 \- return eHalStatus
11839 -------------------------------------------------------------------------*/
11840eHalStatus sme_SetSignificantChange (tHalHandle hHal,
11841 tSirEXTScanSetSignificantChangeReqParams *pSetSignificantChangeReq)
11842{
11843 eHalStatus status = eHAL_STATUS_SUCCESS;
11844 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11845 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11846 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011847 tSirEXTScanSetSignificantChangeReqParams *pEXTScanSetSignificantReq;
11848
11849 pEXTScanSetSignificantReq = vos_mem_malloc(sizeof(*pEXTScanSetSignificantReq));
11850 if ( !pEXTScanSetSignificantReq)
11851 {
11852 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11853 "%s: Not able to allocate memory for "
11854 "WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ",
11855 __func__);
11856 return eHAL_STATUS_FAILURE;
11857 }
11858
11859 *pEXTScanSetSignificantReq = *pSetSignificantChangeReq;
11860
11861
Dino Mycle2c198072014-06-10 10:15:52 +053011862
11863 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11864 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SIGNF_CHANGE, NO_SESSION, 0));
11865 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11866 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011867 vosMessage.bodyptr = pEXTScanSetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011868 vosMessage.type = WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ;
11869 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11870 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11871 status = eHAL_STATUS_FAILURE;
11872
11873 sme_ReleaseGlobalLock(&pMac->sme);
11874 }
11875 return(status);
11876}
11877
11878/* ---------------------------------------------------------------------------
11879 \fn sme_ResetSignificantChange
11880 \brief SME API to reset significant change
11881 \param hHal
11882 \param pResetReq: Extended Scan reset significant change structure
11883 \- return eHalStatus
11884 -------------------------------------------------------------------------*/
11885eHalStatus sme_ResetSignificantChange (tHalHandle hHal,
11886 tSirEXTScanResetSignificantChangeReqParams *pResetReq)
11887{
11888 eHalStatus status = eHAL_STATUS_SUCCESS;
11889 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11890 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11891 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011892 tSirEXTScanResetSignificantChangeReqParams *pEXTScanResetSignificantReq;
11893
11894 pEXTScanResetSignificantReq =
11895 vos_mem_malloc(sizeof(*pEXTScanResetSignificantReq));
11896 if ( !pEXTScanResetSignificantReq)
11897 {
11898 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11899 "%s: Not able to allocate memory for "
11900 "WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ",
11901 __func__);
11902 return eHAL_STATUS_FAILURE;
11903 }
11904
11905 *pEXTScanResetSignificantReq = *pResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011906
11907 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11908 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SIGNF_CHANGE, NO_SESSION, 0));
11909 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11910 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011911 vosMessage.bodyptr = pEXTScanResetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011912 vosMessage.type = WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ;
11913 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11914 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11915 status = eHAL_STATUS_FAILURE;
11916
11917 sme_ReleaseGlobalLock(&pMac->sme);
11918 }
11919 return(status);
11920}
11921
11922/* ---------------------------------------------------------------------------
11923 \fn sme_getCachedResults
11924 \brief SME API to get cached results
11925 \param hHal
11926 \param pCachedResultsReq: Extended Scan get cached results structure
11927 \- return eHalStatus
11928 -------------------------------------------------------------------------*/
11929eHalStatus sme_getCachedResults (tHalHandle hHal,
11930 tSirEXTScanGetCachedResultsReqParams *pCachedResultsReq)
11931{
11932 eHalStatus status = eHAL_STATUS_SUCCESS;
11933 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11934 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11935 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011936 tSirEXTScanGetCachedResultsReqParams *pEXTScanCachedResultsReq;
11937
11938 pEXTScanCachedResultsReq =
11939 vos_mem_malloc(sizeof(*pEXTScanCachedResultsReq));
11940 if ( !pEXTScanCachedResultsReq)
11941 {
11942 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11943 "%s: Not able to allocate memory for "
11944 "WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
11945 __func__);
11946 return eHAL_STATUS_FAILURE;
11947 }
11948
11949 *pEXTScanCachedResultsReq = *pCachedResultsReq;
11950
Dino Mycle2c198072014-06-10 10:15:52 +053011951
11952 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11953 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS, NO_SESSION, 0));
11954 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11955 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011956 vosMessage.bodyptr = pEXTScanCachedResultsReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011957 vosMessage.type = WDA_EXTSCAN_GET_CACHED_RESULTS_REQ;
11958 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11959 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11960 status = eHAL_STATUS_FAILURE;
11961
11962 sme_ReleaseGlobalLock(&pMac->sme);
11963 }
11964 return(status);
11965}
11966
11967eHalStatus sme_EXTScanRegisterCallback (tHalHandle hHal,
11968 void (*pEXTScanIndCb)(void *, const tANI_U16, void *),
11969 void *callbackContext)
11970{
11971 eHalStatus status = eHAL_STATUS_SUCCESS;
11972 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11973
11974 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11975 pMac->sme.pEXTScanIndCb = pEXTScanIndCb;
11976 pMac->sme.pEXTScanCallbackContext = callbackContext;
11977 sme_ReleaseGlobalLock(&pMac->sme);
11978 }
11979 return(status);
11980}
11981
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053011982void sme_SetMiracastMode (tHalHandle hHal,tANI_U8 mode)
11983{
11984 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11985
11986 pMac->miracast_mode = mode;
11987}
Dino Mycle2c198072014-06-10 10:15:52 +053011988#endif /* WLAN_FEATURE_EXTSCAN */
c_hpothuef45bc32014-09-11 10:10:18 +053011989
11990void sme_resetCoexEevent(tHalHandle hHal)
11991{
11992 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11993
11994 if (pMac == NULL)
11995 {
11996 printk("btc: %s pMac is NULL \n",__func__);
11997 return;
11998 }
11999
12000 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12001 FL("isCoexScoIndSet: %d"), pMac->isCoexScoIndSet);
12002
12003 if (pMac->isCoexScoIndSet)
12004 {
12005 pMac->isCoexScoIndSet = 0;
12006 ccmCfgSetInt(pMac, WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC, 0,
12007 NULL, eANI_BOOLEAN_FALSE);
12008 }
12009
12010 return;
12011}
Agarwal Ashish738843c2014-09-25 12:27:56 +053012012
12013void sme_disable_dfs_channel(tHalHandle hHal, bool disbale_dfs)
12014{
12015 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12016 pMac->scan.fEnableDFSChnlScan = !disbale_dfs;
12017 csrDisableDfsChannel(pMac);
12018
12019}
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053012020
12021/* ---------------------------------------------------------------------------
12022 \fn sme_Encryptmsgsend
12023 \brief SME API to issue encrypt message request
12024 \param hHal
12025 \param pCmd: Data to be encrypted
12026 \- return eHalStatus
12027 -------------------------------------------------------------------------*/
12028eHalStatus sme_Encryptmsgsend (tHalHandle hHal,
12029 u8 *pCmd,
12030 int length,
12031 pEncryptMsgRSPCb encMsgCbk)
12032{
12033 eHalStatus status = eHAL_STATUS_SUCCESS;
12034 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12035 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12036 vos_msg_t vosMessage;
12037 u8 *pEncryptMsg;
12038
12039 pEncryptMsg = vos_mem_malloc(length);
12040 if ( !pEncryptMsg)
12041 {
12042 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12043 "%s: Not able to allocate memory for "
12044 "SIR_HAL_ENCRYPT_MSG_REQ",
12045 __func__);
12046 return eHAL_STATUS_FAILURE;
12047 }
12048
12049 vos_mem_copy(pEncryptMsg, pCmd, length);
12050
12051 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12052
12053 pMac->sme.pEncMsgInfoParams.pEncMsgCbk = encMsgCbk;
12054 pMac->sme.pEncMsgInfoParams.pUserData = hHal;
12055 /* Serialize the req through MC thread */
12056 vosMessage.bodyptr = pEncryptMsg;
12057 vosMessage.type = SIR_HAL_ENCRYPT_MSG_REQ;
12058 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
12059 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12060 status = eHAL_STATUS_FAILURE;
12061
12062 sme_ReleaseGlobalLock(&pMac->sme);
12063 }
12064 return(status);
12065}
Pradeep Reddy POTTETIf0569d72014-12-13 16:54:03 +053012066
12067/* ---------------------------------------------------------------------------
12068 \fn sme_RegisterBtCoexTDLSCallback
12069 \brief Used to plug in callback function
12070 Which notify btcoex on or off.
12071 Notification come from FW.
12072 \param hHal
12073 \param pCallbackfn : callback function pointer should be plugged in
12074 \- return eHalStatus
12075 -------------------------------------------------------------------------*/
12076eHalStatus sme_RegisterBtCoexTDLSCallback
12077(
12078 tHalHandle hHal,
12079 void (*pCallbackfn)(void *pAdapter, int )
12080)
12081{
12082 eHalStatus status = eHAL_STATUS_SUCCESS;
12083 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12084
12085 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12086 "%s: Plug in BtCoex TDLS CB", __func__);
12087
12088 status = sme_AcquireGlobalLock(&pMac->sme);
12089 if (eHAL_STATUS_SUCCESS == status)
12090 {
12091 if (NULL != pCallbackfn)
12092 {
12093 pMac->sme.pBtCoexTDLSNotification = pCallbackfn;
12094 }
12095 sme_ReleaseGlobalLock(&pMac->sme);
12096 }
12097 return(status);
12098}
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012099
12100/* ---------------------------------------------------------------------------
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012101 \fn smeNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012102
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012103 \brief This function is a wrapper to call csrNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012104
12105 \param hHal - The handle returned by macOpen.
12106
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012107 \return eANI_BOOLEAN_TRUE if reassoc in progress,
12108 eANI_BOOLEAN_FALSE otherwise
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012109---------------------------------------------------------------------------*/
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012110
12111tANI_BOOLEAN smeNeighborMiddleOfRoaming(tHalHandle hHal)
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012112{
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012113 return (csrNeighborMiddleOfRoaming(PMAC_STRUCT(hHal)));
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012114}
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012115
12116/* ---------------------------------------------------------------------------
12117
12118 \fn sme_IsTdlsOffChannelValid
12119
12120 \brief To check if the channel is valid for currently established domain
12121 This is a synchronous API.
12122
12123 \param hHal - The handle returned by macOpen.
12124 \param channel - channel to verify
12125
12126 \return TRUE/FALSE, TRUE if channel is valid
12127
12128 -------------------------------------------------------------------------------*/
12129tANI_BOOLEAN sme_IsTdlsOffChannelValid(tHalHandle hHal, tANI_U8 channel)
12130{
12131 eHalStatus status = eHAL_STATUS_FAILURE;
12132 tANI_BOOLEAN valid = FALSE;
12133 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12134
12135 status = sme_AcquireGlobalLock( &pMac->sme );
12136 if ( HAL_STATUS_SUCCESS( status ) )
12137 {
12138 /* check whether off channel is valid and non DFS */
12139 if (csrRoamIsChannelValid(pMac, channel) &&
12140 (!CSR_IS_CHANNEL_DFS(channel)))
12141 {
12142 valid = TRUE;
12143 }
12144 sme_ReleaseGlobalLock( &pMac->sme );
12145 }
12146 return (valid);
12147}