blob: 80a53d3c44239afe823202a0868c07beb3886f74 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05302 * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
Kiet Lam0fb93dd2014-02-19 00:32:59 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
Kiet Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080026 */
Kiet Lam0fb93dd2014-02-19 00:32:59 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Jeff Johnson295189b2012-06-20 16:38:30 -070031/**=========================================================================
32
33 \file smeApi.c
34
35 \brief Definitions for SME APIs
36
Kiet Lamaa8e15a2014-02-11 23:30:06 -080037
Jeff Johnson295189b2012-06-20 16:38:30 -070038 ========================================================================*/
39
40/*===========================================================================
41
42 EDIT HISTORY FOR FILE
43
44
45 This section contains comments describing changes made to the module.
46 Notice that changes are listed in reverse chronological order.
47
48
49
50 when who what, where, why
51---------- --- --------------------------------------------------------
5206/03/10 js Added support to hostapd driven
53 * deauth/disassoc/mic failure
54
55===========================================================================*/
56
57/*--------------------------------------------------------------------------
58 Include Files
59 ------------------------------------------------------------------------*/
60
Jeff Johnson295189b2012-06-20 16:38:30 -070061
62#include "smsDebug.h"
63#include "sme_Api.h"
64#include "csrInsideApi.h"
65#include "smeInside.h"
66#include "csrInternal.h"
67#include "wlan_qct_wda.h"
68#include "halMsgApi.h"
Katya Nigam70d68332013-09-16 16:49:45 +053069#include "vos_trace.h"
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -070070#include "sme_Trace.h"
Katya Nigambcb705f2013-12-26 14:26:22 +053071#include "vos_types.h"
72#include "vos_trace.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070073#include "sapApi.h"
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +053074#include "macTrace.h"
Mukul Sharmabe91e2f2014-06-29 22:09:20 +053075#include "vos_utils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070076
Jeff Johnson295189b2012-06-20 16:38:30 -070077extern tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb);
78
79#include <wlan_qct_pal_api.h>
Katya Nigam70d68332013-09-16 16:49:45 +053080#define LOG_SIZE 256
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080081#define READ_MEMORY_DUMP_CMD 9
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +053082#define TL_INIT_STATE 0
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -080083
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070084
85#define CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE 1000*30 //30s
86
Jeff Johnson295189b2012-06-20 16:38:30 -070087// TxMB Functions
88extern eHalStatus pmcPrepareCommand( tpAniSirGlobal pMac, eSmeCommandType cmdType, void *pvParam,
89 tANI_U32 size, tSmeCmd **ppCmd );
90extern void pmcReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
91extern void qosReleaseCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand );
Sushant Kaushik298a8592014-12-09 17:34:07 +053092extern void csrReleaseRocReqCommand( tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -070093extern eHalStatus p2pProcessRemainOnChannelCmd(tpAniSirGlobal pMac, tSmeCmd *p2pRemainonChn);
94extern eHalStatus sme_remainOnChnRsp( tpAniSirGlobal pMac, tANI_U8 *pMsg);
95extern eHalStatus sme_mgmtFrmInd( tHalHandle hHal, tpSirSmeMgmtFrameInd pSmeMgmtFrm);
96extern eHalStatus sme_remainOnChnReady( tHalHandle hHal, tANI_U8* pMsg);
97extern eHalStatus sme_sendActionCnf( tHalHandle hHal, tANI_U8* pMsg);
98extern eHalStatus p2pProcessNoAReq(tpAniSirGlobal pMac, tSmeCmd *pNoACmd);
Jeff Johnson295189b2012-06-20 16:38:30 -070099
100static eHalStatus initSmeCmdList(tpAniSirGlobal pMac);
101static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping );
102
103eCsrPhyMode sme_GetPhyMode(tHalHandle hHal);
104
105eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
106
Sushant Kaushik1d732562014-05-21 14:15:37 +0530107void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac);
108
Amar Singhal0d15bd52013-10-12 23:13:13 -0700109eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf);
110
Jeff Johnson295189b2012-06-20 16:38:30 -0700111eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal);
112
113eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal);
114
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -0700115#ifdef FEATURE_WLAN_LFR
116tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac);
117#endif
118
Chet Lanctot186b5732013-03-18 10:26:30 -0700119#ifdef WLAN_FEATURE_11W
120eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
121 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm );
122#endif
123
Jeff Johnson295189b2012-06-20 16:38:30 -0700124//Internal SME APIs
125eHalStatus sme_AcquireGlobalLock( tSmeStruct *psSme)
126{
127 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
128
129 if(psSme)
130 {
131 if( VOS_IS_STATUS_SUCCESS( vos_lock_acquire( &psSme->lkSmeGlobalLock) ) )
132 {
133 status = eHAL_STATUS_SUCCESS;
134 }
135 }
136
137 return (status);
138}
139
140
141eHalStatus sme_ReleaseGlobalLock( tSmeStruct *psSme)
142{
143 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
144
145 if(psSme)
146 {
147 if( VOS_IS_STATUS_SUCCESS( vos_lock_release( &psSme->lkSmeGlobalLock) ) )
148 {
149 status = eHAL_STATUS_SUCCESS;
150 }
151 }
152
153 return (status);
154}
155
156
157
158static eHalStatus initSmeCmdList(tpAniSirGlobal pMac)
159{
160 eHalStatus status;
161 tSmeCmd *pCmd;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530162 tANI_U32 cmd_idx;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700163 VOS_STATUS vosStatus;
164 vos_timer_t* cmdTimeoutTimer = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700165
166 pMac->sme.totalSmeCmd = SME_TOTAL_COMMAND;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530167 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
168 &pMac->sme.smeCmdActiveList)))
169 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700170
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530171 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
172 &pMac->sme.smeCmdPendingList)))
173 goto end;
174
175 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
176 &pMac->sme.smeScanCmdActiveList)))
177 goto end;
178
179 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
180 &pMac->sme.smeScanCmdPendingList)))
181 goto end;
182
183 if (!HAL_STATUS_SUCCESS(status = csrLLOpen(pMac->hHdd,
184 &pMac->sme.smeCmdFreeList)))
185 goto end;
186
Kiet Lam64c1b492013-07-12 13:56:44 +0530187 pCmd = vos_mem_malloc(sizeof(tSmeCmd) * pMac->sme.totalSmeCmd);
188 if ( NULL == pCmd )
189 status = eHAL_STATUS_FAILURE;
190 else
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530191 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530192 status = eHAL_STATUS_SUCCESS;
193
194 vos_mem_set(pCmd, sizeof(tSmeCmd) * pMac->sme.totalSmeCmd, 0);
195 pMac->sme.pSmeCmdBufAddr = pCmd;
196
197 for (cmd_idx = 0; cmd_idx < pMac->sme.totalSmeCmd; cmd_idx++)
198 {
199 csrLLInsertTail(&pMac->sme.smeCmdFreeList,
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530200 &pCmd[cmd_idx].Link, LL_ACCESS_LOCK);
Kiet Lam64c1b492013-07-12 13:56:44 +0530201 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700202 }
203
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700204 /* This timer is only to debug the active list command timeout */
205
206 cmdTimeoutTimer = (vos_timer_t*)vos_mem_malloc(sizeof(vos_timer_t));
207 if (cmdTimeoutTimer)
208 {
209 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = cmdTimeoutTimer;
210 vosStatus =
211 vos_timer_init( pMac->sme.smeCmdActiveList.cmdTimeoutTimer,
212 VOS_TIMER_TYPE_SW,
213 activeListCmdTimeoutHandle,
214 (void*) pMac);
215
216 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
217 {
218 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
219 "Init Timer fail for active list command process time out");
220 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
221 }
222 else
223 {
224 pMac->sme.smeCmdActiveList.cmdTimeoutDuration =
225 CSR_ACTIVE_LIST_CMD_TIMEOUT_VALUE;
226 }
227 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530228end:
229 if (!HAL_STATUS_SUCCESS(status))
230 smsLog(pMac, LOGE, "failed to initialize sme command list:%d\n",
231 status);
232
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 return (status);
234}
235
236
237void smeReleaseCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
238{
239 pCmd->command = eSmeNoCommand;
240 csrLLInsertTail(&pMac->sme.smeCmdFreeList, &pCmd->Link, LL_ACCESS_LOCK);
241}
242
243
244
245static void smeReleaseCmdList(tpAniSirGlobal pMac, tDblLinkList *pList)
246{
247 tListElem *pEntry;
248 tSmeCmd *pCommand;
249
250 while((pEntry = csrLLRemoveHead(pList, LL_ACCESS_LOCK)) != NULL)
251 {
252 //TODO: base on command type to call release functions
253 //reinitialize different command types so they can be reused
254 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
255 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
256 }
257}
258
259static void purgeSmeCmdList(tpAniSirGlobal pMac)
260{
261 //release any out standing commands back to free command list
262 smeReleaseCmdList(pMac, &pMac->sme.smeCmdPendingList);
263 smeReleaseCmdList(pMac, &pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530264 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdPendingList);
265 smeReleaseCmdList(pMac, &pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700266}
267
Madan Mohan Koyyalamudi21255992013-08-01 18:00:25 +0530268void purgeSmeSessionCmdList(tpAniSirGlobal pMac, tANI_U32 sessionId,
269 tDblLinkList *pList)
Jeff Johnson295189b2012-06-20 16:38:30 -0700270{
271 //release any out standing commands back to free command list
272 tListElem *pEntry, *pNext;
273 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 tDblLinkList localList;
275
276 vos_mem_zero(&localList, sizeof(tDblLinkList));
277 if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &localList)))
278 {
279 smsLog(pMac, LOGE, FL(" failed to open list"));
280 return;
281 }
282
283 csrLLLock(pList);
284 pEntry = csrLLPeekHead(pList, LL_ACCESS_NOLOCK);
285 while(pEntry != NULL)
286 {
287 pNext = csrLLNext(pList, pEntry, LL_ACCESS_NOLOCK);
288 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
289 if(pCommand->sessionId == sessionId)
290 {
291 if(csrLLRemoveEntry(pList, pEntry, LL_ACCESS_NOLOCK))
292 {
293 csrLLInsertTail(&localList, pEntry, LL_ACCESS_NOLOCK);
294 }
295 }
296 pEntry = pNext;
297 }
298 csrLLUnlock(pList);
299
300 while( (pEntry = csrLLRemoveHead(&localList, LL_ACCESS_NOLOCK)) )
301 {
302 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
303 smeAbortCommand(pMac, pCommand, eANI_BOOLEAN_TRUE);
304 }
305 csrLLClose(&localList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700306}
307
308
309static eHalStatus freeSmeCmdList(tpAniSirGlobal pMac)
310{
311 eHalStatus status = eHAL_STATUS_SUCCESS;
312
313 purgeSmeCmdList(pMac);
314 csrLLClose(&pMac->sme.smeCmdPendingList);
315 csrLLClose(&pMac->sme.smeCmdActiveList);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530316 csrLLClose(&pMac->sme.smeScanCmdPendingList);
317 csrLLClose(&pMac->sme.smeScanCmdActiveList);
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 csrLLClose(&pMac->sme.smeCmdFreeList);
319
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700320 /*destroy active list command time out timer */
321 vos_timer_destroy(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
322 vos_mem_free(pMac->sme.smeCmdActiveList.cmdTimeoutTimer);
323 pMac->sme.smeCmdActiveList.cmdTimeoutTimer = NULL;
324
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800325 status = vos_lock_acquire(&pMac->sme.lkSmeGlobalLock);
326 if(status != eHAL_STATUS_SUCCESS)
327 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800328 smsLog(pMac, LOGE,
329 FL("Failed to acquire the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800330 goto done;
331 }
332
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 if(NULL != pMac->sme.pSmeCmdBufAddr)
334 {
Kiet Lam64c1b492013-07-12 13:56:44 +0530335 vos_mem_free(pMac->sme.pSmeCmdBufAddr);
Jeff Johnson295189b2012-06-20 16:38:30 -0700336 pMac->sme.pSmeCmdBufAddr = NULL;
337 }
338
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800339 status = vos_lock_release(&pMac->sme.lkSmeGlobalLock);
340 if(status != eHAL_STATUS_SUCCESS)
341 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800342 smsLog(pMac, LOGE,
343 FL("Failed to release the lock status = %d"), status);
Madan Mohan Koyyalamudi7a5fb7e2012-12-06 13:05:42 -0800344 }
345done:
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 return (status);
347}
348
349
350void dumpCsrCommandInfo(tpAniSirGlobal pMac, tSmeCmd *pCmd)
351{
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 switch( pCmd->command )
353 {
354 case eSmeCommandScan:
355 smsLog( pMac, LOGE, " scan command reason is %d", pCmd->u.scanCmd.reason );
356 break;
357
358 case eSmeCommandRoam:
359 smsLog( pMac, LOGE, " roam command reason is %d", pCmd->u.roamCmd.roamReason );
360 break;
361
362 case eSmeCommandWmStatusChange:
363 smsLog( pMac, LOGE, " WMStatusChange command type is %d", pCmd->u.wmStatusChangeCmd.Type );
364 break;
365
366 case eSmeCommandSetKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800367 smsLog( pMac, LOGE, " setKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700368 pCmd->u.setKeyCmd.authType, pCmd->u.setKeyCmd.encType );
369 break;
370
371 case eSmeCommandRemoveKey:
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800372 smsLog( pMac, LOGE, " removeKey command auth(%d) enc(%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 pCmd->u.removeKeyCmd.authType, pCmd->u.removeKeyCmd.encType );
374 break;
375
376 default:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700377 smsLog( pMac, LOGE, " default: Unhandled command %d",
378 pCmd->command);
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 break;
380 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700381}
382
383tSmeCmd *smeGetCommandBuffer( tpAniSirGlobal pMac )
384{
385 tSmeCmd *pRetCmd = NULL, *pTempCmd = NULL;
386 tListElem *pEntry;
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530387 static int smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdFreeList, LL_ACCESS_LOCK );
389
390 // If we can get another MS Msg buffer, then we are ok. Just link
391 // the entry onto the linked list. (We are using the linked list
392 // to keep track of tfhe message buffers).
393 if ( pEntry )
394 {
395 pRetCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530396 /* reset when free list is available */
397 smeCommandQueueFull = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -0700398 }
399 else {
400 int idx = 1;
401
402 //Cannot change pRetCmd here since it needs to return later.
403 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
404 if( pEntry )
405 {
406 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
407 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800408 smsLog( pMac, LOGE, "Out of command buffer.... command (0x%X) stuck",
Jeff Johnson295189b2012-06-20 16:38:30 -0700409 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
410 if(pTempCmd)
411 {
412 if( eSmeCsrCommandMask & pTempCmd->command )
413 {
414 //CSR command is stuck. See what the reason code is for that command
415 dumpCsrCommandInfo(pMac, pTempCmd);
416 }
417 } //if(pTempCmd)
418
419 //dump what is in the pending queue
420 csrLLLock(&pMac->sme.smeCmdPendingList);
421 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530422 while(pEntry && !smeCommandQueueFull)
Jeff Johnson295189b2012-06-20 16:38:30 -0700423 {
424 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530425 /* Print only 1st five commands from pending queue. */
426 if (idx <= 5)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800427 smsLog( pMac, LOGE, "Out of command buffer.... SME pending command #%d (0x%X)",
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530428 idx, pTempCmd->command );
429 idx++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700430 if( eSmeCsrCommandMask & pTempCmd->command )
431 {
432 //CSR command is stuck. See what the reason code is for that command
433 dumpCsrCommandInfo(pMac, pTempCmd);
434 }
435 pEntry = csrLLNext( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
436 }
Sushant Kaushikc9d0f422014-06-23 18:59:30 +0530437 /* Increament static variable so that it prints pending command only once*/
438 smeCommandQueueFull++;
Jeff Johnson295189b2012-06-20 16:38:30 -0700439 csrLLUnlock(&pMac->sme.smeCmdPendingList);
440
441 //There may be some more command in CSR's own pending queue
442 csrLLLock(&pMac->roam.roamCmdPendingList);
443 pEntry = csrLLPeekHead( &pMac->roam.roamCmdPendingList, LL_ACCESS_NOLOCK );
444 while(pEntry)
445 {
446 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800447 smsLog( pMac, LOGE, "Out of command buffer.... CSR pending command #%d (0x%X)",
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 idx++, pTempCmd->command );
449 dumpCsrCommandInfo(pMac, pTempCmd);
450 pEntry = csrLLNext( &pMac->roam.roamCmdPendingList, pEntry, LL_ACCESS_NOLOCK );
451 }
452 csrLLUnlock(&pMac->roam.roamCmdPendingList);
453 }
454
Masti, Narayanraddi5240fbe2015-02-05 16:51:28 +0530455 if( pRetCmd )
456 {
457 vos_mem_set((tANI_U8 *)&pRetCmd->command, sizeof(pRetCmd->command), 0);
458 vos_mem_set((tANI_U8 *)&pRetCmd->sessionId, sizeof(pRetCmd->sessionId), 0);
459 vos_mem_set((tANI_U8 *)&pRetCmd->u, sizeof(pRetCmd->u), 0);
460 }
461
Jeff Johnson295189b2012-06-20 16:38:30 -0700462 return( pRetCmd );
463}
464
465
466void smePushCommand( tpAniSirGlobal pMac, tSmeCmd *pCmd, tANI_BOOLEAN fHighPriority )
467{
Sushant Kaushik4928e542014-12-29 15:25:54 +0530468 if (!SME_IS_START(pMac))
469 {
470 smsLog( pMac, LOGE, FL("Sme in stop state"));
471 return;
472 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 if ( fHighPriority )
474 {
475 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
476 }
477 else
478 {
479 csrLLInsertTail( &pMac->sme.smeCmdPendingList, &pCmd->Link, LL_ACCESS_LOCK );
480 }
481
482 // process the command queue...
483 smeProcessPendingQueue( pMac );
484
485 return;
486}
487
488
489static eSmeCommandType smeIsFullPowerNeeded( tpAniSirGlobal pMac, tSmeCmd *pCommand )
490{
491 eSmeCommandType pmcCommand = eSmeNoCommand;
492 tANI_BOOLEAN fFullPowerNeeded = eANI_BOOLEAN_FALSE;
493 tPmcState pmcState;
494 eHalStatus status;
495
496 do
497 {
498 pmcState = pmcGetPmcState(pMac);
499
500 status = csrIsFullPowerNeeded( pMac, pCommand, NULL, &fFullPowerNeeded );
501 if( !HAL_STATUS_SUCCESS(status) )
502 {
503 //PMC state is not right for the command, drop it
504 return ( eSmeDropCommand );
505 }
506 if( fFullPowerNeeded ) break;
507 fFullPowerNeeded = ( ( eSmeCommandAddTs == pCommand->command ) ||
508 ( eSmeCommandDelTs == pCommand->command ) );
509 if( fFullPowerNeeded ) break;
Jeff Johnsone7245742012-09-05 17:12:55 -0700510#ifdef FEATURE_OEM_DATA_SUPPORT
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700511 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700512 eSmeCommandOemDataReq == pCommand->command);
513 if(fFullPowerNeeded) break;
514#endif
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700515 fFullPowerNeeded = (pmcState == IMPS &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700516 eSmeCommandRemainOnChannel == pCommand->command);
517 if(fFullPowerNeeded) break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 } while(0);
519
520 if( fFullPowerNeeded )
521 {
522 switch( pmcState )
523 {
524 case IMPS:
525 case STANDBY:
526 pmcCommand = eSmeCommandExitImps;
527 break;
528
529 case BMPS:
530 pmcCommand = eSmeCommandExitBmps;
531 break;
532
533 case UAPSD:
534 pmcCommand = eSmeCommandExitUapsd;
535 break;
536
537 case WOWL:
538 pmcCommand = eSmeCommandExitWowl;
539 break;
540
541 default:
542 break;
543 }
544 }
545
546 return ( pmcCommand );
547}
548
549
550//For commands that need to do extra cleanup.
551static void smeAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
552{
553 if( eSmePmcCommandMask & pCommand->command )
554 {
555 pmcAbortCommand( pMac, pCommand, fStopping );
556 }
557 else if ( eSmeCsrCommandMask & pCommand->command )
558 {
559 csrAbortCommand( pMac, pCommand, fStopping );
560 }
561 else
562 {
563 switch( pCommand->command )
564 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 case eSmeCommandRemainOnChannel:
566 if (NULL != pCommand->u.remainChlCmd.callback)
567 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700568 remainOnChanCallback callback =
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 pCommand->u.remainChlCmd.callback;
570 /* process the msg */
571 if( callback )
572 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700573 callback(pMac, pCommand->u.remainChlCmd.callbackCtx,
Jeff Johnson295189b2012-06-20 16:38:30 -0700574 eCSR_SCAN_ABORT );
575 }
576 }
577 smeReleaseCommand( pMac, pCommand );
578 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700579 default:
580 smeReleaseCommand( pMac, pCommand );
581 break;
582 }
583 }
584}
585
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530586tListElem *csrGetCmdToProcess(tpAniSirGlobal pMac, tDblLinkList *pList,
587 tANI_U8 sessionId, tANI_BOOLEAN fInterlocked)
588{
589 tListElem *pCurEntry = NULL;
590 tSmeCmd *pCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700591
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530592 /* Go through the list and return the command whose session id is not
593 * matching with the current ongoing scan cmd sessionId */
594 pCurEntry = csrLLPeekHead( pList, LL_ACCESS_LOCK );
595 while (pCurEntry)
596 {
597 pCommand = GET_BASE_ADDR(pCurEntry, tSmeCmd, Link);
598 if (pCommand->sessionId != sessionId)
599 {
600 smsLog(pMac, LOG1, "selected the command with different sessionId");
601 return pCurEntry;
602 }
603
604 pCurEntry = csrLLNext(pList, pCurEntry, fInterlocked);
605 }
606
607 smsLog(pMac, LOG1, "No command pending with different sessionId");
608 return NULL;
609}
610
611tANI_BOOLEAN smeProcessScanQueue(tpAniSirGlobal pMac)
612{
613 tListElem *pEntry;
614 tSmeCmd *pCommand;
615 tListElem *pSmeEntry;
616 tSmeCmd *pSmeCommand;
617 tANI_BOOLEAN status = eANI_BOOLEAN_TRUE;
618
619 csrLLLock( &pMac->sme.smeScanCmdActiveList );
620 if (csrLLIsListEmpty( &pMac->sme.smeScanCmdActiveList,
621 LL_ACCESS_NOLOCK ))
622 {
623 if (!csrLLIsListEmpty(&pMac->sme.smeScanCmdPendingList,
624 LL_ACCESS_LOCK))
625 {
626 pEntry = csrLLPeekHead( &pMac->sme.smeScanCmdPendingList,
627 LL_ACCESS_LOCK );
628 if (pEntry)
629 {
630 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
631 //We cannot execute any command in wait-for-key state until setKey is through.
632 if (CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId))
633 {
634 if (!CSR_IS_SET_KEY_COMMAND(pCommand))
635 {
636 smsLog(pMac, LOGE,
637 " Cannot process command(%d) while waiting for key",
638 pCommand->command);
639 status = eANI_BOOLEAN_FALSE;
640 goto end;
641 }
642 }
643
644 if ((!csrLLIsListEmpty(&pMac->sme.smeCmdActiveList,
645 LL_ACCESS_LOCK )))
646 {
647 pSmeEntry = csrLLPeekHead(&pMac->sme.smeCmdActiveList,
648 LL_ACCESS_LOCK);
649 if (pEntry)
650 {
651 pSmeCommand = GET_BASE_ADDR(pEntry, tSmeCmd,
652 Link) ;
653
654 /* if scan is running on one interface and SME recei
655 ves the next command on the same interface then
656 dont the allow the command to be queued to
657 smeCmdPendingList. If next scan is allowed on
658 the same interface the CSR state machine will
659 get screwed up. */
660 if (pSmeCommand->sessionId == pCommand->sessionId)
661 {
662 status = eANI_BOOLEAN_FALSE;
663 goto end;
664 }
665 }
666 }
667 if ( csrLLRemoveEntry( &pMac->sme.smeScanCmdPendingList,
668 pEntry, LL_ACCESS_LOCK ) )
669 {
670 csrLLInsertHead( &pMac->sme.smeScanCmdActiveList,
671 &pCommand->Link, LL_ACCESS_NOLOCK );
672
673 switch (pCommand->command)
674 {
675 case eSmeCommandScan:
676 smsLog(pMac, LOG1,
677 " Processing scan offload command ");
678 csrProcessScanCommand( pMac, pCommand );
679 break;
680 default:
681 smsLog(pMac, LOGE,
682 " Something wrong, wrong command enqueued"
683 " to smeScanCmdPendingList");
684 pEntry = csrLLRemoveHead(
685 &pMac->sme.smeScanCmdActiveList,
686 LL_ACCESS_NOLOCK );
687 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
688 smeReleaseCommand( pMac, pCommand );
689 break;
690 }
691 }
692 }
693 }
694 }
695end:
696 csrLLUnlock(&pMac->sme.smeScanCmdActiveList);
697 return status;
698}
Jeff Johnson295189b2012-06-20 16:38:30 -0700699
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +0530700eHalStatus smeProcessPnoCommand(tpAniSirGlobal pMac, tSmeCmd *pCmd)
701{
702 tpSirPNOScanReq pnoReqBuf;
703 tSirMsgQ msgQ;
704
705 pnoReqBuf = vos_mem_malloc(sizeof(tSirPNOScanReq));
706 if ( NULL == pnoReqBuf )
707 {
708 smsLog(pMac, LOGE, FL("failed to allocate memory"));
709 return eHAL_STATUS_FAILURE;
710 }
711
712 vos_mem_copy(pnoReqBuf, &(pCmd->u.pnoInfo), sizeof(tSirPNOScanReq));
713
714 smsLog(pMac, LOG1, FL("post WDA_SET_PNO_REQ comamnd"));
715 msgQ.type = WDA_SET_PNO_REQ;
716 msgQ.reserved = 0;
717 msgQ.bodyptr = pnoReqBuf;
718 msgQ.bodyval = 0;
719 wdaPostCtrlMsg( pMac, &msgQ);
720
721 return eHAL_STATUS_SUCCESS;
722}
723
Jeff Johnson295189b2012-06-20 16:38:30 -0700724tANI_BOOLEAN smeProcessCommand( tpAniSirGlobal pMac )
725{
726 tANI_BOOLEAN fContinue = eANI_BOOLEAN_FALSE;
727 eHalStatus status = eHAL_STATUS_SUCCESS;
728 tListElem *pEntry;
729 tSmeCmd *pCommand;
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530730 tListElem *pSmeEntry;
731 tSmeCmd *pSmeCommand;
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 eSmeCommandType pmcCommand = eSmeNoCommand;
733
734 // if the ActiveList is empty, then nothing is active so we can process a
735 // pending command...
736 //alwasy lock active list before locking pending list
737 csrLLLock( &pMac->sme.smeCmdActiveList );
738 if ( csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) )
739 {
740 if(!csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK))
741 {
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530742 /* If scan command is pending in the smeScanCmdActive list
743 * then pick the command from smeCmdPendingList which is
744 * not matching with the scan command session id.
745 * At any point of time only one command will be allowed
746 * on a single session. */
747 if ((pMac->fScanOffload) &&
748 (!csrLLIsListEmpty(&pMac->sme.smeScanCmdActiveList,
749 LL_ACCESS_LOCK)))
750 {
751 pSmeEntry = csrLLPeekHead(&pMac->sme.smeScanCmdActiveList,
752 LL_ACCESS_LOCK);
753 if (pSmeEntry)
754 {
755 pSmeCommand = GET_BASE_ADDR(pSmeEntry, tSmeCmd, Link);
756
757 pEntry = csrGetCmdToProcess(pMac,
758 &pMac->sme.smeCmdPendingList,
759 pSmeCommand->sessionId,
760 LL_ACCESS_LOCK);
761 goto sme_process_cmd;
762 }
763 }
764
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 //Peek the command
766 pEntry = csrLLPeekHead( &pMac->sme.smeCmdPendingList, LL_ACCESS_LOCK );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530767sme_process_cmd:
Jeff Johnson295189b2012-06-20 16:38:30 -0700768 if( pEntry )
769 {
770 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530771
Abhishek Singhf4669da2014-05-26 15:07:49 +0530772 /* Allow only disconnect command
773 * in wait-for-key state until setKey is through.
774 */
775 if( CSR_IS_WAIT_FOR_KEY( pMac, pCommand->sessionId ) &&
776 !CSR_IS_DISCONNECT_COMMAND( pCommand ) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 {
778 if( !CSR_IS_SET_KEY_COMMAND( pCommand ) )
779 {
780 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Abhishek Singhf4669da2014-05-26 15:07:49 +0530781 smsLog(pMac, LOGE, FL("SessionId %d: Cannot process "
782 "command(%d) while waiting for key"),
783 pCommand->sessionId, pCommand->command);
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530784 fContinue = eANI_BOOLEAN_FALSE;
785 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700786 }
787 }
788 pmcCommand = smeIsFullPowerNeeded( pMac, pCommand );
789 if( eSmeDropCommand == pmcCommand )
790 {
791 //This command is not ok for current PMC state
792 if( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
793 {
794 smeAbortCommand( pMac, pCommand, eANI_BOOLEAN_FALSE );
795 }
796 csrLLUnlock( &pMac->sme.smeCmdActiveList );
797 //tell caller to continue
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530798 fContinue = eANI_BOOLEAN_TRUE;
799 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700800 }
801 else if( eSmeNoCommand != pmcCommand )
802 {
803 tExitBmpsInfo exitBmpsInfo;
804 void *pv = NULL;
805 tANI_U32 size = 0;
806 tSmeCmd *pPmcCmd = NULL;
807
808 if( eSmeCommandExitBmps == pmcCommand )
809 {
810 exitBmpsInfo.exitBmpsReason = eSME_REASON_OTHER;
811 pv = (void *)&exitBmpsInfo;
812 size = sizeof(tExitBmpsInfo);
813 }
814 //pmcCommand has to be one of the exit power save command
815 status = pmcPrepareCommand( pMac, pmcCommand, pv, size, &pPmcCmd );
816 if( HAL_STATUS_SUCCESS( status ) && pPmcCmd )
817 {
818 //Force this command to wake up the chip
819 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK );
820 csrLLUnlock( &pMac->sme.smeCmdActiveList );
821 fContinue = pmcProcessCommand( pMac, pPmcCmd );
822 if( fContinue )
823 {
824 //The command failed, remove it
825 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList, &pPmcCmd->Link, LL_ACCESS_NOLOCK ) )
826 {
827 pmcReleaseCommand( pMac, pPmcCmd );
828 }
829 }
830 }
831 else
832 {
833 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -0800834 smsLog( pMac, LOGE, FL( "Cannot issue command(0x%X) to wake up the chip. Status = %d"), pmcCommand, status );
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 //Let it retry
836 fContinue = eANI_BOOLEAN_TRUE;
837 }
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +0530838 goto sme_process_scan_queue;
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 }
840 if ( csrLLRemoveEntry( &pMac->sme.smeCmdPendingList, pEntry, LL_ACCESS_LOCK ) )
841 {
842 // we can reuse the pCommand
843
844 // Insert the command onto the ActiveList...
845 csrLLInsertHead( &pMac->sme.smeCmdActiveList, &pCommand->Link, LL_ACCESS_NOLOCK );
846
Rashmi Ramanna68b309c2014-05-20 11:52:22 +0530847 if( pMac->deferImps )
848 {
849 /* IMPS timer is already running so stop it and
850 * it will get restarted when no command is pending
851 */
852 csrScanStopIdleScanTimer( pMac );
853 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_TRUE;
854 pMac->deferImps = eANI_BOOLEAN_FALSE;
855 }
856
Jeff Johnson295189b2012-06-20 16:38:30 -0700857 // .... and process the command.
858
Katya Nigambcb705f2013-12-26 14:26:22 +0530859 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -0700860 TRACE_CODE_SME_COMMAND, pCommand->sessionId, pCommand->command));
Jeff Johnson295189b2012-06-20 16:38:30 -0700861 switch ( pCommand->command )
862 {
863
864 case eSmeCommandScan:
865 csrLLUnlock( &pMac->sme.smeCmdActiveList );
866 status = csrProcessScanCommand( pMac, pCommand );
867 break;
868
869 case eSmeCommandRoam:
870 csrLLUnlock( &pMac->sme.smeCmdActiveList );
871 status = csrRoamProcessCommand( pMac, pCommand );
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800872 if(!HAL_STATUS_SUCCESS(status))
873 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700874 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Madan Mohan Koyyalamudi59efbe02013-01-10 15:38:42 -0800875 &pCommand->Link, LL_ACCESS_LOCK ) )
876 {
877 csrReleaseCommandRoam( pMac, pCommand );
878 }
879 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700880 break;
881
882 case eSmeCommandWmStatusChange:
883 csrLLUnlock( &pMac->sme.smeCmdActiveList );
884 csrRoamProcessWmStatusChangeCommand(pMac, pCommand);
885 break;
886
887 case eSmeCommandSetKey:
888 csrLLUnlock( &pMac->sme.smeCmdActiveList );
889 status = csrRoamProcessSetKeyCommand( pMac, pCommand );
890 if(!HAL_STATUS_SUCCESS(status))
891 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700892 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700893 &pCommand->Link, LL_ACCESS_LOCK ) )
894 {
895 csrReleaseCommandSetKey( pMac, pCommand );
896 }
897 }
898 break;
899
900 case eSmeCommandRemoveKey:
901 csrLLUnlock( &pMac->sme.smeCmdActiveList );
902 status = csrRoamProcessRemoveKeyCommand( pMac, pCommand );
903 if(!HAL_STATUS_SUCCESS(status))
904 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700905 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
Jeff Johnson295189b2012-06-20 16:38:30 -0700906 &pCommand->Link, LL_ACCESS_LOCK ) )
907 {
908 csrReleaseCommandRemoveKey( pMac, pCommand );
909 }
910 }
911 break;
912
913 case eSmeCommandAddStaSession:
914 csrLLUnlock( &pMac->sme.smeCmdActiveList );
915 csrProcessAddStaSessionCommand( pMac, pCommand );
916 break;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -0700917 case eSmeCommandDelStaSession:
Jeff Johnson295189b2012-06-20 16:38:30 -0700918 csrLLUnlock( &pMac->sme.smeCmdActiveList );
919 csrProcessDelStaSessionCommand( pMac, pCommand );
920 break;
Siddharth Bhald8a95e82015-02-12 20:14:52 +0530921 case eSmeCommandMacSpoofRequest:
922 csrLLUnlock( &pMac->sme.smeCmdActiveList );
923 csrProcessMacAddrSpoofCommand( pMac, pCommand );
924 // No Rsp expected, free cmd from active list
925 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
926 &pCommand->Link, LL_ACCESS_LOCK ) )
927 {
928 csrReleaseCommand( pMac, pCommand );
929 }
930
931 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700932
Jeff Johnsone7245742012-09-05 17:12:55 -0700933#ifdef FEATURE_OEM_DATA_SUPPORT
934 case eSmeCommandOemDataReq:
935 csrLLUnlock(&pMac->sme.smeCmdActiveList);
936 oemData_ProcessOemDataReqCommand(pMac, pCommand);
937 break;
938#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700939 case eSmeCommandRemainOnChannel:
940 csrLLUnlock(&pMac->sme.smeCmdActiveList);
941 p2pProcessRemainOnChannelCmd(pMac, pCommand);
942 break;
943 case eSmeCommandNoAUpdate:
944 csrLLUnlock( &pMac->sme.smeCmdActiveList );
945 p2pProcessNoAReq(pMac,pCommand);
Jeff Johnson295189b2012-06-20 16:38:30 -0700946 case eSmeCommandEnterImps:
947 case eSmeCommandExitImps:
948 case eSmeCommandEnterBmps:
949 case eSmeCommandExitBmps:
950 case eSmeCommandEnterUapsd:
951 case eSmeCommandExitUapsd:
952 case eSmeCommandEnterWowl:
953 case eSmeCommandExitWowl:
954 csrLLUnlock( &pMac->sme.smeCmdActiveList );
955 fContinue = pmcProcessCommand( pMac, pCommand );
956 if( fContinue )
957 {
958 //The command failed, remove it
959 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
960 &pCommand->Link, LL_ACCESS_LOCK ) )
961 {
962 pmcReleaseCommand( pMac, pCommand );
963 }
964 }
965 break;
966
967 //Treat standby differently here because caller may not be able to handle
968 //the failure so we do our best here
969 case eSmeCommandEnterStandby:
970 if( csrIsConnStateDisconnected( pMac, pCommand->sessionId ) )
971 {
972 //It can continue
973 csrLLUnlock( &pMac->sme.smeCmdActiveList );
974 fContinue = pmcProcessCommand( pMac, pCommand );
975 if( fContinue )
976 {
977 //The command failed, remove it
978 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
979 &pCommand->Link, LL_ACCESS_LOCK ) )
980 {
981 pmcReleaseCommand( pMac, pCommand );
982 }
983 }
984 }
985 else
986 {
987 //Need to issue a disconnect first before processing this command
988 tSmeCmd *pNewCmd;
989
990 //We need to re-run the command
991 fContinue = eANI_BOOLEAN_TRUE;
992 //Pull off the standby command first
993 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
994 &pCommand->Link, LL_ACCESS_NOLOCK ) )
995 {
996 csrLLUnlock( &pMac->sme.smeCmdActiveList );
997 //Need to call CSR function here because the disconnect command
998 //is handled by CSR
999 pNewCmd = csrGetCommandBuffer( pMac );
1000 if( NULL != pNewCmd )
1001 {
1002 //Put the standby command to the head of the pending list first
1003 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pCommand->Link,
1004 LL_ACCESS_LOCK );
1005 pNewCmd->command = eSmeCommandRoam;
1006 pNewCmd->u.roamCmd.roamReason = eCsrForcedDisassoc;
1007 //Put the disassoc command before the standby command
1008 csrLLInsertHead( &pMac->sme.smeCmdPendingList, &pNewCmd->Link,
1009 LL_ACCESS_LOCK );
1010 }
1011 else
1012 {
1013 //Continue the command here
1014 fContinue = pmcProcessCommand( pMac, pCommand );
1015 if( fContinue )
1016 {
1017 //The command failed, remove it
1018 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1019 &pCommand->Link, LL_ACCESS_LOCK ) )
1020 {
1021 pmcReleaseCommand( pMac, pCommand );
1022 }
1023 }
1024 }
1025 }
1026 else
1027 {
1028 csrLLUnlock( &pMac->sme.smeCmdActiveList );
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001029 smsLog( pMac, LOGE, FL(" failed to remove standby command") );
Jeff Johnson295189b2012-06-20 16:38:30 -07001030 VOS_ASSERT(0);
1031 }
1032 }
1033 break;
Hanumantha Reddy Pothula28b1e652015-02-02 21:10:13 +05301034 case eSmeCommandPnoReq:
1035 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1036 status = smeProcessPnoCommand(pMac, pCommand);
1037 if (!HAL_STATUS_SUCCESS(status)){
1038 smsLog(pMac, LOGE,
1039 FL("failed to post SME PNO SCAN %d"), status);
1040 }
1041 if (csrLLRemoveEntry(&pMac->sme.smeCmdActiveList,
1042 &pCommand->Link, LL_ACCESS_LOCK))
1043 {
1044 csrReleaseCommand(pMac, pCommand);
1045 }
1046 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001047 case eSmeCommandAddTs:
1048 case eSmeCommandDelTs:
1049 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1050#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1051 fContinue = qosProcessCommand( pMac, pCommand );
1052 if( fContinue )
1053 {
1054 //The command failed, remove it
1055 if( csrLLRemoveEntry( &pMac->sme.smeCmdActiveList,
1056 &pCommand->Link, LL_ACCESS_NOLOCK ) )
1057 {
1058//#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1059 qosReleaseCommand( pMac, pCommand );
1060//#endif /* WLAN_MDM_CODE_REDUCTION_OPT*/
1061 }
1062 }
1063#endif
1064 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001065#ifdef FEATURE_WLAN_TDLS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001066 case eSmeCommandTdlsSendMgmt:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001067 case eSmeCommandTdlsAddPeer:
1068 case eSmeCommandTdlsDelPeer:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301069 case eSmeCommandTdlsLinkEstablish:
Atul Mittalc0f739f2014-07-31 13:47:47 +05301070 case eSmeCommandTdlsChannelSwitch: // tdlsoffchan
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001071#ifdef FEATURE_WLAN_TDLS_INTERNAL
1072 case eSmeCommandTdlsDiscovery:
1073 case eSmeCommandTdlsLinkSetup:
1074 case eSmeCommandTdlsLinkTear:
1075 case eSmeCommandTdlsEnterUapsd:
1076 case eSmeCommandTdlsExitUapsd:
1077#endif
1078 {
Hoonki Lee1090c6a2013-01-16 17:40:54 -08001079 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001080 "sending TDLS Command 0x%x to PE", pCommand->command);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001081
1082 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1083 status = csrTdlsProcessCmd( pMac, pCommand );
1084 }
1085 break ;
1086#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001087
1088 default:
1089 //something is wrong
1090 //remove it from the active list
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001091 smsLog(pMac, LOGE, " csrProcessCommand processes an unknown command %d", pCommand->command);
Jeff Johnson295189b2012-06-20 16:38:30 -07001092 pEntry = csrLLRemoveHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK );
1093 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1094 pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
1095 smeReleaseCommand( pMac, pCommand );
1096 status = eHAL_STATUS_FAILURE;
1097 break;
1098 }
1099 if(!HAL_STATUS_SUCCESS(status))
1100 {
1101 fContinue = eANI_BOOLEAN_TRUE;
1102 }
1103 }//if(pEntry)
1104 else
1105 {
1106 //This is odd. Some one else pull off the command.
1107 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1108 }
1109 }
1110 else
1111 {
1112 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1113 }
1114 }
1115 else
1116 {
1117 //No command waiting
1118 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1119 //This is only used to restart an idle mode scan, it means at least one other idle scan has finished.
1120 if(pMac->scan.fRestartIdleScan && eANI_BOOLEAN_FALSE == pMac->scan.fCancelIdleScan)
1121 {
1122 tANI_U32 nTime = 0;
1123
1124 pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
1125 if(!HAL_STATUS_SUCCESS(csrScanTriggerIdleScan(pMac, &nTime)))
1126 {
1127 csrScanStartIdleScanTimer(pMac, nTime);
1128 }
1129 }
1130 }
1131 }
1132 else {
1133 csrLLUnlock( &pMac->sme.smeCmdActiveList );
1134 }
1135
Madan Mohan Koyyalamudie1a64b42013-06-19 16:34:44 +05301136sme_process_scan_queue:
1137 if (pMac->fScanOffload && !(smeProcessScanQueue(pMac)))
1138 fContinue = eANI_BOOLEAN_FALSE;
1139
Jeff Johnson295189b2012-06-20 16:38:30 -07001140 return ( fContinue );
1141}
1142
1143void smeProcessPendingQueue( tpAniSirGlobal pMac )
1144{
1145 while( smeProcessCommand( pMac ) );
1146}
1147
1148
1149tANI_BOOLEAN smeCommandPending(tpAniSirGlobal pMac)
1150{
1151 return ( !csrLLIsListEmpty( &pMac->sme.smeCmdActiveList, LL_ACCESS_NOLOCK ) ||
1152 !csrLLIsListEmpty(&pMac->sme.smeCmdPendingList, LL_ACCESS_NOLOCK) );
1153}
1154
1155
1156
1157//Global APIs
1158
1159/*--------------------------------------------------------------------------
1160
1161 \brief sme_Open() - Initialze all SME modules and put them at idle state
1162
1163 The function initializes each module inside SME, PMC, CCM, CSR, etc. . Upon
1164 successfully return, all modules are at idle state ready to start.
1165
1166 smeOpen must be called before any other SME APIs can be involved.
1167 smeOpen must be called after macOpen.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001168 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001169 \param hHal - The handle returned by macOpen.
1170
1171 \return eHAL_STATUS_SUCCESS - SME is successfully initialized.
1172
1173 Other status means SME is failed to be initialized
1174 \sa
1175
1176 --------------------------------------------------------------------------*/
1177eHalStatus sme_Open(tHalHandle hHal)
1178{
1179 eHalStatus status = eHAL_STATUS_FAILURE;
1180 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1181
1182 do {
1183 pMac->sme.state = SME_STATE_STOP;
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07001184 pMac->sme.currDeviceMode = VOS_STA_MODE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001185 if( !VOS_IS_STATUS_SUCCESS( vos_lock_init( &pMac->sme.lkSmeGlobalLock ) ) )
1186 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001187 smsLog( pMac, LOGE, "sme_Open failed init lock" );
Jeff Johnson295189b2012-06-20 16:38:30 -07001188 status = eHAL_STATUS_FAILURE;
1189 break;
1190 }
1191
1192 status = ccmOpen(hHal);
1193 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1194 smsLog( pMac, LOGE,
1195 "ccmOpen failed during initialization with status=%d", status );
1196 break;
1197 }
1198
1199 status = csrOpen(pMac);
1200 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1201 smsLog( pMac, LOGE,
1202 "csrOpen failed during initialization with status=%d", status );
1203 break;
1204 }
1205
1206 status = pmcOpen(hHal);
1207 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1208 smsLog( pMac, LOGE,
1209 "pmcOpen failed during initialization with status=%d", status );
1210 break;
1211 }
1212
Gopichand Nakkala34d1b062013-03-19 15:28:33 -07001213#ifdef FEATURE_WLAN_TDLS
1214 pMac->isTdlsPowerSaveProhibited = 0;
1215#endif
1216
Jeff Johnson295189b2012-06-20 16:38:30 -07001217#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1218 status = sme_QosOpen(pMac);
1219 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1220 smsLog( pMac, LOGE,
1221 "Qos open failed during initialization with status=%d", status );
1222 break;
1223 }
1224
1225 status = btcOpen(pMac);
1226 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1227 smsLog( pMac, LOGE,
1228 "btcOpen open failed during initialization with status=%d", status );
1229 break;
1230 }
1231#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001232#ifdef FEATURE_OEM_DATA_SUPPORT
1233 status = oemData_OemDataReqOpen(pMac);
1234 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1235 smsLog(pMac, LOGE,
1236 "oemData_OemDataReqOpen failed during initialization with status=%d", status );
1237 break;
1238 }
1239#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001240
1241 if(!HAL_STATUS_SUCCESS((status = initSmeCmdList(pMac))))
1242 break;
1243
Jeff Johnson295189b2012-06-20 16:38:30 -07001244 {
1245 v_PVOID_t pvosGCtx = vos_get_global_context(VOS_MODULE_ID_SAP, NULL);
1246 if ( NULL == pvosGCtx ){
1247 smsLog( pMac, LOGE, "WLANSAP_Open open failed during initialization");
1248 status = eHAL_STATUS_FAILURE;
1249 break;
1250 }
1251
1252 status = WLANSAP_Open( pvosGCtx );
1253 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1254 smsLog( pMac, LOGE,
1255 "WLANSAP_Open open failed during initialization with status=%d", status );
1256 break;
1257 }
1258 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001259#if defined WLAN_FEATURE_VOWIFI
1260 status = rrmOpen(pMac);
1261 if ( ! HAL_STATUS_SUCCESS( status ) ) {
1262 smsLog( pMac, LOGE,
1263 "rrmOpen open failed during initialization with status=%d", status );
1264 break;
1265 }
1266#endif
1267
1268#if defined WLAN_FEATURE_VOWIFI_11R
1269 sme_FTOpen(pMac);
1270#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001271 sme_p2pOpen(pMac);
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001272 smeTraceInit(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001273
1274 }while (0);
1275
1276 return status;
1277}
1278
Jeff Johnson295189b2012-06-20 16:38:30 -07001279/*--------------------------------------------------------------------------
1280
1281 \brief sme_set11dinfo() - Set the 11d information about valid channels
1282 and there power using information from nvRAM
1283 This function is called only for AP.
1284
Srinivas Girigowdade697412013-02-14 16:31:48 -08001285 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001286
1287 \param hHal - The handle returned by macOpen.
1288 \Param pSmeConfigParams - a pointer to a caller allocated object of
1289 typedef struct _smeConfigParams.
1290
1291 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1292
1293 Other status means SME is failed to update the config parameters.
1294 \sa
1295--------------------------------------------------------------------------*/
1296
1297eHalStatus sme_set11dinfo(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1298{
1299 eHalStatus status = eHAL_STATUS_FAILURE;
1300 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1301
Katya Nigambcb705f2013-12-26 14:26:22 +05301302 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001303 TRACE_CODE_SME_RX_HDD_MSG_SET_11DINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001304 if (NULL == pSmeConfigParams ) {
1305 smsLog( pMac, LOGE,
1306 "Empty config param structure for SME, nothing to update");
1307 return status;
1308 }
1309
1310 status = csrSetChannels(hHal, &pSmeConfigParams->csrConfig );
1311 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001312 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001313 status );
1314 }
1315 return status;
1316}
1317
1318/*--------------------------------------------------------------------------
1319
1320 \brief sme_getSoftApDomain() - Get the current regulatory domain of softAp.
1321
Srinivas Girigowdade697412013-02-14 16:31:48 -08001322 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001323
1324 \param hHal - The handle returned by HostapdAdapter.
1325 \Param v_REGDOMAIN_t - The current Regulatory Domain requested for SoftAp.
1326
1327 \return eHAL_STATUS_SUCCESS - SME successfully completed the request.
1328
1329 Other status means, failed to get the current regulatory domain.
1330 \sa
1331--------------------------------------------------------------------------*/
1332
1333eHalStatus sme_getSoftApDomain(tHalHandle hHal, v_REGDOMAIN_t *domainIdSoftAp)
1334{
1335 eHalStatus status = eHAL_STATUS_FAILURE;
1336 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1337
Katya Nigambcb705f2013-12-26 14:26:22 +05301338 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001339 TRACE_CODE_SME_RX_HDD_MSG_GET_SOFTAP_DOMAIN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001340 if (NULL == domainIdSoftAp ) {
1341 smsLog( pMac, LOGE, "Uninitialized domain Id");
1342 return status;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001343 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001344
1345 *domainIdSoftAp = pMac->scan.domainIdCurrent;
1346 status = eHAL_STATUS_SUCCESS;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001347
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 return status;
1349}
1350
1351
1352eHalStatus sme_setRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
1353{
1354 eHalStatus status = eHAL_STATUS_FAILURE;
1355 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1356
Katya Nigambcb705f2013-12-26 14:26:22 +05301357 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001358 TRACE_CODE_SME_RX_HDD_MSG_SET_REGINFO, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001359 if (NULL == apCntryCode ) {
1360 smsLog( pMac, LOGE, "Empty Country Code, nothing to update");
1361 return status;
1362 }
1363
1364 status = csrSetRegInfo(hHal, apCntryCode );
1365 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001366 smsLog( pMac, LOGE, "csrSetRegInfo failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001367 status );
1368 }
1369 return status;
1370}
1371
Jeff Johnson295189b2012-06-20 16:38:30 -07001372#ifdef FEATURE_WLAN_SCAN_PNO
1373/*--------------------------------------------------------------------------
1374
1375 \brief sme_UpdateChannelConfig() - Update channel configuration in RIVA.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001376
1377 It is used at driver start up to inform RIVA of the default channel
1378 configuration.
Jeff Johnson295189b2012-06-20 16:38:30 -07001379
Srinivas Girigowdade697412013-02-14 16:31:48 -08001380 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001381
1382 \param hHal - The handle returned by macOpen.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07001383
Jeff Johnson295189b2012-06-20 16:38:30 -07001384 \return eHAL_STATUS_SUCCESS - SME update the channel config successfully.
1385
1386 Other status means SME is failed to update the channel config.
1387 \sa
1388
1389 --------------------------------------------------------------------------*/
1390eHalStatus sme_UpdateChannelConfig(tHalHandle hHal)
1391{
1392 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1393
Katya Nigambcb705f2013-12-26 14:26:22 +05301394 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001395 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CHANNEL_CONFIG, NO_SESSION, 0));
1396 pmcUpdateScanParams( pMac, &(pMac->roam.configParam),
Jeff Johnson295189b2012-06-20 16:38:30 -07001397 &pMac->scan.base20MHzChannels, FALSE);
1398 return eHAL_STATUS_SUCCESS;
1399}
1400#endif // FEATURE_WLAN_SCAN_PNLO
1401
Abhishek Singhf644b272014-08-21 02:59:39 +05301402eHalStatus sme_UpdateChannelList(tHalHandle hHal)
1403{
1404 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1405 eHalStatus status = eHAL_STATUS_SUCCESS;
1406
1407 status = csrUpdateChannelList(pMac);
1408
1409 if (eHAL_STATUS_SUCCESS != status)
1410 {
1411 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1412 "failed to update the supported channel list");
1413 }
1414 return status;
1415}
1416
Jeff Johnson295189b2012-06-20 16:38:30 -07001417/*--------------------------------------------------------------------------
1418
1419 \brief sme_UpdateConfig() - Change configurations for all SME moduels
1420
1421 The function updates some configuration for modules in SME, CCM, CSR, etc
1422 during SMEs close open sequence.
1423
1424 Modules inside SME apply the new configuration at the next transaction.
1425
Srinivas Girigowdade697412013-02-14 16:31:48 -08001426 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001427
1428 \param hHal - The handle returned by macOpen.
1429 \Param pSmeConfigParams - a pointer to a caller allocated object of
1430 typedef struct _smeConfigParams.
1431
1432 \return eHAL_STATUS_SUCCESS - SME update the config parameters successfully.
1433
1434 Other status means SME is failed to update the config parameters.
1435 \sa
1436
1437 --------------------------------------------------------------------------*/
1438eHalStatus sme_UpdateConfig(tHalHandle hHal, tpSmeConfigParams pSmeConfigParams)
1439{
1440 eHalStatus status = eHAL_STATUS_FAILURE;
1441 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1442
Katya Nigambcb705f2013-12-26 14:26:22 +05301443 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001444 TRACE_CODE_SME_RX_HDD_MSG_UPDATE_CONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001445 if (NULL == pSmeConfigParams ) {
1446 smsLog( pMac, LOGE,
1447 "Empty config param structure for SME, nothing to update");
1448 return status;
1449 }
1450
1451 status = csrChangeDefaultConfigParam(pMac, &pSmeConfigParams->csrConfig);
1452
1453 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001454 smsLog( pMac, LOGE, "csrChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001455 status );
1456 }
1457#if defined WLAN_FEATURE_P2P_INTERNAL
1458 status = p2pChangeDefaultConfigParam(pMac, &pSmeConfigParams->p2pConfig);
1459
1460 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001461 smsLog( pMac, LOGE, "p2pChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001462 status );
1463 }
1464#endif
1465#if defined WLAN_FEATURE_VOWIFI
1466 status = rrmChangeDefaultConfigParam(hHal, &pSmeConfigParams->rrmConfig);
1467
1468 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001469 smsLog( pMac, LOGE, "rrmChangeDefaultConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001470 status );
1471 }
1472#endif
1473 //For SOC, CFG is set before start
1474 //We don't want to apply global CFG in connect state because that may cause some side affect
1475 if(
Jeff Johnson295189b2012-06-20 16:38:30 -07001476 csrIsAllSessionDisconnected( pMac) )
1477 {
1478 csrSetGlobalCfgs(pMac);
1479 }
1480
Gopichand Nakkala86e42662013-06-11 17:44:11 +05301481 /* update the directed scan offload setting */
1482 pMac->fScanOffload = pSmeConfigParams->fScanOffload;
1483
Madan Mohan Koyyalamudid89feb72013-07-31 15:47:12 +05301484 if (pMac->fScanOffload)
1485 {
1486 /* If scan offload is enabled then lim has allow the sending of
1487 scan request to firmware even in powersave mode. The firmware has
1488 to take care of exiting from power save mode */
1489 status = ccmCfgSetInt(hHal, WNI_CFG_SCAN_IN_POWERSAVE,
1490 eANI_BOOLEAN_TRUE, NULL, eANI_BOOLEAN_FALSE);
1491
1492 if (eHAL_STATUS_SUCCESS != status)
1493 {
1494 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1495 "Could not pass on WNI_CFG_SCAN_IN_POWERSAVE to CCM");
1496 }
1497 }
krunal sonie9002db2013-11-25 14:24:17 -08001498 pMac->isCoalesingInIBSSAllowed =
1499 pSmeConfigParams->csrConfig.isCoalesingInIBSSAllowed;
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -08001500 pMac->fEnableDebugLog = pSmeConfigParams->fEnableDebugLog;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301501 pMac->fDeferIMPSTime = pSmeConfigParams->fDeferIMPSTime;
Chandrasekaran, Manishekar5cb0acd2014-12-23 20:06:52 +05301502 pMac->fBtcEnableIndTimerVal = pSmeConfigParams->fBtcEnableIndTimerVal;
Rashmi Ramanna68b309c2014-05-20 11:52:22 +05301503
Jeff Johnson295189b2012-06-20 16:38:30 -07001504 return status;
1505}
1506
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05301507#ifdef WLAN_FEATURE_GTK_OFFLOAD
1508void sme_ProcessGetGtkInfoRsp( tHalHandle hHal,
1509 tpSirGtkOffloadGetInfoRspParams pGtkOffloadGetInfoRsp)
1510{
1511 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1512
1513 if (NULL == pMac)
1514 {
1515 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
1516 "%s: pMac is null", __func__);
1517 return ;
1518 }
1519 if (pMac->pmc.GtkOffloadGetInfoCB == NULL)
1520 {
1521 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1522 "%s: HDD callback is null", __func__);
1523 return ;
1524 }
1525 pMac->pmc.GtkOffloadGetInfoCB(pMac->pmc.GtkOffloadGetInfoCBContext,
1526 pGtkOffloadGetInfoRsp);
1527}
1528#endif
1529
Jeff Johnson295189b2012-06-20 16:38:30 -07001530/* ---------------------------------------------------------------------------
1531 \fn sme_ChangeConfigParams
1532 \brief The SME API exposed for HDD to provide config params to SME during
1533 SMEs stop -> start sequence.
1534
1535 If HDD changed the domain that will cause a reset. This function will
1536 provide the new set of 11d information for the new domain. Currrently this
1537 API provides info regarding 11d only at reset but we can extend this for
1538 other params (PMC, QoS) which needs to be initialized again at reset.
1539
Srinivas Girigowdade697412013-02-14 16:31:48 -08001540 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001541
1542 \param hHal - The handle returned by macOpen.
1543
1544 \Param
1545 pUpdateConfigParam - a pointer to a structure (tCsrUpdateConfigParam) that
1546 currently provides 11d related information like Country code,
1547 Regulatory domain, valid channel list, Tx power per channel, a
1548 list with active/passive scan allowed per valid channel.
1549
1550 \return eHalStatus
1551 ---------------------------------------------------------------------------*/
1552eHalStatus sme_ChangeConfigParams(tHalHandle hHal,
1553 tCsrUpdateConfigParam *pUpdateConfigParam)
1554{
1555 eHalStatus status = eHAL_STATUS_FAILURE;
1556 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1557
1558 if (NULL == pUpdateConfigParam ) {
1559 smsLog( pMac, LOGE,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001560 "Empty config param structure for SME, nothing to reset");
Jeff Johnson295189b2012-06-20 16:38:30 -07001561 return status;
1562 }
1563
1564 status = csrChangeConfigParams(pMac, pUpdateConfigParam);
1565
1566 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001567 smsLog( pMac, LOGE, "csrUpdateConfigParam failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001568 status );
1569 }
1570
1571 return status;
1572
1573}
1574
1575/*--------------------------------------------------------------------------
1576
1577 \brief sme_HDDReadyInd() - SME sends eWNI_SME_SYS_READY_IND to PE to inform
1578 that the NIC is ready tio run.
1579
1580 The function is called by HDD at the end of initialization stage so PE/HAL can
1581 enable the NIC to running state.
1582
Srinivas Girigowdade697412013-02-14 16:31:48 -08001583 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001584 \param hHal - The handle returned by macOpen.
1585
1586 \return eHAL_STATUS_SUCCESS - eWNI_SME_SYS_READY_IND is sent to PE
1587 successfully.
1588
1589 Other status means SME failed to send the message to PE.
1590 \sa
1591
1592 --------------------------------------------------------------------------*/
1593eHalStatus sme_HDDReadyInd(tHalHandle hHal)
1594{
1595 tSirSmeReadyReq Msg;
1596 eHalStatus status = eHAL_STATUS_FAILURE;
1597 tPmcPowerState powerState;
1598 tPmcSwitchState hwWlanSwitchState;
1599 tPmcSwitchState swWlanSwitchState;
1600 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1601
Katya Nigambcb705f2013-12-26 14:26:22 +05301602 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07001603 TRACE_CODE_SME_RX_HDD_MSG_HDDREADYIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07001604 do
1605 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001606
1607 Msg.messageType = eWNI_SME_SYS_READY_IND;
1608 Msg.length = sizeof( tSirSmeReadyReq );
1609
1610 if (eSIR_FAILURE != uMacPostCtrlMsg( hHal, (tSirMbMsg*)&Msg ))
1611 {
1612 status = eHAL_STATUS_SUCCESS;
1613 }
1614 else
1615 {
1616 smsLog( pMac, LOGE,
1617 "uMacPostCtrlMsg failed to send eWNI_SME_SYS_READY_IND");
1618 break;
1619 }
1620
1621 status = pmcQueryPowerState( hHal, &powerState,
1622 &hwWlanSwitchState, &swWlanSwitchState );
1623 if ( ! HAL_STATUS_SUCCESS( status ) )
1624 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001625 smsLog( pMac, LOGE, "pmcQueryPowerState failed with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001626 status );
1627 break;
1628 }
1629
1630 if ( (ePMC_SWITCH_OFF != hwWlanSwitchState) &&
1631 (ePMC_SWITCH_OFF != swWlanSwitchState) )
1632 {
1633 status = csrReady(pMac);
1634 if ( ! HAL_STATUS_SUCCESS( status ) )
1635 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001636 smsLog( pMac, LOGE, "csrReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001637 break;
1638 }
1639 status = pmcReady(hHal);
1640 if ( ! HAL_STATUS_SUCCESS( status ) )
1641 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001642 smsLog( pMac, LOGE, "pmcReady failed with status=%d", status );
Jeff Johnson295189b2012-06-20 16:38:30 -07001643 break;
1644 }
1645#ifndef WLAN_MDM_CODE_REDUCTION_OPT
1646 if(VOS_STATUS_SUCCESS != btcReady(hHal))
1647 {
1648 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001649 smsLog( pMac, LOGE, "btcReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001650 break;
1651 }
1652#endif
1653
1654#if defined WLAN_FEATURE_VOWIFI
1655 if(VOS_STATUS_SUCCESS != rrmReady(hHal))
1656 {
1657 status = eHAL_STATUS_FAILURE;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001658 smsLog( pMac, LOGE, "rrmReady failed");
Jeff Johnson295189b2012-06-20 16:38:30 -07001659 break;
1660 }
1661#endif
1662 }
1663 pMac->sme.state = SME_STATE_READY;
1664 } while( 0 );
1665
1666 return status;
1667}
1668
1669/*--------------------------------------------------------------------------
1670
1671 \brief sme_Start() - Put all SME modules at ready state.
1672
1673 The function starts each module in SME, PMC, CCM, CSR, etc. . Upon
1674 successfully return, all modules are ready to run.
Srinivas Girigowdade697412013-02-14 16:31:48 -08001675 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07001676 \param hHal - The handle returned by macOpen.
1677
1678 \return eHAL_STATUS_SUCCESS - SME is ready.
1679
1680 Other status means SME is failed to start
1681 \sa
1682
1683 --------------------------------------------------------------------------*/
1684eHalStatus sme_Start(tHalHandle hHal)
1685{
1686 eHalStatus status = eHAL_STATUS_FAILURE;
1687 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1688
1689 do
1690 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001691 status = csrStart(pMac);
1692 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001693 smsLog( pMac, LOGE, "csrStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 status );
1695 break;
1696 }
1697
1698 status = pmcStart(hHal);
1699 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001700 smsLog( pMac, LOGE, "pmcStart failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001701 status );
1702 break;
1703 }
1704
Jeff Johnson295189b2012-06-20 16:38:30 -07001705 status = WLANSAP_Start(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
1706 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001707 smsLog( pMac, LOGE, "WLANSAP_Start failed during smeStart with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001708 status );
1709 break;
1710 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001711 pMac->sme.state = SME_STATE_START;
1712 }while (0);
1713
1714 return status;
1715}
1716
1717
1718#ifdef WLAN_FEATURE_PACKET_FILTERING
1719/******************************************************************************
1720*
1721* Name: sme_PCFilterMatchCountResponseHandler
1722*
1723* Description:
1724* Invoke Packet Coalescing Filter Match Count callback routine
1725*
1726* Parameters:
1727* hHal - HAL handle for device
1728* pMsg - Pointer to tRcvFltPktMatchRsp structure
1729*
1730* Returns: eHalStatus
1731*
1732******************************************************************************/
1733eHalStatus sme_PCFilterMatchCountResponseHandler(tHalHandle hHal, void* pMsg)
1734{
1735 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
1736 eHalStatus status = eHAL_STATUS_SUCCESS;
1737 tpSirRcvFltPktMatchRsp pRcvFltPktMatchRsp = (tpSirRcvFltPktMatchRsp)pMsg;
1738
1739 if (NULL == pMsg)
1740 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001741 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001742 status = eHAL_STATUS_FAILURE;
1743 }
1744 else
1745 {
1746 smsLog(pMac, LOG2, "SME: entering "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08001747 "sme_FilterMatchCountResponseHandler");
Jeff Johnson295189b2012-06-20 16:38:30 -07001748
1749 /* Call Packet Coalescing Filter Match Count callback routine. */
1750 if (pMac->pmc.FilterMatchCountCB != NULL)
1751 pMac->pmc.FilterMatchCountCB(pMac->pmc.FilterMatchCountCBContext,
1752 pRcvFltPktMatchRsp);
1753
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001754 smsLog(pMac, LOG1, "%s: status=0x%x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07001755 pRcvFltPktMatchRsp->status);
1756
1757 pMac->pmc.FilterMatchCountCB = NULL;
1758 pMac->pmc.FilterMatchCountCBContext = NULL;
1759 }
1760
1761 return(status);
1762}
1763#endif // WLAN_FEATURE_PACKET_FILTERING
1764
1765
Chet Lanctot186b5732013-03-18 10:26:30 -07001766#ifdef WLAN_FEATURE_11W
1767/*------------------------------------------------------------------
1768 *
1769 * Handle the unprotected management frame indication from LIM and
1770 * forward it to HDD.
1771 *
1772 *------------------------------------------------------------------*/
1773
1774eHalStatus sme_UnprotectedMgmtFrmInd( tHalHandle hHal,
1775 tpSirSmeUnprotMgmtFrameInd pSmeMgmtFrm)
1776{
1777 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1778 eHalStatus status = eHAL_STATUS_SUCCESS;
1779 tCsrRoamInfo pRoamInfo = {0};
1780 tANI_U32 SessionId = pSmeMgmtFrm->sessionId;
1781
1782 pRoamInfo.nFrameLength = pSmeMgmtFrm->frameLen;
1783 pRoamInfo.pbFrames = pSmeMgmtFrm->frameBuf;
1784 pRoamInfo.frameType = pSmeMgmtFrm->frameType;
1785
1786 /* forward the mgmt frame to HDD */
1787 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_UNPROT_MGMT_FRAME_IND, 0);
1788
1789 return status;
1790}
1791#endif
1792
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08001793#ifdef WLAN_FEATURE_AP_HT40_24G
1794/* ---------------------------------------------------------------------------
1795 \fn sme_HT2040CoexInfoInd
1796 \brief a Send 20/40 Coex info to SAP layer
1797
1798 \param tpSirHT2040CoexInfoInd - 20/40 Coex info param
1799 \return eHalStatus
1800 ---------------------------------------------------------------------------*/
1801
1802eHalStatus sme_HT2040CoexInfoInd( tHalHandle hHal,
1803 tpSirHT2040CoexInfoInd pSmeHT2040CoexInfoInd)
1804{
1805 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1806 eHalStatus status = eHAL_STATUS_SUCCESS;
1807 tANI_U32 SessionId = pSmeHT2040CoexInfoInd->sessionId;
1808 tCsrRoamInfo roamInfo = {0};
1809
1810 roamInfo.pSmeHT2040CoexInfoInd = pSmeHT2040CoexInfoInd;
1811
1812 smsLog(pMac, LOGW, FL("HT40MHzIntolerant: %d HT20MHzBssWidthReq: %d"),
1813 roamInfo.pSmeHT2040CoexInfoInd->HT40MHzIntolerant,
1814 roamInfo.pSmeHT2040CoexInfoInd->HT20MHzBssWidthReq);
1815
1816 smsLog(pMac, LOGW, FL("Total Intolerant Channel: %d"),
1817 roamInfo.pSmeHT2040CoexInfoInd->channel_num);
1818
1819 /* forward the 20/40 BSS Coex information to HDD */
1820 smsLog(pMac, LOGW, FL("Sending eCSR_ROAM_2040_COEX_INFO_IND"
1821 " to WLANSAP_RoamCallback "));
1822
1823 csrRoamCallCallback(pMac, SessionId, &roamInfo,
1824 0, eCSR_ROAM_2040_COEX_INFO_IND, 0);
1825 return status;
1826}
1827#endif
1828
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001829#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001830/*------------------------------------------------------------------
1831 *
1832 * Handle the tsm ie indication from LIM and forward it to HDD.
1833 *
1834 *------------------------------------------------------------------*/
1835
1836eHalStatus sme_TsmIeInd(tHalHandle hHal, tSirSmeTsmIEInd *pSmeTsmIeInd)
1837{
1838 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1839 eHalStatus status = eHAL_STATUS_SUCCESS;
1840 tCsrRoamInfo pRoamInfo = {0};
1841 tANI_U32 SessionId = pSmeTsmIeInd->sessionId;
1842
1843 pRoamInfo.tsmIe.tsid= pSmeTsmIeInd->tsmIe.tsid;
1844 pRoamInfo.tsmIe.state= pSmeTsmIeInd->tsmIe.state;
1845 pRoamInfo.tsmIe.msmt_interval= pSmeTsmIeInd->tsmIe.msmt_interval;
1846
1847 /* forward the tsm ie information to HDD */
1848 csrRoamCallCallback(pMac, SessionId, &pRoamInfo, 0, eCSR_ROAM_TSM_IE_IND, 0);
1849
1850 return status;
1851}
1852
1853/* ---------------------------------------------------------------------------
1854 \fn sme_SetCCKMIe
1855 \brief function to store the CCKM IE passed from supplicant and use it while packing
1856 reassociation request
1857 \param hHal - HAL handle for device
1858 \param pCckmIe - pointer to CCKM IE data
1859 \param pCckmIeLen - length of the CCKM IE
1860 \- return Success or failure
1861 -------------------------------------------------------------------------*/
1862eHalStatus sme_SetCCKMIe(tHalHandle hHal, tANI_U8 sessionId,
1863 tANI_U8 *pCckmIe, tANI_U8 cckmIeLen)
1864{
1865 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1866 eHalStatus status = eHAL_STATUS_SUCCESS;
1867
1868 status = sme_AcquireGlobalLock( &pMac->sme );
1869 if ( HAL_STATUS_SUCCESS( status ) )
1870 {
1871 csrSetCCKMIe(pMac, sessionId, pCckmIe, cckmIeLen);
1872 sme_ReleaseGlobalLock( &pMac->sme );
1873 }
1874 return status;
1875}
1876
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001877/* ---------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001878 \fn sme_SetEseBeaconRequest
1879 \brief function to set Ese beacon request parameters
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001880 \param hHal - HAL handle for device
1881 \param sessionId - Session id
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001882 \param pEseBcnReq - pointer to Ese beacon request
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001883 \- return Success or failure
1884 -------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001885eHalStatus sme_SetEseBeaconRequest(tHalHandle hHal, const tANI_U8 sessionId,
1886 const tCsrEseBeaconReq* pEseBcnReq)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001887{
1888 eHalStatus status = eSIR_SUCCESS;
1889 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1890 tpSirBeaconReportReqInd pSmeBcnReportReq = NULL;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001891 tCsrEseBeaconReqParams *pBeaconReq = NULL;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001892 tANI_U8 counter = 0;
1893 tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
1894 tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
1895
1896 /* Store the info in RRM context */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001897 vos_mem_copy(&pSmeRrmContext->eseBcnReqInfo, pEseBcnReq, sizeof(tCsrEseBeaconReq));
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001898
1899 //Prepare the request to send to SME.
1900 pSmeBcnReportReq = vos_mem_malloc(sizeof( tSirBeaconReportReqInd ));
1901 if(NULL == pSmeBcnReportReq)
1902 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001903 smsLog(pMac, LOGP, "Memory Allocation Failure!!! Ese BcnReq Ind to SME");
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001904 return eSIR_FAILURE;
1905 }
1906
1907 smsLog(pMac, LOGE, "Sending Beacon Report Req to SME");
1908 vos_mem_zero( pSmeBcnReportReq, sizeof( tSirBeaconReportReqInd ));
1909
1910 pSmeBcnReportReq->messageType = eWNI_SME_BEACON_REPORT_REQ_IND;
1911 pSmeBcnReportReq->length = sizeof( tSirBeaconReportReqInd );
1912 vos_mem_copy( pSmeBcnReportReq->bssId, pSession->connectedProfile.bssid, sizeof(tSirMacAddr) );
1913 pSmeBcnReportReq->channelInfo.channelNum = 255;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001914 pSmeBcnReportReq->channelList.numChannels = pEseBcnReq->numBcnReqIe;
1915 pSmeBcnReportReq->msgSource = eRRM_MSG_SOURCE_ESE_UPLOAD;
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001916
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001917 for (counter = 0; counter < pEseBcnReq->numBcnReqIe; counter++)
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001918 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001919 pBeaconReq = (tCsrEseBeaconReqParams *)&pEseBcnReq->bcnReq[counter];
Srinivas Girigowda91ccbe82013-11-10 16:37:38 -08001920 pSmeBcnReportReq->fMeasurementtype[counter] = pBeaconReq->scanMode;
1921 pSmeBcnReportReq->measurementDuration[counter] = SYS_TU_TO_MS(pBeaconReq->measurementDuration);
1922 pSmeBcnReportReq->channelList.channelNumber[counter] = pBeaconReq->channel;
1923 }
1924
1925 sme_RrmProcessBeaconReportReqInd(pMac, pSmeBcnReportReq);
1926 return status;
1927}
1928
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001929#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001930
Chet Lanctot186b5732013-03-18 10:26:30 -07001931
c_hpothu92367912014-05-01 15:18:17 +05301932/* ---------------------------------------------------------------------------
1933 \fn sme_getBcnMissRate
1934 \brief function sends 'WDA_GET_BCN_MISS_RATE_REQ' to WDA layer,
1935 \param hHal - HAL handle for device.
1936 \param sessionId - session ID.
1937 \- return Success or Failure.
1938 -------------------------------------------------------------------------*/
1939
1940eHalStatus sme_getBcnMissRate(tHalHandle hHal, tANI_U8 sessionId, void *callback, void *data)
1941{
1942 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1943 VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE;
1944 vos_msg_t vosMessage;
1945 tSirBcnMissRateReq *pMsg;
1946 tCsrRoamSession *pSession;
1947
1948 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
1949 {
1950 pSession = CSR_GET_SESSION( pMac, sessionId );
1951
1952 if (!pSession)
1953 {
1954 smsLog(pMac, LOGE, FL("session %d not found"), sessionId);
1955 sme_ReleaseGlobalLock( &pMac->sme );
1956 return eHAL_STATUS_FAILURE;
1957 }
1958
c_hpothu402de812014-07-10 15:55:45 +05301959 pMsg = (tSirBcnMissRateReq *) vos_mem_malloc(sizeof(tSirBcnMissRateReq));
c_hpothu92367912014-05-01 15:18:17 +05301960 if (NULL == pMsg)
1961 {
1962 smsLog(pMac, LOGE, FL("failed to allocated memory"));
1963 sme_ReleaseGlobalLock( &pMac->sme );
1964 return eHAL_STATUS_FAILURE;
1965 }
1966
1967 vos_mem_copy(pMsg->bssid, pSession->connectedProfile.bssid,
1968 sizeof(tSirMacAddr));
1969
1970 pMsg->msgLen = sizeof(tSirBcnMissRateReq);
1971 pMsg->callback = callback;
1972 pMsg->data = data;
1973
1974 vosMessage.type = WDA_GET_BCN_MISS_RATE_REQ;
1975 vosMessage.bodyptr = pMsg;
1976 vosMessage.reserved = 0;
1977 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
1978 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1979 {
1980 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
1981 "%s: Post Set TM Level MSG fail", __func__);
1982 vos_mem_free(pMsg);
1983 sme_ReleaseGlobalLock( &pMac->sme );
1984 return eHAL_STATUS_FAILURE;
1985 }
1986 sme_ReleaseGlobalLock( &pMac->sme);
1987 return eHAL_STATUS_SUCCESS;
1988 }
1989 return eHAL_STATUS_FAILURE;
1990}
1991
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05301992eHalStatus sme_EncryptMsgResponseHandler(tHalHandle hHal,
1993 tpSirEncryptedDataRspParams pEncRspParams)
1994{
1995 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
1996
1997 if (NULL == pMac)
1998 {
1999 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
2000 "%s: pMac is null", __func__);
2001 return eHAL_STATUS_FAILURE;
2002 }
2003 if (pMac->sme.pEncMsgInfoParams.pEncMsgCbk == NULL)
2004 {
2005 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
2006 "%s: HDD callback is null", __func__);
2007 return eHAL_STATUS_FAILURE;
2008 }
2009 pMac->sme.pEncMsgInfoParams.pEncMsgCbk(pMac->sme.pEncMsgInfoParams.pUserData,
2010 &pEncRspParams->encryptedDataRsp);
2011 return eHAL_STATUS_SUCCESS;
2012}
2013
Girish Gowlia95daca2015-02-04 20:31:31 +05302014eHalStatus sme_UpdateMaxRateInd(tHalHandle hHal,
2015 tSirSmeUpdateMaxRateParams *pSmeUpdateMaxRateParams)
2016{
2017 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2018 eHalStatus status = eHAL_STATUS_SUCCESS;
2019 tANI_U8 sessionId = pSmeUpdateMaxRateParams->smeSessionId;
2020
2021 /* forward the information to HDD */
2022 status = csrRoamCallCallback(pMac, sessionId, NULL, 0,
2023 eCSR_ROAM_UPDATE_MAX_RATE_IND,
2024 pSmeUpdateMaxRateParams->maxRateFlag);
2025 return status;
2026}
2027
Jeff Johnson295189b2012-06-20 16:38:30 -07002028/*--------------------------------------------------------------------------
2029
2030 \brief sme_ProcessMsg() - The main message processor for SME.
2031
2032 The function is called by a message dispatcher when to process a message
2033 targeted for SME.
2034
Srinivas Girigowdade697412013-02-14 16:31:48 -08002035 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002036 \param hHal - The handle returned by macOpen.
2037 \param pMsg - A pointer to a caller allocated object of tSirMsgQ.
2038
2039 \return eHAL_STATUS_SUCCESS - SME successfully process the message.
2040
2041 Other status means SME failed to process the message to HAL.
2042 \sa
2043
2044 --------------------------------------------------------------------------*/
2045eHalStatus sme_ProcessMsg(tHalHandle hHal, vos_msg_t* pMsg)
2046{
2047 eHalStatus status = eHAL_STATUS_FAILURE;
2048 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2049
2050 if (pMsg == NULL) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002051 smsLog( pMac, LOGE, "Empty message for SME, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002052 return status;
2053 }
2054
2055 status = sme_AcquireGlobalLock( &pMac->sme );
2056 if ( HAL_STATUS_SUCCESS( status ) )
2057 {
2058 if( SME_IS_START(pMac) )
2059 {
2060 switch (pMsg->type) { // TODO: Will be modified to do a range check for msgs instead of having cases for each msgs
2061 case eWNI_PMC_ENTER_BMPS_RSP:
2062 case eWNI_PMC_EXIT_BMPS_RSP:
2063 case eWNI_PMC_EXIT_BMPS_IND:
2064 case eWNI_PMC_ENTER_IMPS_RSP:
2065 case eWNI_PMC_EXIT_IMPS_RSP:
2066 case eWNI_PMC_SMPS_STATE_IND:
2067 case eWNI_PMC_ENTER_UAPSD_RSP:
2068 case eWNI_PMC_EXIT_UAPSD_RSP:
2069 case eWNI_PMC_ENTER_WOWL_RSP:
2070 case eWNI_PMC_EXIT_WOWL_RSP:
2071 //PMC
2072 if (pMsg->bodyptr)
2073 {
2074 pmcMessageProcessor(hHal, pMsg->bodyptr);
2075 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302076 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002077 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002078 smsLog( pMac, LOGE, "Empty rsp message for PMC, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 }
2080 break;
2081
2082 case WNI_CFG_SET_CNF:
2083 case WNI_CFG_DNLD_CNF:
2084 case WNI_CFG_GET_RSP:
2085 case WNI_CFG_ADD_GRP_ADDR_CNF:
2086 case WNI_CFG_DEL_GRP_ADDR_CNF:
2087 //CCM
2088 if (pMsg->bodyptr)
2089 {
2090 ccmCfgCnfMsgHandler(hHal, pMsg->bodyptr);
2091 status = eHAL_STATUS_SUCCESS;
Kiet Lam64c1b492013-07-12 13:56:44 +05302092 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002093 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002094 smsLog( pMac, LOGE, "Empty rsp message for CCM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 }
2096 break;
2097
2098 case eWNI_SME_ADDTS_RSP:
2099 case eWNI_SME_DELTS_RSP:
2100 case eWNI_SME_DELTS_IND:
2101#ifdef WLAN_FEATURE_VOWIFI_11R
2102 case eWNI_SME_FT_AGGR_QOS_RSP:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002103#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002104 //QoS
2105 if (pMsg->bodyptr)
2106 {
2107#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2108 status = sme_QosMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302109 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002110#endif
2111 } else {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002112 smsLog( pMac, LOGE, "Empty rsp message for QoS, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 }
2114 break;
2115#if defined WLAN_FEATURE_VOWIFI
2116 case eWNI_SME_NEIGHBOR_REPORT_IND:
2117 case eWNI_SME_BEACON_REPORT_REQ_IND:
2118#if defined WLAN_VOWIFI_DEBUG
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002119 smsLog( pMac, LOGE, "Received RRM message. Message Id = %d", pMsg->type );
Jeff Johnson295189b2012-06-20 16:38:30 -07002120#endif
2121 if ( pMsg->bodyptr )
2122 {
2123 status = sme_RrmMsgProcessor( pMac, pMsg->type, pMsg->bodyptr );
Kiet Lam64c1b492013-07-12 13:56:44 +05302124 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002125 }
2126 else
2127 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002128 smsLog( pMac, LOGE, "Empty message for RRM, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002129 }
2130 break;
2131#endif
2132
Jeff Johnsone7245742012-09-05 17:12:55 -07002133#ifdef FEATURE_OEM_DATA_SUPPORT
2134 //Handle the eWNI_SME_OEM_DATA_RSP:
2135 case eWNI_SME_OEM_DATA_RSP:
2136 if(pMsg->bodyptr)
2137 {
2138 status = sme_HandleOemDataRsp(pMac, pMsg->bodyptr);
2139 vos_mem_free(pMsg->bodyptr);
2140 }
2141 else
2142 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002143 smsLog( pMac, LOGE, "Empty rsp message for oemData_ (eWNI_SME_OEM_DATA_RSP), nothing to process");
Jeff Johnsone7245742012-09-05 17:12:55 -07002144 }
2145 smeProcessPendingQueue( pMac );
2146 break;
2147#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002148
2149 case eWNI_SME_ADD_STA_SELF_RSP:
2150 if(pMsg->bodyptr)
2151 {
2152 status = csrProcessAddStaSessionRsp(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_ADD_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002158 }
2159 break;
2160 case eWNI_SME_DEL_STA_SELF_RSP:
2161 if(pMsg->bodyptr)
2162 {
2163 status = csrProcessDelStaSessionRsp(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_DEL_STA_SELF_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002169 }
2170 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002171 case eWNI_SME_REMAIN_ON_CHN_RSP:
2172 if(pMsg->bodyptr)
2173 {
2174 status = sme_remainOnChnRsp(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_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002180 }
2181 break;
2182 case eWNI_SME_REMAIN_ON_CHN_RDY_IND:
2183 if(pMsg->bodyptr)
2184 {
2185 status = sme_remainOnChnReady(pMac, pMsg->bodyptr);
2186 vos_mem_free(pMsg->bodyptr);
2187 }
2188 else
2189 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002190 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 -07002191 }
2192 break;
2193 case eWNI_SME_MGMT_FRM_IND:
2194 if(pMsg->bodyptr)
2195 {
2196 sme_mgmtFrmInd(pMac, pMsg->bodyptr);
2197 vos_mem_free(pMsg->bodyptr);
2198 }
2199 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002200 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002201 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_MGMT_FRM_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002202 }
2203 break;
Hardik Kantilal Patel81f76342014-11-14 12:45:26 -08002204#ifdef WLAN_FEATURE_AP_HT40_24G
2205 case eWNI_SME_2040_COEX_IND:
2206 if(pMsg->bodyptr)
2207 {
2208 sme_HT2040CoexInfoInd(pMac, pMsg->bodyptr);
2209 vos_mem_free(pMsg->bodyptr);
2210 }
2211 else
2212 {
2213 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_2040_COEX_IND), nothing to process");
2214 }
2215 break;
2216#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002217 case eWNI_SME_ACTION_FRAME_SEND_CNF:
2218 if(pMsg->bodyptr)
2219 {
2220 status = sme_sendActionCnf(pMac, pMsg->bodyptr);
2221 vos_mem_free(pMsg->bodyptr);
2222 }
2223 else
2224 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002225 smsLog( pMac, LOGE, "Empty rsp message for meas (eWNI_SME_ACTION_FRAME_SEND_CNF), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002226 }
2227 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002228 case eWNI_SME_COEX_IND:
2229 if(pMsg->bodyptr)
2230 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302231 tSirSmeCoexInd *pSmeCoexInd = (tSirSmeCoexInd *)pMsg->bodyptr;
2232
2233 if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4)
2234 {
2235 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_DISABLE_AGGREGATION_IN_2p4"));
2236 sme_RequestFullPower(hHal, NULL, NULL, eSME_REASON_OTHER);
2237 pMac->isCoexScoIndSet = 1;
2238 }
2239 else if (pSmeCoexInd->coexIndType == SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4)
2240 {
2241 smsLog( pMac, LOG1, FL("SIR_COEX_IND_TYPE_ENABLE_AGGREGATION_IN_2p4"));
2242 pMac->isCoexScoIndSet = 0;
2243 sme_RequestBmps(hHal, NULL, NULL);
2244 }
2245
Jeff Johnson295189b2012-06-20 16:38:30 -07002246 status = btcHandleCoexInd((void *)pMac, pMsg->bodyptr);
2247 vos_mem_free(pMsg->bodyptr);
2248 }
2249 else
2250 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002251 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_COEX_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002252 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002253 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002254
2255#ifdef FEATURE_WLAN_SCAN_PNO
2256 case eWNI_SME_PREF_NETWORK_FOUND_IND:
2257 if(pMsg->bodyptr)
2258 {
2259 status = sme_PreferredNetworkFoundInd((void *)pMac, pMsg->bodyptr);
2260 vos_mem_free(pMsg->bodyptr);
2261 }
2262 else
2263 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002264 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_PREF_NETWORK_FOUND_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002265 }
2266 break;
2267#endif // FEATURE_WLAN_SCAN_PNO
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002268
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 case eWNI_SME_TX_PER_HIT_IND:
2270 if (pMac->sme.pTxPerHitCallback)
2271 {
2272 pMac->sme.pTxPerHitCallback(pMac->sme.pTxPerHitCbContext);
2273 }
2274 break;
2275
2276 case eWNI_SME_CHANGE_COUNTRY_CODE:
Amar Singhal0d15bd52013-10-12 23:13:13 -07002277 if(pMsg->bodyptr)
Jeff Johnson295189b2012-06-20 16:38:30 -07002278 {
2279 status = sme_HandleChangeCountryCode((void *)pMac, pMsg->bodyptr);
2280 vos_mem_free(pMsg->bodyptr);
2281 }
2282 else
2283 {
Amar Singhal0d15bd52013-10-12 23:13:13 -07002284 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_CHANGE_COUNTRY_CODE), nothing to process");
2285 }
2286 break;
2287
2288 case eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE:
2289 if (pMsg->bodyptr)
2290 {
2291 status = sme_HandleGenericChangeCountryCode((void *)pMac, pMsg->bodyptr);
2292 vos_mem_free(pMsg->bodyptr);
2293 }
2294 else
2295 {
2296 smsLog(pMac, LOGE, "Empty rsp message for message (eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002297 }
2298 break;
2299
2300#ifdef WLAN_FEATURE_PACKET_FILTERING
2301 case eWNI_PMC_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2302 if(pMsg->bodyptr)
2303 {
2304 status = sme_PCFilterMatchCountResponseHandler((void *)pMac, pMsg->bodyptr);
2305 vos_mem_free(pMsg->bodyptr);
2306 }
2307 else
2308 {
2309 smsLog(pMac, LOGE, "Empty rsp message for meas "
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002310 "(PACKET_COALESCING_FILTER_MATCH_COUNT_RSP), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002311 }
2312 break;
2313#endif // WLAN_FEATURE_PACKET_FILTERING
2314 case eWNI_SME_PRE_SWITCH_CHL_IND:
2315 {
2316 status = sme_HandlePreChannelSwitchInd(pMac);
2317 break;
2318 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002319
Jeff Johnson295189b2012-06-20 16:38:30 -07002320 case eWNI_SME_POST_SWITCH_CHL_IND:
2321 {
2322 status = sme_HandlePostChannelSwitchInd(pMac);
2323 break;
2324 }
2325
2326#ifdef WLAN_WAKEUP_EVENTS
2327 case eWNI_SME_WAKE_REASON_IND:
2328 if(pMsg->bodyptr)
2329 {
2330 status = sme_WakeReasonIndCallback((void *)pMac, pMsg->bodyptr);
2331 vos_mem_free(pMsg->bodyptr);
2332 }
2333 else
2334 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002335 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_WAKE_REASON_IND), nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002336 }
2337 break;
2338#endif // WLAN_WAKEUP_EVENTS
2339
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002340#ifdef FEATURE_WLAN_TDLS
2341 /*
2342 * command rescived from PE, SME tdls msg processor shall be called
2343 * to process commands recieved from PE
2344 */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002345 case eWNI_SME_TDLS_SEND_MGMT_RSP:
2346 case eWNI_SME_TDLS_ADD_STA_RSP:
Hoonki Leee6bfe942013-02-05 15:01:19 -08002347 case eWNI_SME_TDLS_DEL_STA_RSP:
2348 case eWNI_SME_TDLS_DEL_STA_IND:
Gopichand Nakkala2a0a1572013-02-10 21:39:16 -08002349 case eWNI_SME_TDLS_DEL_ALL_PEER_IND:
Gopichand Nakkalab977a972013-02-18 19:15:09 -08002350 case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302351 case eWNI_SME_TDLS_LINK_ESTABLISH_RSP:
Atul Mittal60bd4292014-08-14 12:19:27 +05302352 case eWNI_SME_TDLS_CHANNEL_SWITCH_RSP:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002353#ifdef FEATURE_WLAN_TDLS_INTERNAL
2354 case eWNI_SME_TDLS_DISCOVERY_START_RSP:
2355 case eWNI_SME_TDLS_DISCOVERY_START_IND:
2356 case eWNI_SME_TDLS_LINK_START_RSP:
2357 case eWNI_SME_TDLS_LINK_START_IND:
2358 case eWNI_SME_TDLS_TEARDOWN_RSP:
2359 case eWNI_SME_TDLS_TEARDOWN_IND:
2360 case eWNI_SME_ADD_TDLS_PEER_IND:
2361 case eWNI_SME_DELETE_TDLS_PEER_IND:
2362#endif
2363 {
2364 if (pMsg->bodyptr)
2365 {
2366 status = tdlsMsgProcessor(pMac, pMsg->type, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302367 vos_mem_free(pMsg->bodyptr);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002368 }
2369 else
2370 {
2371 smsLog( pMac, LOGE, "Empty rsp message for TDLS, \
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002372 nothing to process");
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002373 }
2374 break;
2375 }
2376#endif
2377
Chet Lanctot186b5732013-03-18 10:26:30 -07002378#ifdef WLAN_FEATURE_11W
2379 case eWNI_SME_UNPROT_MGMT_FRM_IND:
2380 if (pMsg->bodyptr)
2381 {
2382 sme_UnprotectedMgmtFrmInd(pMac, pMsg->bodyptr);
2383 vos_mem_free(pMsg->bodyptr);
2384 }
2385 else
2386 {
2387 smsLog(pMac, LOGE, "Empty rsp message for meas (eWNI_SME_UNPROT_MGMT_FRM_IND), nothing to process");
2388 }
2389 break;
2390#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002391#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002392 case eWNI_SME_TSM_IE_IND:
2393 {
2394 if (pMsg->bodyptr)
2395 {
2396 sme_TsmIeInd(pMac, pMsg->bodyptr);
2397 vos_mem_free(pMsg->bodyptr);
2398 }
2399 else
2400 {
2401 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_SME_TSM_IE_IND), nothing to process");
2402 }
2403 break;
2404 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002405#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -07002406#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
2407 case eWNI_SME_ROAM_SCAN_OFFLOAD_RSP:
2408 status = csrRoamOffloadScanRspHdlr((void *)pMac, pMsg->bodyval);
2409 break;
2410#endif // WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Chet Lanctot186b5732013-03-18 10:26:30 -07002411
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302412#ifdef WLAN_FEATURE_GTK_OFFLOAD
2413 case eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP:
2414 if (pMsg->bodyptr)
2415 {
2416 sme_ProcessGetGtkInfoRsp(pMac, pMsg->bodyptr);
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05302417 vos_mem_zero(pMsg->bodyptr,
2418 sizeof(tSirGtkOffloadGetInfoRspParams));
Gopichand Nakkalad36ee622013-05-07 14:13:27 +05302419 vos_mem_free(pMsg->bodyptr);
2420 }
2421 else
2422 {
2423 smsLog(pMac, LOGE, "Empty rsp message for (eWNI_PMC_GTK_OFFLOAD_GETINFO_RSP), nothing to process");
2424 }
2425 break ;
2426#endif
Leo Chang9056f462013-08-01 19:21:11 -07002427
2428#ifdef FEATURE_WLAN_LPHB
2429 /* LPHB timeout indication arrived, send IND to client */
Leo Changd9df8aa2013-09-26 13:32:26 -07002430 case eWNI_SME_LPHB_IND:
2431 if (pMac->sme.pLphbIndCb)
Leo Chang9056f462013-08-01 19:21:11 -07002432 {
Leo Changd9df8aa2013-09-26 13:32:26 -07002433 pMac->sme.pLphbIndCb(pMac->pAdapter, pMsg->bodyptr);
Leo Chang9056f462013-08-01 19:21:11 -07002434 }
2435 vos_mem_free(pMsg->bodyptr);
2436
2437 break;
2438#endif /* FEATURE_WLAN_LPHB */
2439
Leo Chang0b0e45a2013-12-15 15:18:55 -08002440#ifdef FEATURE_WLAN_CH_AVOID
2441 /* LPHB timeout indication arrived, send IND to client */
2442 case eWNI_SME_CH_AVOID_IND:
2443 if (pMac->sme.pChAvoidNotificationCb)
2444 {
2445 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
2446 "%s: CH avoid notification", __func__);
2447 pMac->sme.pChAvoidNotificationCb(pMac->pAdapter, pMsg->bodyptr);
2448 }
2449 vos_mem_free(pMsg->bodyptr);
2450
2451 break;
2452#endif /* FEATURE_WLAN_CH_AVOID */
2453
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302454 case eWNI_SME_ENCRYPT_MSG_RSP:
2455 if (pMsg->bodyptr)
2456 {
2457 sme_EncryptMsgResponseHandler(pMac, pMsg->bodyptr);
2458 vos_mem_free(pMsg->bodyptr);
2459 }
2460 else
2461 {
2462 smsLog(pMac, LOGE,
2463 "Empty rsp message for (eWNI_SME_ENCRYPT_MSG_RSP),"
2464 " nothing to process");
2465 }
2466 break ;
2467
Girish Gowlia95daca2015-02-04 20:31:31 +05302468 case eWNI_SME_UPDATE_MAX_RATE_IND:
2469 if (pMsg->bodyptr)
2470 {
2471 sme_UpdateMaxRateInd(pMac, pMsg->bodyptr);
2472 vos_mem_free(pMsg->bodyptr);
2473 }
2474 else
2475 {
2476 smsLog(pMac, LOGE,
2477 "Empty message for (eWNI_SME_UPDATE_MAX_RATE_IND),"
2478 " nothing to process");
2479 }
2480 break;
Srinivas Dasarib8fdd422014-11-27 10:44:20 +05302481
Jeff Johnson295189b2012-06-20 16:38:30 -07002482 default:
2483
2484 if ( ( pMsg->type >= eWNI_SME_MSG_TYPES_BEGIN )
2485 && ( pMsg->type <= eWNI_SME_MSG_TYPES_END ) )
2486 {
2487 //CSR
2488 if (pMsg->bodyptr)
2489 {
2490 status = csrMsgProcessor(hHal, pMsg->bodyptr);
Kiet Lam64c1b492013-07-12 13:56:44 +05302491 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002492 }
2493 else
2494 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002495 smsLog( pMac, LOGE, "Empty rsp message for CSR, nothing to process");
Jeff Johnson295189b2012-06-20 16:38:30 -07002496 }
2497 }
2498 else
2499 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002500 smsLog( pMac, LOGW, "Unknown message type %d, nothing to process",
Jeff Johnson295189b2012-06-20 16:38:30 -07002501 pMsg->type);
2502 if (pMsg->bodyptr)
2503 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302504 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002505 }
2506 }
2507 }//switch
2508 } //SME_IS_START
2509 else
2510 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002511 smsLog( pMac, LOGW, "message type %d in stop state ignored", pMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07002512 if (pMsg->bodyptr)
2513 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302514 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002515 }
2516 }
2517 sme_ReleaseGlobalLock( &pMac->sme );
2518 }
2519 else
2520 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002521 smsLog( pMac, LOGW, "Locking failed, bailing out");
Jeff Johnson295189b2012-06-20 16:38:30 -07002522 if (pMsg->bodyptr)
2523 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302524 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002525 }
2526 }
2527
2528 return status;
2529}
2530
2531
2532//No need to hold the global lock here because this function can only be called
2533//after sme_Stop.
2534v_VOID_t sme_FreeMsg( tHalHandle hHal, vos_msg_t* pMsg )
2535{
2536 if( pMsg )
2537 {
2538 if (pMsg->bodyptr)
2539 {
Kiet Lam64c1b492013-07-12 13:56:44 +05302540 vos_mem_free(pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002541 }
2542 }
2543
2544}
2545
2546
2547/*--------------------------------------------------------------------------
2548
2549 \brief sme_Stop() - Stop all SME modules and put them at idle state
2550
2551 The function stops each module in SME, PMC, CCM, CSR, etc. . Upon
2552 return, all modules are at idle state ready to start.
2553
Srinivas Girigowdade697412013-02-14 16:31:48 -08002554 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002555 \param hHal - The handle returned by macOpen
Kiet Lama72a2322013-11-15 11:18:11 +05302556 \param tHalStopType - reason for stopping
Jeff Johnson295189b2012-06-20 16:38:30 -07002557
2558 \return eHAL_STATUS_SUCCESS - SME is stopped.
2559
2560 Other status means SME is failed to stop but caller should still
2561 consider SME is stopped.
2562 \sa
2563
2564 --------------------------------------------------------------------------*/
Kiet Lama72a2322013-11-15 11:18:11 +05302565eHalStatus sme_Stop(tHalHandle hHal, tHalStopType stopType)
Jeff Johnson295189b2012-06-20 16:38:30 -07002566{
2567 eHalStatus status = eHAL_STATUS_FAILURE;
2568 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2569 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2570
Jeff Johnson295189b2012-06-20 16:38:30 -07002571 status = WLANSAP_Stop(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2572 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002573 smsLog( pMac, LOGE, "WLANSAP_Stop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002574 status );
2575 fail_status = status;
2576 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002577
2578 p2pStop(hHal);
2579
Kiet Lama72a2322013-11-15 11:18:11 +05302580 status = pmcStop(hHal);
2581 if ( ! HAL_STATUS_SUCCESS( status ) ) {
2582 smsLog( pMac, LOGE, "pmcStop failed during smeStop with status=%d",
2583 status );
2584 fail_status = status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002585 }
2586
Kiet Lama72a2322013-11-15 11:18:11 +05302587 status = csrStop(pMac, stopType);
Jeff Johnson295189b2012-06-20 16:38:30 -07002588 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002589 smsLog( pMac, LOGE, "csrStop failed during smeStop with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002590 status );
2591 fail_status = status;
2592 }
2593
2594 ccmStop(hHal);
2595
2596 purgeSmeCmdList(pMac);
2597
2598 if (!HAL_STATUS_SUCCESS( fail_status )) {
2599 status = fail_status;
2600 }
2601
2602 pMac->sme.state = SME_STATE_STOP;
2603
2604 return status;
2605}
2606
2607/*--------------------------------------------------------------------------
2608
2609 \brief sme_Close() - Release all SME modules and their resources.
2610
2611 The function release each module in SME, PMC, CCM, CSR, etc. . Upon
2612 return, all modules are at closed state.
2613
2614 No SME APIs can be involved after smeClose except smeOpen.
2615 smeClose must be called before macClose.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002616 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002617 \param hHal - The handle returned by macOpen
2618
2619 \return eHAL_STATUS_SUCCESS - SME is successfully close.
2620
2621 Other status means SME is failed to be closed but caller still cannot
2622 call any other SME functions except smeOpen.
2623 \sa
2624
2625 --------------------------------------------------------------------------*/
2626eHalStatus sme_Close(tHalHandle hHal)
2627{
2628 eHalStatus status = eHAL_STATUS_FAILURE;
2629 eHalStatus fail_status = eHAL_STATUS_SUCCESS;
2630 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2631
2632 status = csrClose(pMac);
2633 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002634 smsLog( pMac, LOGE, "csrClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002635 status );
2636 fail_status = status;
2637 }
2638
Jeff Johnson295189b2012-06-20 16:38:30 -07002639 status = WLANSAP_Close(vos_get_global_context(VOS_MODULE_ID_SAP, NULL));
2640 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002641 smsLog( pMac, LOGE, "WLANSAP_close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002642 status );
2643 fail_status = status;
2644 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002645
2646#ifndef WLAN_MDM_CODE_REDUCTION_OPT
2647 status = btcClose(hHal);
2648 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002649 smsLog( pMac, LOGE, "BTC close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002650 status );
2651 fail_status = status;
2652 }
2653
2654 status = sme_QosClose(pMac);
2655 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002656 smsLog( pMac, LOGE, "Qos close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002657 status );
2658 fail_status = status;
2659 }
2660#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002661#ifdef FEATURE_OEM_DATA_SUPPORT
2662 status = oemData_OemDataReqClose(hHal);
2663 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002664 smsLog( pMac, LOGE, "OEM DATA REQ close failed during sme close with status=%d",
Jeff Johnsone7245742012-09-05 17:12:55 -07002665 status );
2666 fail_status = status;
2667 }
2668#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002669
2670 status = ccmClose(hHal);
2671 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002672 smsLog( pMac, LOGE, "ccmClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002673 status );
2674 fail_status = status;
2675 }
2676
2677 status = pmcClose(hHal);
2678 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002679 smsLog( pMac, LOGE, "pmcClose failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002680 status );
2681 fail_status = status;
2682 }
2683#if defined WLAN_FEATURE_VOWIFI
2684 status = rrmClose(hHal);
2685 if ( ! HAL_STATUS_SUCCESS( status ) ) {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08002686 smsLog( pMac, LOGE, "RRM close failed during sme close with status=%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07002687 status );
2688 fail_status = status;
2689 }
2690#endif
2691
2692#if defined WLAN_FEATURE_VOWIFI_11R
2693 sme_FTClose(hHal);
2694#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002695 sme_p2pClose(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07002696
2697 freeSmeCmdList(pMac);
2698
2699 if( !VOS_IS_STATUS_SUCCESS( vos_lock_destroy( &pMac->sme.lkSmeGlobalLock ) ) )
2700 {
2701 fail_status = eHAL_STATUS_FAILURE;
2702 }
2703
2704 if (!HAL_STATUS_SUCCESS( fail_status )) {
2705 status = fail_status;
2706 }
2707
2708 pMac->sme.state = SME_STATE_STOP;
2709
2710 return status;
2711}
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002712#ifdef FEATURE_WLAN_LFR
2713tANI_BOOLEAN csrIsScanAllowed(tpAniSirGlobal pMac)
2714{
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002715#if 0
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002716 switch(pMac->roam.neighborRoamInfo.neighborRoamState) {
2717 case eCSR_NEIGHBOR_ROAM_STATE_REPORT_SCAN:
2718 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTHENTICATING:
2719 case eCSR_NEIGHBOR_ROAM_STATE_PREAUTH_DONE:
2720 case eCSR_NEIGHBOR_ROAM_STATE_REASSOCIATING:
2721 return eANI_BOOLEAN_FALSE;
2722 default:
2723 return eANI_BOOLEAN_TRUE;
2724 }
Madan Mohan Koyyalamudifb534bb2012-10-24 14:35:45 -07002725#else
2726 /*
2727 * TODO: always return TRUE for now until
2728 * we figure out why we could be stuck in
2729 * one of the roaming states forever.
2730 */
2731 return eANI_BOOLEAN_TRUE;
2732#endif
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002733}
2734#endif
c_hpothu58901462014-11-01 16:44:34 +05302735
2736/* ---------------------------------------------------------------------------
2737 \fn sco_isScanAllowed
2738 \brief check for scan interface connection status
2739 \param pMac - Pointer to the global MAC parameter structure
2740 \param pScanReq - scan request structure.
2741
2742 \return tANI_BOOLEAN TRUE to allow scan otherwise FALSE
2743 ---------------------------------------------------------------------------*/
2744tANI_BOOLEAN sco_isScanAllowed(tpAniSirGlobal pMac, tCsrScanRequest *pscanReq)
2745{
2746 tANI_BOOLEAN ret;
2747
2748 if (pscanReq->p2pSearch)
2749 ret = csrIsP2pSessionConnected(pMac);
2750 else
2751 ret = csrIsStaSessionConnected(pMac);
2752
2753 return !ret;
2754}
2755
Jeff Johnson295189b2012-06-20 16:38:30 -07002756/* ---------------------------------------------------------------------------
2757 \fn sme_ScanRequest
2758 \brief a wrapper function to Request a 11d or full scan from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002759 This is an asynchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002760 \param pScanRequestID - pointer to an object to get back the request ID
2761 \param callback - a callback function that scan calls upon finish, will not
2762 be called if csrScanRequest returns error
2763 \param pContext - a pointer passed in for the callback
2764 \return eHalStatus
2765 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002766eHalStatus sme_ScanRequest(tHalHandle hHal, tANI_U8 sessionId, tCsrScanRequest *pscanReq,
2767 tANI_U32 *pScanRequestID,
Jeff Johnson295189b2012-06-20 16:38:30 -07002768 csrScanCompleteCallback callback, void *pContext)
2769{
2770 eHalStatus status = eHAL_STATUS_FAILURE;
2771 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05302772 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002773 TRACE_CODE_SME_RX_HDD_MSG_SCAN_REQ, sessionId, pscanReq->scanType));
Jeff Johnson295189b2012-06-20 16:38:30 -07002774 smsLog(pMac, LOG2, FL("enter"));
2775 do
2776 {
c_hpothu304c0522014-09-30 10:22:57 +05302777 if(pMac->scan.fScanEnable &&
c_hpothu58901462014-11-01 16:44:34 +05302778 (pMac->isCoexScoIndSet ? sco_isScanAllowed(pMac, pscanReq) : TRUE))
Jeff Johnson295189b2012-06-20 16:38:30 -07002779 {
2780 status = sme_AcquireGlobalLock( &pMac->sme );
2781 if ( HAL_STATUS_SUCCESS( status ) )
2782 {
2783 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002784#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002785 if(csrIsScanAllowed(pMac))
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002786 {
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002787#endif
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002788 status = csrScanRequest( hHal, sessionId, pscanReq,
2789 pScanRequestID, callback, pContext );
Vinay Krishna Eranna636b7bc2013-12-18 20:49:08 +05302790 if ( !HAL_STATUS_SUCCESS( status ) )
2791 {
2792 smsLog(pMac, LOGE, FL("csrScanRequest failed"
2793 " SId=%d"), sessionId);
2794 }
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002795#ifdef FEATURE_WLAN_LFR
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002796 }
2797 else
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002798 {
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302799 smsLog(pMac, LOGE, FL("Scan denied in state %s"
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302800 "(sub-state %s)"),
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05302801 macTraceGetNeighbourRoamState(
2802 pMac->roam.neighborRoamInfo.neighborRoamState),
Mahesh A Saptasagar14addb62014-02-17 17:17:51 +05302803 macTraceGetcsrRoamSubState(
2804 pMac->roam.curSubState[sessionId]));
Madan Mohan Koyyalamudiab4ab0d2012-10-24 14:26:50 -07002805 /*HandOff is in progress. So schedule this scan later*/
2806 status = eHAL_STATUS_RESOURCES;
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07002807 }
2808#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002809 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07002810
Jeff Johnson295189b2012-06-20 16:38:30 -07002811 sme_ReleaseGlobalLock( &pMac->sme );
2812 } //sme_AcquireGlobalLock success
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002813 else
2814 {
2815 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
2816 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002817 } //if(pMac->scan.fScanEnable)
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002818 else
2819 {
c_hpothu3ba2a512014-08-06 14:02:54 +05302820 smsLog(pMac, LOGE, FL("fScanEnable %d isCoexScoIndSet: %d "),
2821 pMac->scan.fScanEnable, pMac->isCoexScoIndSet);
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08002822 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002823 } while( 0 );
2824
2825 return (status);
2826
2827
2828}
2829
2830/* ---------------------------------------------------------------------------
2831 \fn sme_ScanGetResult
2832 \brief a wrapper function to request scan results from CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002833 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002834 \param pFilter - If pFilter is NULL, all cached results are returned
2835 \param phResult - an object for the result.
2836 \return eHalStatus
2837 ---------------------------------------------------------------------------*/
2838eHalStatus sme_ScanGetResult(tHalHandle hHal, tANI_U8 sessionId, tCsrScanResultFilter *pFilter,
2839 tScanResultHandle *phResult)
2840{
2841 eHalStatus status = eHAL_STATUS_FAILURE;
2842 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2843
Katya Nigambcb705f2013-12-26 14:26:22 +05302844 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002845 TRACE_CODE_SME_RX_HDD_MSG_SCAN_GET_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002846 smsLog(pMac, LOG2, FL("enter"));
2847 status = sme_AcquireGlobalLock( &pMac->sme );
2848 if ( HAL_STATUS_SUCCESS( status ) )
2849 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002850 status = csrScanGetResult( hHal, pFilter, phResult );
Jeff Johnson295189b2012-06-20 16:38:30 -07002851 sme_ReleaseGlobalLock( &pMac->sme );
2852 }
2853 smsLog(pMac, LOG2, FL("exit status %d"), status);
2854
2855 return (status);
2856}
2857
2858
2859/* ---------------------------------------------------------------------------
2860 \fn sme_ScanFlushResult
2861 \brief a wrapper function to request CSR to clear scan results.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002862 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002863 \return eHalStatus
2864 ---------------------------------------------------------------------------*/
2865eHalStatus sme_ScanFlushResult(tHalHandle hHal, tANI_U8 sessionId)
2866{
2867 eHalStatus status = eHAL_STATUS_FAILURE;
2868 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2869
Katya Nigambcb705f2013-12-26 14:26:22 +05302870 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002871 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002872 status = sme_AcquireGlobalLock( &pMac->sme );
2873 if ( HAL_STATUS_SUCCESS( status ) )
2874 {
Madan Mohan Koyyalamudica43cdf2012-09-24 13:15:49 -07002875 status = csrScanFlushResult( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07002876 sme_ReleaseGlobalLock( &pMac->sme );
2877 }
2878
2879 return (status);
2880}
2881
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05302882/* ---------------------------------------------------------------------------
2883 \fn sme_FilterScanResults
2884 \brief a wrapper function to request CSR to clear scan results.
2885 This is a synchronous call
2886 \return eHalStatus
2887 ---------------------------------------------------------------------------*/
2888eHalStatus sme_FilterScanResults(tHalHandle hHal, tANI_U8 sessionId)
2889{
2890 eHalStatus status = eHAL_STATUS_SUCCESS;
2891 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2892
2893 MTRACE(macTraceNew(pMac, VOS_MODULE_ID_SME,
2894 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_RESULTS, sessionId,0 ));
2895 status = sme_AcquireGlobalLock( &pMac->sme );
2896 if ( HAL_STATUS_SUCCESS( status ) )
2897 {
2898 csrScanFilterResults(pMac);
2899 sme_ReleaseGlobalLock( &pMac->sme );
2900 }
2901
2902 return (status);
2903}
2904
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002905eHalStatus sme_ScanFlushP2PResult(tHalHandle hHal, tANI_U8 sessionId)
2906{
2907 eHalStatus status = eHAL_STATUS_FAILURE;
2908 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2909
Katya Nigambcb705f2013-12-26 14:26:22 +05302910 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002911 TRACE_CODE_SME_RX_HDD_MSG_SCAN_FLUSH_P2PRESULTS, sessionId,0 ));
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002912 status = sme_AcquireGlobalLock( &pMac->sme );
2913 if ( HAL_STATUS_SUCCESS( status ) )
2914 {
Madan Mohan Koyyalamudi5850f312012-11-27 19:00:25 +05302915 status = csrScanFlushSelectiveResult( hHal, VOS_TRUE );
Madan Mohan Koyyalamudia3fcf142012-10-18 15:01:20 -07002916 sme_ReleaseGlobalLock( &pMac->sme );
2917 }
2918
2919 return (status);
2920}
Jeff Johnson295189b2012-06-20 16:38:30 -07002921
2922/* ---------------------------------------------------------------------------
2923 \fn sme_ScanResultGetFirst
2924 \brief a wrapper function to request CSR to returns the first element of
2925 scan result.
Srinivas Girigowdade697412013-02-14 16:31:48 -08002926 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002927 \param hScanResult - returned from csrScanGetResult
2928 \return tCsrScanResultInfo * - NULL if no result
2929 ---------------------------------------------------------------------------*/
2930tCsrScanResultInfo *sme_ScanResultGetFirst(tHalHandle hHal,
2931 tScanResultHandle hScanResult)
2932{
2933 eHalStatus status = eHAL_STATUS_FAILURE;
2934 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2935 tCsrScanResultInfo *pRet = NULL;
2936
Katya Nigambcb705f2013-12-26 14:26:22 +05302937 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002938 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETFIRST, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002939 status = sme_AcquireGlobalLock( &pMac->sme );
2940 if ( HAL_STATUS_SUCCESS( status ) )
2941 {
2942 pRet = csrScanResultGetFirst( pMac, hScanResult );
2943 sme_ReleaseGlobalLock( &pMac->sme );
2944 }
2945
2946 return (pRet);
2947}
2948
2949
2950/* ---------------------------------------------------------------------------
2951 \fn sme_ScanResultGetNext
2952 \brief a wrapper function to request CSR to returns the next element of
2953 scan result. It can be called without calling csrScanResultGetFirst
2954 first
Srinivas Girigowdade697412013-02-14 16:31:48 -08002955 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002956 \param hScanResult - returned from csrScanGetResult
2957 \return Null if no result or reach the end
2958 ---------------------------------------------------------------------------*/
2959tCsrScanResultInfo *sme_ScanResultGetNext(tHalHandle hHal,
2960 tScanResultHandle hScanResult)
2961{
2962 eHalStatus status = eHAL_STATUS_FAILURE;
2963 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2964 tCsrScanResultInfo *pRet = NULL;
2965
Katya Nigambcb705f2013-12-26 14:26:22 +05302966 MTRACE(vos_trace(VOS_MODULE_ID_SME ,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07002967 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_GETNEXT, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07002968 status = sme_AcquireGlobalLock( &pMac->sme );
2969 if ( HAL_STATUS_SUCCESS( status ) )
2970 {
2971 pRet = csrScanResultGetNext( pMac, hScanResult );
2972 sme_ReleaseGlobalLock( &pMac->sme );
2973 }
2974
2975 return (pRet);
2976}
2977
2978
2979/* ---------------------------------------------------------------------------
2980 \fn sme_ScanSetBGScanparams
2981 \brief a wrapper function to request CSR to set BG scan params in PE
Srinivas Girigowdade697412013-02-14 16:31:48 -08002982 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07002983 \param pScanReq - BG scan request structure
2984 \return eHalStatus
2985 ---------------------------------------------------------------------------*/
2986eHalStatus sme_ScanSetBGScanparams(tHalHandle hHal, tANI_U8 sessionId, tCsrBGScanRequest *pScanReq)
2987{
2988 eHalStatus status = eHAL_STATUS_FAILURE;
2989 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
2990
2991 if( NULL != pScanReq )
2992 {
2993 status = sme_AcquireGlobalLock( &pMac->sme );
2994 if ( HAL_STATUS_SUCCESS( status ) )
2995 {
2996 status = csrScanSetBGScanparams( hHal, pScanReq );
2997 sme_ReleaseGlobalLock( &pMac->sme );
2998 }
2999 }
3000
3001 return (status);
3002}
3003
3004
3005/* ---------------------------------------------------------------------------
3006 \fn sme_ScanResultPurge
3007 \brief a wrapper function to request CSR to remove all items(tCsrScanResult)
3008 in the list and free memory for each item
Srinivas Girigowdade697412013-02-14 16:31:48 -08003009 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003010 \param hScanResult - returned from csrScanGetResult. hScanResult is
3011 considered gone by
3012 calling this function and even before this function reutrns.
3013 \return eHalStatus
3014 ---------------------------------------------------------------------------*/
3015eHalStatus sme_ScanResultPurge(tHalHandle hHal, tScanResultHandle hScanResult)
3016{
3017 eHalStatus status = eHAL_STATUS_FAILURE;
3018 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3019
Katya Nigambcb705f2013-12-26 14:26:22 +05303020 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003021 TRACE_CODE_SME_RX_HDD_MSG_SCAN_RESULT_PURGE, NO_SESSION,0 ));
Jeff Johnson295189b2012-06-20 16:38:30 -07003022 status = sme_AcquireGlobalLock( &pMac->sme );
3023 if ( HAL_STATUS_SUCCESS( status ) )
3024 {
3025 status = csrScanResultPurge( hHal, hScanResult );
3026 sme_ReleaseGlobalLock( &pMac->sme );
3027 }
3028
3029 return (status);
3030}
3031
3032/* ---------------------------------------------------------------------------
3033 \fn sme_ScanGetPMKIDCandidateList
3034 \brief a wrapper function to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003035 This is a synchronous call
Jeff Johnson295189b2012-06-20 16:38:30 -07003036 \param pPmkidList - caller allocated buffer point to an array of
3037 tPmkidCandidateInfo
3038 \param pNumItems - pointer to a variable that has the number of
3039 tPmkidCandidateInfo allocated when retruning, this is
3040 either the number needed or number of items put into
3041 pPmkidList
3042 \return eHalStatus - when fail, it usually means the buffer allocated is not
3043 big enough and pNumItems
3044 has the number of tPmkidCandidateInfo.
3045 \Note: pNumItems is a number of tPmkidCandidateInfo,
3046 not sizeof(tPmkidCandidateInfo) * something
3047 ---------------------------------------------------------------------------*/
3048eHalStatus sme_ScanGetPMKIDCandidateList(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003049 tPmkidCandidateInfo *pPmkidList,
Jeff Johnson295189b2012-06-20 16:38:30 -07003050 tANI_U32 *pNumItems )
3051{
3052 eHalStatus status = eHAL_STATUS_FAILURE;
3053 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3054
3055 status = sme_AcquireGlobalLock( &pMac->sme );
3056 if ( HAL_STATUS_SUCCESS( status ) )
3057 {
3058 status = csrScanGetPMKIDCandidateList( pMac, sessionId, pPmkidList, pNumItems );
3059 sme_ReleaseGlobalLock( &pMac->sme );
3060 }
3061
3062 return (status);
3063}
3064
3065/*----------------------------------------------------------------------------
3066 \fn sme_RoamRegisterLinkQualityIndCallback
3067
3068 \brief
3069 a wrapper function to allow HDD to register a callback handler with CSR for
3070 link quality indications.
3071
3072 Only one callback may be registered at any time.
3073 In order to deregister the callback, a NULL cback may be provided.
3074
3075 Registration happens in the task context of the caller.
3076
3077 \param callback - Call back being registered
3078 \param pContext - user data
3079
3080 DEPENDENCIES: After CSR open
3081
3082 \return eHalStatus
3083-----------------------------------------------------------------------------*/
3084eHalStatus sme_RoamRegisterLinkQualityIndCallback(tHalHandle hHal, tANI_U8 sessionId,
3085 csrRoamLinkQualityIndCallback callback,
3086 void *pContext)
3087{
3088 return(csrRoamRegisterLinkQualityIndCallback((tpAniSirGlobal)hHal, callback, pContext));
3089}
3090
3091/* ---------------------------------------------------------------------------
3092 \fn sme_RoamRegisterCallback
3093 \brief a wrapper function to allow HDD to register a callback with CSR.
3094 Unlike scan, roam has one callback for all the roam requests
3095 \param callback - a callback function that roam calls upon when state changes
3096 \param pContext - a pointer passed in for the callback
3097 \return eHalStatus
3098 ---------------------------------------------------------------------------*/
3099eHalStatus sme_RoamRegisterCallback(tHalHandle hHal,
3100 csrRoamCompleteCallback callback,
3101 void *pContext)
3102{
3103 return(csrRoamRegisterCallback((tpAniSirGlobal)hHal, callback, pContext));
3104}
3105
3106eCsrPhyMode sme_GetPhyMode(tHalHandle hHal)
3107{
3108 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3109 return pMac->roam.configParam.phyMode;
3110}
3111
3112/* ---------------------------------------------------------------------------
Peng Xu117eab42014-09-25 13:33:27 +05303113 \fn sme_GetChannelBondingMode5G
3114 \brief get the channel bonding mode for 5G band
3115 \param hHal - HAL handle
3116 \return channel bonding mode for 5G
3117 ---------------------------------------------------------------------------*/
3118tANI_U32 sme_GetChannelBondingMode5G(tHalHandle hHal)
3119{
3120 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3121 tSmeConfigParams smeConfig;
3122
3123 sme_GetConfigParam(pMac, &smeConfig);
3124
3125 return smeConfig.csrConfig.channelBondingMode5GHz;
3126}
3127
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303128#ifdef WLAN_FEATURE_AP_HT40_24G
Peng Xu117eab42014-09-25 13:33:27 +05303129/* ---------------------------------------------------------------------------
3130 \fn sme_GetChannelBondingMode24G
3131 \brief get the channel bonding mode for 2.4G band
3132 \param hHal - HAL handle
3133 \return channel bonding mode for 2.4G
3134 ---------------------------------------------------------------------------*/
3135tANI_U32 sme_GetChannelBondingMode24G(tHalHandle hHal)
3136{
3137 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3138 tSmeConfigParams smeConfig;
3139
3140 sme_GetConfigParam(pMac, &smeConfig);
3141
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303142 return smeConfig.csrConfig.channelBondingAPMode24GHz;
Peng Xu117eab42014-09-25 13:33:27 +05303143}
3144
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303145/* ---------------------------------------------------------------------------
3146 \fn sme_UpdateChannelBondingMode24G
3147 \brief update the channel bonding mode for 2.4G band
3148 \param hHal - HAL handle
3149 \param cbMode - channel bonding mode
3150 \return
3151 ---------------------------------------------------------------------------*/
3152void sme_UpdateChannelBondingMode24G(tHalHandle hHal, tANI_U8 cbMode)
3153{
3154 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
3155 tSmeConfigParams smeConfig;
3156
3157 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
3158 sme_GetConfigParam(pMac, &smeConfig);
3159 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3160 FL("Previous Channel Bonding : = %d"),
3161 smeConfig.csrConfig.channelBondingAPMode24GHz);
3162
3163 smeConfig.csrConfig.channelBondingAPMode24GHz = cbMode;
3164 sme_UpdateConfig(hHal, &smeConfig);
3165 VOS_TRACE( VOS_MODULE_ID_SAP, VOS_TRACE_LEVEL_INFO,
3166 FL("New Channel Bonding : = %d"),
3167 sme_GetChannelBondingMode24G(hHal));
3168 return;
3169}
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05303170
3171/* ---------------------------------------------------------------------------
3172
3173 \fn sme_SetHT2040Mode
3174
3175 \brief To update HT Operation beacon IE & Channel Bonding.
3176
3177 \param
3178
3179 \return eHalStatus SUCCESS
3180 FAILURE or RESOURCES
3181 The API finished and failed.
3182
3183 -------------------------------------------------------------------------------*/
3184eHalStatus sme_SetHT2040Mode(tHalHandle hHal, tANI_U8 sessionId, tANI_U8 cbMode)
3185{
3186 eHalStatus status = eHAL_STATUS_FAILURE;
3187 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3188
3189 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
3190 FL("Channel Bonding =%d"),
3191 cbMode);
3192
3193 status = sme_AcquireGlobalLock(&pMac->sme);
3194 if (HAL_STATUS_SUCCESS(status))
3195 {
3196 status = csrSetHT2040Mode(pMac, sessionId, cbMode);
3197 sme_ReleaseGlobalLock(&pMac->sme );
3198 }
3199 return (status);
3200}
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +05303201#endif
Peng Xu117eab42014-09-25 13:33:27 +05303202
3203/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003204 \fn sme_RoamConnect
3205 \brief a wrapper function to request CSR to inititiate an association
Srinivas Girigowdade697412013-02-14 16:31:48 -08003206 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003207 \param sessionId - the sessionId returned by sme_OpenSession.
3208 \param pProfile - description of the network to which to connect
3209 \param hBssListIn - a list of BSS descriptor to roam to. It is returned
3210 from csrScanGetResult
3211 \param pRoamId - to get back the request ID
3212 \return eHalStatus
3213 ---------------------------------------------------------------------------*/
3214eHalStatus sme_RoamConnect(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3215 tANI_U32 *pRoamId)
3216{
3217 eHalStatus status = eHAL_STATUS_FAILURE;
3218 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3219
Yue Mae36e3552014-03-05 17:06:20 -08003220 if (!pMac)
3221 {
3222 return eHAL_STATUS_FAILURE;
3223 }
3224
Katya Nigambcb705f2013-12-26 14:26:22 +05303225 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003226 TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003227 smsLog(pMac, LOG2, FL("enter"));
3228 status = sme_AcquireGlobalLock( &pMac->sme );
3229 if ( HAL_STATUS_SUCCESS( status ) )
3230 {
3231 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3232 {
3233 status = csrRoamConnect( pMac, sessionId, pProfile, NULL, pRoamId );
3234 }
3235 else
3236 {
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003237 smsLog(pMac, LOGE, FL("invalid sessionID %d"), sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003238 status = eHAL_STATUS_INVALID_PARAMETER;
3239 }
3240 sme_ReleaseGlobalLock( &pMac->sme );
3241 }
Gopichand Nakkala9b89a732012-12-31 16:31:46 -08003242 else
3243 {
3244 smsLog(pMac, LOGE, FL("sme_AcquireGlobalLock failed"));
3245 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003246
3247 return (status);
3248}
3249
3250/* ---------------------------------------------------------------------------
Gopichand Nakkaladacbcb52013-04-18 16:41:54 +05303251
3252 \fn sme_SetPhyMode
3253
3254 \brief Changes the PhyMode.
3255
3256 \param hHal - The handle returned by macOpen.
3257
3258 \param phyMode new phyMode which is to set
3259
3260 \return eHalStatus SUCCESS.
3261
3262 -------------------------------------------------------------------------------*/
3263eHalStatus sme_SetPhyMode(tHalHandle hHal, eCsrPhyMode phyMode)
3264{
3265 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3266
3267 if (NULL == pMac)
3268 {
3269 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
3270 "%s: invalid context", __func__);
3271 return eHAL_STATUS_FAILURE;
3272 }
3273
3274 pMac->roam.configParam.phyMode = phyMode;
3275 pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL,
3276 pMac->roam.configParam.phyMode,
3277 pMac->roam.configParam.ProprietaryRatesEnabled);
3278
3279 return eHAL_STATUS_SUCCESS;
3280}
3281
3282/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07003283 \fn sme_RoamReassoc
3284 \brief a wrapper function to request CSR to inititiate a re-association
3285 \param pProfile - can be NULL to join the currently connected AP. In that
3286 case modProfileFields should carry the modified field(s) which could trigger
3287 reassoc
3288 \param modProfileFields - fields which are part of tCsrRoamConnectedProfile
3289 that might need modification dynamically once STA is up & running and this
3290 could trigger a reassoc
3291 \param pRoamId - to get back the request ID
3292 \return eHalStatus
3293 -------------------------------------------------------------------------------*/
3294eHalStatus sme_RoamReassoc(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamProfile *pProfile,
3295 tCsrRoamModifyProfileFields modProfileFields,
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003296 tANI_U32 *pRoamId, v_BOOL_t fForce)
Jeff Johnson295189b2012-06-20 16:38:30 -07003297{
3298 eHalStatus status = eHAL_STATUS_FAILURE;
3299 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3300
Katya Nigambcb705f2013-12-26 14:26:22 +05303301 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003302 TRACE_CODE_SME_RX_HDD_ROAM_REASSOC, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003303 smsLog(pMac, LOG2, FL("enter"));
3304 status = sme_AcquireGlobalLock( &pMac->sme );
3305 if ( HAL_STATUS_SUCCESS( status ) )
3306 {
3307 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3308 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003309 if((NULL == pProfile) && (fForce == 1))
3310 {
Madan Mohan Koyyalamudi0d0e1712012-10-21 12:02:45 -07003311 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
3312 /* to force the AP initiate fresh 802.1x authentication need to clear
3313 * the PMKID cache for that set the following boolean. this is needed
3314 * by the HS 2.0 passpoint certification 5.2.a and b testcases */
3315 pSession->fIgnorePMKIDCache = TRUE;
Madan Mohan Koyyalamudiea22cdc2012-10-18 21:02:23 -07003316 status = csrReassoc( pMac, sessionId, &modProfileFields, pRoamId , fForce);
3317 }
3318 else
3319 {
3320 status = csrRoamReassoc( pMac, sessionId, pProfile, modProfileFields, pRoamId );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003321 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003322 }
3323 else
3324 {
3325 status = eHAL_STATUS_INVALID_PARAMETER;
3326 }
3327 sme_ReleaseGlobalLock( &pMac->sme );
3328 }
3329
3330 return (status);
3331}
3332
3333/* ---------------------------------------------------------------------------
3334 \fn sme_RoamConnectToLastProfile
3335 \brief a wrapper function to request CSR to disconnect and reconnect with
3336 the same profile
Srinivas Girigowdade697412013-02-14 16:31:48 -08003337 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003338 \return eHalStatus. It returns fail if currently connected
3339 ---------------------------------------------------------------------------*/
3340eHalStatus sme_RoamConnectToLastProfile(tHalHandle hHal, tANI_U8 sessionId)
3341{
3342 eHalStatus status = eHAL_STATUS_FAILURE;
3343 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3344
3345 status = sme_AcquireGlobalLock( &pMac->sme );
3346 if ( HAL_STATUS_SUCCESS( status ) )
3347 {
3348 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3349 {
3350 status = csrRoamConnectToLastProfile( pMac, sessionId );
3351 }
3352 else
3353 {
3354 status = eHAL_STATUS_INVALID_PARAMETER;
3355 }
3356 sme_ReleaseGlobalLock( &pMac->sme );
3357 }
3358
3359 return (status);
3360}
3361
3362/* ---------------------------------------------------------------------------
3363 \fn sme_RoamDisconnect
3364 \brief a wrapper function to request CSR to disconnect from a network
Srinivas Girigowdade697412013-02-14 16:31:48 -08003365 This is an asynchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003366 \param reason -- To indicate the reason for disconnecting. Currently, only
3367 eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
3368 \return eHalStatus
3369 ---------------------------------------------------------------------------*/
3370eHalStatus sme_RoamDisconnect(tHalHandle hHal, tANI_U8 sessionId, eCsrRoamDisconnectReason reason)
3371{
3372 eHalStatus status = eHAL_STATUS_FAILURE;
3373 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3374
Katya Nigambcb705f2013-12-26 14:26:22 +05303375 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003376 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId, reason));
Jeff Johnson295189b2012-06-20 16:38:30 -07003377 smsLog(pMac, LOG2, FL("enter"));
3378 status = sme_AcquireGlobalLock( &pMac->sme );
3379 if ( HAL_STATUS_SUCCESS( status ) )
3380 {
3381 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3382 {
3383 status = csrRoamDisconnect( pMac, sessionId, reason );
3384 }
3385 else
3386 {
3387 status = eHAL_STATUS_INVALID_PARAMETER;
3388 }
3389 sme_ReleaseGlobalLock( &pMac->sme );
3390 }
3391
3392 return (status);
3393}
3394
Jeff Johnson295189b2012-06-20 16:38:30 -07003395/* ---------------------------------------------------------------------------
3396 \fn sme_RoamStopBss
3397 \brief To stop BSS for Soft AP. This is an asynchronous API.
3398 \param hHal - Global structure
3399 \param sessionId - sessionId of SoftAP
3400 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3401 -------------------------------------------------------------------------------*/
3402eHalStatus sme_RoamStopBss(tHalHandle hHal, tANI_U8 sessionId)
3403{
3404 eHalStatus status = eHAL_STATUS_FAILURE;
3405 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3406
3407 smsLog(pMac, LOG2, FL("enter"));
3408 status = sme_AcquireGlobalLock( &pMac->sme );
3409 if ( HAL_STATUS_SUCCESS( status ) )
3410 {
3411 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3412 {
Gopichand Nakkalaf44bdc52013-02-16 00:54:45 +05303413 status = csrRoamIssueStopBssCmd( pMac, sessionId, eANI_BOOLEAN_FALSE );
Jeff Johnson295189b2012-06-20 16:38:30 -07003414 }
3415 else
3416 {
3417 status = eHAL_STATUS_INVALID_PARAMETER;
3418 }
3419 sme_ReleaseGlobalLock( &pMac->sme );
3420 }
3421
3422 return (status);
3423}
3424
3425/* ---------------------------------------------------------------------------
3426 \fn sme_RoamDisconnectSta
3427 \brief To disassociate a station. This is an asynchronous API.
3428 \param hHal - Global structure
3429 \param sessionId - sessionId of SoftAP
3430 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3431 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3432 -------------------------------------------------------------------------------*/
3433eHalStatus sme_RoamDisconnectSta(tHalHandle hHal, tANI_U8 sessionId,
3434 tANI_U8 *pPeerMacAddr)
3435{
3436 eHalStatus status = eHAL_STATUS_FAILURE;
3437 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3438
3439 if ( NULL == pMac )
3440 {
3441 VOS_ASSERT(0);
3442 return status;
3443 }
3444
3445 status = sme_AcquireGlobalLock( &pMac->sme );
3446 if ( HAL_STATUS_SUCCESS( status ) )
3447 {
3448 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3449 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003450 status = csrRoamIssueDisassociateStaCmd( pMac, sessionId, pPeerMacAddr,
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303451 eSIR_MAC_DEAUTH_LEAVING_BSS_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07003452 }
3453 else
3454 {
3455 status = eHAL_STATUS_INVALID_PARAMETER;
3456 }
3457 sme_ReleaseGlobalLock( &pMac->sme );
3458 }
3459
3460 return (status);
3461}
3462
3463/* ---------------------------------------------------------------------------
3464 \fn sme_RoamDeauthSta
3465 \brief To disassociate a station. This is an asynchronous API.
3466 \param hHal - Global structure
3467 \param sessionId - sessionId of SoftAP
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303468 \param pDelStaParams -Pointer to parameters of the station to deauthenticate
Jeff Johnson295189b2012-06-20 16:38:30 -07003469 \return eHalStatus SUCCESS Roam callback will be called to indicate actual results
3470 -------------------------------------------------------------------------------*/
3471eHalStatus sme_RoamDeauthSta(tHalHandle hHal, tANI_U8 sessionId,
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303472 struct tagCsrDelStaParams *pDelStaParams)
Jeff Johnson295189b2012-06-20 16:38:30 -07003473{
3474 eHalStatus status = eHAL_STATUS_FAILURE;
3475 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3476
3477 if ( NULL == pMac )
3478 {
3479 VOS_ASSERT(0);
3480 return status;
3481 }
3482
3483 status = sme_AcquireGlobalLock( &pMac->sme );
3484 if ( HAL_STATUS_SUCCESS( status ) )
3485 {
3486 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3487 {
Hanumantha Reddy Pothulaf57da152014-10-31 13:02:08 +05303488 status = csrRoamIssueDeauthStaCmd( pMac, sessionId, pDelStaParams);
Jeff Johnson295189b2012-06-20 16:38:30 -07003489 }
3490 else
3491 {
3492 status = eHAL_STATUS_INVALID_PARAMETER;
3493 }
3494 sme_ReleaseGlobalLock( &pMac->sme );
3495 }
3496
3497 return (status);
3498}
3499
3500/* ---------------------------------------------------------------------------
3501 \fn sme_RoamTKIPCounterMeasures
3502 \brief To start or stop TKIP counter measures. This is an asynchronous API.
3503 \param sessionId - sessionId of SoftAP
3504 \param pPeerMacAddr - Caller allocated memory filled with peer MAC address (6 bytes)
3505 \return eHalStatus
3506 -------------------------------------------------------------------------------*/
3507eHalStatus sme_RoamTKIPCounterMeasures(tHalHandle hHal, tANI_U8 sessionId,
3508 tANI_BOOLEAN bEnable)
3509{
3510 eHalStatus status = eHAL_STATUS_FAILURE;
3511 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3512
3513 if ( NULL == pMac )
3514 {
3515 VOS_ASSERT(0);
3516 return status;
3517 }
3518
3519 status = sme_AcquireGlobalLock( &pMac->sme );
3520 if ( HAL_STATUS_SUCCESS( status ) )
3521 {
3522 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3523 {
3524 status = csrRoamIssueTkipCounterMeasures( pMac, sessionId, bEnable);
3525 }
3526 else
3527 {
3528 status = eHAL_STATUS_INVALID_PARAMETER;
3529 }
3530 sme_ReleaseGlobalLock( &pMac->sme );
3531 }
3532
3533 return (status);
3534}
3535
3536/* ---------------------------------------------------------------------------
3537 \fn sme_RoamGetAssociatedStas
3538 \brief To probe the list of associated stations from various modules of CORE stack.
3539 \This is an asynchronous API.
3540 \param sessionId - sessionId of SoftAP
3541 \param modId - Module from whom list of associtated stations is to be probed.
3542 If an invalid module is passed then by default VOS_MODULE_ID_PE will be probed
3543 \param pUsrContext - Opaque HDD context
3544 \param pfnSapEventCallback - Sap event callback in HDD
3545 \param pAssocBuf - Caller allocated memory to be filled with associatd stations info
3546 \return eHalStatus
3547 -------------------------------------------------------------------------------*/
3548eHalStatus sme_RoamGetAssociatedStas(tHalHandle hHal, tANI_U8 sessionId,
3549 VOS_MODULE_ID modId, void *pUsrContext,
3550 void *pfnSapEventCallback, tANI_U8 *pAssocStasBuf)
3551{
3552 eHalStatus status = eHAL_STATUS_FAILURE;
3553 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3554
3555 if ( NULL == pMac )
3556 {
3557 VOS_ASSERT(0);
3558 return status;
3559 }
3560
3561 status = sme_AcquireGlobalLock( &pMac->sme );
3562 if ( HAL_STATUS_SUCCESS( status ) )
3563 {
3564 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3565 {
3566 status = csrRoamGetAssociatedStas( pMac, sessionId, modId, pUsrContext, pfnSapEventCallback, pAssocStasBuf );
3567 }
3568 else
3569 {
3570 status = eHAL_STATUS_INVALID_PARAMETER;
3571 }
3572 sme_ReleaseGlobalLock( &pMac->sme );
3573 }
3574
3575 return (status);
3576}
3577
3578/* ---------------------------------------------------------------------------
3579 \fn sme_RoamGetWpsSessionOverlap
3580 \brief To get the WPS PBC session overlap information.
3581 \This is an asynchronous API.
3582 \param sessionId - sessionId of SoftAP
3583 \param pUsrContext - Opaque HDD context
3584 \param pfnSapEventCallback - Sap event callback in HDD
3585 \pRemoveMac - pointer to Mac address which needs to be removed from session
3586 \return eHalStatus
3587 -------------------------------------------------------------------------------*/
3588eHalStatus sme_RoamGetWpsSessionOverlap(tHalHandle hHal, tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07003589 void *pUsrContext, void
Jeff Johnson295189b2012-06-20 16:38:30 -07003590 *pfnSapEventCallback, v_MACADDR_t pRemoveMac)
3591{
3592 eHalStatus status = eHAL_STATUS_FAILURE;
3593 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3594
3595 if ( NULL == pMac )
3596 {
3597 VOS_ASSERT(0);
3598 return status;
3599 }
3600
3601 status = sme_AcquireGlobalLock( &pMac->sme );
3602 if ( HAL_STATUS_SUCCESS( status ) )
3603 {
3604 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3605 {
3606 status = csrRoamGetWpsSessionOverlap( pMac, sessionId, pUsrContext, pfnSapEventCallback, pRemoveMac);
3607 }
3608 else
3609 {
3610 status = eHAL_STATUS_INVALID_PARAMETER;
3611 }
3612 sme_ReleaseGlobalLock( &pMac->sme );
3613 }
3614
3615 return (status);
3616}
3617
Jeff Johnson295189b2012-06-20 16:38:30 -07003618
3619/* ---------------------------------------------------------------------------
3620 \fn sme_RoamGetConnectState
3621 \brief a wrapper function to request CSR to return the current connect state
3622 of Roaming
Srinivas Girigowdade697412013-02-14 16:31:48 -08003623 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003624 \return eHalStatus
3625 ---------------------------------------------------------------------------*/
3626eHalStatus sme_RoamGetConnectState(tHalHandle hHal, tANI_U8 sessionId, eCsrConnectState *pState)
3627{
3628 eHalStatus status = eHAL_STATUS_FAILURE;
3629 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3630
3631 status = sme_AcquireGlobalLock( &pMac->sme );
3632 if ( HAL_STATUS_SUCCESS( status ) )
3633 {
3634 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3635 {
3636 status = csrRoamGetConnectState( pMac, sessionId, pState );
3637 }
3638 else
3639 {
3640 status = eHAL_STATUS_INVALID_PARAMETER;
3641 }
3642 sme_ReleaseGlobalLock( &pMac->sme );
3643 }
3644
3645 return (status);
3646}
3647
3648/* ---------------------------------------------------------------------------
3649 \fn sme_RoamGetConnectProfile
3650 \brief a wrapper function to request CSR to return the current connect
3651 profile. Caller must call csrRoamFreeConnectProfile after it is done
3652 and before reuse for another csrRoamGetConnectProfile call.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003653 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003654 \param pProfile - pointer to a caller allocated structure
3655 tCsrRoamConnectedProfile
3656 \return eHalStatus. Failure if not connected
3657 ---------------------------------------------------------------------------*/
3658eHalStatus sme_RoamGetConnectProfile(tHalHandle hHal, tANI_U8 sessionId,
3659 tCsrRoamConnectedProfile *pProfile)
3660{
3661 eHalStatus status = eHAL_STATUS_FAILURE;
3662 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3663
Katya Nigambcb705f2013-12-26 14:26:22 +05303664 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003665 TRACE_CODE_SME_RX_HDD_ROAM_GET_CONNECTPROFILE, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003666 status = sme_AcquireGlobalLock( &pMac->sme );
3667 if ( HAL_STATUS_SUCCESS( status ) )
3668 {
3669 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3670 {
3671 status = csrRoamGetConnectProfile( pMac, sessionId, pProfile );
3672 }
3673 else
3674 {
3675 status = eHAL_STATUS_INVALID_PARAMETER;
3676 }
3677 sme_ReleaseGlobalLock( &pMac->sme );
3678 }
3679
3680 return (status);
3681}
3682
3683/* ---------------------------------------------------------------------------
3684 \fn sme_RoamFreeConnectProfile
3685 \brief a wrapper function to request CSR to free and reinitialize the
3686 profile returned previously by csrRoamGetConnectProfile.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003687 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 \param pProfile - pointer to a caller allocated structure
3689 tCsrRoamConnectedProfile
3690 \return eHalStatus.
3691 ---------------------------------------------------------------------------*/
3692eHalStatus sme_RoamFreeConnectProfile(tHalHandle hHal,
3693 tCsrRoamConnectedProfile *pProfile)
3694{
3695 eHalStatus status = eHAL_STATUS_FAILURE;
3696 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3697
Katya Nigambcb705f2013-12-26 14:26:22 +05303698 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003699 TRACE_CODE_SME_RX_HDD_ROAM_FREE_CONNECTPROFILE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003700 status = sme_AcquireGlobalLock( &pMac->sme );
3701 if ( HAL_STATUS_SUCCESS( status ) )
3702 {
3703 status = csrRoamFreeConnectProfile( pMac, pProfile );
3704 sme_ReleaseGlobalLock( &pMac->sme );
3705 }
3706
3707 return (status);
3708}
3709
3710/* ---------------------------------------------------------------------------
3711 \fn sme_RoamSetPMKIDCache
3712 \brief a wrapper function to request CSR to return the PMKID candidate list
Srinivas Girigowdade697412013-02-14 16:31:48 -08003713 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003714 \param pPMKIDCache - caller allocated buffer point to an array of
3715 tPmkidCacheInfo
3716 \param numItems - a variable that has the number of tPmkidCacheInfo
3717 allocated when retruning, this is either the number needed
3718 or number of items put into pPMKIDCache
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303719 \param update_entire_cache - this bool value specifies if the entire pmkid
3720 cache should be overwritten or should it be
3721 updated entry by entry.
Jeff Johnson295189b2012-06-20 16:38:30 -07003722 \return eHalStatus - when fail, it usually means the buffer allocated is not
3723 big enough and pNumItems has the number of
3724 tPmkidCacheInfo.
3725 \Note: pNumItems is a number of tPmkidCacheInfo,
3726 not sizeof(tPmkidCacheInfo) * something
3727 ---------------------------------------------------------------------------*/
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303728eHalStatus sme_RoamSetPMKIDCache( tHalHandle hHal, tANI_U8 sessionId,
3729 tPmkidCacheInfo *pPMKIDCache,
3730 tANI_U32 numItems,
3731 tANI_BOOLEAN update_entire_cache )
Jeff Johnson295189b2012-06-20 16:38:30 -07003732{
3733 eHalStatus status = eHAL_STATUS_FAILURE;
3734 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3735
Katya Nigambcb705f2013-12-26 14:26:22 +05303736 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003737 TRACE_CODE_SME_RX_HDD_ROAM_SET_PMKIDCACHE, sessionId, numItems));
Jeff Johnson295189b2012-06-20 16:38:30 -07003738 status = sme_AcquireGlobalLock( &pMac->sme );
3739 if ( HAL_STATUS_SUCCESS( status ) )
3740 {
3741 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3742 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303743 status = csrRoamSetPMKIDCache( pMac, sessionId, pPMKIDCache,
3744 numItems, update_entire_cache );
Jeff Johnson295189b2012-06-20 16:38:30 -07003745 }
3746 else
3747 {
3748 status = eHAL_STATUS_INVALID_PARAMETER;
3749 }
3750 sme_ReleaseGlobalLock( &pMac->sme );
3751 }
3752
3753 return (status);
3754}
3755
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303756eHalStatus sme_RoamDelPMKIDfromCache( tHalHandle hHal, tANI_U8 sessionId,
3757 tANI_U8 *pBSSId,
3758 tANI_BOOLEAN flush_cache )
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003759{
3760 eHalStatus status = eHAL_STATUS_FAILURE;
3761 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3762 status = sme_AcquireGlobalLock( &pMac->sme );
3763 if ( HAL_STATUS_SUCCESS( status ) )
3764 {
3765 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3766 {
Kanchanapally, Vidyullatha2633ace2014-09-25 15:16:50 +05303767 status = csrRoamDelPMKIDfromCache( pMac, sessionId,
3768 pBSSId, flush_cache );
Leela Venkata Kiran Kumar Reddy Chiralaede10652013-09-11 18:48:46 -07003769 }
3770 else
3771 {
3772 status = eHAL_STATUS_INVALID_PARAMETER;
3773 }
3774 sme_ReleaseGlobalLock( &pMac->sme );
3775 }
3776 return (status);
3777}
Wilson Yang47b58192013-12-11 11:40:19 -08003778
Jeff Johnson295189b2012-06-20 16:38:30 -07003779/* ---------------------------------------------------------------------------
3780 \fn sme_RoamGetSecurityReqIE
3781 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE CSR
3782 passes to PE to JOIN request or START_BSS request
Srinivas Girigowdade697412013-02-14 16:31:48 -08003783 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003784 \param pLen - caller allocated memory that has the length of pBuf as input.
3785 Upon returned, *pLen has the needed or IE length in pBuf.
3786 \param pBuf - Caller allocated memory that contain the IE field, if any,
3787 upon return
3788 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3789 \return eHalStatus - when fail, it usually means the buffer allocated is not
3790 big enough
3791 ---------------------------------------------------------------------------*/
3792eHalStatus sme_RoamGetSecurityReqIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3793 tANI_U8 *pBuf, eCsrSecurityType secType)
3794{
3795 eHalStatus status = eHAL_STATUS_FAILURE;
3796 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3797
3798 status = sme_AcquireGlobalLock( &pMac->sme );
3799 if ( HAL_STATUS_SUCCESS( status ) )
3800 {
3801 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3802 {
3803 status = csrRoamGetWpaRsnReqIE( hHal, sessionId, pLen, pBuf );
3804 }
3805 else
3806 {
3807 status = eHAL_STATUS_INVALID_PARAMETER;
3808 }
3809 sme_ReleaseGlobalLock( &pMac->sme );
3810 }
3811
3812 return (status);
3813}
3814
3815/* ---------------------------------------------------------------------------
3816 \fn sme_RoamGetSecurityRspIE
3817 \brief a wrapper function to request CSR to return the WPA or RSN or WAPI IE from
3818 the beacon or probe rsp if connected
Srinivas Girigowdade697412013-02-14 16:31:48 -08003819 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003820 \param pLen - caller allocated memory that has the length of pBuf as input.
3821 Upon returned, *pLen has the needed or IE length in pBuf.
3822 \param pBuf - Caller allocated memory that contain the IE field, if any,
3823 upon return
3824 \param secType - Specifies whether looking for WPA/WPA2/WAPI IE
3825 \return eHalStatus - when fail, it usually means the buffer allocated is not
3826 big enough
3827 ---------------------------------------------------------------------------*/
3828eHalStatus sme_RoamGetSecurityRspIE(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pLen,
3829 tANI_U8 *pBuf, eCsrSecurityType secType)
3830{
3831 eHalStatus status = eHAL_STATUS_FAILURE;
3832 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3833
3834 status = sme_AcquireGlobalLock( &pMac->sme );
3835 if ( HAL_STATUS_SUCCESS( status ) )
3836 {
3837 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3838 {
3839 status = csrRoamGetWpaRsnRspIE( pMac, sessionId, pLen, pBuf );
3840 }
3841 else
3842 {
3843 status = eHAL_STATUS_INVALID_PARAMETER;
3844 }
3845 sme_ReleaseGlobalLock( &pMac->sme );
3846 }
3847
3848 return (status);
3849
3850}
3851
3852
3853/* ---------------------------------------------------------------------------
3854 \fn sme_RoamGetNumPMKIDCache
3855 \brief a wrapper function to request CSR to return number of PMKID cache
3856 entries
Srinivas Girigowdade697412013-02-14 16:31:48 -08003857 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003858 \return tANI_U32 - the number of PMKID cache entries
3859 ---------------------------------------------------------------------------*/
3860tANI_U32 sme_RoamGetNumPMKIDCache(tHalHandle hHal, tANI_U8 sessionId)
3861{
3862 eHalStatus status = eHAL_STATUS_FAILURE;
3863 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3864 tANI_U32 numPmkidCache = 0;
3865
3866 status = sme_AcquireGlobalLock( &pMac->sme );
3867 if ( HAL_STATUS_SUCCESS( status ) )
3868 {
3869 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3870 {
3871 numPmkidCache = csrRoamGetNumPMKIDCache( pMac, sessionId );
3872 status = eHAL_STATUS_SUCCESS;
3873 }
3874 else
3875 {
3876 status = eHAL_STATUS_INVALID_PARAMETER;
3877 }
3878 sme_ReleaseGlobalLock( &pMac->sme );
3879 }
3880
3881 return (numPmkidCache);
3882}
3883
3884/* ---------------------------------------------------------------------------
3885 \fn sme_RoamGetPMKIDCache
3886 \brief a wrapper function to request CSR to return PMKID cache from CSR
Srinivas Girigowdade697412013-02-14 16:31:48 -08003887 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003888 \param pNum - caller allocated memory that has the space of the number of
3889 pBuf tPmkidCacheInfo as input. Upon returned, *pNum has the
3890 needed or actually number in tPmkidCacheInfo.
3891 \param pPmkidCache - Caller allocated memory that contains PMKID cache, if
3892 any, upon return
3893 \return eHalStatus - when fail, it usually means the buffer allocated is not
3894 big enough
3895 ---------------------------------------------------------------------------*/
3896eHalStatus sme_RoamGetPMKIDCache(tHalHandle hHal, tANI_U8 sessionId, tANI_U32 *pNum,
3897 tPmkidCacheInfo *pPmkidCache)
3898{
3899 eHalStatus status = eHAL_STATUS_FAILURE;
3900 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3901
3902 status = sme_AcquireGlobalLock( &pMac->sme );
3903 if ( HAL_STATUS_SUCCESS( status ) )
3904 {
3905 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
3906 {
3907 status = csrRoamGetPMKIDCache( pMac, sessionId, pNum, pPmkidCache );
3908 }
3909 else
3910 {
3911 status = eHAL_STATUS_INVALID_PARAMETER;
3912 }
3913 sme_ReleaseGlobalLock( &pMac->sme );
3914 }
3915
3916 return (status);
3917}
3918
3919
3920/* ---------------------------------------------------------------------------
3921 \fn sme_GetConfigParam
3922 \brief a wrapper function that HDD calls to get the global settings
3923 currently maintained by CSR.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003924 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003925 \param pParam - caller allocated memory
3926 \return eHalStatus
3927 ---------------------------------------------------------------------------*/
3928eHalStatus sme_GetConfigParam(tHalHandle hHal, tSmeConfigParams *pParam)
3929{
3930 eHalStatus status = eHAL_STATUS_FAILURE;
3931 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
3932
Katya Nigambcb705f2013-12-26 14:26:22 +05303933 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07003934 TRACE_CODE_SME_RX_HDD_GET_CONFIGPARAM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07003935 status = sme_AcquireGlobalLock( &pMac->sme );
3936 if ( HAL_STATUS_SUCCESS( status ) )
3937 {
3938 status = csrGetConfigParam(pMac, &pParam->csrConfig);
3939 if (status != eHAL_STATUS_SUCCESS)
3940 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003941 smsLog( pMac, LOGE, "%s csrGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003942 sme_ReleaseGlobalLock( &pMac->sme );
3943 return status;
3944 }
3945#if defined WLAN_FEATURE_P2P_INTERNAL
3946 status = p2pGetConfigParam(pMac, &pParam->p2pConfig);
3947 if (status != eHAL_STATUS_SUCCESS)
3948 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08003949 smsLog( pMac, LOGE, "%s p2pGetConfigParam failed", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07003950 sme_ReleaseGlobalLock( &pMac->sme );
3951 return status;
3952 }
3953#endif
3954 sme_ReleaseGlobalLock( &pMac->sme );
3955 }
3956
3957 return (status);
3958}
3959
3960/* ---------------------------------------------------------------------------
3961 \fn sme_CfgSetInt
3962 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003963 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003964 \param cfgId - Configuration Parameter ID (type) for STA.
3965 \param ccmValue - The information related to Configuration Parameter ID
3966 which needs to be saved in CFG
3967 \param callback - To be registered by CSR with CCM. Once the CFG done with
3968 saving the information in the database, it notifies CCM &
3969 then the callback will be invoked to notify.
3970 \param toBeSaved - To save the request for future reference
3971 \return eHalStatus
3972 ---------------------------------------------------------------------------*/
3973eHalStatus sme_CfgSetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 ccmValue,
3974 tCcmCfgSetCallback callback, eAniBoolean toBeSaved)
3975{
3976 return(ccmCfgSetInt(hHal, cfgId, ccmValue, callback, toBeSaved));
3977}
3978
3979/* ---------------------------------------------------------------------------
3980 \fn sme_CfgSetStr
3981 \brief a wrapper function that HDD calls to set parameters in CFG.
Srinivas Girigowdade697412013-02-14 16:31:48 -08003982 This is a synchronous call.
Jeff Johnson295189b2012-06-20 16:38:30 -07003983 \param cfgId - Configuration Parameter ID (type) for STA.
3984 \param pStr - Pointer to the byte array which carries the information needs
3985 to be saved in CFG
3986 \param length - Length of the data to be saved
3987 \param callback - To be registered by CSR with CCM. Once the CFG done with
3988 saving the information in the database, it notifies CCM &
3989 then the callback will be invoked to notify.
3990 \param toBeSaved - To save the request for future reference
3991 \return eHalStatus
3992 ---------------------------------------------------------------------------*/
3993eHalStatus sme_CfgSetStr(tHalHandle hHal, tANI_U32 cfgId, tANI_U8 *pStr,
3994 tANI_U32 length, tCcmCfgSetCallback callback,
3995 eAniBoolean toBeSaved)
3996{
3997 return(ccmCfgSetStr(hHal, cfgId, pStr, length, callback, toBeSaved));
3998}
3999
4000/* ---------------------------------------------------------------------------
Sandeep Puligillaa3e76952014-06-23 15:53:11 +05304001 \fn sme_GetModifyProfileFields
4002 \brief HDD or SME - QOS calls this function to get the current values of
4003 connected profile fields, changing which can cause reassoc.
4004 This function must be called after CFG is downloaded and STA is in connected
4005 state. Also, make sure to call this function to get the current profile
4006 fields before calling the reassoc. So that pModifyProfileFields will have
4007 all the latest values plus the one(s) has been updated as part of reassoc
4008 request.
4009 \param pModifyProfileFields - pointer to the connected profile fields
4010 changing which can cause reassoc
4011
4012 \return eHalStatus
4013 -------------------------------------------------------------------------------*/
4014eHalStatus sme_GetModifyProfileFields(tHalHandle hHal, tANI_U8 sessionId,
4015 tCsrRoamModifyProfileFields * pModifyProfileFields)
4016{
4017 eHalStatus status = eHAL_STATUS_FAILURE;
4018 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4019
4020 MTRACE(vos_trace(VOS_MODULE_ID_SME,
4021 TRACE_CODE_SME_RX_HDD_GET_MODPROFFIELDS, sessionId, 0));
4022 status = sme_AcquireGlobalLock( &pMac->sme );
4023 if ( HAL_STATUS_SUCCESS( status ) )
4024 {
4025 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4026 {
4027 status = csrGetModifyProfileFields(pMac, sessionId, pModifyProfileFields);
4028 }
4029 else
4030 {
4031 status = eHAL_STATUS_INVALID_PARAMETER;
4032 }
4033 sme_ReleaseGlobalLock( &pMac->sme );
4034 }
4035
4036 return (status);
4037}
4038
4039/* ---------------------------------------------------------------------------
Sandeep Puligilla332ea912014-02-04 00:16:24 +05304040 \fn sme_HT40StopOBSSScan
4041 \brief HDD or SME - Command to stop the OBSS scan
4042 THis is implemented only for debugging purpose.
4043 As per spec while operating in 2.4GHz OBSS scan shouldnt be stopped.
4044 \param sessionId - sessionId
4045 changing which can cause reassoc
4046
4047 \return eHalStatus
4048 -------------------------------------------------------------------------------*/
4049eHalStatus sme_HT40StopOBSSScan(tHalHandle hHal, tANI_U8 sessionId)
4050{
4051 eHalStatus status = eHAL_STATUS_FAILURE;
4052 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4053
4054 smsLog(pMac, LOG2, FL("enter"));
4055 status = sme_AcquireGlobalLock( &pMac->sme );
4056 if ( HAL_STATUS_SUCCESS( status ) )
4057 {
4058 if( CSR_IS_SESSION_VALID( pMac, sessionId ) )
4059 {
4060 csrHT40StopOBSSScan( pMac, sessionId );
4061 }
4062 else
4063 {
4064 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
4065 "%s: Invalid session sessionId %d", __func__,sessionId);
4066 status = eHAL_STATUS_INVALID_PARAMETER;
4067 }
4068 sme_ReleaseGlobalLock( &pMac->sme );
4069 }
4070 return (status);
4071}
4072
Jeff Johnson295189b2012-06-20 16:38:30 -07004073/*--------------------------------------------------------------------------
4074 \fn sme_SetConfigPowerSave
4075 \brief Wrapper fn to change power save configuration in SME (PMC) module.
4076 For BMPS related configuration, this function also updates the CFG
4077 and sends a message to FW to pick up the new values. Note: Calling
4078 this function only updates the configuration and does not enable
4079 the specified power save mode.
4080 \param hHal - The handle returned by macOpen.
4081 \param psMode - Power Saving mode being modified
4082 \param pConfigParams - a pointer to a caller allocated object of type
4083 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4084 \return eHalStatus
4085 --------------------------------------------------------------------------*/
4086eHalStatus sme_SetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4087 void *pConfigParams)
4088{
4089 eHalStatus status = eHAL_STATUS_FAILURE;
4090 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4091
Katya Nigambcb705f2013-12-26 14:26:22 +05304092 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004093 TRACE_CODE_SME_RX_HDD_SET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004094 if (NULL == pConfigParams ) {
4095 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4096 "nothing to update");
4097 return eHAL_STATUS_FAILURE;
4098 }
4099
4100 status = sme_AcquireGlobalLock( &pMac->sme );
4101 if ( HAL_STATUS_SUCCESS( status ) )
4102 {
4103 status = pmcSetConfigPowerSave(hHal, psMode, pConfigParams);
4104 sme_ReleaseGlobalLock( &pMac->sme );
4105 }
4106
4107 return (status);
4108}
4109
4110/*--------------------------------------------------------------------------
4111 \fn sme_GetConfigPowerSave
4112 \brief Wrapper fn to retrieve power save configuration in SME (PMC) module
4113 \param hHal - The handle returned by macOpen.
4114 \param psMode - Power Saving mode
4115 \param pConfigParams - a pointer to a caller allocated object of type
4116 tPmcSmpsConfigParams or tPmcBmpsConfigParams or tPmcImpsConfigParams
4117 \return eHalStatus
4118 --------------------------------------------------------------------------*/
4119eHalStatus sme_GetConfigPowerSave(tHalHandle hHal, tPmcPowerSavingMode psMode,
4120 void *pConfigParams)
4121{
4122 eHalStatus status = eHAL_STATUS_FAILURE;
4123 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4124
Katya Nigambcb705f2013-12-26 14:26:22 +05304125 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004126 TRACE_CODE_SME_RX_HDD_GET_CONFIG_PWRSAVE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004127 if (NULL == pConfigParams ) {
4128 smsLog( pMac, LOGE, "Empty config param structure for PMC, "
4129 "nothing to update");
4130 return eHAL_STATUS_FAILURE;
4131 }
4132
4133 status = sme_AcquireGlobalLock( &pMac->sme );
4134 if ( HAL_STATUS_SUCCESS( status ) )
4135 {
4136 status = pmcGetConfigPowerSave(hHal, psMode, pConfigParams);
4137 sme_ReleaseGlobalLock( &pMac->sme );
4138 }
4139
4140 return (status);
4141}
4142
4143/* ---------------------------------------------------------------------------
4144 \fn sme_SignalPowerEvent
4145 \brief Signals to PMC that a power event has occurred. Used for putting
4146 the chip into deep sleep mode.
4147 \param hHal - The handle returned by macOpen.
4148 \param event - the event that has occurred
4149 \return eHalStatus
4150 ---------------------------------------------------------------------------*/
4151eHalStatus sme_SignalPowerEvent (tHalHandle hHal, tPmcPowerEvent event)
4152{
4153 eHalStatus status = eHAL_STATUS_FAILURE;
4154 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4155
4156 status = sme_AcquireGlobalLock( &pMac->sme );
4157 if ( HAL_STATUS_SUCCESS( status ) )
4158 {
4159 status = pmcSignalPowerEvent(hHal, event);
4160 sme_ReleaseGlobalLock( &pMac->sme );
4161 }
4162
4163 return (status);
4164}
4165
4166/* ---------------------------------------------------------------------------
4167 \fn sme_EnablePowerSave
4168 \brief Enables one of the power saving modes.
4169 \param hHal - The handle returned by macOpen.
4170 \param psMode - The power saving mode to enable. If BMPS mode is enabled
4171 while the chip is operating in Full Power, PMC will start
4172 a timer that will try to put the chip in BMPS mode after
4173 expiry.
4174 \return eHalStatus
4175 ---------------------------------------------------------------------------*/
4176eHalStatus sme_EnablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4177{
4178 eHalStatus status = eHAL_STATUS_FAILURE;
4179 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4180
Katya Nigambcb705f2013-12-26 14:26:22 +05304181 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004182 TRACE_CODE_SME_RX_HDD_ENABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004183 status = sme_AcquireGlobalLock( &pMac->sme );
4184 if ( HAL_STATUS_SUCCESS( status ) )
4185 {
4186 status = pmcEnablePowerSave(hHal, psMode);
4187 sme_ReleaseGlobalLock( &pMac->sme );
4188 }
4189
4190 return (status);
4191}
4192
4193/* ---------------------------------------------------------------------------
4194 \fn sme_DisablePowerSave
4195 \brief Disables one of the power saving modes.
4196 \param hHal - The handle returned by macOpen.
4197 \param psMode - The power saving mode to disable. Disabling does not imply
4198 that device will be brought out of the current PS mode. This
4199 is purely a configuration API.
4200 \return eHalStatus
4201 ---------------------------------------------------------------------------*/
4202eHalStatus sme_DisablePowerSave (tHalHandle hHal, tPmcPowerSavingMode psMode)
4203{
4204 eHalStatus status = eHAL_STATUS_FAILURE;
4205 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4206
Katya Nigambcb705f2013-12-26 14:26:22 +05304207 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004208 TRACE_CODE_SME_RX_HDD_DISABLE_PWRSAVE, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004209 status = sme_AcquireGlobalLock( &pMac->sme );
4210 if ( HAL_STATUS_SUCCESS( status ) )
4211 {
4212 status = pmcDisablePowerSave(hHal, psMode);
4213 sme_ReleaseGlobalLock( &pMac->sme );
4214 }
4215
4216 return (status);
4217 }
4218
4219/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi69b34182013-01-16 08:51:40 +05304220+ \fn sme_SetHostPowerSave
4221+ \brief Enables BMPS logic to be controlled by User level apps
4222+ \param hHal - The handle returned by macOpen.
4223+ \param psMode - The power saving mode to disable. Disabling does not imply
4224+ that device will be brought out of the current PS mode. This
4225+ is purely a configuration API.
4226+ \return eHalStatus
4227+ ---------------------------------------------------------------------------*/
4228eHalStatus sme_SetHostPowerSave (tHalHandle hHal, v_BOOL_t psMode)
4229{
4230 eHalStatus status = eHAL_STATUS_FAILURE;
4231 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4232
4233 pMac->pmc.isHostPsEn = psMode;
4234
4235 return (status);
4236}
4237
4238/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004239 \fn sme_StartAutoBmpsTimer
4240 \brief Starts a timer that periodically polls all the registered
4241 module for entry into Bmps mode. This timer is started only if BMPS is
4242 enabled and whenever the device is in full power.
4243 \param hHal - The handle returned by macOpen.
4244 \return eHalStatus
4245 ---------------------------------------------------------------------------*/
4246eHalStatus sme_StartAutoBmpsTimer ( tHalHandle hHal)
4247{
4248 eHalStatus status = eHAL_STATUS_FAILURE;
4249 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4250
Katya Nigambcb705f2013-12-26 14:26:22 +05304251 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004252 TRACE_CODE_SME_RX_HDD_START_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004253 status = sme_AcquireGlobalLock( &pMac->sme );
4254 if ( HAL_STATUS_SUCCESS( status ) )
4255 {
4256 status = pmcStartAutoBmpsTimer(hHal);
4257 sme_ReleaseGlobalLock( &pMac->sme );
4258 }
4259
4260 return (status);
4261}
4262/* ---------------------------------------------------------------------------
4263 \fn sme_StopAutoBmpsTimer
4264 \brief Stops the Auto BMPS Timer that was started using sme_startAutoBmpsTimer
4265 Stopping the timer does not cause a device state change. Only the timer
4266 is stopped. If "Full Power" is desired, use the sme_RequestFullPower API
4267 \param hHal - The handle returned by macOpen.
4268 \return eHalStatus
4269 ---------------------------------------------------------------------------*/
4270eHalStatus sme_StopAutoBmpsTimer ( tHalHandle hHal)
4271{
4272 eHalStatus status = eHAL_STATUS_FAILURE;
4273 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4274
Katya Nigambcb705f2013-12-26 14:26:22 +05304275 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004276 TRACE_CODE_SME_RX_HDD_STOP_AUTO_BMPSTIMER, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004277 status = sme_AcquireGlobalLock( &pMac->sme );
4278 if ( HAL_STATUS_SUCCESS( status ) )
4279 {
4280 status = pmcStopAutoBmpsTimer(hHal);
4281 sme_ReleaseGlobalLock( &pMac->sme );
4282 }
4283
4284 return (status);
4285}
4286/* ---------------------------------------------------------------------------
4287 \fn sme_QueryPowerState
4288 \brief Returns the current power state of the device.
4289 \param hHal - The handle returned by macOpen.
4290 \param pPowerState - pointer to location to return power state (LOW or HIGH)
4291 \param pSwWlanSwitchState - ptr to location to return SW WLAN Switch state
4292 \return eHalStatus
4293 ---------------------------------------------------------------------------*/
4294eHalStatus sme_QueryPowerState (
4295 tHalHandle hHal,
4296 tPmcPowerState *pPowerState,
4297 tPmcSwitchState *pSwWlanSwitchState)
4298{
4299 eHalStatus status = eHAL_STATUS_FAILURE;
4300 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4301
4302 status = sme_AcquireGlobalLock( &pMac->sme );
4303 if ( HAL_STATUS_SUCCESS( status ) )
4304 {
4305 status = pmcQueryPowerState (hHal, pPowerState, NULL, pSwWlanSwitchState);
4306 sme_ReleaseGlobalLock( &pMac->sme );
4307 }
4308
4309 return (status);
4310}
4311
4312/* ---------------------------------------------------------------------------
4313 \fn sme_IsPowerSaveEnabled
4314 \brief Checks if the device is able to enter a particular power save mode
4315 This does not imply that the device is in a particular PS mode
4316 \param hHal - The handle returned by macOpen.
4317 \param psMode - the power saving mode
4318 \return eHalStatus
4319 ---------------------------------------------------------------------------*/
4320tANI_BOOLEAN sme_IsPowerSaveEnabled (tHalHandle hHal, tPmcPowerSavingMode psMode)
4321{
4322 eHalStatus status = eHAL_STATUS_FAILURE;
4323 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4324 tANI_BOOLEAN result = false;
4325
Katya Nigambcb705f2013-12-26 14:26:22 +05304326 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004327 TRACE_CODE_SME_RX_HDD_IS_PWRSAVE_ENABLED, NO_SESSION, psMode));
Jeff Johnson295189b2012-06-20 16:38:30 -07004328 status = sme_AcquireGlobalLock( &pMac->sme );
4329 if ( HAL_STATUS_SUCCESS( status ) )
4330 {
4331 result = pmcIsPowerSaveEnabled(hHal, psMode);
4332 sme_ReleaseGlobalLock( &pMac->sme );
4333 return result;
4334 }
4335
4336 return false;
4337}
4338
4339/* ---------------------------------------------------------------------------
4340 \fn sme_RequestFullPower
4341 \brief Request that the device be brought to full power state. When the
4342 device enters Full Power PMC will start a BMPS timer if BMPS PS mode
4343 is enabled. On timer expiry PMC will attempt to put the device in
4344 BMPS mode if following holds true:
4345 - BMPS mode is enabled
4346 - Polling of all modules through the Power Save Check routine passes
4347 - STA is associated to an access point
4348 \param hHal - The handle returned by macOpen.
4349 \param - callbackRoutine Callback routine invoked in case of success/failure
4350 \return eHalStatus - status
4351 eHAL_STATUS_SUCCESS - device brought to full power state
4352 eHAL_STATUS_FAILURE - device cannot be brought to full power state
4353 eHAL_STATUS_PMC_PENDING - device is being brought to full power state,
4354 ---------------------------------------------------------------------------*/
4355eHalStatus sme_RequestFullPower (
4356 tHalHandle hHal,
4357 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4358 void *callbackContext,
4359 tRequestFullPowerReason fullPowerReason)
4360{
4361 eHalStatus status = eHAL_STATUS_FAILURE;
4362 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4363
Katya Nigambcb705f2013-12-26 14:26:22 +05304364 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004365 TRACE_CODE_SME_RX_HDD_REQUEST_FULLPOWER, NO_SESSION, fullPowerReason));
Jeff Johnson295189b2012-06-20 16:38:30 -07004366 status = sme_AcquireGlobalLock( &pMac->sme );
4367 if ( HAL_STATUS_SUCCESS( status ) )
4368 {
4369 status = pmcRequestFullPower(hHal, callbackRoutine, callbackContext, fullPowerReason);
4370 sme_ReleaseGlobalLock( &pMac->sme );
4371 }
4372
4373 return (status);
4374}
4375
4376/* ---------------------------------------------------------------------------
4377 \fn sme_RequestBmps
4378 \brief Request that the device be put in BMPS state. Request will be
4379 accepted only if BMPS mode is enabled and power save check routine
4380 passes.
4381 \param hHal - The handle returned by macOpen.
4382 \param - callbackRoutine Callback routine invoked in case of success/failure
4383 \return eHalStatus
4384 eHAL_STATUS_SUCCESS - device is in BMPS state
4385 eHAL_STATUS_FAILURE - device cannot be brought to BMPS state
4386 eHAL_STATUS_PMC_PENDING - device is being brought to BMPS state
4387 ---------------------------------------------------------------------------*/
4388eHalStatus sme_RequestBmps (
4389 tHalHandle hHal,
4390 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4391 void *callbackContext)
4392{
4393 eHalStatus status = eHAL_STATUS_FAILURE;
4394 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4395
Katya Nigambcb705f2013-12-26 14:26:22 +05304396 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004397 TRACE_CODE_SME_RX_HDD_REQUEST_BMPS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004398 status = sme_AcquireGlobalLock( &pMac->sme );
4399 if ( HAL_STATUS_SUCCESS( status ) )
4400 {
4401 status = pmcRequestBmps(hHal, callbackRoutine, callbackContext);
4402 sme_ReleaseGlobalLock( &pMac->sme );
4403 }
4404
4405 return (status);
4406}
4407
4408
4409/* ---------------------------------------------------------------------------
4410 \fn sme_SetDHCPTillPowerActiveFlag
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004411 \brief Sets/Clears DHCP related flag in PMC to disable/enable auto BMPS
4412 entry by PMC
Jeff Johnson295189b2012-06-20 16:38:30 -07004413 \param hHal - The handle returned by macOpen.
4414 ---------------------------------------------------------------------------*/
4415void sme_SetDHCPTillPowerActiveFlag(tHalHandle hHal, tANI_U8 flag)
4416{
4417 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4418
Katya Nigambcb705f2013-12-26 14:26:22 +05304419 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004420 TRACE_CODE_SME_RX_HDD_SET_DHCP_FLAG, NO_SESSION, flag));
Jeff Johnson295189b2012-06-20 16:38:30 -07004421 // Set/Clear the DHCP flag which will disable/enable auto BMPS entery by PMC
4422 pMac->pmc.remainInPowerActiveTillDHCP = flag;
4423}
4424
4425
4426/* ---------------------------------------------------------------------------
4427 \fn sme_StartUapsd
4428 \brief Request that the device be put in UAPSD state. If the device is in
4429 Full Power it will be put in BMPS mode first and then into UAPSD
4430 mode.
4431 \param hHal - The handle returned by macOpen.
4432 \param - callbackRoutine Callback routine invoked in case of success/failure
4433 eHAL_STATUS_SUCCESS - device is in UAPSD state
4434 eHAL_STATUS_FAILURE - device cannot be brought to UAPSD state
4435 eHAL_STATUS_PMC_PENDING - device is being brought to UAPSD state
4436 eHAL_STATUS_PMC_DISABLED - UAPSD is disabled or BMPS mode is disabled
4437 \return eHalStatus
4438 ---------------------------------------------------------------------------*/
4439eHalStatus sme_StartUapsd (
4440 tHalHandle hHal,
4441 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4442 void *callbackContext)
4443{
4444 eHalStatus status = eHAL_STATUS_FAILURE;
4445 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4446
4447 status = sme_AcquireGlobalLock( &pMac->sme );
4448 if ( HAL_STATUS_SUCCESS( status ) )
4449 {
4450 status = pmcStartUapsd(hHal, callbackRoutine, callbackContext);
4451 sme_ReleaseGlobalLock( &pMac->sme );
4452 }
4453
4454 return (status);
4455 }
4456
4457/* ---------------------------------------------------------------------------
4458 \fn sme_StopUapsd
4459 \brief Request that the device be put out of UAPSD state. Device will be
4460 put in in BMPS state after stop UAPSD completes.
4461 \param hHal - The handle returned by macOpen.
4462 \return eHalStatus
4463 eHAL_STATUS_SUCCESS - device is put out of UAPSD and back in BMPS state
4464 eHAL_STATUS_FAILURE - device cannot be brought out of UAPSD state
4465 ---------------------------------------------------------------------------*/
4466eHalStatus sme_StopUapsd (tHalHandle hHal)
4467{
4468 eHalStatus status = eHAL_STATUS_FAILURE;
4469 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4470
4471 status = sme_AcquireGlobalLock( &pMac->sme );
4472 if ( HAL_STATUS_SUCCESS( status ) )
4473 {
4474 status = pmcStopUapsd(hHal);
4475 sme_ReleaseGlobalLock( &pMac->sme );
4476 }
4477
4478 return (status);
4479}
4480
4481/* ---------------------------------------------------------------------------
4482 \fn sme_RequestStandby
4483 \brief Request that the device be put in standby. It is HDD's responsibility
4484 to bring the chip to full power and do a disassoc before calling
4485 this API.
4486 \param hHal - The handle returned by macOpen.
4487 \param - callbackRoutine Callback routine invoked in case of success/failure
4488 \return eHalStatus
4489 eHAL_STATUS_SUCCESS - device is in Standby mode
4490 eHAL_STATUS_FAILURE - device cannot be put in standby mode
4491 eHAL_STATUS_PMC_PENDING - device is being put in standby mode
4492 ---------------------------------------------------------------------------*/
4493eHalStatus sme_RequestStandby (
4494 tHalHandle hHal,
4495 void (*callbackRoutine) (void *callbackContext, eHalStatus status),
4496 void *callbackContext)
4497{
4498 eHalStatus status = eHAL_STATUS_FAILURE;
4499 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4500
Katya Nigambcb705f2013-12-26 14:26:22 +05304501 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004502 TRACE_CODE_SME_RX_HDD_REQUEST_STANDBY, NO_SESSION, 0));
Agarwal Ashishe3cca2a2013-07-21 03:01:48 +05304503 smsLog( pMac, LOG1, FL(" called") );
Jeff Johnson295189b2012-06-20 16:38:30 -07004504 status = sme_AcquireGlobalLock( &pMac->sme );
4505 if ( HAL_STATUS_SUCCESS( status ) )
4506 {
4507 status = pmcRequestStandby(hHal, callbackRoutine, callbackContext);
4508 sme_ReleaseGlobalLock( &pMac->sme );
4509 }
4510
4511 return (status);
4512}
4513
4514/* ---------------------------------------------------------------------------
4515 \fn sme_RegisterPowerSaveCheck
4516 \brief Register a power save check routine that is called whenever
4517 the device is about to enter one of the power save modes.
4518 \param hHal - The handle returned by macOpen.
4519 \param checkRoutine - Power save check routine to be registered
4520 \return eHalStatus
4521 eHAL_STATUS_SUCCESS - successfully registered
4522 eHAL_STATUS_FAILURE - not successfully registered
4523 ---------------------------------------------------------------------------*/
4524eHalStatus sme_RegisterPowerSaveCheck (
4525 tHalHandle hHal,
4526 tANI_BOOLEAN (*checkRoutine) (void *checkContext), void *checkContext)
4527{
4528 eHalStatus status = eHAL_STATUS_FAILURE;
4529 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4530
4531 status = sme_AcquireGlobalLock( &pMac->sme );
4532 if ( HAL_STATUS_SUCCESS( status ) )
4533 {
4534 status = pmcRegisterPowerSaveCheck (hHal, checkRoutine, checkContext);
4535 sme_ReleaseGlobalLock( &pMac->sme );
4536 }
4537
4538 return (status);
4539}
4540
4541/* ---------------------------------------------------------------------------
Mihir Shetefc7ff5b2014-01-27 11:30:05 +05304542 \fn sme_Register11dScanDoneCallback
4543 \brief Register a routine of type csrScanCompleteCallback which is
4544 called whenever an 11d scan is done
4545 \param hHal - The handle returned by macOpen.
4546 \param callback - 11d scan complete routine to be registered
4547 \return eHalStatus
4548 ---------------------------------------------------------------------------*/
4549eHalStatus sme_Register11dScanDoneCallback (
4550 tHalHandle hHal,
4551 csrScanCompleteCallback callback)
4552{
4553 eHalStatus status = eHAL_STATUS_SUCCESS;
4554 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4555
4556 pMac->scan.callback11dScanDone = callback;
4557
4558 return (status);
4559}
4560
4561/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07004562 \fn sme_DeregisterPowerSaveCheck
4563 \brief Deregister a power save check routine
4564 \param hHal - The handle returned by macOpen.
4565 \param checkRoutine - Power save check routine to be deregistered
4566 \return eHalStatus
4567 eHAL_STATUS_SUCCESS - successfully deregistered
4568 eHAL_STATUS_FAILURE - not successfully deregistered
4569 ---------------------------------------------------------------------------*/
4570eHalStatus sme_DeregisterPowerSaveCheck (
4571 tHalHandle hHal,
4572 tANI_BOOLEAN (*checkRoutine) (void *checkContext))
4573{
4574 eHalStatus status = eHAL_STATUS_FAILURE;
4575 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4576
4577 status = sme_AcquireGlobalLock( &pMac->sme );
4578 if ( HAL_STATUS_SUCCESS( status ) )
4579 {
4580 status = pmcDeregisterPowerSaveCheck (hHal, checkRoutine);
4581 sme_ReleaseGlobalLock( &pMac->sme );
4582 }
4583
4584 return (status);
4585}
4586
4587/* ---------------------------------------------------------------------------
4588 \fn sme_RegisterDeviceStateUpdateInd
4589 \brief Register a callback routine that is called whenever
4590 the device enters a new device state (Full Power, BMPS, UAPSD)
4591 \param hHal - The handle returned by macOpen.
4592 \param callbackRoutine - Callback routine to be registered
4593 \param callbackContext - Cookie to be passed back during callback
4594 \return eHalStatus
4595 eHAL_STATUS_SUCCESS - successfully registered
4596 eHAL_STATUS_FAILURE - not successfully registered
4597 ---------------------------------------------------------------------------*/
4598eHalStatus sme_RegisterDeviceStateUpdateInd (
4599 tHalHandle hHal,
4600 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState),
4601 void *callbackContext)
4602{
4603 eHalStatus status = eHAL_STATUS_FAILURE;
4604 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4605
4606 status = sme_AcquireGlobalLock( &pMac->sme );
4607 if ( HAL_STATUS_SUCCESS( status ) )
4608 {
4609 status = pmcRegisterDeviceStateUpdateInd (hHal, callbackRoutine, callbackContext);
4610 sme_ReleaseGlobalLock( &pMac->sme );
4611 }
4612
4613 return (status);
4614}
4615
4616/* ---------------------------------------------------------------------------
4617 \fn sme_DeregisterDeviceStateUpdateInd
4618 \brief Deregister a routine that was registered for device state changes
4619 \param hHal - The handle returned by macOpen.
4620 \param callbackRoutine - Callback routine to be deregistered
4621 \return eHalStatus
4622 eHAL_STATUS_SUCCESS - successfully deregistered
4623 eHAL_STATUS_FAILURE - not successfully deregistered
4624 ---------------------------------------------------------------------------*/
4625eHalStatus sme_DeregisterDeviceStateUpdateInd (
4626 tHalHandle hHal,
4627 void (*callbackRoutine) (void *callbackContext, tPmcState pmcState))
4628{
4629 eHalStatus status = eHAL_STATUS_FAILURE;
4630 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4631
4632 status = sme_AcquireGlobalLock( &pMac->sme );
4633 if ( HAL_STATUS_SUCCESS( status ) )
4634 {
4635 status = pmcDeregisterDeviceStateUpdateInd (hHal, callbackRoutine);
4636 sme_ReleaseGlobalLock( &pMac->sme );
4637 }
4638
4639 return (status);
4640}
4641
4642/* ---------------------------------------------------------------------------
4643 \fn sme_WowlAddBcastPattern
4644 \brief Add a pattern for Pattern Byte Matching in Wowl mode. Firmware will
4645 do a pattern match on these patterns when Wowl is enabled during BMPS
4646 mode. Note that Firmware performs the pattern matching only on
4647 broadcast frames and while Libra is in BMPS mode.
4648 \param hHal - The handle returned by macOpen.
4649 \param pattern - Pattern to be added
4650 \return eHalStatus
4651 eHAL_STATUS_FAILURE Cannot add pattern
4652 eHAL_STATUS_SUCCESS Request accepted.
4653 ---------------------------------------------------------------------------*/
4654eHalStatus sme_WowlAddBcastPattern (
4655 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004656 tpSirWowlAddBcastPtrn pattern,
4657 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004658{
4659 eHalStatus status = eHAL_STATUS_FAILURE;
4660 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304661 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004662 TRACE_CODE_SME_RX_HDD_WOWL_ADDBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004663 status = sme_AcquireGlobalLock( &pMac->sme );
4664 if ( HAL_STATUS_SUCCESS( status ) )
4665 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004666 status = pmcWowlAddBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004667 sme_ReleaseGlobalLock( &pMac->sme );
4668 }
4669
4670 return (status);
4671}
4672
4673/* ---------------------------------------------------------------------------
4674 \fn sme_WowlDelBcastPattern
4675 \brief Delete a pattern that was added for Pattern Byte Matching.
4676 \param hHal - The handle returned by macOpen.
4677 \param pattern - Pattern to be deleted
4678 \return eHalStatus
4679 eHAL_STATUS_FAILURE Cannot delete pattern
4680 eHAL_STATUS_SUCCESS Request accepted.
4681 ---------------------------------------------------------------------------*/
4682eHalStatus sme_WowlDelBcastPattern (
4683 tHalHandle hHal,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004684 tpSirWowlDelBcastPtrn pattern,
4685 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004686{
4687 eHalStatus status = eHAL_STATUS_FAILURE;
4688 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304689 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004690 TRACE_CODE_SME_RX_HDD_WOWL_DELBCAST_PATTERN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004691 status = sme_AcquireGlobalLock( &pMac->sme );
4692 if ( HAL_STATUS_SUCCESS( status ) )
4693 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004694 status = pmcWowlDelBcastPattern (hHal, pattern, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004695 sme_ReleaseGlobalLock( &pMac->sme );
4696 }
4697
4698 return (status);
4699}
4700
4701/* ---------------------------------------------------------------------------
4702 \fn sme_EnterWowl
4703 \brief This is the SME API exposed to HDD to request enabling of WOWL mode.
4704 WoWLAN works on top of BMPS mode. If the device is not in BMPS mode,
4705 SME will will cache the information that WOWL has been enabled and
4706 attempt to put the device in BMPS. On entry into BMPS, SME will
4707 enable the WOWL mode.
4708 Note 1: If we exit BMPS mode (someone requests full power), we
4709 will NOT resume WOWL when we go back to BMPS again. Request for full
4710 power (while in WOWL mode) means disable WOWL and go to full power.
4711 Note 2: Both UAPSD and WOWL work on top of BMPS. On entry into BMPS, SME
4712 will give priority to UAPSD and enable only UAPSD if both UAPSD and WOWL
4713 are required. Currently there is no requirement or use case to support
4714 UAPSD and WOWL at the same time.
4715
4716 \param hHal - The handle returned by macOpen.
4717 \param enterWowlCallbackRoutine - Callback routine provided by HDD.
4718 Used for success/failure notification by SME
4719 \param enterWowlCallbackContext - A cookie passed by HDD, that is passed back to HDD
4720 at the time of callback.
4721 \param wakeReasonIndCB - Callback routine provided by HDD.
4722 Used for Wake Reason Indication by SME
4723 \param wakeReasonIndCBContext - A cookie passed by HDD, that is passed back to HDD
4724 at the time of callback.
4725 \return eHalStatus
4726 eHAL_STATUS_SUCCESS Device is already in WoWLAN mode
4727 eHAL_STATUS_FAILURE Device cannot enter WoWLAN mode.
4728 eHAL_STATUS_PMC_PENDING Request accepted. SME will enable WOWL after
4729 BMPS mode is entered.
4730 ---------------------------------------------------------------------------*/
4731eHalStatus sme_EnterWowl (
4732 tHalHandle hHal,
4733 void (*enterWowlCallbackRoutine) (void *callbackContext, eHalStatus status),
4734 void *enterWowlCallbackContext,
4735#ifdef WLAN_WAKEUP_EVENTS
4736 void (*wakeIndicationCB) (void *callbackContext, tpSirWakeReasonInd pWakeReasonInd),
4737 void *wakeIndicationCBContext,
4738#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004739 tpSirSmeWowlEnterParams wowlEnterParams, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07004740{
4741 eHalStatus status = eHAL_STATUS_FAILURE;
4742 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304743 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004744 TRACE_CODE_SME_RX_HDD_ENTER_WOWL, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004745 status = sme_AcquireGlobalLock( &pMac->sme );
4746 if ( HAL_STATUS_SUCCESS( status ) )
4747 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004748 status = pmcEnterWowl (hHal, enterWowlCallbackRoutine, enterWowlCallbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004749#ifdef WLAN_WAKEUP_EVENTS
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004750 wakeIndicationCB, wakeIndicationCBContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07004751#endif // WLAN_WAKEUP_EVENTS
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07004752 wowlEnterParams, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004753 sme_ReleaseGlobalLock( &pMac->sme );
4754 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004755 return (status);
4756}
4757/* ---------------------------------------------------------------------------
4758 \fn sme_ExitWowl
4759 \brief This is the SME API exposed to HDD to request exit from WoWLAN mode.
4760 SME will initiate exit from WoWLAN mode and device will be put in BMPS
4761 mode.
4762 \param hHal - The handle returned by macOpen.
4763 \return eHalStatus
4764 eHAL_STATUS_FAILURE Device cannot exit WoWLAN mode.
4765 eHAL_STATUS_SUCCESS Request accepted to exit WoWLAN mode.
4766 ---------------------------------------------------------------------------*/
c_hpothu01484c02014-05-16 14:05:15 +05304767eHalStatus sme_ExitWowl (tHalHandle hHal, tWowlExitSource wowlExitSrc)
Jeff Johnson295189b2012-06-20 16:38:30 -07004768{
4769 eHalStatus status = eHAL_STATUS_FAILURE;
4770 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05304771 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004772 TRACE_CODE_SME_RX_HDD_EXIT_WOWL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004773 status = sme_AcquireGlobalLock( &pMac->sme );
4774 if ( HAL_STATUS_SUCCESS( status ) )
4775 {
c_hpothu01484c02014-05-16 14:05:15 +05304776 status = pmcExitWowl (hHal, wowlExitSrc);
Jeff Johnson295189b2012-06-20 16:38:30 -07004777 sme_ReleaseGlobalLock( &pMac->sme );
4778 }
4779
4780 return (status);
4781}
4782
4783/* ---------------------------------------------------------------------------
4784
4785 \fn sme_RoamSetKey
4786
4787 \brief To set encryption key. This function should be called only when connected
4788 This is an asynchronous API.
4789
4790 \param pSetKeyInfo - pointer to a caller allocated object of tCsrSetContextInfo
4791
4792 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4793
4794 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4795
4796 FAILURE or RESOURCES The API finished and failed.
4797
4798 -------------------------------------------------------------------------------*/
4799eHalStatus sme_RoamSetKey(tHalHandle hHal, tANI_U8 sessionId, tCsrRoamSetKey *pSetKey, tANI_U32 *pRoamId)
4800{
4801 eHalStatus status = eHAL_STATUS_FAILURE;
4802 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4803 tANI_U32 roamId;
Jeff Johnson295189b2012-06-20 16:38:30 -07004804 tANI_U32 i;
4805 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004806
Katya Nigambcb705f2013-12-26 14:26:22 +05304807 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004808 TRACE_CODE_SME_RX_HDD_SET_KEY, sessionId, 0));
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004809 if (pSetKey->keyLength > CSR_MAX_KEY_LEN)
4810 {
4811 smsLog(pMac, LOGE, FL("Invalid key length %d"), pSetKey->keyLength);
4812 return eHAL_STATUS_FAILURE;
4813 }
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304814 /*Once Setkey is done, we can go in BMPS*/
4815 if(pSetKey->keyLength)
Abhishek Singh65d939e2014-04-25 13:33:07 +05304816 {
Abhishek Singh36abbcb2014-03-20 13:04:09 +05304817 pMac->pmc.remainInPowerActiveTillDHCP = FALSE;
Abhishek Singh65d939e2014-04-25 13:33:07 +05304818 smsLog(pMac, LOG1, FL("Reset remainInPowerActiveTillDHCP"
4819 " to allow BMPS"));
4820 }
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004821
Jeff Johnson295189b2012-06-20 16:38:30 -07004822 status = sme_AcquireGlobalLock( &pMac->sme );
4823 if ( HAL_STATUS_SUCCESS( status ) )
4824 {
4825 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4826 if(pRoamId)
4827 {
4828 *pRoamId = roamId;
4829 }
4830
Jeff Johnsonf89f4b52013-03-27 10:32:44 -07004831 smsLog(pMac, LOG2, FL("keyLength %d"), pSetKey->keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07004832
4833 for(i=0; i<pSetKey->keyLength; i++)
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004834 smsLog(pMac, LOG2, FL("%02x"), pSetKey->Key[i]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004835
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08004836 smsLog(pMac, LOG2, "\n sessionId=%d roamId=%d", sessionId, roamId);
Jeff Johnson295189b2012-06-20 16:38:30 -07004837
4838 pSession = CSR_GET_SESSION(pMac, sessionId);
4839
Jeff Johnson32d95a32012-09-10 13:15:23 -07004840 if(!pSession)
4841 {
4842 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08004843 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07004844 return eHAL_STATUS_FAILURE;
4845 }
4846
Jeff Johnson295189b2012-06-20 16:38:30 -07004847 if(CSR_IS_INFRA_AP(&pSession->connectedProfile))
4848 {
4849 if(pSetKey->keyDirection == eSIR_TX_DEFAULT)
4850 {
4851 if ( ( eCSR_ENCRYPT_TYPE_WEP40 == pSetKey->encType ) ||
4852 ( eCSR_ENCRYPT_TYPE_WEP40_STATICKEY == pSetKey->encType ))
4853 {
4854 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP40_STATICKEY;
4855 }
4856 if ( ( eCSR_ENCRYPT_TYPE_WEP104 == pSetKey->encType ) ||
4857 ( eCSR_ENCRYPT_TYPE_WEP104_STATICKEY == pSetKey->encType ))
4858 {
4859 pSession->pCurRoamProfile->negotiatedUCEncryptionType = eCSR_ENCRYPT_TYPE_WEP104_STATICKEY;
4860 }
4861 }
4862 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004863
4864 status = csrRoamSetKey ( pMac, sessionId, pSetKey, roamId );
4865 sme_ReleaseGlobalLock( &pMac->sme );
4866 }
Girish Gowli1c2fc802015-01-19 16:18:07 +05304867 if (pMac->roam.configParam.roamDelayStatsEnabled)
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05304868 {
Girish Gowli1c2fc802015-01-19 16:18:07 +05304869 //Store sent PTK key time
4870 if(pSetKey->keyDirection == eSIR_TX_RX)
4871 {
4872 vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0);
4873 }
4874 else if(pSetKey->keyDirection == eSIR_RX_ONLY)
4875 {
4876 vos_record_roam_event(e_HDD_SET_GTK_REQ, NULL, 0);
4877 }
4878 else
4879 {
4880 return (status);
4881 }
Mukul Sharmabe91e2f2014-06-29 22:09:20 +05304882 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004883
4884 return (status);
4885}
4886
4887
4888/* ---------------------------------------------------------------------------
4889
4890 \fn sme_RoamRemoveKey
4891
4892 \brief To set encryption key. This is an asynchronous API.
4893
4894 \param pRemoveKey - pointer to a caller allocated object of tCsrRoamRemoveKey
4895
4896 \param pRoamId Upon success return, this is the id caller can use to identify the request in roamcallback
4897
4898 \return eHalStatus SUCCESS Roam callback will be called indicate actually results
4899
4900 FAILURE or RESOURCES The API finished and failed.
4901
4902 -------------------------------------------------------------------------------*/
4903eHalStatus sme_RoamRemoveKey(tHalHandle hHal, tANI_U8 sessionId,
4904 tCsrRoamRemoveKey *pRemoveKey, tANI_U32 *pRoamId)
4905{
4906 eHalStatus status = eHAL_STATUS_FAILURE;
4907 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4908 tANI_U32 roamId;
4909
Katya Nigambcb705f2013-12-26 14:26:22 +05304910 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07004911 TRACE_CODE_SME_RX_HDD_REMOVE_KEY, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07004912 status = sme_AcquireGlobalLock( &pMac->sme );
4913 if ( HAL_STATUS_SUCCESS( status ) )
4914 {
4915 roamId = GET_NEXT_ROAM_ID(&pMac->roam);
4916 if(pRoamId)
4917 {
4918 *pRoamId = roamId;
4919 }
4920 status = csrRoamIssueRemoveKeyCommand( pMac, sessionId, pRemoveKey, roamId );
4921 sme_ReleaseGlobalLock( &pMac->sme );
4922 }
4923
4924 return (status);
4925}
4926
4927/* ---------------------------------------------------------------------------
4928 \fn sme_GetRssi
4929 \brief a wrapper function that client calls to register a callback to get RSSI
4930
4931 \param callback - SME sends back the requested stats using the callback
4932 \param staId - The station ID for which the stats is requested for
4933 \param pContext - user context to be passed back along with the callback
4934 \param pVosContext - vos context
4935 \return eHalStatus
4936 ---------------------------------------------------------------------------*/
4937eHalStatus sme_GetRssi(tHalHandle hHal,
4938 tCsrRssiCallback callback,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07004939 tANI_U8 staId, tCsrBssid bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07004940 void *pContext, void* pVosContext)
4941{
4942 eHalStatus status = eHAL_STATUS_FAILURE;
4943 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4944
4945 status = sme_AcquireGlobalLock( &pMac->sme );
4946 if ( HAL_STATUS_SUCCESS( status ) )
4947 {
4948 status = csrGetRssi( pMac, callback,
4949 staId, bssId, pContext, pVosContext);
4950 sme_ReleaseGlobalLock( &pMac->sme );
4951 }
4952 return (status);
4953}
Madan Mohan Koyyalamudid9383fd2013-08-13 09:27:30 +05304954
4955/* ---------------------------------------------------------------------------
4956 \fn sme_GetSnr
4957 \brief a wrapper function that client calls to register a callback to
4958 get SNR
4959
4960 \param callback - SME sends back the requested stats using the callback
4961 \param staId - The station ID for which the stats is requested for
4962 \param pContext - user context to be passed back along with the callback
4963 \param pVosContext - vos context
4964 \return eHalStatus
4965 ---------------------------------------------------------------------------*/
4966eHalStatus sme_GetSnr(tHalHandle hHal,
4967 tCsrSnrCallback callback,
4968 tANI_U8 staId, tCsrBssid bssId,
4969 void *pContext)
4970{
4971 eHalStatus status = eHAL_STATUS_FAILURE;
4972 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
4973
4974 status = sme_AcquireGlobalLock( &pMac->sme );
4975 if ( HAL_STATUS_SUCCESS( status ) )
4976 {
4977 status = csrGetSnr(pMac, callback,
4978 staId, bssId, pContext);
4979 sme_ReleaseGlobalLock( &pMac->sme );
4980 }
4981 return status;
4982}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004983#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004984/* ---------------------------------------------------------------------------
4985 \fn sme_GetRoamRssi
4986 \brief a wrapper function that client calls to register a callback to get Roam RSSI
4987
4988 \param callback - SME sends back the requested stats using the callback
4989 \param staId - The station ID for which the stats is requested for
4990 \param pContext - user context to be passed back along with the callback
4991 \param pVosContext - vos context
4992 \return eHalStatus
4993 ---------------------------------------------------------------------------*/
4994eHalStatus sme_GetRoamRssi(tHalHandle hHal,
4995 tCsrRssiCallback callback,
4996 tANI_U8 staId, tCsrBssid bssId,
4997 void *pContext, void* pVosContext)
4998{
4999 eHalStatus status = eHAL_STATUS_FAILURE;
5000 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5001
5002 status = sme_AcquireGlobalLock( &pMac->sme );
5003 if ( HAL_STATUS_SUCCESS( status ) )
5004 {
5005 status = csrGetRoamRssi( pMac, callback,
5006 staId, bssId, pContext, pVosContext);
5007 sme_ReleaseGlobalLock( &pMac->sme );
5008 }
5009 return (status);
5010}
5011#endif
5012
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005013#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005014/* ---------------------------------------------------------------------------
5015 \fn sme_GetTsmStats
5016 \brief a wrapper function that client calls to register a callback to get TSM Stats
5017
5018 \param callback - SME sends back the requested stats using the callback
5019 \param staId - The station ID for which the stats is requested for
5020 \param pContext - user context to be passed back along with the callback
5021 \param pVosContext - vos context
5022 \return eHalStatus
5023 ---------------------------------------------------------------------------*/
5024eHalStatus sme_GetTsmStats(tHalHandle hHal,
5025 tCsrTsmStatsCallback callback,
5026 tANI_U8 staId, tCsrBssid bssId,
5027 void *pContext, void* pVosContext, tANI_U8 tid)
5028{
5029 eHalStatus status = eHAL_STATUS_FAILURE;
5030 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5031
5032 status = sme_AcquireGlobalLock( &pMac->sme );
5033 if ( HAL_STATUS_SUCCESS( status ) )
5034 {
5035 status = csrGetTsmStats( pMac, callback,
5036 staId, bssId, pContext, pVosContext, tid);
5037 sme_ReleaseGlobalLock( &pMac->sme );
5038 }
5039 return (status);
5040}
5041#endif
5042
5043
Jeff Johnson295189b2012-06-20 16:38:30 -07005044/* ---------------------------------------------------------------------------
5045 \fn sme_GetStatistics
5046 \brief a wrapper function that client calls to register a callback to get
5047 different PHY level statistics from CSR.
5048
5049 \param requesterId - different client requesting for statistics, HDD, UMA/GAN etc
5050 \param statsMask - The different category/categories of stats requester is looking for
5051 \param callback - SME sends back the requested stats using the callback
5052 \param periodicity - If requester needs periodic update in millisec, 0 means
5053 it's an one time request
5054 \param cache - If requester is happy with cached stats
5055 \param staId - The station ID for which the stats is requested for
5056 \param pContext - user context to be passed back along with the callback
5057 \return eHalStatus
5058 ---------------------------------------------------------------------------*/
5059eHalStatus sme_GetStatistics(tHalHandle hHal, eCsrStatsRequesterType requesterId,
5060 tANI_U32 statsMask,
5061 tCsrStatsCallback callback,
5062 tANI_U32 periodicity, tANI_BOOLEAN cache,
5063 tANI_U8 staId, void *pContext)
5064{
5065 eHalStatus status = eHAL_STATUS_FAILURE;
5066 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5067
Katya Nigambcb705f2013-12-26 14:26:22 +05305068 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005069 TRACE_CODE_SME_RX_HDD_GET_STATS, NO_SESSION, periodicity));
Jeff Johnson295189b2012-06-20 16:38:30 -07005070 status = sme_AcquireGlobalLock( &pMac->sme );
5071 if ( HAL_STATUS_SUCCESS( status ) )
5072 {
5073 status = csrGetStatistics( pMac, requesterId , statsMask, callback,
5074 periodicity, cache, staId, pContext);
5075 sme_ReleaseGlobalLock( &pMac->sme );
5076 }
5077
5078 return (status);
5079
5080}
5081
Abhishek Singh08aa7762014-12-16 13:59:03 +05305082eHalStatus sme_GetFwStats(tHalHandle hHal, tANI_U32 stats,
5083 void *pContext, tSirFWStatsCallback callback)
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305084{
5085 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5086 vos_msg_t msg;
5087 tSirFWStatsGetReq *pGetFWStatsReq;
5088
5089 smsLog(pMac, LOG1, FL(" ENTER stats = %d "),stats);
5090
5091 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ))
5092 {
5093 pGetFWStatsReq = (tSirFWStatsGetReq *)vos_mem_malloc(sizeof(tSirFWStatsGetReq));
5094 if ( NULL == pGetFWStatsReq)
5095 {
5096 smsLog(pMac, LOGE, FL("Not able to allocate memory for "
5097 "WDA_FW_STATS_GET_REQ"));
5098 sme_ReleaseGlobalLock( &pMac->sme );
5099 return eHAL_STATUS_FAILURE;
5100 }
5101 pGetFWStatsReq->stats = stats;
5102 pGetFWStatsReq->callback = (tSirFWStatsCallback)callback;
Abhishek Singh08aa7762014-12-16 13:59:03 +05305103 pGetFWStatsReq->data = pContext;
Abhishek Singh3ae443b2014-10-08 11:49:27 +05305104
5105 msg.type = WDA_FW_STATS_GET_REQ;
5106 msg.reserved = 0;
5107 msg.bodyptr = pGetFWStatsReq;
5108 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_WDA, &msg))
5109 {
5110 smsLog(pMac, LOGE,
5111 FL("Not able to post WDA_FW_STATS_GET_REQ message to HAL"));
5112 vos_mem_free(pGetFWStatsReq);
5113 sme_ReleaseGlobalLock( &pMac->sme );
5114 return eHAL_STATUS_FAILURE;
5115 }
5116 sme_ReleaseGlobalLock( &pMac->sme );
5117 return eHAL_STATUS_SUCCESS;
5118 }
5119 return eHAL_STATUS_FAILURE;
5120}
5121
Jeff Johnson295189b2012-06-20 16:38:30 -07005122/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi8af9b402013-07-11 14:59:10 +05305123 \fn smeGetTLSTAState
5124 \helper function to get the TL STA State whenever the function is called.
5125
5126 \param staId - The staID to be passed to the TL
5127 to get the relevant TL STA State
5128 \return the state as tANI_U16
5129 ---------------------------------------------------------------------------*/
5130tANI_U16 smeGetTLSTAState(tHalHandle hHal, tANI_U8 staId)
5131{
5132 tANI_U16 tlSTAState = TL_INIT_STATE;
5133 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5134 eHalStatus status = eHAL_STATUS_FAILURE;
5135
5136 status = sme_AcquireGlobalLock( &pMac->sme );
5137 if ( HAL_STATUS_SUCCESS( status ) )
5138 {
5139 tlSTAState = csrGetTLSTAState( pMac, staId);
5140 sme_ReleaseGlobalLock( &pMac->sme );
5141 }
5142
5143 return tlSTAState;
5144}
5145
5146/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07005147
5148 \fn sme_GetCountryCode
5149
5150 \brief To return the current country code. If no country code is applied, default country code is
5151 used to fill the buffer.
5152 If 11d supported is turned off, an error is return and the last applied/default country code is used.
5153 This is a synchronous API.
5154
5155 \param pBuf - pointer to a caller allocated buffer for returned country code.
5156
5157 \param pbLen For input, this parameter indicates how big is the buffer.
5158 Upon return, this parameter has the number of bytes for country. If pBuf
5159 doesn't have enough space, this function returns
5160 fail status and this parameter contains the number that is needed.
5161
5162 \return eHalStatus SUCCESS.
5163
5164 FAILURE or RESOURCES The API finished and failed.
5165
5166 -------------------------------------------------------------------------------*/
5167eHalStatus sme_GetCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U8 *pbLen)
5168{
5169 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5170
Katya Nigambcb705f2013-12-26 14:26:22 +05305171 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005172 TRACE_CODE_SME_RX_HDD_GET_CNTRYCODE, NO_SESSION, 0));
5173
Jeff Johnson295189b2012-06-20 16:38:30 -07005174 return ( csrGetCountryCode( pMac, pBuf, pbLen ) );
5175}
5176
5177
5178/* ---------------------------------------------------------------------------
5179
5180 \fn sme_SetCountryCode
5181
5182 \brief To change the current/default country code.
5183 If 11d supported is turned off, an error is return.
5184 This is a synchronous API.
5185
5186 \param pCountry - pointer to a caller allocated buffer for the country code.
5187
5188 \param pfRestartNeeded A pointer to caller allocated memory, upon successful return, it indicates
5189 whether a reset is required.
5190
5191 \return eHalStatus SUCCESS.
5192
5193 FAILURE or RESOURCES The API finished and failed.
5194
5195 -------------------------------------------------------------------------------*/
5196eHalStatus sme_SetCountryCode(tHalHandle hHal, tANI_U8 *pCountry, tANI_BOOLEAN *pfRestartNeeded)
5197{
5198 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5199
Katya Nigambcb705f2013-12-26 14:26:22 +05305200 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005201 TRACE_CODE_SME_RX_HDD_SET_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005202 return ( csrSetCountryCode( pMac, pCountry, pfRestartNeeded ) );
5203}
5204
5205
5206/* ---------------------------------------------------------------------------
5207 \fn sme_ResetCountryCodeInformation
5208 \brief this function is to reset the country code current being used back to EEPROM default
5209 this includes channel list and power setting. This is a synchronous API.
5210 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5211 a restart is needed to apply the change
5212 \return eHalStatus
5213 -------------------------------------------------------------------------------*/
5214eHalStatus sme_ResetCountryCodeInformation(tHalHandle hHal, tANI_BOOLEAN *pfRestartNeeded)
5215{
5216 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5217
5218 return ( csrResetCountryCodeInformation( pMac, pfRestartNeeded ) );
5219}
5220
5221
5222/* ---------------------------------------------------------------------------
5223 \fn sme_GetSupportedCountryCode
5224 \brief this function is to get a list of the country code current being supported
5225 \param pBuf - Caller allocated buffer with at least 3 bytes, upon success return,
5226 this has the country code list. 3 bytes for each country code. This may be NULL if
5227 caller wants to know the needed byte count.
5228 \param pbLen - Caller allocated, as input, it indicates the length of pBuf. Upon success return,
5229 this contains the length of the data in pBuf. If pbuf is NULL, as input, *pbLen should be 0.
5230 \return eHalStatus
5231 -------------------------------------------------------------------------------*/
5232eHalStatus sme_GetSupportedCountryCode(tHalHandle hHal, tANI_U8 *pBuf, tANI_U32 *pbLen)
5233{
5234 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5235
5236 return ( csrGetSupportedCountryCode( pMac, pBuf, pbLen ) );
5237}
5238
5239
5240/* ---------------------------------------------------------------------------
5241 \fn sme_GetCurrentRegulatoryDomain
5242 \brief this function is to get the current regulatory domain. This is a synchronous API.
5243 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5244 SME. The function fails if 11d support is turned off.
5245 \param pDomain - Caller allocated buffer to return the current domain.
5246 \return eHalStatus SUCCESS.
5247
5248 FAILURE or RESOURCES The API finished and failed.
5249 -------------------------------------------------------------------------------*/
5250eHalStatus sme_GetCurrentRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t *pDomain)
5251{
5252 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5253 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5254
5255 if( pDomain )
5256 {
5257 if( csrIs11dSupported( pMac ) )
5258 {
5259 *pDomain = csrGetCurrentRegulatoryDomain( pMac );
5260 status = eHAL_STATUS_SUCCESS;
5261 }
5262 else
5263 {
5264 status = eHAL_STATUS_FAILURE;
5265 }
5266 }
5267
5268 return ( status );
5269}
5270
5271
5272/* ---------------------------------------------------------------------------
5273 \fn sme_SetRegulatoryDomain
5274 \brief this function is to set the current regulatory domain.
5275 This function must be called after CFG is downloaded and all the band/mode setting already passed into
5276 SME. This is a synchronous API.
5277 \param domainId - indicate the domain (defined in the driver) needs to set to.
5278 See v_REGDOMAIN_t for definition
5279 \param pfRestartNeeded - pointer to a caller allocated space. Upon successful return, it indicates whether
5280 a restart is needed to apply the change
5281 \return eHalStatus
5282 -------------------------------------------------------------------------------*/
5283eHalStatus sme_SetRegulatoryDomain(tHalHandle hHal, v_REGDOMAIN_t domainId, tANI_BOOLEAN *pfRestartNeeded)
5284{
5285 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5286
5287 return ( csrSetRegulatoryDomain( pMac, domainId, pfRestartNeeded ) );
5288}
5289
5290
5291/* ---------------------------------------------------------------------------
5292
5293 \fn sme_GetRegulatoryDomainForCountry
5294
5295 \brief To return a regulatory domain base on a country code. This is a synchronous API.
5296
5297 \param pCountry - pointer to a caller allocated buffer for input country code.
5298
5299 \param pDomainId Upon successful return, it is the domain that country belongs to.
5300 If it is NULL, returning success means that the country code is known.
5301
5302 \return eHalStatus SUCCESS.
5303
5304 FAILURE or RESOURCES The API finished and failed.
5305
5306 -------------------------------------------------------------------------------*/
5307eHalStatus sme_GetRegulatoryDomainForCountry(tHalHandle hHal, tANI_U8 *pCountry, v_REGDOMAIN_t *pDomainId)
5308{
5309 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5310
Kiet Lam6c583332013-10-14 05:37:09 +05305311 return csrGetRegulatoryDomainForCountry(pMac, pCountry, pDomainId,
5312 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07005313}
5314
5315
5316
5317
5318/* ---------------------------------------------------------------------------
5319
5320 \fn sme_GetSupportedRegulatoryDomains
5321
5322 \brief To return a list of supported regulatory domains. This is a synchronous API.
5323
5324 \param pDomains - pointer to a caller allocated buffer for returned regulatory domains.
5325
5326 \param pNumDomains For input, this parameter indicates howm many domains pDomains can hold.
5327 Upon return, this parameter has the number for supported domains. If pDomains
5328 doesn't have enough space for all the supported domains, this function returns
5329 fail status and this parameter contains the number that is needed.
5330
5331 \return eHalStatus SUCCESS.
5332
5333 FAILURE or RESOURCES The API finished and failed.
5334
5335 -------------------------------------------------------------------------------*/
5336eHalStatus sme_GetSupportedRegulatoryDomains(tHalHandle hHal, v_REGDOMAIN_t *pDomains, tANI_U32 *pNumDomains)
5337{
5338 eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
5339
5340 //We support all domains for now
5341 if( pNumDomains )
5342 {
5343 if( NUM_REG_DOMAINS <= *pNumDomains )
5344 {
5345 status = eHAL_STATUS_SUCCESS;
5346 }
5347 *pNumDomains = NUM_REG_DOMAINS;
5348 }
5349 if( HAL_STATUS_SUCCESS( status ) )
5350 {
5351 if( pDomains )
5352 {
5353 pDomains[0] = REGDOMAIN_FCC;
5354 pDomains[1] = REGDOMAIN_ETSI;
5355 pDomains[2] = REGDOMAIN_JAPAN;
5356 pDomains[3] = REGDOMAIN_WORLD;
5357 pDomains[4] = REGDOMAIN_N_AMER_EXC_FCC;
5358 pDomains[5] = REGDOMAIN_APAC;
5359 pDomains[6] = REGDOMAIN_KOREA;
5360 pDomains[7] = REGDOMAIN_HI_5GHZ;
5361 pDomains[8] = REGDOMAIN_NO_5GHZ;
5362 }
5363 else
5364 {
5365 status = eHAL_STATUS_INVALID_PARAMETER;
5366 }
5367 }
5368
5369 return ( status );
5370}
5371
5372
5373//some support functions
5374tANI_BOOLEAN sme_Is11dSupported(tHalHandle hHal)
5375{
5376 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5377
5378 return ( csrIs11dSupported( pMac ) );
5379}
5380
5381
5382tANI_BOOLEAN sme_Is11hSupported(tHalHandle hHal)
5383{
5384 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5385
5386 return ( csrIs11hSupported( pMac ) );
5387}
5388
5389
5390tANI_BOOLEAN sme_IsWmmSupported(tHalHandle hHal)
5391{
5392 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5393
5394 return ( csrIsWmmSupported( pMac ) );
5395}
5396
5397//Upper layer to get the list of the base channels to scan for passively 11d info from csr
5398eHalStatus sme_ScanGetBaseChannels( tHalHandle hHal, tCsrChannelInfo * pChannelInfo )
5399{
5400 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5401
5402 return(csrScanGetBaseChannels(pMac,pChannelInfo) );
5403}
5404
5405/* ---------------------------------------------------------------------------
5406
5407 \fn sme_ChangeCountryCode
5408
5409 \brief Change Country code from upperlayer during WLAN driver operation.
5410 This is a synchronous API.
5411
5412 \param hHal - The handle returned by macOpen.
5413
5414 \param pCountry New Country Code String
5415
Abhishek Singha306a442013-11-07 18:39:01 +05305416 \param sendRegHint If we want to send reg hint to nl80211
5417
Jeff Johnson295189b2012-06-20 16:38:30 -07005418 \return eHalStatus SUCCESS.
5419
5420 FAILURE or RESOURCES The API finished and failed.
5421
5422 -------------------------------------------------------------------------------*/
5423eHalStatus sme_ChangeCountryCode( tHalHandle hHal,
5424 tSmeChangeCountryCallback callback,
5425 tANI_U8 *pCountry,
5426 void *pContext,
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305427 void* pVosContext,
Abhishek Singha306a442013-11-07 18:39:01 +05305428 tAniBool countryFromUserSpace,
5429 tAniBool sendRegHint )
Jeff Johnson295189b2012-06-20 16:38:30 -07005430{
5431 eHalStatus status = eHAL_STATUS_FAILURE;
5432 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5433 vos_msg_t msg;
5434 tAniChangeCountryCodeReq *pMsg;
5435
Katya Nigambcb705f2013-12-26 14:26:22 +05305436 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005437 TRACE_CODE_SME_RX_HDD_CHANGE_CNTRYCODE, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005438 status = sme_AcquireGlobalLock( &pMac->sme );
5439 if ( HAL_STATUS_SUCCESS( status ) )
5440 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005441 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal97a2d992013-11-19 10:58:07 -08005442
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05305443 if ((pMac->roam.configParam.Is11dSupportEnabledOriginal == true) &&
Amar Singhal97a2d992013-11-19 10:58:07 -08005444 (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority))
5445 {
5446
5447 smsLog(pMac, LOGW, "Set Country Code Fail since the STA is associated and userspace does not have priority ");
5448
5449 sme_ReleaseGlobalLock( &pMac->sme );
5450 status = eHAL_STATUS_FAILURE;
5451 return status;
5452 }
5453
Kiet Lam64c1b492013-07-12 13:56:44 +05305454 pMsg = vos_mem_malloc(sizeof(tAniChangeCountryCodeReq));
5455 if ( NULL == pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07005456 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005457 smsLog(pMac, LOGE, " csrChangeCountryCode: failed to allocate mem for req");
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08005458 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lam64c1b492013-07-12 13:56:44 +05305459 return eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07005460 }
5461
5462 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_CHANGE_COUNTRY_CODE);
5463 pMsg->msgLen = (tANI_U16)sizeof(tAniChangeCountryCodeReq);
Kiet Lam64c1b492013-07-12 13:56:44 +05305464 vos_mem_copy(pMsg->countryCode, pCountry, 3);
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05305465 pMsg->countryFromUserSpace = countryFromUserSpace;
Abhishek Singha306a442013-11-07 18:39:01 +05305466 pMsg->sendRegHint = sendRegHint;
Jeff Johnson295189b2012-06-20 16:38:30 -07005467 pMsg->changeCCCallback = callback;
5468 pMsg->pDevContext = pContext;
5469 pMsg->pVosContext = pVosContext;
5470
5471 msg.type = eWNI_SME_CHANGE_COUNTRY_CODE;
5472 msg.bodyptr = pMsg;
5473 msg.reserved = 0;
5474
5475 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5476 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005477 smsLog(pMac, LOGE, " sme_ChangeCountryCode failed to post msg to self ");
Kiet Lam64c1b492013-07-12 13:56:44 +05305478 vos_mem_free((void *)pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07005479 status = eHAL_STATUS_FAILURE;
5480 }
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08005481 smsLog(pMac, LOG1, FL(" returned"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005482 sme_ReleaseGlobalLock( &pMac->sme );
5483 }
5484
5485 return (status);
5486}
Amar Singhal0d15bd52013-10-12 23:13:13 -07005487
5488/*--------------------------------------------------------------------------
5489
5490 \fn sme_GenericChangeCountryCode
5491
5492 \brief Change Country code from upperlayer during WLAN driver operation.
5493 This is a synchronous API.
5494
5495 \param hHal - The handle returned by macOpen.
5496
5497 \param pCountry New Country Code String
5498
5499 \param reg_domain regulatory domain
5500
5501 \return eHalStatus SUCCESS.
5502
5503 FAILURE or RESOURCES The API finished and failed.
5504
5505-----------------------------------------------------------------------------*/
5506eHalStatus sme_GenericChangeCountryCode( tHalHandle hHal,
5507 tANI_U8 *pCountry,
5508 v_REGDOMAIN_t reg_domain)
5509{
5510 eHalStatus status = eHAL_STATUS_FAILURE;
5511 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5512 vos_msg_t msg;
5513 tAniGenericChangeCountryCodeReq *pMsg;
5514
Kiet Lamcffc5862013-10-30 16:28:45 +05305515 if (NULL == pMac)
5516 {
5517 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5518 "%s: pMac is null", __func__);
5519 return status;
5520 }
5521
Amar Singhal0d15bd52013-10-12 23:13:13 -07005522 status = sme_AcquireGlobalLock( &pMac->sme );
5523 if ( HAL_STATUS_SUCCESS( status ) )
5524 {
5525 smsLog(pMac, LOG1, FL(" called"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05305526 pMsg = vos_mem_malloc(sizeof(tAniGenericChangeCountryCodeReq));
5527 if (NULL == pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07005528 {
5529 smsLog(pMac, LOGE, " sme_GenericChangeCountryCode: failed to allocate mem for req");
5530 sme_ReleaseGlobalLock( &pMac->sme );
Kiet Lamf2f201e2013-11-16 21:24:16 +05305531 return eHAL_STATUS_FAILURE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07005532 }
5533
5534 pMsg->msgType = pal_cpu_to_be16((tANI_U16)eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE);
5535 pMsg->msgLen = (tANI_U16)sizeof(tAniGenericChangeCountryCodeReq);
Sameer Thalappil7324e8b2014-01-15 10:32:54 -08005536 vos_mem_copy(pMsg->countryCode, pCountry, 2);
Dino Mycle6c77a962014-08-19 15:34:23 +05305537
5538 pMsg->countryCode[2] = ' '; /* For ASCII space */
5539
Amar Singhal0d15bd52013-10-12 23:13:13 -07005540 pMsg->domain_index = reg_domain;
5541
5542 msg.type = eWNI_SME_GENERIC_CHANGE_COUNTRY_CODE;
5543 msg.bodyptr = pMsg;
5544 msg.reserved = 0;
5545
5546 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg))
5547 {
5548 smsLog(pMac, LOGE, "sme_GenericChangeCountryCode failed to post msg to self");
Kiet Lamf2f201e2013-11-16 21:24:16 +05305549 vos_mem_free(pMsg);
Amar Singhal0d15bd52013-10-12 23:13:13 -07005550 status = eHAL_STATUS_FAILURE;
5551 }
5552 smsLog(pMac, LOG1, FL(" returned"));
5553 sme_ReleaseGlobalLock( &pMac->sme );
5554 }
5555
5556 return (status);
5557}
Mihir Shetee1093ba2014-01-21 20:13:32 +05305558
5559/* ---------------------------------------------------------------------------
5560
5561 \fn sme_InitChannels
5562
5563 \brief Used to initialize CSR channel lists while driver loading
5564
5565 \param hHal - global pMac structure
5566
5567 \return eHalStatus SUCCESS.
5568
5569 FAILURE or RESOURCES The API finished and failed.
5570
5571 -------------------------------------------------------------------------------*/
5572eHalStatus sme_InitChannels(tHalHandle hHal)
5573{
5574 eHalStatus status = eHAL_STATUS_FAILURE;
5575 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5576
5577 if (NULL == pMac)
5578 {
5579 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5580 "%s: pMac is null", __func__);
5581 return status;
5582 }
5583
Vinay Krishna Erannab9295ae2014-05-09 13:43:23 +05305584 status = csrInitChannels(pMac);
5585
Mihir Shetee1093ba2014-01-21 20:13:32 +05305586 return status;
5587}
5588
Mihir Shete04206452014-11-20 17:50:58 +05305589#ifdef CONFIG_ENABLE_LINUX_REG
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305590/*-------------------------------------------------------------------------
5591 \fn sme_InitChannelsForCC
5592
5593 \brief Used to issue regulatory hint to user
5594
5595 \param hHal - global pMac structure
5596
5597 \return eHalStatus SUCCESS.
5598
5599 FAILURE or RESOURCES The API finished and failed.
5600--------------------------------------------------------------------------*/
5601
Agarwal Ashish6db9d532014-09-30 18:19:10 +05305602eHalStatus sme_InitChannelsForCC(tHalHandle hHal, driver_load_type init)
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305603{
5604 eHalStatus status = eHAL_STATUS_FAILURE;
5605 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
5606
5607 if (NULL == pMac)
5608 {
5609 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
5610 "%s: pMac is null", __func__);
5611 return status;
5612 }
Agarwal Ashish6db9d532014-09-30 18:19:10 +05305613 status = csrInitChannelsForCC(pMac, init);
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305614
5615 return status;
5616}
Mihir Shete04206452014-11-20 17:50:58 +05305617#endif
Mahesh A Saptasagar74289d22014-05-14 12:43:37 +05305618
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305619/* ---------------------------------------------------------------------------
5620
5621 \fn sme_DHCPStartInd
5622
5623 \brief API to signal the FW about the DHCP Start event.
5624
5625 \param hHal - HAL handle for device.
5626
5627 \param device_mode - mode(AP,SAP etc) of the device.
5628
5629 \param macAddr - MAC address of the device.
5630
5631 \return eHalStatus SUCCESS.
5632
5633 FAILURE or RESOURCES The API finished and failed.
5634 --------------------------------------------------------------------------*/
5635eHalStatus sme_DHCPStartInd( tHalHandle hHal,
5636 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305637 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305638{
5639 eHalStatus status;
5640 VOS_STATUS vosStatus;
5641 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5642 vos_msg_t vosMessage;
5643 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305644 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305645
5646 status = sme_AcquireGlobalLock(&pMac->sme);
5647 if ( eHAL_STATUS_SUCCESS == status)
5648 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305649 pSession = CSR_GET_SESSION( pMac, sessionId );
5650
5651 if (!pSession)
5652 {
5653 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5654 sme_ReleaseGlobalLock( &pMac->sme );
5655 return eHAL_STATUS_FAILURE;
5656 }
5657
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305658 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5659 if (NULL == pMsg)
5660 {
5661 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5662 "%s: Not able to allocate memory for dhcp start", __func__);
5663 sme_ReleaseGlobalLock( &pMac->sme );
5664 return eHAL_STATUS_FAILURE;
5665 }
5666 pMsg->msgType = WDA_DHCP_START_IND;
5667 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5668 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305669 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5670 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305671 vosMessage.type = WDA_DHCP_START_IND;
5672 vosMessage.bodyptr = pMsg;
5673 vosMessage.reserved = 0;
5674
5675 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5676 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5677 {
5678 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5679 "%s: Post DHCP Start MSG fail", __func__);
5680 vos_mem_free(pMsg);
5681 status = eHAL_STATUS_FAILURE;
5682 }
5683 sme_ReleaseGlobalLock( &pMac->sme );
5684 }
5685 return (status);
5686}
5687/* ---------------------------------------------------------------------------
5688 \fn sme_DHCPStopInd
5689
5690 \brief API to signal the FW about the DHCP complete event.
5691
5692 \param hHal - HAL handle for device.
5693
5694 \param device_mode - mode(AP, SAP etc) of the device.
5695
5696 \param macAddr - MAC address of the device.
5697
5698 \return eHalStatus SUCCESS.
5699 FAILURE or RESOURCES The API finished and failed.
5700 --------------------------------------------------------------------------*/
5701eHalStatus sme_DHCPStopInd( tHalHandle hHal,
5702 tANI_U8 device_mode,
c_hpothu0b0cab72014-02-13 21:52:40 +05305703 tANI_U8 sessionId )
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305704{
5705 eHalStatus status;
5706 VOS_STATUS vosStatus;
5707 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5708 vos_msg_t vosMessage;
5709 tAniDHCPInd *pMsg;
c_hpothu0b0cab72014-02-13 21:52:40 +05305710 tCsrRoamSession *pSession;
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305711
5712 status = sme_AcquireGlobalLock(&pMac->sme);
5713 if ( eHAL_STATUS_SUCCESS == status)
5714 {
c_hpothu0b0cab72014-02-13 21:52:40 +05305715 pSession = CSR_GET_SESSION( pMac, sessionId );
5716
5717 if (!pSession)
5718 {
5719 smsLog(pMac, LOGE, FL("session %d not found "), sessionId);
5720 sme_ReleaseGlobalLock( &pMac->sme );
5721 return eHAL_STATUS_FAILURE;
5722 }
5723
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305724 pMsg = (tAniDHCPInd*)vos_mem_malloc(sizeof(tAniDHCPInd));
5725 if (NULL == pMsg)
5726 {
5727 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5728 "%s: Not able to allocate memory for dhcp stop", __func__);
5729 sme_ReleaseGlobalLock( &pMac->sme );
5730 return eHAL_STATUS_FAILURE;
5731 }
5732
5733 pMsg->msgType = WDA_DHCP_STOP_IND;
5734 pMsg->msgLen = (tANI_U16)sizeof(tAniDHCPInd);
5735 pMsg->device_mode = device_mode;
c_hpothu0b0cab72014-02-13 21:52:40 +05305736 vos_mem_copy(pMsg->macAddr, pSession->connectedProfile.bssid,
5737 sizeof(tSirMacAddr));
Sundaresan Ramachandran76e48e82013-07-15 13:07:17 +05305738
5739 vosMessage.type = WDA_DHCP_STOP_IND;
5740 vosMessage.bodyptr = pMsg;
5741 vosMessage.reserved = 0;
5742
5743 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
5744 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
5745 {
5746 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
5747 "%s: Post DHCP Stop MSG fail", __func__);
5748 vos_mem_free(pMsg);
5749 status = eHAL_STATUS_FAILURE;
5750 }
5751
5752 sme_ReleaseGlobalLock( &pMac->sme );
5753 }
5754 return (status);
5755}
5756
Jeff Johnson295189b2012-06-20 16:38:30 -07005757
5758/* ---------------------------------------------------------------------------
5759 \fn sme_BtcSignalBtEvent
5760 \brief API to signal Bluetooth (BT) event to the WLAN driver. Based on the
5761 BT event type and the current operating mode of Libra (full power,
5762 BMPS, UAPSD etc), appropriate Bluetooth Coexistence (BTC) strategy
5763 would be employed.
5764 \param hHal - The handle returned by macOpen.
5765 \param pBtEvent - Pointer to a caller allocated object of type tSmeBtEvent
5766 Caller owns the memory and is responsible for freeing it.
5767 \return VOS_STATUS
5768 VOS_STATUS_E_FAILURE BT Event not passed to HAL. This can happen
5769 if BTC execution mode is set to BTC_WLAN_ONLY
5770 or BTC_PTA_ONLY.
5771 VOS_STATUS_SUCCESS BT Event passed to HAL
5772 ---------------------------------------------------------------------------*/
5773VOS_STATUS sme_BtcSignalBtEvent (tHalHandle hHal, tpSmeBtEvent pBtEvent)
5774{
5775 VOS_STATUS status = VOS_STATUS_E_FAILURE;
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005776
Jeff Johnson295189b2012-06-20 16:38:30 -07005777#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5778 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5779
Katya Nigambcb705f2013-12-26 14:26:22 +05305780 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005781 TRACE_CODE_SME_RX_HDD_BTC_SIGNALEVENT, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005782 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5783 {
5784 status = btcSignalBTEvent (hHal, pBtEvent);
5785 sme_ReleaseGlobalLock( &pMac->sme );
5786 }
5787#endif
5788 return (status);
5789}
5790
5791/* ---------------------------------------------------------------------------
5792 \fn sme_BtcSetConfig
5793 \brief API to change the current Bluetooth Coexistence (BTC) configuration
5794 This function should be invoked only after CFG download has completed.
5795 Calling it after sme_HDDReadyInd is recommended.
5796 \param hHal - The handle returned by macOpen.
5797 \param pSmeBtcConfig - Pointer to a caller allocated object of type tSmeBtcConfig.
5798 Caller owns the memory and is responsible for freeing it.
5799 \return VOS_STATUS
5800 VOS_STATUS_E_FAILURE Config not passed to HAL.
5801 VOS_STATUS_SUCCESS Config passed to HAL
5802 ---------------------------------------------------------------------------*/
5803VOS_STATUS sme_BtcSetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5804{
5805 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5806#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5807 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305808 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005809 TRACE_CODE_SME_RX_HDD_BTC_SETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005810 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5811 {
5812 status = btcSetConfig (hHal, pSmeBtcConfig);
5813 sme_ReleaseGlobalLock( &pMac->sme );
5814 }
5815#endif
5816 return (status);
5817}
5818
5819/* ---------------------------------------------------------------------------
5820 \fn sme_BtcGetConfig
5821 \brief API to retrieve the current Bluetooth Coexistence (BTC) configuration
5822 \param hHal - The handle returned by macOpen.
5823 \param pSmeBtcConfig - Pointer to a caller allocated object of type
5824 tSmeBtcConfig. Caller owns the memory and is responsible
5825 for freeing it.
5826 \return VOS_STATUS
5827 VOS_STATUS_E_FAILURE - failure
5828 VOS_STATUS_SUCCESS success
5829 ---------------------------------------------------------------------------*/
5830VOS_STATUS sme_BtcGetConfig (tHalHandle hHal, tpSmeBtcConfig pSmeBtcConfig)
5831{
5832 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5833#ifndef WLAN_MDM_CODE_REDUCTION_OPT
5834 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
5835
Katya Nigambcb705f2013-12-26 14:26:22 +05305836 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005837 TRACE_CODE_SME_RX_HDD_BTC_GETCONFIG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005838 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5839 {
5840 status = btcGetConfig (hHal, pSmeBtcConfig);
5841 sme_ReleaseGlobalLock( &pMac->sme );
5842 }
5843#endif
5844 return (status);
5845}
5846/* ---------------------------------------------------------------------------
5847 \fn sme_SetCfgPrivacy
5848 \brief API to set configure privacy parameters
5849 \param hHal - The handle returned by macOpen.
5850 \param pProfile - Pointer CSR Roam profile.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005851 \param fPrivacy - This parameter indicates status of privacy
Jeff Johnson295189b2012-06-20 16:38:30 -07005852
5853 \return void
5854 ---------------------------------------------------------------------------*/
5855void sme_SetCfgPrivacy( tHalHandle hHal,
5856 tCsrRoamProfile *pProfile,
5857 tANI_BOOLEAN fPrivacy
5858 )
5859{
5860 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305861 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005862 TRACE_CODE_SME_RX_HDD_SET_CFGPRIVACY, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005863 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5864 {
5865 csrSetCfgPrivacy(pMac, pProfile, fPrivacy);
5866 sme_ReleaseGlobalLock( &pMac->sme );
5867 }
5868}
5869
5870#if defined WLAN_FEATURE_VOWIFI
5871/* ---------------------------------------------------------------------------
5872 \fn sme_NeighborReportRequest
5873 \brief API to request neighbor report.
5874 \param hHal - The handle returned by macOpen.
5875 \param pRrmNeighborReq - Pointer to a caller allocated object of type
5876 tRrmNeighborReq. Caller owns the memory and is responsible
5877 for freeing it.
5878 \return VOS_STATUS
5879 VOS_STATUS_E_FAILURE - failure
5880 VOS_STATUS_SUCCESS success
5881 ---------------------------------------------------------------------------*/
5882VOS_STATUS sme_NeighborReportRequest (tHalHandle hHal, tANI_U8 sessionId,
5883 tpRrmNeighborReq pRrmNeighborReq, tpRrmNeighborRspCallbackInfo callbackInfo)
5884{
5885 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5886 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05305887 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005888 TRACE_CODE_SME_RX_HDD_NEIGHBOR_REPORTREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005889
5890 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
5891 {
5892 status = sme_RrmNeighborReportRequest (hHal, sessionId, pRrmNeighborReq, callbackInfo);
5893 sme_ReleaseGlobalLock( &pMac->sme );
5894 }
5895
5896 return (status);
5897}
5898#endif
5899
5900//The following are debug APIs to support direct read/write register/memory
5901//They are placed in SME because HW cannot be access when in LOW_POWER state
5902//AND not connected. The knowledge and synchronization is done in SME
5903
5904//sme_DbgReadRegister
5905//Caller needs to validate the input values
5906VOS_STATUS sme_DbgReadRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t *pRegValue)
5907{
5908 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5909 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005910 tPmcPowerState PowerState;
5911 tANI_U32 sessionId = 0;
Katya Nigambcb705f2013-12-26 14:26:22 +05305912 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005913 TRACE_CODE_SME_RX_HDD_DBG_READREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005914
5915 /* 1) To make Quarky work in FTM mode **************************************/
5916
5917 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5918 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005919 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005920 {
5921 return VOS_STATUS_SUCCESS;
5922 }
5923 return VOS_STATUS_E_FAILURE;
5924 }
5925
5926 /* 2) NON FTM mode driver *************************************************/
5927
5928 /* Acquire SME global lock */
5929 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5930 {
5931 return VOS_STATUS_E_FAILURE;
5932 }
5933
5934 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
5935 {
5936 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
5937 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
5938 {
Hoonki Lee0af6aaf2013-02-08 12:26:44 -08005939 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgReadRegister(regAddr, pRegValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005940 {
5941 status = VOS_STATUS_SUCCESS;
5942 }
5943 else
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005944 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005945 status = VOS_STATUS_E_FAILURE;
5946 }
5947 }
5948 else
5949 {
5950 status = VOS_STATUS_E_FAILURE;
5951 }
5952 }
5953
5954 /* This is a hack for Qualky/pttWniSocket
5955 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
5956 if ( VOS_STATUS_SUCCESS != status )
5957 {
5958 *pRegValue = 0xDEADBEEF;
5959 status = VOS_STATUS_SUCCESS;
5960 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005961
Jeff Johnson295189b2012-06-20 16:38:30 -07005962 /* Release SME global lock */
5963 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07005964
Jeff Johnson295189b2012-06-20 16:38:30 -07005965 return (status);
5966}
5967
5968
5969//sme_DbgWriteRegister
5970//Caller needs to validate the input values
5971VOS_STATUS sme_DbgWriteRegister(tHalHandle hHal, v_U32_t regAddr, v_U32_t regValue)
5972{
5973 VOS_STATUS status = VOS_STATUS_E_FAILURE;
5974 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07005975 tPmcPowerState PowerState;
5976 tANI_U32 sessionId = 0;
5977
5978 /* 1) To make Quarky work in FTM mode **************************************/
5979
Katya Nigambcb705f2013-12-26 14:26:22 +05305980 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07005981 TRACE_CODE_SME_RX_HDD_DBG_WRITEREG, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07005982 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
5983 {
Jeff Johnson295189b2012-06-20 16:38:30 -07005984 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07005985 {
5986 return VOS_STATUS_SUCCESS;
5987 }
5988 return VOS_STATUS_E_FAILURE;
5989 }
5990
5991 /* 2) NON FTM mode driver *************************************************/
5992
5993 /* Acquire SME global lock */
5994 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
5995 {
5996 return VOS_STATUS_E_FAILURE;
5997 }
5998
5999 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6000 {
6001 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6002 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6003 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006004 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteRegister(regAddr, regValue))
Jeff Johnson295189b2012-06-20 16:38:30 -07006005 {
6006 status = VOS_STATUS_SUCCESS;
6007 }
6008 else
6009 {
6010 status = VOS_STATUS_E_FAILURE;
6011 }
6012 }
6013 else
6014 {
6015 status = VOS_STATUS_E_FAILURE;
6016 }
6017 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006018
Jeff Johnson295189b2012-06-20 16:38:30 -07006019 /* Release SME global lock */
6020 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006021
Jeff Johnson295189b2012-06-20 16:38:30 -07006022 return (status);
6023}
6024
6025
6026
6027//sme_DbgReadMemory
6028//Caller needs to validate the input values
6029//pBuf caller allocated buffer has the length of nLen
6030VOS_STATUS sme_DbgReadMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6031{
6032 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6033 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07006034 tPmcPowerState PowerState;
6035 tANI_U32 sessionId = 0;
Gopichand Nakkalafab3fae2013-01-07 15:01:01 -08006036 tANI_U32 cmd = READ_MEMORY_DUMP_CMD;
6037 tANI_U32 arg1 = memAddr;
6038 tANI_U32 arg2 = nLen/4;
6039 tANI_U32 arg3 = 4;
6040 tANI_U32 arg4 = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07006041 /* 1) To make Quarky work in FTM mode **************************************/
6042
Katya Nigambcb705f2013-12-26 14:26:22 +05306043 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006044 TRACE_CODE_SME_RX_HDD_DBG_READMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006045 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6046 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306047 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8*)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006048 {
6049 return VOS_STATUS_SUCCESS;
6050 }
6051 return VOS_STATUS_E_FAILURE;
6052 }
6053
6054 /* 2) NON FTM mode driver *************************************************/
6055
6056 /* Acquire SME global lock */
6057 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6058 {
6059 return VOS_STATUS_E_FAILURE;
6060 }
6061
6062 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6063 {
6064 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6065 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6066 {
Siddharth Bhal68115602015-01-18 20:44:55 +05306067 if (VOS_STATUS_SUCCESS == WDA_HALDumpCmdReq(pMac, cmd, arg1, arg2, arg3, arg4, (tANI_U8 *)pBuf, 0))
Jeff Johnson295189b2012-06-20 16:38:30 -07006068 {
6069 status = VOS_STATUS_SUCCESS;
6070 }
6071 else
6072 {
6073 status = VOS_STATUS_E_FAILURE;
6074 }
6075 }
6076 else
6077 {
6078 status = VOS_STATUS_E_FAILURE;
6079 }
6080 }
6081
6082 /* This is a hack for Qualky/pttWniSocket
6083 Current implementation doesn't allow pttWniSocket to inform Qualky an error */
6084 if (VOS_STATUS_SUCCESS != status)
6085 {
6086 vos_mem_set(pBuf, nLen, 0xCD);
6087 status = VOS_STATUS_SUCCESS;
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006088 smsLog(pMac, LOGE, FL(" filled with 0xCD because it cannot access the hardware"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006089 }
6090
6091 /* Release SME lock */
6092 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006093
Jeff Johnson295189b2012-06-20 16:38:30 -07006094 return (status);
6095}
6096
6097
6098//sme_DbgWriteMemory
6099//Caller needs to validate the input values
6100VOS_STATUS sme_DbgWriteMemory(tHalHandle hHal, v_U32_t memAddr, v_U8_t *pBuf, v_U32_t nLen)
6101{
6102 VOS_STATUS status = VOS_STATUS_E_FAILURE;
6103 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnson295189b2012-06-20 16:38:30 -07006104 tPmcPowerState PowerState;
6105 tANI_U32 sessionId = 0;
6106
6107 /* 1) To make Quarky work in FTM mode **************************************/
6108
Katya Nigambcb705f2013-12-26 14:26:22 +05306109 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006110 TRACE_CODE_SME_RX_HDD_DBG_WRITEMEM, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006111 if(eDRIVER_TYPE_MFG == pMac->gDriverType)
6112 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006113 {
6114 return VOS_STATUS_SUCCESS;
6115 }
6116 return VOS_STATUS_E_FAILURE;
6117 }
6118
6119 /* 2) NON FTM mode driver *************************************************/
6120
6121 /* Acquire SME global lock */
6122 if (eHAL_STATUS_SUCCESS != sme_AcquireGlobalLock(&pMac->sme))
6123 {
6124 return VOS_STATUS_E_FAILURE;
6125 }
6126
6127 if(HAL_STATUS_SUCCESS(pmcQueryPowerState(pMac, &PowerState, NULL, NULL)))
6128 {
6129 /* Are we not in IMPS mode? Or are we in connected? Then we're safe*/
6130 if(!csrIsConnStateDisconnected(pMac, sessionId) || (ePMC_LOW_POWER != PowerState))
6131 {
Jeff Johnson295189b2012-06-20 16:38:30 -07006132 if (eWLAN_PAL_STATUS_SUCCESS == wpalDbgWriteMemory(memAddr, (void *)pBuf, nLen))
Jeff Johnson295189b2012-06-20 16:38:30 -07006133 {
6134 status = VOS_STATUS_SUCCESS;
6135 }
6136 else
6137 {
6138 status = VOS_STATUS_E_FAILURE;
6139 }
6140 }
6141 else
6142 {
6143 status = VOS_STATUS_E_FAILURE;
6144 }
6145 }
6146
6147 /* Release Global lock */
6148 sme_ReleaseGlobalLock(&pMac->sme);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006149
Jeff Johnson295189b2012-06-20 16:38:30 -07006150 return (status);
6151}
6152
6153
Katya Nigam70d68332013-09-16 16:49:45 +05306154void pmcLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString, ...)
6155{
6156 VOS_TRACE_LEVEL vosDebugLevel;
6157 char logBuffer[LOG_SIZE];
6158 va_list marker;
6159
6160 /* getting proper Debug level */
6161 vosDebugLevel = getVosDebugLevel(loglevel);
6162
6163 /* extracting arguments from pstring */
6164 va_start( marker, pString );
6165 vsnprintf(logBuffer, LOG_SIZE, pString, marker);
6166
6167 VOS_TRACE(VOS_MODULE_ID_PMC, vosDebugLevel, "%s", logBuffer);
6168 va_end( marker );
6169}
6170
6171
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006172void smsLog(tpAniSirGlobal pMac, tANI_U32 loglevel, const char *pString,...)
Jeff Johnson295189b2012-06-20 16:38:30 -07006173{
6174#ifdef WLAN_DEBUG
6175 // Verify against current log level
6176 if ( loglevel > pMac->utils.gLogDbgLevel[LOG_INDEX_FOR_MODULE( SIR_SMS_MODULE_ID )] )
6177 return;
6178 else
6179 {
6180 va_list marker;
6181
6182 va_start( marker, pString ); /* Initialize variable arguments. */
6183
6184 logDebug(pMac, SIR_SMS_MODULE_ID, loglevel, pString, marker);
6185
6186 va_end( marker ); /* Reset variable arguments. */
6187 }
6188#endif
6189}
Jeff Johnson295189b2012-06-20 16:38:30 -07006190
Jeff Johnson295189b2012-06-20 16:38:30 -07006191/* ---------------------------------------------------------------------------
6192 \fn sme_GetWcnssWlanCompiledVersion
6193 \brief This API returns the version of the WCNSS WLAN API with
6194 which the HOST driver was built
6195 \param hHal - The handle returned by macOpen.
6196 \param pVersion - Points to the Version structure to be filled
6197 \return VOS_STATUS
6198 VOS_STATUS_E_INVAL - failure
6199 VOS_STATUS_SUCCESS success
6200 ---------------------------------------------------------------------------*/
6201VOS_STATUS sme_GetWcnssWlanCompiledVersion(tHalHandle hHal,
6202 tSirVersionType *pVersion)
6203{
6204 VOS_STATUS status = VOS_STATUS_SUCCESS;
6205 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6206 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6207
6208 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6209 {
6210 if( pVersion != NULL )
6211 {
6212 status = WDA_GetWcnssWlanCompiledVersion(vosContext, pVersion);
6213 }
6214 else
6215 {
6216 status = VOS_STATUS_E_INVAL;
6217 }
6218 sme_ReleaseGlobalLock( &pMac->sme );
6219 }
6220
6221 return (status);
6222}
6223
6224
6225/* ---------------------------------------------------------------------------
6226 \fn sme_GetWcnssWlanReportedVersion
6227 \brief This API returns the version of the WCNSS WLAN API with
6228 which the WCNSS driver reports it was built
6229 \param hHal - The handle returned by macOpen.
6230 \param pVersion - Points to the Version structure to be filled
6231 \return VOS_STATUS
6232 VOS_STATUS_E_INVAL - failure
6233 VOS_STATUS_SUCCESS success
6234 ---------------------------------------------------------------------------*/
6235VOS_STATUS sme_GetWcnssWlanReportedVersion(tHalHandle hHal,
6236 tSirVersionType *pVersion)
6237{
6238 VOS_STATUS status = VOS_STATUS_SUCCESS;
6239 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6240 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6241
6242 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6243 {
6244 if( pVersion != NULL )
6245 {
6246 status = WDA_GetWcnssWlanReportedVersion(vosContext, pVersion);
6247 }
6248 else
6249 {
6250 status = VOS_STATUS_E_INVAL;
6251 }
6252 sme_ReleaseGlobalLock( &pMac->sme );
6253 }
6254
6255 return (status);
6256}
6257
6258
6259/* ---------------------------------------------------------------------------
6260 \fn sme_GetWcnssSoftwareVersion
6261 \brief This API returns the version string of the WCNSS driver
6262 \param hHal - The handle returned by macOpen.
6263 \param pVersion - Points to the Version string buffer to be filled
6264 \param versionBufferSize - THe size of the Version string buffer
6265 \return VOS_STATUS
6266 VOS_STATUS_E_INVAL - failure
6267 VOS_STATUS_SUCCESS success
6268 ---------------------------------------------------------------------------*/
6269VOS_STATUS sme_GetWcnssSoftwareVersion(tHalHandle hHal,
6270 tANI_U8 *pVersion,
6271 tANI_U32 versionBufferSize)
6272{
6273 VOS_STATUS status = VOS_STATUS_SUCCESS;
6274 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6275 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6276
6277 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6278 {
6279 if( pVersion != NULL )
6280 {
6281 status = WDA_GetWcnssSoftwareVersion(vosContext, pVersion,
6282 versionBufferSize);
6283 }
6284 else
6285 {
6286 status = VOS_STATUS_E_INVAL;
6287 }
6288 sme_ReleaseGlobalLock( &pMac->sme );
6289 }
6290
6291 return (status);
6292}
6293
6294
6295/* ---------------------------------------------------------------------------
6296 \fn sme_GetWcnssHardwareVersion
6297 \brief This API returns the version string of the WCNSS hardware
6298 \param hHal - The handle returned by macOpen.
6299 \param pVersion - Points to the Version string buffer to be filled
6300 \param versionBufferSize - THe size of the Version string buffer
6301 \return VOS_STATUS
6302 VOS_STATUS_E_INVAL - failure
6303 VOS_STATUS_SUCCESS success
6304 ---------------------------------------------------------------------------*/
6305VOS_STATUS sme_GetWcnssHardwareVersion(tHalHandle hHal,
6306 tANI_U8 *pVersion,
6307 tANI_U32 versionBufferSize)
6308{
6309 VOS_STATUS status = VOS_STATUS_SUCCESS;
6310 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6311 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
6312
6313 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
6314 {
6315 if( pVersion != NULL )
6316 {
6317 status = WDA_GetWcnssHardwareVersion(vosContext, pVersion,
6318 versionBufferSize);
6319 }
6320 else
6321 {
6322 status = VOS_STATUS_E_INVAL;
6323 }
6324 sme_ReleaseGlobalLock( &pMac->sme );
6325 }
6326
6327 return (status);
6328}
Jeff Johnson4824d4c2013-02-12 14:23:57 -08006329
Jeff Johnson295189b2012-06-20 16:38:30 -07006330
6331#ifdef FEATURE_WLAN_WAPI
6332/* ---------------------------------------------------------------------------
6333 \fn sme_RoamSetBKIDCache
6334 \brief The SME API exposed to HDD to allow HDD to provde SME the BKID
6335 candidate list.
6336 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6337 it is opened (by calling halOpen).
6338 \param pBKIDCache - caller allocated buffer point to an array of tBkidCacheInfo
6339 \param numItems - a variable that has the number of tBkidCacheInfo allocated
6340 when retruning, this is the number of items put into pBKIDCache
6341 \return eHalStatus - when fail, it usually means the buffer allocated is not
6342 big enough and pNumItems has the number of tBkidCacheInfo.
6343 ---------------------------------------------------------------------------*/
6344eHalStatus sme_RoamSetBKIDCache( tHalHandle hHal, tANI_U32 sessionId, tBkidCacheInfo *pBKIDCache,
6345 tANI_U32 numItems )
6346{
6347 eHalStatus status = eHAL_STATUS_FAILURE;
6348 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6349
6350 status = sme_AcquireGlobalLock( &pMac->sme );
6351 if ( HAL_STATUS_SUCCESS( status ) )
6352 {
6353 status = csrRoamSetBKIDCache( pMac, sessionId, pBKIDCache, numItems );
6354 sme_ReleaseGlobalLock( &pMac->sme );
6355 }
6356
6357 return (status);
6358}
6359
6360/* ---------------------------------------------------------------------------
6361 \fn sme_RoamGetBKIDCache
6362 \brief The SME API exposed to HDD to allow HDD to request SME to return its
6363 BKID cache.
6364 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6365 it is opened (by calling halOpen).
6366 \param pNum - caller allocated memory that has the space of the number of
6367 tBkidCacheInfo as input. Upon returned, *pNum has the needed number of entries
6368 in SME cache.
6369 \param pBkidCache - Caller allocated memory that contains BKID cache, if any,
6370 upon return
6371 \return eHalStatus - when fail, it usually means the buffer allocated is not
6372 big enough.
6373 ---------------------------------------------------------------------------*/
6374eHalStatus sme_RoamGetBKIDCache(tHalHandle hHal, tANI_U32 *pNum,
6375 tBkidCacheInfo *pBkidCache)
6376{
6377 eHalStatus status = eHAL_STATUS_FAILURE;
6378 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6379
6380 status = sme_AcquireGlobalLock( &pMac->sme );
6381 if ( HAL_STATUS_SUCCESS( status ) )
6382 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006383 smsLog(pMac, LOGE, FL(" !!!!!!!!!!!!!!!!!!SessionId is hardcoded"));
Jeff Johnson295189b2012-06-20 16:38:30 -07006384 status = csrRoamGetBKIDCache( pMac, 0, pNum, pBkidCache );
6385 sme_ReleaseGlobalLock( &pMac->sme );
6386 }
6387
6388 return (status);
6389}
6390
6391/* ---------------------------------------------------------------------------
6392 \fn sme_RoamGetNumBKIDCache
6393 \brief The SME API exposed to HDD to allow HDD to request SME to return the
6394 number of BKID cache entries.
6395 \param hHal - Handle to the HAL. The HAL handle is returned by the HAL after
6396 it is opened (by calling halOpen).
6397 \return tANI_U32 - the number of BKID cache entries.
6398 ---------------------------------------------------------------------------*/
6399tANI_U32 sme_RoamGetNumBKIDCache(tHalHandle hHal, tANI_U32 sessionId)
6400{
6401 eHalStatus status = eHAL_STATUS_FAILURE;
6402 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6403 tANI_U32 numBkidCache = 0;
6404
6405 status = sme_AcquireGlobalLock( &pMac->sme );
6406 if ( HAL_STATUS_SUCCESS( status ) )
6407 {
6408 numBkidCache = csrRoamGetNumBKIDCache( pMac, sessionId );
6409 sme_ReleaseGlobalLock( &pMac->sme );
6410 }
6411
6412 return (numBkidCache);
6413}
6414
6415/* ---------------------------------------------------------------------------
6416 \fn sme_ScanGetBKIDCandidateList
6417 \brief a wrapper function to return the BKID candidate list
6418 \param pBkidList - caller allocated buffer point to an array of
6419 tBkidCandidateInfo
6420 \param pNumItems - pointer to a variable that has the number of
6421 tBkidCandidateInfo allocated when retruning, this is
6422 either the number needed or number of items put into
6423 pPmkidList
6424 \return eHalStatus - when fail, it usually means the buffer allocated is not
6425 big enough and pNumItems
6426 has the number of tBkidCandidateInfo.
6427 \Note: pNumItems is a number of tBkidCandidateInfo,
6428 not sizeof(tBkidCandidateInfo) * something
6429 ---------------------------------------------------------------------------*/
6430eHalStatus sme_ScanGetBKIDCandidateList(tHalHandle hHal, tANI_U32 sessionId,
6431 tBkidCandidateInfo *pBkidList,
6432 tANI_U32 *pNumItems )
6433{
6434 eHalStatus status = eHAL_STATUS_FAILURE;
6435 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6436
6437 status = sme_AcquireGlobalLock( &pMac->sme );
6438 if ( HAL_STATUS_SUCCESS( status ) )
6439 {
6440 status = csrScanGetBKIDCandidateList( pMac, sessionId, pBkidList, pNumItems );
6441 sme_ReleaseGlobalLock( &pMac->sme );
6442 }
6443
6444 return (status);
6445}
6446#endif /* FEATURE_WLAN_WAPI */
6447
Jeff Johnsone7245742012-09-05 17:12:55 -07006448#ifdef FEATURE_OEM_DATA_SUPPORT
6449
6450/*****************************************************************************
6451 OEM DATA related modifications and function additions
6452 *****************************************************************************/
6453
6454/* ---------------------------------------------------------------------------
6455 \fn sme_getOemDataRsp
6456 \brief a wrapper function to obtain the OEM DATA RSP
6457 \param pOemDataRsp - A pointer to the response object
6458 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006459 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006460 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006461eHalStatus sme_getOemDataRsp(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006462 tOemDataRsp **pOemDataRsp)
6463{
6464 eHalStatus status = eHAL_STATUS_SUCCESS;
6465 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6466
6467 do
6468 {
6469 //acquire the lock for the sme object
6470 status = sme_AcquireGlobalLock(&pMac->sme);
6471
6472 if(!HAL_STATUS_SUCCESS(status))
6473 {
6474 break;
6475 }
6476
6477 if(pMac->oemData.pOemDataRsp != NULL)
6478 {
6479 *pOemDataRsp = pMac->oemData.pOemDataRsp;
6480 }
6481 else
6482 {
6483 status = eHAL_STATUS_FAILURE;
6484 }
6485
6486 //release the lock for the sme object
6487 sme_ReleaseGlobalLock( &pMac->sme );
6488
6489 } while(0);
6490
6491 return status;
6492}
6493
6494/* ---------------------------------------------------------------------------
6495 \fn sme_OemDataReq
6496 \brief a wrapper function for OEM DATA REQ
6497 \param sessionId - session id to be used.
6498 \param pOemDataReqId - pointer to an object to get back the request ID
6499 \param callback - a callback function that is called upon finish
6500 \param pContext - a pointer passed in for the callback
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006501 \return eHalStatus
Jeff Johnsone7245742012-09-05 17:12:55 -07006502 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006503eHalStatus sme_OemDataReq(tHalHandle hHal,
Jeff Johnsone7245742012-09-05 17:12:55 -07006504 tANI_U8 sessionId,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006505 tOemDataReqConfig *pOemDataReqConfig,
6506 tANI_U32 *pOemDataReqID,
6507 oemData_OemDataReqCompleteCallback callback,
Jeff Johnsone7245742012-09-05 17:12:55 -07006508 void *pContext)
6509{
6510 eHalStatus status = eHAL_STATUS_SUCCESS;
6511 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
6512
6513 do
6514 {
6515 //acquire the lock for the sme object
6516 status = sme_AcquireGlobalLock(&pMac->sme);
6517 if(HAL_STATUS_SUCCESS(status))
6518 {
6519 tANI_U32 lOemDataReqId = pMac->oemData.oemDataReqID++; //let it wrap around
6520
6521 if(pOemDataReqID)
6522 {
6523 *pOemDataReqID = lOemDataReqId;
6524 }
6525 else
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08006526 {
6527 sme_ReleaseGlobalLock( &pMac->sme );
6528 return eHAL_STATUS_FAILURE;
6529 }
Jeff Johnsone7245742012-09-05 17:12:55 -07006530
6531 status = oemData_OemDataReq(hHal, sessionId, pOemDataReqConfig, pOemDataReqID, callback, pContext);
6532
6533 //release the lock for the sme object
6534 sme_ReleaseGlobalLock( &pMac->sme );
6535 }
6536 } while(0);
6537
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006538 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07006539
6540 return(status);
6541}
6542
6543#endif /*FEATURE_OEM_DATA_SUPPORT*/
Jeff Johnson295189b2012-06-20 16:38:30 -07006544
6545/*--------------------------------------------------------------------------
6546
6547 \brief sme_OpenSession() - Open a session for scan/roam operation.
6548
6549 This is a synchronous API.
6550
6551
6552 \param hHal - The handle returned by macOpen.
6553 \param callback - A pointer to the function caller specifies for roam/connect status indication
6554 \param pContext - The context passed with callback
6555 \param pSelfMacAddr - Caller allocated memory filled with self MAC address (6 bytes)
6556 \param pbSessionId - pointer to a caller allocated buffer for returned session ID
6557
6558 \return eHAL_STATUS_SUCCESS - session is opened. sessionId returned.
6559
6560 Other status means SME is failed to open the session.
6561 eHAL_STATUS_RESOURCES - no more session available.
6562 \sa
6563
6564 --------------------------------------------------------------------------*/
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006565eHalStatus sme_OpenSession(tHalHandle hHal, csrRoamCompleteCallback callback,
6566 void *pContext, tANI_U8 *pSelfMacAddr,
6567 tANI_U8 *pbSessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006568{
6569 eHalStatus status;
6570 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6571
6572 if( NULL == pbSessionId )
6573 {
6574 status = eHAL_STATUS_INVALID_PARAMETER;
6575 }
6576 else
6577 {
6578 status = sme_AcquireGlobalLock( &pMac->sme );
6579 if ( HAL_STATUS_SUCCESS( status ) )
6580 {
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07006581 status = csrRoamOpenSession(pMac, callback, pContext,
6582 pSelfMacAddr, pbSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006583
6584 sme_ReleaseGlobalLock( &pMac->sme );
6585 }
6586 }
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006587 if( NULL != pbSessionId )
Katya Nigambcb705f2013-12-26 14:26:22 +05306588 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006589 TRACE_CODE_SME_RX_HDD_OPEN_SESSION,*pbSessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006590
6591 return ( status );
6592}
6593
6594
6595/*--------------------------------------------------------------------------
6596
6597 \brief sme_CloseSession() - Open a session for scan/roam operation.
6598
6599 This is a synchronous API.
6600
6601
6602 \param hHal - The handle returned by macOpen.
6603
6604 \param sessionId - A previous opened session's ID.
6605
6606 \return eHAL_STATUS_SUCCESS - session is closed.
6607
6608 Other status means SME is failed to open the session.
6609 eHAL_STATUS_INVALID_PARAMETER - session is not opened.
6610 \sa
6611
6612 --------------------------------------------------------------------------*/
6613eHalStatus sme_CloseSession(tHalHandle hHal, tANI_U8 sessionId,
6614 csrRoamSessionCloseCallback callback, void *pContext)
6615{
6616 eHalStatus status;
6617 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6618
Katya Nigambcb705f2013-12-26 14:26:22 +05306619 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006620 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006621 status = sme_AcquireGlobalLock( &pMac->sme );
6622 if ( HAL_STATUS_SUCCESS( status ) )
6623 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006624 status = csrRoamCloseSession( pMac, sessionId, FALSE,
Jeff Johnson295189b2012-06-20 16:38:30 -07006625 callback, pContext );
6626
6627 sme_ReleaseGlobalLock( &pMac->sme );
6628 }
6629
6630 return ( status );
6631}
6632
Jeff Johnson295189b2012-06-20 16:38:30 -07006633/* ---------------------------------------------------------------------------
6634
6635 \fn sme_RoamUpdateAPWPSIE
6636
6637 \brief To update AP's WPS IE. This function should be called after SME AP session is created
6638 This is an asynchronous API.
6639
6640 \param pAPWPSIES - pointer to a caller allocated object of tSirAPWPSIEs
6641
6642 \return eHalStatus – SUCCESS –
6643
6644 FAILURE or RESOURCES – The API finished and failed.
6645
6646 -------------------------------------------------------------------------------*/
6647eHalStatus sme_RoamUpdateAPWPSIE(tHalHandle hHal, tANI_U8 sessionId, tSirAPWPSIEs *pAPWPSIES)
6648{
6649
6650 eHalStatus status = eHAL_STATUS_FAILURE;
6651 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6652
6653 status = sme_AcquireGlobalLock( &pMac->sme );
6654 if ( HAL_STATUS_SUCCESS( status ) )
6655 {
6656
6657 status = csrRoamUpdateAPWPSIE( pMac, sessionId, pAPWPSIES );
6658
6659 sme_ReleaseGlobalLock( &pMac->sme );
6660 }
6661
6662 return (status);
6663}
6664/* ---------------------------------------------------------------------------
6665
6666 \fn sme_RoamUpdateAPWPARSNIEs
6667
6668 \brief To update AP's WPA/RSN IEs. This function should be called after SME AP session is created
6669 This is an asynchronous API.
6670
6671 \param pAPSirRSNie - pointer to a caller allocated object of tSirRSNie with WPS/RSN IEs
6672
6673 \return eHalStatus – SUCCESS –
6674
6675 FAILURE or RESOURCES – The API finished and failed.
6676
6677 -------------------------------------------------------------------------------*/
6678eHalStatus sme_RoamUpdateAPWPARSNIEs(tHalHandle hHal, tANI_U8 sessionId, tSirRSNie * pAPSirRSNie)
6679{
6680
6681 eHalStatus status = eHAL_STATUS_FAILURE;
6682 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6683
6684 status = sme_AcquireGlobalLock( &pMac->sme );
6685 if ( HAL_STATUS_SUCCESS( status ) )
6686 {
6687
6688 status = csrRoamUpdateWPARSNIEs( pMac, sessionId, pAPSirRSNie);
6689
6690 sme_ReleaseGlobalLock( &pMac->sme );
6691 }
6692
6693 return (status);
6694}
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006695/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006696
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006697 \fn sme_ChangeMCCBeaconInterval
6698
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006699 \brief To update P2P-GO beaconInterval. This function should be called after
6700 disassociating all the station is done
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006701 This is an asynchronous API.
6702
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006703 \param
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006704
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006705 \return eHalStatus SUCCESS
6706 FAILURE or RESOURCES
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006707 The API finished and failed.
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006708
6709 -------------------------------------------------------------------------------*/
6710eHalStatus sme_ChangeMCCBeaconInterval(tHalHandle hHal, tANI_U8 sessionId)
6711{
6712 eHalStatus status = eHAL_STATUS_FAILURE;
6713 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6714
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08006715 smsLog(pMac, LOG1, FL("Update Beacon PARAMS "));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006716 status = sme_AcquireGlobalLock( &pMac->sme );
6717 if ( HAL_STATUS_SUCCESS( status ) )
6718 {
6719 status = csrSendChngMCCBeaconInterval( pMac, sessionId);
6720 sme_ReleaseGlobalLock( &pMac->sme );
6721 }
6722 return (status);
6723}
Jeff Johnson295189b2012-06-20 16:38:30 -07006724
6725/*-------------------------------------------------------------------------------*
6726
6727 \fn sme_sendBTAmpEvent
6728
6729 \brief to receive the coex priorty request from BT-AMP PAL
6730 and send the BT_AMP link state to HAL
6731
6732 \param btAmpEvent - btAmpEvent
6733
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08006734 \return eHalStatus: SUCCESS : BTAmp event successfully sent to HAL
Jeff Johnson295189b2012-06-20 16:38:30 -07006735
6736 FAILURE: API failed
6737
6738-------------------------------------------------------------------------------*/
6739
6740eHalStatus sme_sendBTAmpEvent(tHalHandle hHal, tSmeBtAmpEvent btAmpEvent)
6741{
6742 vos_msg_t msg;
6743 tpSmeBtAmpEvent ptrSmeBtAmpEvent = NULL;
6744 eHalStatus status = eHAL_STATUS_FAILURE;
6745
Leela Venkata Kiran Kumar Reddy Chiralaf7ea5432013-11-15 11:03:04 -08006746 ptrSmeBtAmpEvent = vos_mem_malloc(sizeof(tSmeBtAmpEvent));
Jeff Johnson295189b2012-06-20 16:38:30 -07006747 if (NULL == ptrSmeBtAmpEvent)
6748 {
6749 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006750 "Not able to allocate memory for BTAmp event", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006751 return status;
6752 }
6753
6754 vos_mem_copy(ptrSmeBtAmpEvent, (void*)&btAmpEvent, sizeof(tSmeBtAmpEvent));
6755 msg.type = WDA_SIGNAL_BTAMP_EVENT;
6756 msg.reserved = 0;
6757 msg.bodyptr = ptrSmeBtAmpEvent;
6758
6759 //status = halFW_SendBTAmpEventMesg(pMac, event);
6760
6761 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
6762 {
6763 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07006764 "Not able to post SIR_HAL_SIGNAL_BTAMP_EVENT message to HAL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07006765 vos_mem_free(ptrSmeBtAmpEvent);
6766 return status;
6767 }
6768
6769 return eHAL_STATUS_SUCCESS;
6770
6771}
6772
6773/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306774 \fn smeIssueFastRoamNeighborAPEvent
6775 \brief API to trigger fast BSS roam independent of RSSI triggers
6776 \param hHal - The handle returned by macOpen.
6777 \param bssid - Pointer to the BSSID to roam to.
6778 \param fastRoamTrig - Trigger to Scan or roam
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306779 \param channel - channel number on which fastroam is requested
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306780 \return eHalStatus
6781 ---------------------------------------------------------------------------*/
6782eHalStatus smeIssueFastRoamNeighborAPEvent (tHalHandle hHal,
6783 tANI_U8 *bssid,
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306784 tSmeFastRoamTrigger fastRoamTrig,
6785 tANI_U8 channel)
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306786{
6787 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6788 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
6789 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
6790 eHalStatus status = eHAL_STATUS_SUCCESS;
6791
6792 status = sme_AcquireGlobalLock( &pMac->sme );
6793 if ( HAL_STATUS_SUCCESS( status ) )
6794 {
6795 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
6796 "%s: invoked", __func__);
6797
6798 if (eSME_ROAM_TRIGGER_SCAN == fastRoamTrig)
6799 {
6800 smsLog(pMac, LOG1, FL("CFG Channel list scan... "));
6801 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_SCAN;
6802 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6803 (void *)bssid, sizeof(tSirMacAddr));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306804 smsLog(pMac, LOG1, "Calling Roam Look Up down Event BSSID"
Arif Hussaina7c8e412013-11-20 11:06:42 -08006805 MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Mukul Sharma9e4e0f92015-02-13 18:45:20 +05306806 /*
6807 * As FastReassoc is based on assumption that roamable AP should be
6808 * present into the occupied channel list.We shd add i/p channel
6809 * in occupied channel list if roamable-ap(BSSID in fastreassoc cmd)
6810 * aged out prior to connection and there is no scan from aged out
6811 * to till connection indication.
6812 */
6813 csrAddChannelToOccupiedChannelList(pMac, channel);
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306814 vosStatus = csrNeighborRoamTransitToCFGChanScan(pMac);
6815 if (VOS_STATUS_SUCCESS != vosStatus)
6816 {
6817 smsLog(pMac, LOGE,
6818 FL("CFG Channel list scan state failed with status %d "),
6819 vosStatus);
6820 }
6821 }
6822 else if (eSME_ROAM_TRIGGER_FAST_ROAM == fastRoamTrig)
6823 {
6824 vos_mem_copy((void *)(&pNeighborRoamInfo->cfgRoambssId),
6825 (void *)bssid, sizeof(tSirMacAddr));
6826 pNeighborRoamInfo->cfgRoamEn = eSME_ROAM_TRIGGER_FAST_ROAM;
Arif Hussaina7c8e412013-11-20 11:06:42 -08006827 smsLog(pMac, LOG1, "Roam to BSSID "MAC_ADDRESS_STR,
6828 MAC_ADDR_ARRAY(pNeighborRoamInfo->cfgRoambssId));
Madan Mohan Koyyalamudi48101412013-09-11 23:09:37 +05306829
6830 vosStatus = csrNeighborRoamReassocIndCallback(pMac->roam.gVosContext,
6831 0,
6832 pMac,
6833 0);
6834
6835 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
6836 {
6837 smsLog(pMac,
6838 LOGE,
6839 FL(" Call to csrNeighborRoamReassocIndCallback failed, status = %d"),
6840 vosStatus);
6841 }
6842 }
6843 sme_ReleaseGlobalLock( &pMac->sme );
6844 }
6845 return vosStatus;
6846}
6847/* ---------------------------------------------------------------------------
Jeff Johnson295189b2012-06-20 16:38:30 -07006848 \fn sme_SetHostOffload
6849 \brief API to set the host offload feature.
6850 \param hHal - The handle returned by macOpen.
6851 \param pRequest - Pointer to the offload request.
6852 \return eHalStatus
6853 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006854eHalStatus sme_SetHostOffload (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006855 tpSirHostOffloadReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006856{
6857 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnsone7245742012-09-05 17:12:55 -07006858 eHalStatus status = eHAL_STATUS_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07006859
Katya Nigambcb705f2013-12-26 14:26:22 +05306860 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006861 TRACE_CODE_SME_RX_HDD_SET_HOSTOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006862 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6863 {
6864#ifdef WLAN_NS_OFFLOAD
6865 if(SIR_IPV6_NS_OFFLOAD == pRequest->offloadType)
6866 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006867 status = pmcSetNSOffload( hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006868 }
6869 else
6870#endif //WLAN_NS_OFFLOAD
6871 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006872 status = pmcSetHostOffload (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006873 }
6874 sme_ReleaseGlobalLock( &pMac->sme );
6875 }
6876
6877 return (status);
6878}
6879
6880#ifdef WLAN_FEATURE_GTK_OFFLOAD
6881/* ---------------------------------------------------------------------------
6882 \fn sme_SetGTKOffload
6883 \brief API to set GTK offload information.
6884 \param hHal - The handle returned by macOpen.
6885 \param pRequest - Pointer to the GTK offload request.
6886 \return eHalStatus
6887 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006888eHalStatus sme_SetGTKOffload (tHalHandle hHal, tpSirGtkOffloadParams pRequest,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006889 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07006890{
6891 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6892 eHalStatus status;
6893
Katya Nigambcb705f2013-12-26 14:26:22 +05306894 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006895 TRACE_CODE_SME_RX_HDD_SET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006896 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6897 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006898 status = pmcSetGTKOffload( hHal, pRequest, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07006899 sme_ReleaseGlobalLock( &pMac->sme );
6900 }
6901
6902 return (status);
6903}
6904
6905/* ---------------------------------------------------------------------------
6906 \fn sme_GetGTKOffload
6907 \brief API to get GTK offload information.
6908 \param hHal - The handle returned by macOpen.
6909 \param pRequest - Pointer to the GTK offload response.
6910 \return eHalStatus
6911 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006912eHalStatus sme_GetGTKOffload (tHalHandle hHal, GTKOffloadGetInfoCallback callbackRoutine,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006913 void *callbackContext, tANI_U8 sessionId )
Jeff Johnson295189b2012-06-20 16:38:30 -07006914{
6915 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6916 eHalStatus status;
6917
Katya Nigambcb705f2013-12-26 14:26:22 +05306918 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006919 TRACE_CODE_SME_RX_HDD_GET_GTKOFFLOAD, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006920 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6921 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006922 pmcGetGTKOffload(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006923 sme_ReleaseGlobalLock( &pMac->sme );
6924 }
6925
6926 return (status);
6927}
6928#endif // WLAN_FEATURE_GTK_OFFLOAD
6929
6930/* ---------------------------------------------------------------------------
6931 \fn sme_SetKeepAlive
6932 \brief API to set the Keep Alive feature.
6933 \param hHal - The handle returned by macOpen.
6934 \param pRequest - Pointer to the Keep Alive request.
6935 \return eHalStatus
6936 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07006937eHalStatus sme_SetKeepAlive (tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07006938 tpSirKeepAliveReq pRequest)
Jeff Johnson295189b2012-06-20 16:38:30 -07006939{
6940 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6941 eHalStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07006942 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6943 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07006944 status = pmcSetKeepAlive (hHal, pRequest, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07006945 sme_ReleaseGlobalLock( &pMac->sme );
6946 }
6947
6948 return (status);
6949}
6950
6951#ifdef FEATURE_WLAN_SCAN_PNO
6952/* ---------------------------------------------------------------------------
6953 \fn sme_SetPreferredNetworkList
6954 \brief API to set the Preferred Network List Offload feature.
6955 \param hHal - The handle returned by macOpen.
6956 \param pRequest - Pointer to the offload request.
6957 \return eHalStatus
6958 ---------------------------------------------------------------------------*/
6959eHalStatus sme_SetPreferredNetworkList (tHalHandle hHal, tpSirPNOScanReq pRequest, tANI_U8 sessionId, void (*callbackRoutine) (void *callbackContext, tSirPrefNetworkFoundInd *pPrefNetworkFoundInd), void *callbackContext )
6960{
6961 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6962 eHalStatus status;
6963
6964 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6965 {
6966 pmcSetPreferredNetworkList(hHal, pRequest, sessionId, callbackRoutine, callbackContext);
6967 sme_ReleaseGlobalLock( &pMac->sme );
6968 }
6969
6970 return (status);
6971}
6972
6973eHalStatus sme_SetRSSIFilter(tHalHandle hHal, v_U8_t rssiThreshold)
6974{
6975 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6976 eHalStatus status;
6977
6978 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6979 {
6980 pmcSetRssiFilter(hHal, rssiThreshold);
6981 sme_ReleaseGlobalLock( &pMac->sme );
6982 }
6983
6984 return (status);
6985}
6986
6987#endif // FEATURE_WLAN_SCAN_PNO
6988
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006989eHalStatus sme_SetPowerParams(tHalHandle hHal, tSirSetPowerParamsReq* pwParams, tANI_BOOLEAN forced)
Jeff Johnson295189b2012-06-20 16:38:30 -07006990{
6991 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
6992 eHalStatus status;
6993
Katya Nigambcb705f2013-12-26 14:26:22 +05306994 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07006995 TRACE_CODE_SME_RX_HDD_SET_POWERPARAMS, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07006996 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
6997 {
Tushnim Bhattacharyya3a37def2013-02-24 11:11:15 -08006998 pmcSetPowerParams(hHal, pwParams, forced);
Jeff Johnson295189b2012-06-20 16:38:30 -07006999 sme_ReleaseGlobalLock( &pMac->sme );
7000 }
7001
7002 return (status);
7003}
7004
7005/* ---------------------------------------------------------------------------
7006 \fn sme_AbortMacScan
7007 \brief API to cancel MAC scan.
7008 \param hHal - The handle returned by macOpen.
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05307009 \param sessionId - sessionId on which we need to abort scan.
Srinivas, Dasari138af4f2014-02-07 11:13:45 +05307010 \param reason - Reason to abort the scan.
c_hpothua3d45d52015-01-05 14:11:17 +05307011 \return tSirAbortScanStatus Abort scan status
Jeff Johnson295189b2012-06-20 16:38:30 -07007012 ---------------------------------------------------------------------------*/
c_hpothua3d45d52015-01-05 14:11:17 +05307013tSirAbortScanStatus sme_AbortMacScan(tHalHandle hHal, tANI_U8 sessionId,
7014 eCsrAbortReason reason)
Jeff Johnson295189b2012-06-20 16:38:30 -07007015{
c_hpothua3d45d52015-01-05 14:11:17 +05307016 tSirAbortScanStatus scanAbortStatus = eSIR_ABORT_SCAN_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07007017 eHalStatus status;
7018 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7019
Katya Nigambcb705f2013-12-26 14:26:22 +05307020 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007021 TRACE_CODE_SME_RX_HDD_ABORT_MACSCAN, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007022 status = sme_AcquireGlobalLock( &pMac->sme );
7023 if ( HAL_STATUS_SUCCESS( status ) )
7024 {
c_hpothua3d45d52015-01-05 14:11:17 +05307025 scanAbortStatus = csrScanAbortMacScan(pMac, sessionId, reason);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007026
Jeff Johnson295189b2012-06-20 16:38:30 -07007027 sme_ReleaseGlobalLock( &pMac->sme );
7028 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007029
c_hpothua3d45d52015-01-05 14:11:17 +05307030 return ( scanAbortStatus );
Jeff Johnson295189b2012-06-20 16:38:30 -07007031}
7032
7033/* ----------------------------------------------------------------------------
7034 \fn sme_GetOperationChannel
7035 \brief API to get current channel on which STA is parked
7036 this function gives channel information only of infra station or IBSS station
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007037 \param hHal, pointer to memory location and sessionId
Jeff Johnson295189b2012-06-20 16:38:30 -07007038 \returns eHAL_STATUS_SUCCESS
7039 eHAL_STATUS_FAILURE
7040-------------------------------------------------------------------------------*/
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007041eHalStatus sme_GetOperationChannel(tHalHandle hHal, tANI_U32 *pChannel, tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07007042{
Jeff Johnson295189b2012-06-20 16:38:30 -07007043 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7044 tCsrRoamSession *pSession;
7045
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007046 if (CSR_IS_SESSION_VALID( pMac, sessionId ))
Jeff Johnson295189b2012-06-20 16:38:30 -07007047 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007048 pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07007049
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007050 if(( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRASTRUCTURE ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007051 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_IBSS ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007052 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_INFRA_AP ) ||
Jeff Johnson04dd8a82012-06-29 20:41:40 -07007053 ( pSession->connectedProfile.BSSType == eCSR_BSS_TYPE_START_IBSS ))
7054 {
7055 *pChannel =pSession->connectedProfile.operationChannel;
7056 return eHAL_STATUS_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07007057 }
7058 }
7059 return eHAL_STATUS_FAILURE;
7060}// sme_GetOperationChannel ends here
7061
Jeff Johnson295189b2012-06-20 16:38:30 -07007062/* ---------------------------------------------------------------------------
7063
7064 \fn sme_RegisterMgtFrame
7065
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007066 \brief To register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007067 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007068 \param matchData - data which needs to be matched before passing frame
7069 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007070 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007071 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007072 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007073eHalStatus sme_RegisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007074 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7075{
7076 eHalStatus status = eHAL_STATUS_SUCCESS;
7077 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7078
Katya Nigambcb705f2013-12-26 14:26:22 +05307079 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007080 TRACE_CODE_SME_RX_HDD_REGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007081 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7082 {
7083 tSirRegisterMgmtFrame *pMsg;
7084 tANI_U16 len;
7085 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007086
7087 if(!pSession)
7088 {
7089 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007090 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007091 return eHAL_STATUS_FAILURE;
7092 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007093
Jeff Johnson295189b2012-06-20 16:38:30 -07007094 if( !pSession->sessionActive )
7095 {
7096 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007097 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007098 sme_ReleaseGlobalLock( &pMac->sme );
7099 return eHAL_STATUS_FAILURE;
7100 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007101
Jeff Johnson295189b2012-06-20 16:38:30 -07007102 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7103
Kiet Lam64c1b492013-07-12 13:56:44 +05307104 pMsg = vos_mem_malloc(len);
7105 if ( NULL == pMsg )
7106 status = eHAL_STATUS_FAILURE;
7107 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007108 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307109 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007110 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
7111 pMsg->length = len;
7112 pMsg->sessionId = sessionId;
7113 pMsg->registerFrame = VOS_TRUE;
7114 pMsg->frameType = frameType;
7115 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307116 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007117 status = palSendMBMessage(pMac->hHdd, pMsg);
7118 }
7119 sme_ReleaseGlobalLock( &pMac->sme );
7120 }
7121 return status;
7122}
7123
7124/* ---------------------------------------------------------------------------
7125
7126 \fn sme_DeregisterMgtFrame
7127
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007128 \brief To De-register managment frame of specified type and subtype.
Jeff Johnson295189b2012-06-20 16:38:30 -07007129 \param frameType - type of the frame that needs to be passed to HDD.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007130 \param matchData - data which needs to be matched before passing frame
7131 to HDD.
Jeff Johnson295189b2012-06-20 16:38:30 -07007132 \param matchDataLen - Length of matched data.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007133 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07007134 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007135eHalStatus sme_DeregisterMgmtFrame(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnson295189b2012-06-20 16:38:30 -07007136 tANI_U16 frameType, tANI_U8* matchData, tANI_U16 matchLen)
7137{
7138 eHalStatus status = eHAL_STATUS_SUCCESS;
7139 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7140
Katya Nigambcb705f2013-12-26 14:26:22 +05307141 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007142 TRACE_CODE_SME_RX_HDD_DEREGISTER_MGMTFR, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007143 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7144 {
7145 tSirRegisterMgmtFrame *pMsg;
7146 tANI_U16 len;
7147 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007148
7149 if(!pSession)
7150 {
7151 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08007152 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07007153 return eHAL_STATUS_FAILURE;
7154 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007155
7156 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07007157 {
7158 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007159 "%s Invalid Sessionid", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007160 sme_ReleaseGlobalLock( &pMac->sme );
7161 return eHAL_STATUS_FAILURE;
7162 }
7163
7164 len = sizeof(tSirRegisterMgmtFrame) + matchLen;
7165
Kiet Lam64c1b492013-07-12 13:56:44 +05307166 pMsg = vos_mem_malloc(len);
7167 if ( NULL == pMsg )
7168 status = eHAL_STATUS_FAILURE;
7169 else
Jeff Johnson295189b2012-06-20 16:38:30 -07007170 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307171 vos_mem_set(pMsg, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07007172 pMsg->messageType = eWNI_SME_REGISTER_MGMT_FRAME_REQ;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007173 pMsg->length = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07007174 pMsg->registerFrame = VOS_FALSE;
7175 pMsg->frameType = frameType;
7176 pMsg->matchLen = matchLen;
Kiet Lam64c1b492013-07-12 13:56:44 +05307177 vos_mem_copy(pMsg->matchData, matchData, matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07007178 status = palSendMBMessage(pMac->hHdd, pMsg);
7179 }
7180 sme_ReleaseGlobalLock( &pMac->sme );
7181 }
7182 return status;
7183}
7184
7185/* ---------------------------------------------------------------------------
7186 \fn sme_RemainOnChannel
7187 \brief API to request remain on channel for 'x' duration. used in p2p in listen state
7188 \param hHal - The handle returned by macOpen.
7189 \param pRequest - channel
7190 \param duration - duration in ms
7191 \param callback - HDD registered callback to process reaminOnChannelRsp
7192 \param context - HDD Callback param
7193 \return eHalStatus
7194 ---------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -07007195eHalStatus sme_RemainOnChannel(tHalHandle hHal, tANI_U8 sessionId,
7196 tANI_U8 channel, tANI_U32 duration,
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307197 remainOnChanCallback callback,
7198 void *pContext,
7199 tANI_U8 isP2PProbeReqAllowed)
Jeff Johnson295189b2012-06-20 16:38:30 -07007200{
7201 eHalStatus status = eHAL_STATUS_SUCCESS;
7202 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7203
Katya Nigambcb705f2013-12-26 14:26:22 +05307204 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007205 TRACE_CODE_SME_RX_HDD_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007206 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7207 {
Gopichand Nakkala924e4552013-05-08 19:18:14 +05307208 status = p2pRemainOnChannel (hHal, sessionId, channel, duration, callback, pContext,
7209 isP2PProbeReqAllowed
Jeff Johnson295189b2012-06-20 16:38:30 -07007210#ifdef WLAN_FEATURE_P2P_INTERNAL
7211 , eP2PRemainOnChnReasonUnknown
7212#endif
7213 );
7214 sme_ReleaseGlobalLock( &pMac->sme );
7215 }
7216 return(status);
7217}
7218
7219/* ---------------------------------------------------------------------------
7220 \fn sme_ReportProbeReq
7221 \brief API to enable/disable forwarding of probeReq to apps in p2p.
7222 \param hHal - The handle returned by macOpen.
7223 \param falg: to set the Probe request forarding to wpa_supplicant in listen state in p2p
7224 \return eHalStatus
7225 ---------------------------------------------------------------------------*/
7226
7227#ifndef WLAN_FEATURE_CONCURRENT_P2P
7228eHalStatus sme_ReportProbeReq(tHalHandle hHal, tANI_U8 flag)
7229{
7230 eHalStatus status = eHAL_STATUS_SUCCESS;
7231 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7232
7233 do
7234 {
7235 //acquire the lock for the sme object
7236 status = sme_AcquireGlobalLock(&pMac->sme);
7237 if(HAL_STATUS_SUCCESS(status))
7238 {
7239 /* call set in context */
7240 pMac->p2pContext.probeReqForwarding = flag;
7241 //release the lock for the sme object
7242 sme_ReleaseGlobalLock( &pMac->sme );
7243 }
7244 } while(0);
7245
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007246 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007247
7248 return(status);
7249}
7250
7251/* ---------------------------------------------------------------------------
7252 \fn sme_updateP2pIe
7253 \brief API to set the P2p Ie in p2p context
7254 \param hHal - The handle returned by macOpen.
7255 \param p2pIe - Ptr to p2pIe from HDD.
7256 \param p2pIeLength: length of p2pIe
7257 \return eHalStatus
7258 ---------------------------------------------------------------------------*/
7259
7260eHalStatus sme_updateP2pIe(tHalHandle hHal, void *p2pIe, tANI_U32 p2pIeLength)
7261{
7262 eHalStatus status = eHAL_STATUS_SUCCESS;
7263 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7264
7265 //acquire the lock for the sme object
7266 status = sme_AcquireGlobalLock(&pMac->sme);
7267 if(HAL_STATUS_SUCCESS(status))
7268 {
7269 if(NULL != pMac->p2pContext.probeRspIe){
7270 vos_mem_free(pMac->p2pContext.probeRspIe);
7271 pMac->p2pContext.probeRspIeLength = 0;
7272 }
7273
7274 pMac->p2pContext.probeRspIe = vos_mem_malloc(p2pIeLength);
7275 if (NULL == pMac->p2pContext.probeRspIe)
7276 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007277 smsLog(pMac, LOGE, "%s: Unable to allocate P2P IE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007278 pMac->p2pContext.probeRspIeLength = 0;
7279 status = eHAL_STATUS_FAILURE;
7280 }
7281 else
7282 {
7283 pMac->p2pContext.probeRspIeLength = p2pIeLength;
7284
7285 sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG2,
7286 pMac->p2pContext.probeRspIe,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007287 pMac->p2pContext.probeRspIeLength );
Jeff Johnson295189b2012-06-20 16:38:30 -07007288 vos_mem_copy((tANI_U8 *)pMac->p2pContext.probeRspIe, p2pIe,
7289 p2pIeLength);
7290 }
7291
7292 //release the lock for the sme object
7293 sme_ReleaseGlobalLock( &pMac->sme );
7294 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007295
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007296 smsLog(pMac, LOG2, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007297
7298 return(status);
7299}
7300#endif
7301
7302/* ---------------------------------------------------------------------------
7303 \fn sme_sendAction
7304 \brief API to send action frame from supplicant.
7305 \param hHal - The handle returned by macOpen.
7306 \return eHalStatus
7307 ---------------------------------------------------------------------------*/
7308
7309eHalStatus sme_sendAction(tHalHandle hHal, tANI_U8 sessionId,
Jeff Johnsone7245742012-09-05 17:12:55 -07007310 const tANI_U8 *pBuf, tANI_U32 len,
7311 tANI_U16 wait, tANI_BOOLEAN noack)
Jeff Johnson295189b2012-06-20 16:38:30 -07007312{
7313 eHalStatus status = eHAL_STATUS_SUCCESS;
7314 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7315
Katya Nigambcb705f2013-12-26 14:26:22 +05307316 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007317 TRACE_CODE_SME_RX_HDD_SEND_ACTION, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007318 //acquire the lock for the sme object
7319 status = sme_AcquireGlobalLock(&pMac->sme);
7320 if(HAL_STATUS_SUCCESS(status))
7321 {
Jeff Johnsone7245742012-09-05 17:12:55 -07007322 p2pSendAction(hHal, sessionId, pBuf, len, wait, noack);
Jeff Johnson295189b2012-06-20 16:38:30 -07007323 //release the lock for the sme object
7324 sme_ReleaseGlobalLock( &pMac->sme );
7325 }
7326
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007327 smsLog(pMac, LOGW, "exiting function %s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007328
7329 return(status);
7330}
7331
7332eHalStatus sme_CancelRemainOnChannel(tHalHandle hHal, tANI_U8 sessionId )
7333{
7334 eHalStatus status = eHAL_STATUS_SUCCESS;
7335 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7336
Katya Nigambcb705f2013-12-26 14:26:22 +05307337 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007338 TRACE_CODE_SME_RX_HDD_CANCEL_REMAIN_ONCHAN, sessionId, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007339 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7340 {
7341 status = p2pCancelRemainOnChannel (hHal, sessionId);
7342 sme_ReleaseGlobalLock( &pMac->sme );
7343 }
7344 return(status);
7345}
7346
7347//Power Save Related
7348eHalStatus sme_p2pSetPs(tHalHandle hHal, tP2pPsConfig * data)
7349{
7350 eHalStatus status = eHAL_STATUS_SUCCESS;
7351 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7352
7353 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7354 {
7355 status = p2pSetPs (hHal, data);
7356 sme_ReleaseGlobalLock( &pMac->sme );
7357 }
7358 return(status);
7359}
7360
Jeff Johnson295189b2012-06-20 16:38:30 -07007361
7362/* ---------------------------------------------------------------------------
7363
7364 \fn sme_ConfigureRxpFilter
7365
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007366 \brief
Jeff Johnson295189b2012-06-20 16:38:30 -07007367 SME will pass this request to lower mac to set/reset the filter on RXP for
7368 multicast & broadcast traffic.
7369
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007370 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007371
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007372 hHal - The handle returned by macOpen.
7373
Jeff Johnson295189b2012-06-20 16:38:30 -07007374 filterMask- Currently the API takes a 1 or 0 (set or reset) as filter.
7375 Basically to enable/disable the filter (to filter "all" mcbc traffic) based
7376 on this param. In future we can use this as a mask to set various types of
7377 filters as suggested below:
7378 FILTER_ALL_MULTICAST:
7379 FILTER_ALL_BROADCAST:
7380 FILTER_ALL_MULTICAST_BROADCAST:
7381
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007382
7383 \return eHalStatus
7384
7385
Jeff Johnson295189b2012-06-20 16:38:30 -07007386--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007387eHalStatus sme_ConfigureRxpFilter( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007388 tpSirWlanSetRxpFilters wlanRxpFilterParam)
7389{
7390 eHalStatus status = eHAL_STATUS_SUCCESS;
7391 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7392 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7393 vos_msg_t vosMessage;
7394
Katya Nigambcb705f2013-12-26 14:26:22 +05307395 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007396 TRACE_CODE_SME_RX_HDD_CONFIG_RXPFIL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007397 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7398 {
7399 /* serialize the req through MC thread */
7400 vosMessage.bodyptr = wlanRxpFilterParam;
7401 vosMessage.type = WDA_CFG_RXP_FILTER_REQ;
7402 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7403 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7404 {
7405 status = eHAL_STATUS_FAILURE;
7406 }
7407 sme_ReleaseGlobalLock( &pMac->sme );
7408 }
7409 return(status);
7410}
7411
Jeff Johnson295189b2012-06-20 16:38:30 -07007412/* ---------------------------------------------------------------------------
7413
7414 \fn sme_ConfigureSuspendInd
7415
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007416 \brief
7417 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007418 be suspended
7419
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007420 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007421
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007422 hHal - The handle returned by macOpen.
7423
Jeff Johnson295189b2012-06-20 16:38:30 -07007424 wlanSuspendParam- Depicts the wlan suspend params
7425
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007426
7427 \return eHalStatus
7428
7429
Jeff Johnson295189b2012-06-20 16:38:30 -07007430--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007431eHalStatus sme_ConfigureSuspendInd( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007432 tpSirWlanSuspendParam wlanSuspendParam)
7433{
7434 eHalStatus status = eHAL_STATUS_SUCCESS;
7435 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7436 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7437 vos_msg_t vosMessage;
7438
Katya Nigambcb705f2013-12-26 14:26:22 +05307439 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007440 TRACE_CODE_SME_RX_HDD_CONFIG_SUSPENDIND, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007441 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7442 {
7443 /* serialize the req through MC thread */
7444 vosMessage.bodyptr = wlanSuspendParam;
7445 vosMessage.type = WDA_WLAN_SUSPEND_IND;
7446 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7447 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7448 {
7449 status = eHAL_STATUS_FAILURE;
7450 }
7451 sme_ReleaseGlobalLock( &pMac->sme );
7452 }
7453 return(status);
7454}
7455
7456/* ---------------------------------------------------------------------------
7457
7458 \fn sme_ConfigureResumeReq
7459
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007460 \brief
7461 SME will pass this request to lower mac to Indicate that the wlan needs to
Jeff Johnson295189b2012-06-20 16:38:30 -07007462 be Resumed
7463
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007464 \param
Jeff Johnson295189b2012-06-20 16:38:30 -07007465
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007466 hHal - The handle returned by macOpen.
7467
Jeff Johnson295189b2012-06-20 16:38:30 -07007468 wlanResumeParam- Depicts the wlan resume params
7469
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007470
7471 \return eHalStatus
7472
7473
Jeff Johnson295189b2012-06-20 16:38:30 -07007474--------------------------------------------------------------------------- */
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007475eHalStatus sme_ConfigureResumeReq( tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07007476 tpSirWlanResumeParam wlanResumeParam)
7477{
7478 eHalStatus status = eHAL_STATUS_SUCCESS;
7479 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7480 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7481 vos_msg_t vosMessage;
7482
Katya Nigambcb705f2013-12-26 14:26:22 +05307483 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07007484 TRACE_CODE_SME_RX_HDD_CONFIG_RESUMEREQ, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07007485 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
7486 {
7487 /* serialize the req through MC thread */
7488 vosMessage.bodyptr = wlanResumeParam;
7489 vosMessage.type = WDA_WLAN_RESUME_REQ;
7490 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
7491 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
7492 {
7493 status = eHAL_STATUS_FAILURE;
7494 }
7495 sme_ReleaseGlobalLock( &pMac->sme );
7496 }
7497 return(status);
7498}
7499
Jeff Johnson295189b2012-06-20 16:38:30 -07007500/* ---------------------------------------------------------------------------
7501
7502 \fn sme_GetInfraSessionId
7503
7504 \brief To get the session ID for infra session, if connected
7505 This is a synchronous API.
7506
7507 \param hHal - The handle returned by macOpen.
7508
7509 \return sessionid, -1 if infra session is not connected
7510
7511 -------------------------------------------------------------------------------*/
7512tANI_S8 sme_GetInfraSessionId(tHalHandle hHal)
7513{
7514 eHalStatus status = eHAL_STATUS_FAILURE;
7515 tANI_S8 sessionid = -1;
7516 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007517
Jeff Johnson295189b2012-06-20 16:38:30 -07007518 status = sme_AcquireGlobalLock( &pMac->sme );
7519 if ( HAL_STATUS_SUCCESS( status ) )
7520 {
7521
7522 sessionid = csrGetInfraSessionId( pMac);
7523
7524 sme_ReleaseGlobalLock( &pMac->sme );
7525 }
7526
7527 return (sessionid);
7528}
7529
7530/* ---------------------------------------------------------------------------
7531
7532 \fn sme_GetInfraOperationChannel
7533
7534 \brief To get the operating channel for infra session, if connected
7535 This is a synchronous API.
7536
7537 \param hHal - The handle returned by macOpen.
7538 \param sessionId - the sessionId returned by sme_OpenSession.
7539
7540 \return operating channel, 0 if infra session is not connected
7541
7542 -------------------------------------------------------------------------------*/
7543tANI_U8 sme_GetInfraOperationChannel( tHalHandle hHal, tANI_U8 sessionId)
7544{
7545 eHalStatus status = eHAL_STATUS_FAILURE;
7546 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7547 tANI_U8 channel = 0;
7548 status = sme_AcquireGlobalLock( &pMac->sme );
7549 if ( HAL_STATUS_SUCCESS( status ) )
7550 {
7551
7552 channel = csrGetInfraOperationChannel( pMac, sessionId);
7553
7554 sme_ReleaseGlobalLock( &pMac->sme );
7555 }
7556
7557 return (channel);
7558}
7559
7560//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 -07007561//If other BSS is not up or not connected it will return 0
Jeff Johnson295189b2012-06-20 16:38:30 -07007562tANI_U8 sme_GetConcurrentOperationChannel( tHalHandle hHal )
7563{
7564 eHalStatus status = eHAL_STATUS_FAILURE;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007565 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Jeff Johnson295189b2012-06-20 16:38:30 -07007566 tANI_U8 channel = 0;
7567 status = sme_AcquireGlobalLock( &pMac->sme );
7568 if ( HAL_STATUS_SUCCESS( status ) )
7569 {
7570
7571 channel = csrGetConcurrentOperationChannel( pMac );
7572 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO_HIGH, "%s: "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007573 " Other Concurrent Channel = %d", __func__,channel);
Jeff Johnson295189b2012-06-20 16:38:30 -07007574 sme_ReleaseGlobalLock( &pMac->sme );
7575 }
7576
7577 return (channel);
7578}
7579
7580#ifdef FEATURE_WLAN_SCAN_PNO
7581/******************************************************************************
7582*
7583* Name: sme_PreferredNetworkFoundInd
7584*
7585* Description:
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007586* Invoke Preferred Network Found Indication
Jeff Johnson295189b2012-06-20 16:38:30 -07007587*
7588* Parameters:
7589* hHal - HAL handle for device
7590* pMsg - found network description
7591*
7592* Returns: eHalStatus
7593*
7594******************************************************************************/
7595eHalStatus sme_PreferredNetworkFoundInd (tHalHandle hHal, void* pMsg)
7596{
7597 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
7598 eHalStatus status = eHAL_STATUS_SUCCESS;
7599 tSirPrefNetworkFoundInd *pPrefNetworkFoundInd = (tSirPrefNetworkFoundInd *)pMsg;
Srikant Kuppa066904f2013-05-07 13:56:02 -07007600 v_U8_t dumpSsId[SIR_MAC_MAX_SSID_LENGTH + 1];
7601 tANI_U8 ssIdLength = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07007602
7603 if (NULL == pMsg)
7604 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007605 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007606 status = eHAL_STATUS_FAILURE;
7607 }
7608 else
7609 {
7610 if (pPrefNetworkFoundInd->ssId.length > 0)
7611 {
Srikant Kuppa066904f2013-05-07 13:56:02 -07007612 ssIdLength = CSR_MIN(SIR_MAC_MAX_SSID_LENGTH,
7613 pPrefNetworkFoundInd->ssId.length);
7614 vos_mem_copy(dumpSsId, pPrefNetworkFoundInd->ssId.ssId, ssIdLength);
7615 dumpSsId[ssIdLength] = 0;
Abhishek Singh195c03e2014-05-14 17:21:30 +05307616 smsLog(pMac, LOG1, FL(" SSID=%s frame length %d"),
7617 dumpSsId, pPrefNetworkFoundInd->frameLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07007618
Vinay Krishna Erannab13043b2013-12-06 11:50:21 +05307619 /* Flush scan results, So as to avoid indication/updation of
7620 * stale entries, which may not have aged out during APPS collapse
7621 */
7622 sme_ScanFlushResult(hHal,0);
7623
Srikant Kuppa066904f2013-05-07 13:56:02 -07007624 //Save the frame to scan result
7625 if (pPrefNetworkFoundInd->mesgLen > sizeof(tSirPrefNetworkFoundInd))
7626 {
7627 //we may have a frame
7628 status = csrScanSavePreferredNetworkFound(pMac,
7629 pPrefNetworkFoundInd);
7630 if (!HAL_STATUS_SUCCESS(status))
7631 {
7632 smsLog(pMac, LOGE, FL(" fail to save preferred network"));
7633 }
7634 }
7635 else
7636 {
Jeff Johnsonafeb9582013-11-22 18:39:00 -08007637 smsLog(pMac, LOGE, FL(" not enough data length %u needed %zu"),
Srikant Kuppa066904f2013-05-07 13:56:02 -07007638 pPrefNetworkFoundInd->mesgLen, sizeof(tSirPrefNetworkFoundInd));
Jeff Johnson295189b2012-06-20 16:38:30 -07007639 }
7640
Srikant Kuppa066904f2013-05-07 13:56:02 -07007641 /* Call Preferred Netowrk Found Indication callback routine. */
7642 if (HAL_STATUS_SUCCESS(status) && (pMac->pmc.prefNetwFoundCB != NULL))
7643 {
7644 pMac->pmc.prefNetwFoundCB(
7645 pMac->pmc.preferredNetworkFoundIndCallbackContext,
7646 pPrefNetworkFoundInd);
7647 }
Jeff Johnson295189b2012-06-20 16:38:30 -07007648 }
7649 else
7650 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007651 smsLog(pMac, LOGE, "%s: callback failed - SSID is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07007652 status = eHAL_STATUS_FAILURE;
7653 }
7654 }
7655
7656
7657 return(status);
7658}
7659
7660#endif // FEATURE_WLAN_SCAN_PNO
7661
7662
7663eHalStatus sme_GetCfgValidChannels(tHalHandle hHal, tANI_U8 *aValidChannels, tANI_U32 *len)
7664{
7665 eHalStatus status = eHAL_STATUS_FAILURE;
7666 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007667
Jeff Johnson295189b2012-06-20 16:38:30 -07007668 status = sme_AcquireGlobalLock( &pMac->sme );
7669 if ( HAL_STATUS_SUCCESS( status ) )
7670 {
7671 status = csrGetCfgValidChannels(pMac, aValidChannels, len);
7672 sme_ReleaseGlobalLock( &pMac->sme );
7673 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007674
Jeff Johnson295189b2012-06-20 16:38:30 -07007675 return (status);
7676}
7677
7678
7679/* ---------------------------------------------------------------------------
7680
7681 \fn sme_SetTxPerTracking
7682
7683 \brief Set Tx PER tracking configuration parameters
7684
7685 \param hHal - The handle returned by macOpen.
7686 \param pTxPerTrackingConf - Tx PER configuration parameters
7687
7688 \return eHalStatus
7689
7690 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007691eHalStatus sme_SetTxPerTracking(tHalHandle hHal,
7692 void (*pCallbackfn) (void *pCallbackContext),
Jeff Johnson295189b2012-06-20 16:38:30 -07007693 void *pCallbackContext,
7694 tpSirTxPerTrackingParam pTxPerTrackingParam)
7695{
7696 vos_msg_t msg;
7697 tpSirTxPerTrackingParam pTxPerTrackingParamReq = NULL;
7698 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
7699
7700 if ( eHAL_STATUS_SUCCESS == sme_AcquireGlobalLock( &pMac->sme ) )
7701 {
7702 pMac->sme.pTxPerHitCallback = pCallbackfn;
7703 pMac->sme.pTxPerHitCbContext = pCallbackContext;
7704 sme_ReleaseGlobalLock( &pMac->sme );
7705 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007706
Jeff Johnson295189b2012-06-20 16:38:30 -07007707 // free this memory in failure case or WDA request callback function
7708 pTxPerTrackingParamReq = vos_mem_malloc(sizeof(tSirTxPerTrackingParam));
7709 if (NULL == pTxPerTrackingParamReq)
7710 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007711 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 -07007712 return eHAL_STATUS_FAILURE;
7713 }
7714
Kiet Lam64c1b492013-07-12 13:56:44 +05307715 vos_mem_copy(pTxPerTrackingParamReq, (void*)pTxPerTrackingParam,
7716 sizeof(tSirTxPerTrackingParam));
Jeff Johnson295189b2012-06-20 16:38:30 -07007717 msg.type = WDA_SET_TX_PER_TRACKING_REQ;
7718 msg.reserved = 0;
7719 msg.bodyptr = pTxPerTrackingParamReq;
7720
7721 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
7722 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07007723 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 -07007724 vos_mem_free(pTxPerTrackingParamReq);
7725 return eHAL_STATUS_FAILURE;
7726 }
7727
7728 return eHAL_STATUS_SUCCESS;
7729}
7730
7731/* ---------------------------------------------------------------------------
7732
7733 \fn sme_HandleChangeCountryCode
7734
7735 \brief Change Country code, Reg Domain and channel list
7736
7737 \details Country Code Priority
7738 0 = 11D > Configured Country > NV
7739 1 = Configured Country > 11D > NV
7740 If Supplicant country code is priority than 11d is disabled.
7741 If 11D is enabled, we update the country code after every scan.
7742 Hence when Supplicant country code is priority, we don't need 11D info.
7743 Country code from Supplicant is set as current courtry code.
7744 User can send reset command XX (instead of country code) to reset the
7745 country code to default values which is read from NV.
7746 In case of reset, 11D is enabled and default NV code is Set as current country code
7747 If 11D is priority,
7748 Than Supplicant country code code is set to default code. But 11D code is set as current country code
7749
7750 \param pMac - The handle returned by macOpen.
7751 \param pMsgBuf - MSG Buffer
7752
7753 \return eHalStatus
7754
7755 -------------------------------------------------------------------------------*/
7756eHalStatus sme_HandleChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
7757{
7758 eHalStatus status = eHAL_STATUS_SUCCESS;
7759 tAniChangeCountryCodeReq *pMsg;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007760 v_REGDOMAIN_t domainIdIoctl;
Jeff Johnson295189b2012-06-20 16:38:30 -07007761 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
7762 static uNvTables nvTables;
7763 pMsg = (tAniChangeCountryCodeReq *)pMsgBuf;
7764
7765
7766 /* if the reset Supplicant country code command is triggered, enable 11D, reset the NV country code and return */
7767 if( VOS_TRUE == vos_mem_compare(pMsg->countryCode, SME_INVALID_COUNTRY_CODE, 2) )
7768 {
7769 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7770
7771 vosStatus = vos_nv_readDefaultCountryTable( &nvTables );
7772
7773 /* read the country code from NV and use it */
7774 if ( VOS_IS_STATUS_SUCCESS(vosStatus) )
7775 {
Kiet Lam64c1b492013-07-12 13:56:44 +05307776 vos_mem_copy(pMsg->countryCode,
7777 nvTables.defaultCountryTable.countryCode,
7778 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007779 }
7780 else
7781 {
7782 status = eHAL_STATUS_FAILURE;
7783 return status;
7784 }
Abhishek Singh4d6b54c2014-10-14 12:31:00 +05307785 /* Update the 11d country to default country from NV bin so that when
7786 * callback is received for this default country, driver will not
7787 * disable the 11d taking it as valid country by user.
7788 */
7789 smsLog(pMac, LOG1,
7790 FL("Set default country code (%c%c) from NV as invalid country received"),
7791 pMsg->countryCode[0],pMsg->countryCode[1]);
7792 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
7793 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007794 }
7795 else
7796 {
7797 /* if Supplicant country code has priority, disable 11d */
Gopichand Nakkalaacd94112013-05-29 21:37:47 +05307798 if(pMac->roam.configParam.fSupplicantCountryCodeHasPriority &&
7799 pMsg->countryFromUserSpace)
Jeff Johnson295189b2012-06-20 16:38:30 -07007800 {
7801 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
7802 }
7803 }
7804
7805 /* WEXT set country code means
7806 * 11D should be supported?
7807 * 11D Channel should be enforced?
7808 * 11D Country code should be matched?
7809 * 11D Reg Domian should be matched?
7810 * Country string changed */
7811 if(pMac->roam.configParam.Is11dSupportEnabled &&
7812 pMac->roam.configParam.fEnforce11dChannels &&
7813 pMac->roam.configParam.fEnforceCountryCodeMatch &&
7814 pMac->roam.configParam.fEnforceDefaultDomain &&
7815 !csrSave11dCountryString(pMac, pMsg->countryCode, eANI_BOOLEAN_TRUE))
7816 {
7817 /* All 11D related options are already enabled
7818 * Country string is not changed
7819 * Do not need do anything for country code change request */
7820 return eHAL_STATUS_SUCCESS;
7821 }
7822
7823 /* Set Current Country code and Current Regulatory domain */
7824 status = csrSetCountryCode(pMac, pMsg->countryCode, NULL);
7825 if(eHAL_STATUS_SUCCESS != status)
7826 {
7827 /* Supplicant country code failed. So give 11D priority */
7828 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7829 smsLog(pMac, LOGE, "Set Country Code Fail %d", status);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07007830 return status;
Jeff Johnson295189b2012-06-20 16:38:30 -07007831 }
7832
Jeff Johnson295189b2012-06-20 16:38:30 -07007833 /* overwrite the defualt country code */
Kiet Lam64c1b492013-07-12 13:56:44 +05307834 vos_mem_copy(pMac->scan.countryCodeDefault,
7835 pMac->scan.countryCodeCurrent,
7836 WNI_CFG_COUNTRY_CODE_LEN);
Jeff Johnson295189b2012-06-20 16:38:30 -07007837
7838 /* Get Domain ID from country code */
Kiet Lam6c583332013-10-14 05:37:09 +05307839 status = csrGetRegulatoryDomainForCountry(pMac,
7840 pMac->scan.countryCodeCurrent,
7841 (v_REGDOMAIN_t *) &domainIdIoctl,
7842 COUNTRY_QUERY);
Jeff Johnson295189b2012-06-20 16:38:30 -07007843 if ( status != eHAL_STATUS_SUCCESS )
7844 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007845 smsLog( pMac, LOGE, FL(" fail to get regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007846 return status;
7847 }
Tushnim Bhattacharyya796ffe82013-11-05 16:31:36 -08007848 else if (REGDOMAIN_WORLD == domainIdIoctl)
7849 {
7850 /* Supplicant country code is invalid, so we are on world mode now. So
7851 give 11D chance to update */
7852 pMac->roam.configParam.Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabledOriginal;
7853 smsLog(pMac, LOG1, FL("Country Code unrecognized by driver"));
7854 }
7855
Jeff Johnson295189b2012-06-20 16:38:30 -07007856
Abhishek Singha306a442013-11-07 18:39:01 +05307857 status = WDA_SetRegDomain(pMac, domainIdIoctl, pMsg->sendRegHint);
Jeff Johnson295189b2012-06-20 16:38:30 -07007858
7859 if ( status != eHAL_STATUS_SUCCESS )
7860 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007861 smsLog( pMac, LOGE, FL(" fail to set regId %d"), domainIdIoctl );
Jeff Johnson295189b2012-06-20 16:38:30 -07007862 return status;
7863 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007864 else
7865 {
7866 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7867 //set again if we find AP with 11d info during scan
Sachin Ahujacb64fc82015-01-12 17:01:05 +05307868 status = csrSetRegulatoryDomain(pMac, domainIdIoctl, NULL);
7869 if (status != eHAL_STATUS_SUCCESS)
7870 {
7871 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
7872 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007873 if (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
7874 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007875 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007876 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
7877 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
7878 }
7879 }
Kiet Lam6c583332013-10-14 05:37:09 +05307880#ifndef CONFIG_ENABLE_LINUX_REG
Jeff Johnson295189b2012-06-20 16:38:30 -07007881 /* set to default domain ID */
7882 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7883
7884 /* get the channels based on new cc */
7885 status = csrInitGetChannels( pMac );
7886
7887 if ( status != eHAL_STATUS_SUCCESS )
7888 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08007889 smsLog( pMac, LOGE, FL(" fail to get Channels "));
Jeff Johnson295189b2012-06-20 16:38:30 -07007890 return status;
7891 }
7892
7893 /* reset info based on new cc, and we are done */
Gopichand Nakkalab9185f22012-12-21 08:03:42 -08007894 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307895 /* Country code Changed, Purge Only scan result
7896 * which does not have channel number belong to 11d
7897 * channel list
7898 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05307899 csrScanFilterResults(pMac);
Agarwal Ashishfaef6692014-01-29 19:40:30 +05307900
Kiet Lam6c583332013-10-14 05:37:09 +05307901#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07007902 if( pMsg->changeCCCallback )
7903 {
7904 ((tSmeChangeCountryCallback)(pMsg->changeCCCallback))((void *)pMsg->pDevContext);
7905 }
7906
7907 return eHAL_STATUS_SUCCESS;
7908}
7909
Amar Singhal0d15bd52013-10-12 23:13:13 -07007910/* ---------------------------------------------------------------------------
7911
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007912 \fn sme_HandleChangeCountryCodeByUser
Amar Singhal0d15bd52013-10-12 23:13:13 -07007913
7914 \brief Change Country code, Reg Domain and channel list
7915
7916 If Supplicant country code is priority than 11d is disabled.
7917 If 11D is enabled, we update the country code after every scan.
7918 Hence when Supplicant country code is priority, we don't need 11D info.
7919 Country code from Supplicant is set as current country code.
7920
7921 \param pMac - The handle returned by macOpen.
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007922 \param pMsg - Carrying new CC & domain set in kernel by user
Amar Singhal0d15bd52013-10-12 23:13:13 -07007923
7924 \return eHalStatus
7925
7926 -------------------------------------------------------------------------------*/
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007927eHalStatus sme_HandleChangeCountryCodeByUser(tpAniSirGlobal pMac,
7928 tAniGenericChangeCountryCodeReq *pMsg)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007929{
7930 eHalStatus status = eHAL_STATUS_SUCCESS;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007931 v_REGDOMAIN_t reg_domain_id;
Kiet Lam6c583332013-10-14 05:37:09 +05307932 v_BOOL_t is11dCountry = VOS_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007933
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07007934 smsLog(pMac, LOG1, FL(" called"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007935 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
7936
Kiet Lam6c583332013-10-14 05:37:09 +05307937 if (memcmp(pMsg->countryCode, pMac->scan.countryCode11d,
7938 VOS_COUNTRY_CODE_LEN) == 0)
7939 {
7940 is11dCountry = VOS_TRUE;
7941 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07007942
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307943 /* Set the country code given by userspace when 11dOriginal is FALSE
7944 * when 11doriginal is True,is11dCountry =0 and
7945 * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
7946 * and return failure
7947 */
7948 if (pMac->roam.configParam.Is11dSupportEnabledOriginal == true)
Amar Singhal97a2d992013-11-19 10:58:07 -08007949 {
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05307950 if ((!is11dCountry) && (!pMac->roam.configParam.fSupplicantCountryCodeHasPriority)&&
7951 (!pMac->roam.configParam.fEnforceCountryCode) )
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307952 {
Amar Singhal97a2d992013-11-19 10:58:07 -08007953
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307954 smsLog( pMac, LOGW, FL(" incorrect country being set, nullify this request"));
Amar Singhal97a2d992013-11-19 10:58:07 -08007955
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307956 status = csrGetRegulatoryDomainForCountry(pMac,
Amar Singhal97a2d992013-11-19 10:58:07 -08007957 pMac->scan.countryCode11d,
7958 (v_REGDOMAIN_t *) &reg_domain_id,
7959 COUNTRY_IE);
7960
Agarwal Ashish04dd7c72014-04-24 14:25:28 +05307961 return eHAL_STATUS_FAILURE;
7962 }
Amar Singhal97a2d992013-11-19 10:58:07 -08007963 }
Abhishek Singh2ec36ab2014-08-07 16:14:25 +05307964 pMac->roam.configParam.fEnforceCountryCode = eANI_BOOLEAN_FALSE;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007965 /* if Supplicant country code has priority, disable 11d */
Kiet Lam6c583332013-10-14 05:37:09 +05307966 if (!is11dCountry && pMac->roam.configParam.fSupplicantCountryCodeHasPriority)
Amar Singhal0d15bd52013-10-12 23:13:13 -07007967 {
7968 pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
Agarwal Ashishcd9b8e62014-07-21 19:48:24 +05307969 smsLog( pMac, LOG1, FL(" 11d is being disabled"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07007970 }
7971
Kiet Lamf2f201e2013-11-16 21:24:16 +05307972 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Amar Singhal0d15bd52013-10-12 23:13:13 -07007973 WNI_CFG_COUNTRY_CODE_LEN);
7974
Sachin Ahujacb64fc82015-01-12 17:01:05 +05307975 status = csrSetRegulatoryDomain(pMac, reg_domain_id, NULL);
7976 if (status != eHAL_STATUS_SUCCESS)
7977 {
7978 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
7979 }
Abhishek Singha306a442013-11-07 18:39:01 +05307980 status = WDA_SetRegDomain(pMac, reg_domain_id, eSIR_TRUE);
Amar Singhal0d15bd52013-10-12 23:13:13 -07007981
Kiet Lam6c583332013-10-14 05:37:09 +05307982 if (VOS_FALSE == is11dCountry )
7983 {
7984 /* overwrite the defualt country code */
Kiet Lamf2f201e2013-11-16 21:24:16 +05307985 vos_mem_copy(pMac->scan.countryCodeDefault,
Kiet Lam6c583332013-10-14 05:37:09 +05307986 pMac->scan.countryCodeCurrent, WNI_CFG_COUNTRY_CODE_LEN);
7987 /* set to default domain ID */
7988 pMac->scan.domainIdDefault = pMac->scan.domainIdCurrent;
7989 }
7990
Amar Singhal0d15bd52013-10-12 23:13:13 -07007991 if ( status != eHAL_STATUS_SUCCESS )
7992 {
7993 smsLog( pMac, LOGE, FL(" fail to set regId %d"), reg_domain_id );
Kiet Lam6c583332013-10-14 05:37:09 +05307994 return status;
Amar Singhal0d15bd52013-10-12 23:13:13 -07007995 }
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07007996 else
7997 {
7998 //if 11d has priority, clear currentCountryBssid & countryCode11d to get
7999 //set again if we find AP with 11d info during scan
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008000 if((!pMac->roam.configParam.fSupplicantCountryCodeHasPriority) &&
8001 (VOS_FALSE == is11dCountry ))
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008002 {
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008003 smsLog( pMac, LOGW, FL("Clearing currentCountryBssid, countryCode11d"));
Tushnim Bhattacharyyac3022ef2013-10-24 15:58:56 -07008004 vos_mem_zero(&pMac->scan.currentCountryBssid, sizeof(tCsrBssid));
8005 vos_mem_zero( pMac->scan.countryCode11d, sizeof( pMac->scan.countryCode11d ) );
8006 }
8007 }
Amar Singhal0d15bd52013-10-12 23:13:13 -07008008
Amar Singhal0d15bd52013-10-12 23:13:13 -07008009 /* get the channels based on new cc */
8010 status = csrInitGetChannels(pMac);
8011
8012 if ( status != eHAL_STATUS_SUCCESS )
8013 {
8014 smsLog( pMac, LOGE, FL(" fail to get Channels "));
8015 return status;
8016 }
8017
8018 /* reset info based on new cc, and we are done */
8019 csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
Kiet Lam6c583332013-10-14 05:37:09 +05308020 if (VOS_TRUE == is11dCountry)
8021 {
Kiet Lam6c583332013-10-14 05:37:09 +05308022 pMac->scan.f11dInfoApplied = eANI_BOOLEAN_TRUE;
8023 pMac->scan.f11dInfoReset = eANI_BOOLEAN_FALSE;
8024 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308025 /* Country code Changed, Purge Only scan result
8026 * which does not have channel number belong to 11d
8027 * channel list
8028 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308029 csrScanFilterResults(pMac);
Kiet Lambd5cd9b2013-11-11 19:01:45 +05308030 // Do active scans after the country is set by User hints or Country IE
8031 pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
Sushant Kaushik1d732562014-05-21 14:15:37 +05308032 sme_DisconnectConnectedSessions(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008033 smsLog(pMac, LOG1, FL(" returned"));
8034 return eHAL_STATUS_SUCCESS;
8035}
8036
8037/* ---------------------------------------------------------------------------
8038
Kiet Lamcffc5862013-10-30 16:28:45 +05308039 \fn sme_HandleChangeCountryCodeByCore
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008040
8041 \brief Update Country code in the driver if set by kernel as world
8042
8043 If 11D is enabled, we update the country code after every scan & notify kernel.
8044 This is to make sure kernel & driver are in sync in case of CC found in
8045 driver but not in kernel database
8046
8047 \param pMac - The handle returned by macOpen.
8048 \param pMsg - Carrying new CC set in kernel
8049
8050 \return eHalStatus
8051
8052 -------------------------------------------------------------------------------*/
Kiet Lamcffc5862013-10-30 16:28:45 +05308053eHalStatus sme_HandleChangeCountryCodeByCore(tpAniSirGlobal pMac, tAniGenericChangeCountryCodeReq *pMsg)
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008054{
Kiet Lamcffc5862013-10-30 16:28:45 +05308055 eHalStatus status;
8056
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008057 smsLog(pMac, LOG1, FL(" called"));
8058
8059 //this is to make sure kernel & driver are in sync in case of CC found in
8060 //driver but not in kernel database
8061 if (('0' == pMsg->countryCode[0]) && ('0' == pMsg->countryCode[1]))
8062 {
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08008063 smsLog( pMac, LOGW, FL("Setting countryCode11d & countryCodeCurrent to world CC"));
Kiet Lamf2f201e2013-11-16 21:24:16 +05308064 vos_mem_copy(pMac->scan.countryCode11d, pMsg->countryCode,
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008065 WNI_CFG_COUNTRY_CODE_LEN);
Kiet Lamf2f201e2013-11-16 21:24:16 +05308066 vos_mem_copy(pMac->scan.countryCodeCurrent, pMsg->countryCode,
Tushnim Bhattacharyya582ac1d2013-11-07 23:44:09 -08008067 WNI_CFG_COUNTRY_CODE_LEN);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008068 }
Kiet Lamcffc5862013-10-30 16:28:45 +05308069
Abhishek Singha306a442013-11-07 18:39:01 +05308070 status = WDA_SetRegDomain(pMac, REGDOMAIN_WORLD, eSIR_TRUE);
Kiet Lamcffc5862013-10-30 16:28:45 +05308071
8072 if ( status != eHAL_STATUS_SUCCESS )
8073 {
8074 smsLog( pMac, LOGE, FL(" fail to set regId") );
8075 return status;
8076 }
8077 else
8078 {
Sachin Ahujacb64fc82015-01-12 17:01:05 +05308079 status = csrSetRegulatoryDomain(pMac, REGDOMAIN_WORLD, NULL);
8080 if (status != eHAL_STATUS_SUCCESS)
8081 {
8082 smsLog( pMac, LOGE, FL("fail to set regId.status : %d"), status);
8083 }
Kiet Lamcffc5862013-10-30 16:28:45 +05308084 status = csrInitGetChannels(pMac);
8085 if ( status != eHAL_STATUS_SUCCESS )
8086 {
8087 smsLog( pMac, LOGE, FL(" fail to get Channels "));
8088 }
8089 else
8090 {
8091 csrInitChannelList(pMac);
8092 }
8093 }
Agarwal Ashishfaef6692014-01-29 19:40:30 +05308094 /* Country code Changed, Purge Only scan result
8095 * which does not have channel number belong to 11d
8096 * channel list
8097 */
Srinivas, Dasari42bf7702014-02-07 11:29:53 +05308098 csrScanFilterResults(pMac);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008099 smsLog(pMac, LOG1, FL(" returned"));
8100 return eHAL_STATUS_SUCCESS;
8101}
8102
8103/* ---------------------------------------------------------------------------
8104
Sushant Kaushik1d732562014-05-21 14:15:37 +05308105 \fn sme_DisconnectConnectedSessions
8106
8107 \brief Disconnect STA and P2P client session if channel is not supported
8108
8109 If new country code does not support the channel on which STA/P2P client
8110 is connetced, it sends the disconnect to the AP/P2P GO
8111
8112 \param pMac - The handle returned by macOpen
8113
8114 \return eHalStatus
8115
8116 -------------------------------------------------------------------------------*/
8117
8118void sme_DisconnectConnectedSessions(tpAniSirGlobal pMac)
8119{
8120 v_U8_t i, sessionId, isChanFound = false;
8121 tANI_U8 currChannel;
8122
8123 for (sessionId=0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
8124 {
8125 if (csrIsSessionClientAndConnected(pMac, sessionId))
8126 {
8127 isChanFound = false;
8128 //Session is connected.Check the channel
8129 currChannel = csrGetInfraOperationChannel(pMac, sessionId);
8130 smsLog(pMac, LOGW, "Current Operating channel : %d, session :%d",
8131 currChannel, sessionId);
8132 for (i=0; i < pMac->scan.base20MHzChannels.numChannels; i++)
8133 {
8134 if (pMac->scan.base20MHzChannels.channelList[i] == currChannel)
8135 {
8136 isChanFound = true;
8137 break;
8138 }
8139 }
8140
8141 if (!isChanFound)
8142 {
8143 for (i=0; i < pMac->scan.base40MHzChannels.numChannels; i++)
8144 {
8145 if (pMac->scan.base40MHzChannels.channelList[i] == currChannel)
8146 {
8147 isChanFound = true;
8148 break;
8149 }
8150 }
8151 }
8152 if (!isChanFound)
8153 {
8154 smsLog(pMac, LOGW, "%s : Disconnect Session :%d", __func__, sessionId);
8155 csrRoamDisconnect(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED);
8156 }
8157 }
8158 }
8159}
8160/* ---------------------------------------------------------------------------
8161
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008162 \fn sme_HandleGenericChangeCountryCode
8163
8164 \brief Change Country code, Reg Domain and channel list
8165
8166 If Supplicant country code is priority than 11d is disabled.
8167 If 11D is enabled, we update the country code after every scan.
8168 Hence when Supplicant country code is priority, we don't need 11D info.
8169 Country code from kernel is set as current country code.
8170
8171 \param pMac - The handle returned by macOpen.
8172 \param pMsgBuf - message buffer
8173
8174 \return eHalStatus
8175
8176 -------------------------------------------------------------------------------*/
8177eHalStatus sme_HandleGenericChangeCountryCode(tpAniSirGlobal pMac, void *pMsgBuf)
8178{
8179 tAniGenericChangeCountryCodeReq *pMsg;
8180 v_REGDOMAIN_t reg_domain_id;
8181
8182 smsLog(pMac, LOG1, FL(" called"));
8183 pMsg = (tAniGenericChangeCountryCodeReq *)pMsgBuf;
8184 reg_domain_id = (v_REGDOMAIN_t)pMsg->domain_index;
8185
8186 if (REGDOMAIN_COUNT == reg_domain_id)
8187 {
Kiet Lamcffc5862013-10-30 16:28:45 +05308188 sme_HandleChangeCountryCodeByCore(pMac, pMsg);
Tushnim Bhattacharyyac3c1e8e2013-10-29 17:27:43 -07008189 }
8190 else
8191 {
8192 sme_HandleChangeCountryCodeByUser(pMac, pMsg);
8193 }
8194 smsLog(pMac, LOG1, FL(" returned"));
Amar Singhal0d15bd52013-10-12 23:13:13 -07008195 return eHAL_STATUS_SUCCESS;
8196}
8197
Jeff Johnson295189b2012-06-20 16:38:30 -07008198#ifdef WLAN_FEATURE_PACKET_FILTERING
Amar Singhalf3a6e762013-02-19 15:06:50 -08008199eHalStatus sme_8023MulticastList (tHalHandle hHal, tANI_U8 sessionId, tpSirRcvFltMcAddrList pMulticastAddrs)
Jeff Johnson295189b2012-06-20 16:38:30 -07008200{
8201 tpSirRcvFltMcAddrList pRequestBuf;
8202 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008203 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
Jeff Johnsone7245742012-09-05 17:12:55 -07008204 tCsrRoamSession *pSession = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07008205
8206 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: "
Gopichand Nakkala66c0bd02013-04-10 11:36:29 +05308207 "ulMulticastAddrCnt=%d, multicastAddr[0]=%p", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008208 pMulticastAddrs->ulMulticastAddrCnt,
8209 pMulticastAddrs->multicastAddr[0]);
Jeff Johnsone7245742012-09-05 17:12:55 -07008210
8211 /*
8212 *Find the connected Infra / P2P_client connected session
Amar Singhalf3a6e762013-02-19 15:06:50 -08008213 */
8214 if (CSR_IS_SESSION_VALID(pMac, sessionId) &&
8215 csrIsConnStateInfra(pMac, sessionId))
8216 {
8217 pSession = CSR_GET_SESSION( pMac, sessionId );
8218 }
Jeff Johnsone7245742012-09-05 17:12:55 -07008219
8220 if(pSession == NULL )
8221 {
8222 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Unable to find "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008223 "the right session", __func__);
Jeff Johnsone7245742012-09-05 17:12:55 -07008224 return eHAL_STATUS_FAILURE;
8225 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08008226
Jeff Johnson295189b2012-06-20 16:38:30 -07008227 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltMcAddrList));
8228 if (NULL == pRequestBuf)
8229 {
8230 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008231 "allocate memory for 8023 Multicast List request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008232 return eHAL_STATUS_FAILED_ALLOC;
8233 }
Amar Singhalf3a6e762013-02-19 15:06:50 -08008234
8235 if( !csrIsConnStateConnectedInfra (pMac, sessionId ))
8236 {
8237 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Ignoring the "
8238 "indication as we are not connected", __func__);
8239 vos_mem_free(pRequestBuf);
8240 return eHAL_STATUS_FAILURE;
8241 }
8242
Jeff Johnson295189b2012-06-20 16:38:30 -07008243 vos_mem_copy(pRequestBuf, pMulticastAddrs, sizeof(tSirRcvFltMcAddrList));
8244
Kiet Lam64c1b492013-07-12 13:56:44 +05308245 vos_mem_copy(pRequestBuf->selfMacAddr, pSession->selfMacAddr,
8246 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008247 vos_mem_copy(pRequestBuf->bssId, pSession->connectedProfile.bssid,
8248 sizeof(tSirMacAddr));
8249
Jeff Johnson295189b2012-06-20 16:38:30 -07008250 msg.type = WDA_8023_MULTICAST_LIST_REQ;
8251 msg.reserved = 0;
8252 msg.bodyptr = pRequestBuf;
8253 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8254 {
8255 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008256 "post WDA_8023_MULTICAST_LIST message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008257 vos_mem_free(pRequestBuf);
8258 return eHAL_STATUS_FAILURE;
8259 }
8260
8261 return eHAL_STATUS_SUCCESS;
8262}
8263
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008264eHalStatus sme_ReceiveFilterSetFilter(tHalHandle hHal, tpSirRcvPktFilterCfgType pRcvPktFilterCfg,
Jeff Johnsone7245742012-09-05 17:12:55 -07008265 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008266{
8267 tpSirRcvPktFilterCfgType pRequestBuf;
8268 v_SINT_t allocSize;
8269 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008270 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8271 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07008272 v_U8_t idx=0;
8273
8274 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterType=%d, "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008275 "filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008276 pRcvPktFilterCfg->filterType, pRcvPktFilterCfg->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008277
Madan Mohan Koyyalamudid4029622012-10-18 20:30:17 -07008278 allocSize = sizeof(tSirRcvPktFilterCfgType);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008279
Jeff Johnson295189b2012-06-20 16:38:30 -07008280 pRequestBuf = vos_mem_malloc(allocSize);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008281
8282 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008283 {
8284 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008285 "allocate memory for Receive Filter Set Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008286 return eHAL_STATUS_FAILED_ALLOC;
8287 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008288
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008289 if( NULL == pSession )
8290 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008291 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Session Not found ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008292 vos_mem_free(pRequestBuf);
8293 return eHAL_STATUS_FAILURE;
8294 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008295
Kiet Lam64c1b492013-07-12 13:56:44 +05308296 vos_mem_copy(pRcvPktFilterCfg->selfMacAddr, pSession->selfMacAddr,
8297 sizeof(tSirMacAddr));
8298 vos_mem_copy(pRcvPktFilterCfg->bssId, pSession->connectedProfile.bssid,
8299 sizeof(tSirMacAddr));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008300 vos_mem_copy(pRequestBuf, pRcvPktFilterCfg, allocSize);
8301
Jeff Johnson295189b2012-06-20 16:38:30 -07008302 msg.type = WDA_RECEIVE_FILTER_SET_FILTER_REQ;
8303 msg.reserved = 0;
8304 msg.bodyptr = pRequestBuf;
8305
8306 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008307 "FT %d FID %d ",
8308 pRequestBuf->filterType, pRequestBuf->filterId);
Jeff Johnson295189b2012-06-20 16:38:30 -07008309
8310 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "Pkt Flt Req : "
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008311 "params %d CT %d",
8312 pRequestBuf->numFieldParams, pRequestBuf->coalesceTime);
Jeff Johnson295189b2012-06-20 16:38:30 -07008313
8314 for (idx=0; idx<pRequestBuf->numFieldParams; idx++)
8315 {
8316
8317 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008318 "Proto %d Comp Flag %d ",
Jeff Johnson295189b2012-06-20 16:38:30 -07008319 pRequestBuf->paramsData[idx].protocolLayer,
8320 pRequestBuf->paramsData[idx].cmpFlag);
8321
8322 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008323 "Data Offset %d Data Len %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008324 pRequestBuf->paramsData[idx].dataOffset,
8325 pRequestBuf->paramsData[idx].dataLength);
8326
8327 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008328 "CData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008329 pRequestBuf->paramsData[idx].compareData[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008330 pRequestBuf->paramsData[idx].compareData[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008331 pRequestBuf->paramsData[idx].compareData[2],
8332 pRequestBuf->paramsData[idx].compareData[3],
8333 pRequestBuf->paramsData[idx].compareData[4],
8334 pRequestBuf->paramsData[idx].compareData[5]);
8335
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008336 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008337 "MData: %d:%d:%d:%d:%d:%d",
Jeff Johnson295189b2012-06-20 16:38:30 -07008338 pRequestBuf->paramsData[idx].dataMask[0],
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008339 pRequestBuf->paramsData[idx].dataMask[1],
Jeff Johnson295189b2012-06-20 16:38:30 -07008340 pRequestBuf->paramsData[idx].dataMask[2],
8341 pRequestBuf->paramsData[idx].dataMask[3],
8342 pRequestBuf->paramsData[idx].dataMask[4],
8343 pRequestBuf->paramsData[idx].dataMask[5]);
8344
8345 }
8346
8347 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8348 {
8349 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008350 "WDA_RECEIVE_FILTER_SET_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008351 vos_mem_free(pRequestBuf);
8352 return eHAL_STATUS_FAILURE;
8353 }
8354
8355 return eHAL_STATUS_SUCCESS;
8356}
8357
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008358eHalStatus sme_GetFilterMatchCount(tHalHandle hHal,
Jeff Johnson295189b2012-06-20 16:38:30 -07008359 FilterMatchCountCallback callbackRoutine,
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008360 void *callbackContext,
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008361 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008362{
8363 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8364 eHalStatus status;
8365
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008366 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "+%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008367
8368 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme)))
8369 {
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008370 pmcGetFilterMatchCount(hHal, callbackRoutine, callbackContext, sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07008371 sme_ReleaseGlobalLock( &pMac->sme );
8372 }
8373
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008374 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "-%s", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008375
8376 return (status);
8377}
8378
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008379eHalStatus sme_ReceiveFilterClearFilter(tHalHandle hHal, tpSirRcvFltPktClearParam pRcvFltPktClearParam,
Jeff Johnsone7245742012-09-05 17:12:55 -07008380 tANI_U8 sessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07008381{
8382 tpSirRcvFltPktClearParam pRequestBuf;
8383 vos_msg_t msg;
Jeff Johnsone7245742012-09-05 17:12:55 -07008384 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8385 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson295189b2012-06-20 16:38:30 -07008386
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008387 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: filterId = %d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -07008388 pRcvFltPktClearParam->filterId);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008389
Jeff Johnson295189b2012-06-20 16:38:30 -07008390 pRequestBuf = vos_mem_malloc(sizeof(tSirRcvFltPktClearParam));
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008391 if (NULL == pRequestBuf)
Jeff Johnson295189b2012-06-20 16:38:30 -07008392 {
8393 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8394 "%s: Not able to allocate memory for Receive Filter "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008395 "Clear Filter request", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008396 return eHAL_STATUS_FAILED_ALLOC;
8397 }
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008398 if( NULL == pSession )
8399 {
8400 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008401 "%s: Session Not find ", __func__);
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008402 vos_mem_free(pRequestBuf);
8403 return eHAL_STATUS_FAILURE;
8404 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008405
Kiet Lam64c1b492013-07-12 13:56:44 +05308406 vos_mem_copy(pRcvFltPktClearParam->selfMacAddr, pSession->selfMacAddr,
8407 sizeof(tSirMacAddr));
8408 vos_mem_copy(pRcvFltPktClearParam->bssId, pSession->connectedProfile.bssid,
8409 sizeof(tSirMacAddr));
Jeff Johnsone7245742012-09-05 17:12:55 -07008410
Madan Mohan Koyyalamudi96dd30d2012-10-05 17:24:51 -07008411 vos_mem_copy(pRequestBuf, pRcvFltPktClearParam, sizeof(tSirRcvFltPktClearParam));
8412
Jeff Johnson295189b2012-06-20 16:38:30 -07008413 msg.type = WDA_RECEIVE_FILTER_CLEAR_FILTER_REQ;
8414 msg.reserved = 0;
8415 msg.bodyptr = pRequestBuf;
8416 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8417 {
8418 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: Not able to post "
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008419 "WDA_RECEIVE_FILTER_CLEAR_FILTER message to WDA", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008420 vos_mem_free(pRequestBuf);
8421 return eHAL_STATUS_FAILURE;
8422 }
8423
8424 return eHAL_STATUS_SUCCESS;
8425}
8426#endif // WLAN_FEATURE_PACKET_FILTERING
8427
8428/* ---------------------------------------------------------------------------
8429 \fn sme_PreChannelSwitchIndFullPowerCB
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008430 \brief call back function for the PMC full power request because of pre
Jeff Johnson295189b2012-06-20 16:38:30 -07008431 channel switch.
8432 \param callbackContext
8433 \param status
8434 ---------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008435void sme_PreChannelSwitchIndFullPowerCB(void *callbackContext,
Jeff Johnson295189b2012-06-20 16:38:30 -07008436 eHalStatus status)
8437{
8438 tpAniSirGlobal pMac = (tpAniSirGlobal)callbackContext;
8439 tSirMbMsg *pMsg;
8440 tANI_U16 msgLen;
8441
8442 msgLen = (tANI_U16)(sizeof( tSirMbMsg ));
Kiet Lam64c1b492013-07-12 13:56:44 +05308443 pMsg = vos_mem_malloc(msgLen);
8444 if ( NULL != pMsg )
Jeff Johnson295189b2012-06-20 16:38:30 -07008445 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308446 vos_mem_set(pMsg, msgLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008447 pMsg->type = pal_cpu_to_be16((tANI_U16)eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER);
8448 pMsg->msgLen = pal_cpu_to_be16(msgLen);
8449 status = palSendMBMessage(pMac->hHdd, pMsg);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008450 }
Jeff Johnson295189b2012-06-20 16:38:30 -07008451
8452 return;
8453}
8454
8455/* ---------------------------------------------------------------------------
8456 \fn sme_HandlePreChannelSwitchInd
8457 \brief Processes the indcation from PE for pre-channel switch.
8458 \param hHal
8459 \- The handle returned by macOpen. return eHalStatus
8460 ---------------------------------------------------------------------------*/
8461eHalStatus sme_HandlePreChannelSwitchInd(tHalHandle hHal)
8462{
8463 eHalStatus status = eHAL_STATUS_FAILURE;
8464 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8465 status = sme_AcquireGlobalLock( &pMac->sme );
8466 if ( HAL_STATUS_SUCCESS( status ) )
8467 {
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008468 status = pmcRequestFullPower(hHal, sme_PreChannelSwitchIndFullPowerCB,
8469 pMac, eSME_FULL_PWR_NEEDED_BY_CHANNEL_SWITCH);
Jeff Johnson295189b2012-06-20 16:38:30 -07008470 sme_ReleaseGlobalLock( &pMac->sme );
8471 }
8472
8473 return (status);
8474}
8475
8476/* ---------------------------------------------------------------------------
8477 \fn sme_HandlePostChannelSwitchInd
8478 \brief Processes the indcation from PE for post-channel switch.
8479 \param hHal
8480 \- The handle returned by macOpen. return eHalStatus
8481 ---------------------------------------------------------------------------*/
8482eHalStatus sme_HandlePostChannelSwitchInd(tHalHandle hHal)
8483{
8484 eHalStatus status = eHAL_STATUS_FAILURE;
8485 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8486
8487 status = sme_AcquireGlobalLock( &pMac->sme );
8488 if ( HAL_STATUS_SUCCESS( status ) )
8489 {
8490 status = pmcRequestBmps(hHal, NULL, NULL);
8491 sme_ReleaseGlobalLock( &pMac->sme );
8492 }
8493
8494 return (status);
8495}
8496
8497/* ---------------------------------------------------------------------------
8498
8499 \fn sme_IsChannelValid
8500
8501 \brief To check if the channel is valid for currently established domain
8502 This is a synchronous API.
8503
8504 \param hHal - The handle returned by macOpen.
8505 \param channel - channel to verify
8506
8507 \return TRUE/FALSE, TRUE if channel is valid
8508
8509 -------------------------------------------------------------------------------*/
8510tANI_BOOLEAN sme_IsChannelValid(tHalHandle hHal, tANI_U8 channel)
8511{
8512 eHalStatus status = eHAL_STATUS_FAILURE;
8513 tANI_BOOLEAN valid = FALSE;
8514 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008515
Jeff Johnson295189b2012-06-20 16:38:30 -07008516 status = sme_AcquireGlobalLock( &pMac->sme );
8517 if ( HAL_STATUS_SUCCESS( status ) )
8518 {
8519
8520 valid = csrRoamIsChannelValid( pMac, channel);
8521
8522 sme_ReleaseGlobalLock( &pMac->sme );
8523 }
8524
8525 return (valid);
8526}
8527
8528/* ---------------------------------------------------------------------------
8529 \fn sme_SetFreqBand
8530 \brief Used to set frequency band.
8531 \param hHal
8532 \eBand band value to be configured
8533 \- return eHalStatus
8534 -------------------------------------------------------------------------*/
8535eHalStatus sme_SetFreqBand(tHalHandle hHal, eCsrBand eBand)
8536{
8537 eHalStatus status = eHAL_STATUS_FAILURE;
8538 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8539
8540 status = sme_AcquireGlobalLock( &pMac->sme );
8541 if ( HAL_STATUS_SUCCESS( status ) )
8542 {
8543 status = csrSetBand(hHal, eBand);
8544 sme_ReleaseGlobalLock( &pMac->sme );
8545 }
8546 return status;
8547}
8548
8549/* ---------------------------------------------------------------------------
8550 \fn sme_GetFreqBand
8551 \brief Used to get the current band settings.
8552 \param hHal
8553 \pBand pointer to hold band value
8554 \- return eHalStatus
8555 -------------------------------------------------------------------------*/
8556eHalStatus sme_GetFreqBand(tHalHandle hHal, eCsrBand *pBand)
8557{
8558 eHalStatus status = eHAL_STATUS_FAILURE;
8559 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8560
8561 status = sme_AcquireGlobalLock( &pMac->sme );
8562 if ( HAL_STATUS_SUCCESS( status ) )
8563 {
8564 *pBand = csrGetCurrentBand( hHal );
8565 sme_ReleaseGlobalLock( &pMac->sme );
8566 }
8567 return status;
8568}
8569
8570#ifdef WLAN_WAKEUP_EVENTS
8571/******************************************************************************
8572 \fn sme_WakeReasonIndCallback
8573
8574 \brief
8575 a callback function called when SME received eWNI_SME_WAKE_REASON_IND event from WDA
8576
8577 \param hHal - HAL handle for device
8578 \param pMsg - Message body passed from WDA; includes Wake Reason Indication parameter
8579
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008580 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008581******************************************************************************/
8582eHalStatus sme_WakeReasonIndCallback (tHalHandle hHal, void* pMsg)
8583{
8584 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8585 eHalStatus status = eHAL_STATUS_SUCCESS;
8586 tSirWakeReasonInd *pWakeReasonInd = (tSirWakeReasonInd *)pMsg;
8587
8588 if (NULL == pMsg)
8589 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008590 smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008591 status = eHAL_STATUS_FAILURE;
8592 }
8593 else
8594 {
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08008595 smsLog(pMac, LOG2, "SME: entering sme_WakeReasonIndCallback");
Jeff Johnson295189b2012-06-20 16:38:30 -07008596
8597 /* Call Wake Reason Indication callback routine. */
8598 if (pMac->pmc.wakeReasonIndCB != NULL)
8599 pMac->pmc.wakeReasonIndCB(pMac->pmc.wakeReasonIndCBContext, pWakeReasonInd);
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008600
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008601 smsLog(pMac, LOG1, "Wake Reason Indication in %s(), reason=%d", __func__, pWakeReasonInd->ulReason);
Jeff Johnson295189b2012-06-20 16:38:30 -07008602 }
8603
8604 return(status);
8605}
8606#endif // WLAN_WAKEUP_EVENTS
8607
8608
8609/* ---------------------------------------------------------------------------
8610
8611 \fn sme_SetMaxTxPower
8612
8613 \brief Set the Maximum Transmit Power dynamically. Note: this setting will
8614 not persist over reboots.
8615
8616 \param hHal
8617 \param pBssid BSSID to set the power cap for
8618 \param pBssid pSelfMacAddress self MAC Address
8619 \param pBssid power to set in dB
8620 \- return eHalStatus
8621
8622 -------------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008623eHalStatus sme_SetMaxTxPower(tHalHandle hHal, tSirMacAddr pBssid,
Jeff Johnson295189b2012-06-20 16:38:30 -07008624 tSirMacAddr pSelfMacAddress, v_S7_t dB)
8625{
8626 vos_msg_t msg;
8627 tpMaxTxPowerParams pMaxTxParams = NULL;
Katya Nigambcb705f2013-12-26 14:26:22 +05308628 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008629 TRACE_CODE_SME_RX_HDD_SET_MAXTXPOW, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008630 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
8631 if (NULL == pMaxTxParams)
8632 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008633 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 -07008634 return eHAL_STATUS_FAILURE;
8635 }
8636
8637 vos_mem_copy(pMaxTxParams->bssId, pBssid, SIR_MAC_ADDR_LENGTH);
Kiet Lam64c1b492013-07-12 13:56:44 +05308638 vos_mem_copy(pMaxTxParams->selfStaMacAddr, pSelfMacAddress,
Jeff Johnson295189b2012-06-20 16:38:30 -07008639 SIR_MAC_ADDR_LENGTH);
8640 pMaxTxParams->power = dB;
8641
8642 msg.type = WDA_SET_MAX_TX_POWER_REQ;
8643 msg.reserved = 0;
8644 msg.bodyptr = pMaxTxParams;
8645
8646 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8647 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008648 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 -07008649 vos_mem_free(pMaxTxParams);
8650 return eHAL_STATUS_FAILURE;
8651 }
8652
8653 return eHAL_STATUS_SUCCESS;
8654}
8655
Jeff Johnson295189b2012-06-20 16:38:30 -07008656/* ---------------------------------------------------------------------------
8657
Arif Hussaina5ebce02013-08-09 15:09:58 -07008658 \fn sme_SetMaxTxPowerPerBand
8659
8660 \brief Set the Maximum Transmit Power specific to band dynamically.
8661 Note: this setting will not persist over reboots.
8662
8663 \param band
8664 \param power to set in dB
8665 \- return eHalStatus
8666
8667 ----------------------------------------------------------------------------*/
8668eHalStatus sme_SetMaxTxPowerPerBand(eCsrBand band, v_S7_t dB)
8669{
8670 vos_msg_t msg;
8671 tpMaxTxPowerPerBandParams pMaxTxPowerPerBandParams = NULL;
8672
8673 pMaxTxPowerPerBandParams = vos_mem_malloc(sizeof(tMaxTxPowerPerBandParams));
8674 if (NULL == pMaxTxPowerPerBandParams)
8675 {
8676 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8677 "%s:Not able to allocate memory for pMaxTxPowerPerBandParams",
8678 __func__);
8679 return eHAL_STATUS_FAILURE;
8680 }
8681
8682 pMaxTxPowerPerBandParams->power = dB;
8683 pMaxTxPowerPerBandParams->bandInfo = band;
8684
8685 msg.type = WDA_SET_MAX_TX_POWER_PER_BAND_REQ;
8686 msg.reserved = 0;
8687 msg.bodyptr = pMaxTxPowerPerBandParams;
8688
8689 if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
8690 {
8691 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8692 "%s:Not able to post WDA_SET_MAX_TX_POWER_PER_BAND_REQ",
8693 __func__);
8694 vos_mem_free(pMaxTxPowerPerBandParams);
8695 return eHAL_STATUS_FAILURE;
8696 }
8697
8698 return eHAL_STATUS_SUCCESS;
8699}
8700
8701/* ---------------------------------------------------------------------------
8702
schang86c22c42013-03-13 18:41:24 -07008703 \fn sme_SetTxPower
8704
8705 \brief Set Transmit Power dynamically. Note: this setting will
8706 not persist over reboots.
8707
8708 \param hHal
8709 \param sessionId Target Session ID
8710 \param mW power to set in mW
8711 \- return eHalStatus
8712
8713 -------------------------------------------------------------------------------*/
8714eHalStatus sme_SetTxPower(tHalHandle hHal, v_U8_t sessionId, v_U8_t mW)
8715{
8716
8717 eHalStatus status = eHAL_STATUS_FAILURE;
8718 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8719
Katya Nigambcb705f2013-12-26 14:26:22 +05308720 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008721 TRACE_CODE_SME_RX_HDD_SET_TXPOW, NO_SESSION, 0));
schang86c22c42013-03-13 18:41:24 -07008722 smsLog(pMac, LOG1, FL("set tx power %dmW"), mW);
8723 status = sme_AcquireGlobalLock(&pMac->sme);
8724 if (HAL_STATUS_SUCCESS(status))
8725 {
8726 status = csrSetTxPower(pMac, sessionId, mW);
8727 sme_ReleaseGlobalLock(&pMac->sme);
8728 }
8729 return status;
8730}
8731
8732/* ---------------------------------------------------------------------------
8733
Jeff Johnson295189b2012-06-20 16:38:30 -07008734 \fn sme_HideSSID
8735
8736 \brief hide/show SSID dynamically. Note: this setting will
8737 not persist over reboots.
8738
8739 \param hHal
8740 \param sessionId
8741 \param ssidHidden 0 - Broadcast SSID, 1 - Disable broadcast SSID
8742 \- return eHalStatus
8743
8744 -------------------------------------------------------------------------------*/
8745eHalStatus sme_HideSSID(tHalHandle hHal, v_U8_t sessionId, v_U8_t ssidHidden)
8746{
8747 eHalStatus status = eHAL_STATUS_SUCCESS;
8748 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8749 tANI_U16 len;
8750
8751 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8752 {
8753 tpSirUpdateParams pMsg;
8754 tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008755
8756 if(!pSession)
8757 {
8758 smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008759 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson32d95a32012-09-10 13:15:23 -07008760 return eHAL_STATUS_FAILURE;
8761 }
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008762
8763 if( !pSession->sessionActive )
Jeff Johnson295189b2012-06-20 16:38:30 -07008764 VOS_ASSERT(0);
8765
8766 /* Create the message and send to lim */
8767 len = sizeof(tSirUpdateParams);
Kiet Lam64c1b492013-07-12 13:56:44 +05308768 pMsg = vos_mem_malloc(len);
8769 if ( NULL == pMsg )
8770 status = eHAL_STATUS_FAILURE;
8771 else
Jeff Johnson295189b2012-06-20 16:38:30 -07008772 {
Kiet Lam64c1b492013-07-12 13:56:44 +05308773 vos_mem_set(pMsg, sizeof(tSirUpdateParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07008774 pMsg->messageType = eWNI_SME_HIDE_SSID_REQ;
8775 pMsg->length = len;
8776 /* Data starts from here */
8777 pMsg->sessionId = sessionId;
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008778 pMsg->ssidHidden = ssidHidden;
Jeff Johnson295189b2012-06-20 16:38:30 -07008779 status = palSendMBMessage(pMac->hHdd, pMsg);
8780 }
8781 sme_ReleaseGlobalLock( &pMac->sme );
8782 }
8783 return status;
8784}
Jeff Johnson295189b2012-06-20 16:38:30 -07008785
8786/* ---------------------------------------------------------------------------
8787
8788 \fn sme_SetTmLevel
8789 \brief Set Thermal Mitigation Level to RIVA
8790 \param hHal - The handle returned by macOpen.
8791 \param newTMLevel - new Thermal Mitigation Level
8792 \param tmMode - Thermal Mitigation handle mode, default 0
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07008793 \return eHalStatus
Jeff Johnson295189b2012-06-20 16:38:30 -07008794 ---------------------------------------------------------------------------*/
8795eHalStatus sme_SetTmLevel(tHalHandle hHal, v_U16_t newTMLevel, v_U16_t tmMode)
8796{
8797 eHalStatus status = eHAL_STATUS_SUCCESS;
8798 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
8799 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8800 vos_msg_t vosMessage;
8801 tAniSetTmLevelReq *setTmLevelReq = NULL;
8802
Katya Nigambcb705f2013-12-26 14:26:22 +05308803 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008804 TRACE_CODE_SME_RX_HDD_SET_TMLEVEL, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008805 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme ) ) )
8806 {
8807 setTmLevelReq = (tAniSetTmLevelReq *)vos_mem_malloc(sizeof(tAniSetTmLevelReq));
Kiet Lam64c1b492013-07-12 13:56:44 +05308808 if (NULL == setTmLevelReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07008809 {
8810 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008811 "%s: Not able to allocate memory for sme_SetTmLevel", __func__);
Leela Venkata Kiran Kumar Reddy Chirala090cc1f2013-03-07 17:40:17 -08008812 sme_ReleaseGlobalLock( &pMac->sme );
Jeff Johnson295189b2012-06-20 16:38:30 -07008813 return eHAL_STATUS_FAILURE;
8814 }
8815
8816 setTmLevelReq->tmMode = tmMode;
8817 setTmLevelReq->newTmLevel = newTMLevel;
8818
8819 /* serialize the req through MC thread */
8820 vosMessage.bodyptr = setTmLevelReq;
8821 vosMessage.type = WDA_SET_TM_LEVEL_REQ;
8822 vosStatus = vos_mq_post_message( VOS_MQ_ID_WDA, &vosMessage );
8823 if ( !VOS_IS_STATUS_SUCCESS(vosStatus) )
8824 {
8825 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07008826 "%s: Post Set TM Level MSG fail", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07008827 vos_mem_free(setTmLevelReq);
8828 status = eHAL_STATUS_FAILURE;
8829 }
8830 sme_ReleaseGlobalLock( &pMac->sme );
8831 }
8832 return(status);
8833}
8834
8835/*---------------------------------------------------------------------------
8836
8837 \brief sme_featureCapsExchange() - SME interface to exchange capabilities between
8838 Host and FW.
8839
8840 \param hHal - HAL handle for device
8841
8842 \return NONE
8843
8844---------------------------------------------------------------------------*/
8845void sme_featureCapsExchange( tHalHandle hHal)
8846{
8847 v_CONTEXT_t vosContext = vos_get_global_context(VOS_MODULE_ID_SME, NULL);
Katya Nigambcb705f2013-12-26 14:26:22 +05308848 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008849 TRACE_CODE_SME_RX_HDD_CAPS_EXCH, NO_SESSION, 0));
Jeff Johnson295189b2012-06-20 16:38:30 -07008850 WDA_featureCapsExchange(vosContext);
8851}
Jeff Johnsond13512a2012-07-17 11:42:19 -07008852
Yathish9f22e662012-12-10 14:21:35 -08008853/*---------------------------------------------------------------------------
8854
8855 \brief sme_disableFeatureCapablity() - SME interface to disable Active mode offload capablity
8856 in Host.
8857
8858 \param hHal - HAL handle for device
8859
8860 \return NONE
8861
8862---------------------------------------------------------------------------*/
8863void sme_disableFeatureCapablity(tANI_U8 feature_index)
8864{
8865 WDA_disableCapablityFeature(feature_index);
8866}
8867
Jeff Johnsond13512a2012-07-17 11:42:19 -07008868/* ---------------------------------------------------------------------------
8869
8870 \fn sme_GetDefaultCountryCode
8871
8872 \brief Get the default country code from NV
8873
8874 \param hHal
8875 \param pCountry
8876 \- return eHalStatus
8877
8878 -------------------------------------------------------------------------------*/
8879eHalStatus sme_GetDefaultCountryCodeFrmNv(tHalHandle hHal, tANI_U8 *pCountry)
8880{
8881 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308882 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008883 TRACE_CODE_SME_RX_HDD_GET_DEFCCNV, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008884 return csrGetDefaultCountryCodeFrmNv(pMac, pCountry);
8885}
8886
8887/* ---------------------------------------------------------------------------
8888
8889 \fn sme_GetCurrentCountryCode
8890
8891 \brief Get the current country code
8892
8893 \param hHal
8894 \param pCountry
8895 \- return eHalStatus
8896
8897 -------------------------------------------------------------------------------*/
8898eHalStatus sme_GetCurrentCountryCode(tHalHandle hHal, tANI_U8 *pCountry)
8899{
8900 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05308901 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008902 TRACE_CODE_SME_RX_HDD_GET_CURCC, NO_SESSION, 0));
Jeff Johnsond13512a2012-07-17 11:42:19 -07008903 return csrGetCurrentCountryCode(pMac, pCountry);
8904}
8905
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008906/* ---------------------------------------------------------------------------
8907 \fn sme_transportDebug
8908 \brief Dynamically monitoring Transport channels
8909 Private IOCTL will querry transport channel status if driver loaded
schang6295e542013-03-12 15:31:23 -07008910 \param hHal Upper MAC context
Jeff Johnsonb88db982012-12-10 13:34:59 -08008911 \param displaySnapshot Display transport channel snapshot option
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008912 \param toggleStallDetect Enable stall detect feature
8913 This feature will take effect to data performance
8914 Not integrate till fully verification
8915 \- return NONE
8916 -------------------------------------------------------------------------*/
schang6295e542013-03-12 15:31:23 -07008917void sme_transportDebug(tHalHandle hHal, v_BOOL_t displaySnapshot, v_BOOL_t toggleStallDetect)
Madan Mohan Koyyalamudi8cb53982012-09-28 14:34:47 -07008918{
schang6295e542013-03-12 15:31:23 -07008919 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
8920
8921 if (NULL == pMac)
8922 {
8923 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
8924 "%s: invalid context", __func__);
8925 return;
8926 }
8927 WDA_TransportChannelDebug(pMac, displaySnapshot, toggleStallDetect);
Madan Mohan Koyyalamudi3b230fe2012-10-18 14:46:32 -07008928}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008929
Kiran4a17ebe2013-01-31 10:43:43 -08008930/* ---------------------------------------------------------------------------
8931 \fn sme_ResetPowerValuesFor5G
8932 \brief Reset the power values for 5G band with NV power values.
8933 \param hHal - HAL handle for device
8934 \- return NONE
8935 -------------------------------------------------------------------------*/
8936void sme_ResetPowerValuesFor5G (tHalHandle hHal)
8937{
8938 tpAniSirGlobal pMac = PMAC_STRUCT (hHal);
Katya Nigambcb705f2013-12-26 14:26:22 +05308939 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008940 TRACE_CODE_SME_RX_HDD_RESET_PW5G, NO_SESSION, 0));
Kiran4a17ebe2013-01-31 10:43:43 -08008941 csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
8942 csrApplyPower2Current(pMac); // Store the channel+power info in the global place: Cfg
8943}
8944
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08008945#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008946/* ---------------------------------------------------------------------------
8947 \fn sme_UpdateRoamPrefer5GHz
8948 \brief enable/disable Roam prefer 5G runtime option
8949 This function is called through dynamic setConfig callback function
8950 to configure the Roam prefer 5G runtime option
8951 \param hHal - HAL handle for device
8952 \param nRoamPrefer5GHz Enable/Disable Roam prefer 5G runtime option
8953 \- return Success or failure
8954 -------------------------------------------------------------------------*/
8955
8956eHalStatus sme_UpdateRoamPrefer5GHz(tHalHandle hHal, v_BOOL_t nRoamPrefer5GHz)
8957{
8958 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08008959 eHalStatus status = eHAL_STATUS_SUCCESS;
8960
Katya Nigambcb705f2013-12-26 14:26:22 +05308961 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008962 TRACE_CODE_SME_RX_HDD_UPDATE_RP5G, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08008963 status = sme_AcquireGlobalLock( &pMac->sme );
8964 if ( HAL_STATUS_SUCCESS( status ) )
8965 {
8966 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8967 "%s: gRoamPrefer5GHz is changed from %d to %d", __func__,
8968 pMac->roam.configParam.nRoamPrefer5GHz,
8969 nRoamPrefer5GHz);
8970 pMac->roam.configParam.nRoamPrefer5GHz = nRoamPrefer5GHz;
8971 sme_ReleaseGlobalLock( &pMac->sme );
8972 }
8973
8974 return status ;
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -08008975}
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08008976
8977/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008978 \fn sme_setRoamIntraBand
8979 \brief enable/disable Intra band roaming
8980 This function is called through dynamic setConfig callback function
8981 to configure the intra band roaming
8982 \param hHal - HAL handle for device
8983 \param nRoamIntraBand Enable/Disable Intra band roaming
8984 \- return Success or failure
8985 -------------------------------------------------------------------------*/
8986eHalStatus sme_setRoamIntraBand(tHalHandle hHal, const v_BOOL_t nRoamIntraBand)
8987{
8988 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
8989 eHalStatus status = eHAL_STATUS_SUCCESS;
8990
Katya Nigambcb705f2013-12-26 14:26:22 +05308991 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07008992 TRACE_CODE_SME_RX_HDD_SET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07008993 status = sme_AcquireGlobalLock( &pMac->sme );
8994 if ( HAL_STATUS_SUCCESS( status ) )
8995 {
8996 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
8997 "%s: gRoamIntraBand is changed from %d to %d", __func__,
8998 pMac->roam.configParam.nRoamIntraBand,
8999 nRoamIntraBand);
9000 pMac->roam.configParam.nRoamIntraBand = nRoamIntraBand;
9001 sme_ReleaseGlobalLock( &pMac->sme );
9002 }
9003
9004 return status ;
9005}
9006
9007/* ---------------------------------------------------------------------------
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009008 \fn sme_UpdateRoamScanNProbes
9009 \brief function to update roam scan N probes
9010 This function is called through dynamic setConfig callback function
9011 to update roam scan N probes
9012 \param hHal - HAL handle for device
9013 \param nProbes number of probe requests to be sent out
9014 \- return Success or failure
9015 -------------------------------------------------------------------------*/
9016eHalStatus sme_UpdateRoamScanNProbes(tHalHandle hHal, const v_U8_t nProbes)
9017{
9018 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9019 eHalStatus status = eHAL_STATUS_SUCCESS;
9020
9021 status = sme_AcquireGlobalLock( &pMac->sme );
9022 if ( HAL_STATUS_SUCCESS( status ) )
9023 {
9024 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9025 "%s: gRoamScanNProbes is changed from %d to %d", __func__,
9026 pMac->roam.configParam.nProbes,
9027 nProbes);
9028 pMac->roam.configParam.nProbes = nProbes;
9029 sme_ReleaseGlobalLock( &pMac->sme );
9030 }
9031#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9032 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9033 {
9034 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9035 REASON_NPROBES_CHANGED);
9036 }
9037#endif
9038 return status ;
9039}
9040
9041/* ---------------------------------------------------------------------------
9042 \fn sme_UpdateRoamScanHomeAwayTime
9043 \brief function to update roam scan Home away time
9044 This function is called through dynamic setConfig callback function
9045 to update roam scan home away time
9046 \param hHal - HAL handle for device
9047 \param nRoamScanAwayTime Scan home away time
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009048 \param bSendOffloadCmd If TRUE then send offload command to firmware
9049 If FALSE then command is not sent to firmware
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009050 \- return Success or failure
9051 -------------------------------------------------------------------------*/
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009052eHalStatus sme_UpdateRoamScanHomeAwayTime(tHalHandle hHal, const v_U16_t nRoamScanHomeAwayTime,
9053 const eAniBoolean bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009054{
9055 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9056 eHalStatus status = eHAL_STATUS_SUCCESS;
9057
9058 status = sme_AcquireGlobalLock( &pMac->sme );
9059 if ( HAL_STATUS_SUCCESS( status ) )
9060 {
9061 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9062 "%s: gRoamScanHomeAwayTime is changed from %d to %d", __func__,
9063 pMac->roam.configParam.nRoamScanHomeAwayTime,
9064 nRoamScanHomeAwayTime);
9065 pMac->roam.configParam.nRoamScanHomeAwayTime = nRoamScanHomeAwayTime;
9066 sme_ReleaseGlobalLock( &pMac->sme );
9067 }
9068
9069#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Srinivas Girigowda6cf0b822013-06-27 14:00:20 -07009070 if (pMac->roam.configParam.isRoamOffloadScanEnabled && bSendOffloadCmd)
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009071 {
9072 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9073 REASON_HOME_AWAY_TIME_CHANGED);
9074 }
9075#endif
9076 return status;
9077}
9078
9079
9080/* ---------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009081 \fn sme_getRoamIntraBand
9082 \brief get Intra band roaming
9083 \param hHal - HAL handle for device
9084 \- return Success or failure
9085 -------------------------------------------------------------------------*/
9086v_BOOL_t sme_getRoamIntraBand(tHalHandle hHal)
9087{
9088 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Katya Nigambcb705f2013-12-26 14:26:22 +05309089 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009090 TRACE_CODE_SME_RX_HDD_GET_ROAMIBAND, NO_SESSION, 0));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009091 return pMac->roam.configParam.nRoamIntraBand;
9092}
9093
Varun Reddy Yeturu920df212013-05-22 08:07:23 -07009094/* ---------------------------------------------------------------------------
9095 \fn sme_getRoamScanNProbes
9096 \brief get N Probes
9097 \param hHal - HAL handle for device
9098 \- return Success or failure
9099 -------------------------------------------------------------------------*/
9100v_U8_t sme_getRoamScanNProbes(tHalHandle hHal)
9101{
9102 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9103 return pMac->roam.configParam.nProbes;
9104}
9105
9106/* ---------------------------------------------------------------------------
9107 \fn sme_getRoamScanHomeAwayTime
9108 \brief get Roam scan home away time
9109 \param hHal - HAL handle for device
9110 \- return Success or failure
9111 -------------------------------------------------------------------------*/
9112v_U16_t sme_getRoamScanHomeAwayTime(tHalHandle hHal)
9113{
9114 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9115 return pMac->roam.configParam.nRoamScanHomeAwayTime;
9116}
9117
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009118
9119/* ---------------------------------------------------------------------------
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009120 \fn sme_UpdateImmediateRoamRssiDiff
9121 \brief Update nImmediateRoamRssiDiff
9122 This function is called through dynamic setConfig callback function
9123 to configure nImmediateRoamRssiDiff
9124 Usage: adb shell iwpriv wlan0 setConfig gImmediateRoamRssiDiff=[0 .. 125]
9125 \param hHal - HAL handle for device
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009126 \param nImmediateRoamRssiDiff - minimum rssi difference between potential
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009127 candidate and current AP.
9128 \- return Success or failure
9129 -------------------------------------------------------------------------*/
9130
9131eHalStatus sme_UpdateImmediateRoamRssiDiff(tHalHandle hHal, v_U8_t nImmediateRoamRssiDiff)
9132{
9133 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08009134 eHalStatus status = eHAL_STATUS_SUCCESS;
9135
Katya Nigambcb705f2013-12-26 14:26:22 +05309136 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009137 TRACE_CODE_SME_RX_HDD_UPDATE_IMMRSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009138 status = sme_AcquireGlobalLock( &pMac->sme );
9139 if ( HAL_STATUS_SUCCESS( status ) )
9140 {
9141 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309142 "LFR runtime successfully set immediate roam rssi diff to"
9143 "%d - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009144 nImmediateRoamRssiDiff,
9145 pMac->roam.configParam.nImmediateRoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309146 macTraceGetNeighbourRoamState(
9147 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009148 pMac->roam.configParam.nImmediateRoamRssiDiff = nImmediateRoamRssiDiff;
9149 sme_ReleaseGlobalLock( &pMac->sme );
9150 }
9151
9152 return status ;
9153}
9154
9155/* ---------------------------------------------------------------------------
9156 \fn sme_UpdateRoamRssiDiff
9157 \brief Update RoamRssiDiff
9158 This function is called through dynamic setConfig callback function
9159 to configure RoamRssiDiff
9160 Usage: adb shell iwpriv wlan0 setConfig RoamRssiDiff=[0 .. 125]
9161 \param hHal - HAL handle for device
9162 \param RoamRssiDiff - minimum rssi difference between potential
9163 candidate and current AP.
9164 \- return Success or failure
9165 -------------------------------------------------------------------------*/
9166
9167eHalStatus sme_UpdateRoamRssiDiff(tHalHandle hHal, v_U8_t RoamRssiDiff)
9168{
9169 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9170 eHalStatus status = eHAL_STATUS_SUCCESS;
9171
9172 status = sme_AcquireGlobalLock( &pMac->sme );
Katya Nigambcb705f2013-12-26 14:26:22 +05309173 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009174 TRACE_CODE_SME_RX_HDD_UPDATE_RSSIDIFF, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009175 if ( HAL_STATUS_SUCCESS( status ) )
9176 {
9177 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309178 "LFR runtime successfully set roam rssi diff to %d"
9179 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009180 RoamRssiDiff,
9181 pMac->roam.configParam.RoamRssiDiff,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309182 macTraceGetNeighbourRoamState(
9183 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009184 pMac->roam.configParam.RoamRssiDiff = RoamRssiDiff;
9185 sme_ReleaseGlobalLock( &pMac->sme );
9186 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009187#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9188 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9189 {
9190 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_RSSI_DIFF_CHANGED);
9191 }
9192#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009193 return status ;
Madan Mohan Koyyalamudi62b55b02012-12-03 16:45:39 -08009194}
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009195
9196/*--------------------------------------------------------------------------
9197 \brief sme_UpdateFastTransitionEnabled() - enable/disable Fast Transition support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009198 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009199 isFastTransitionEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009200 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009201 \param hHal - The handle returned by macOpen.
9202 \return eHAL_STATUS_SUCCESS - SME update isFastTransitionEnabled config successfully.
9203 Other status means SME is failed to update isFastTransitionEnabled.
9204 \sa
9205 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009206eHalStatus sme_UpdateFastTransitionEnabled(tHalHandle hHal,
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009207 v_BOOL_t isFastTransitionEnabled)
9208{
9209 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Srinivas Girigowdade697412013-02-14 16:31:48 -08009210 eHalStatus status = eHAL_STATUS_SUCCESS;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009211
Katya Nigambcb705f2013-12-26 14:26:22 +05309212 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009213 TRACE_CODE_SME_RX_HDD_UPDATE_FTENABLED, NO_SESSION, 0));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009214 status = sme_AcquireGlobalLock( &pMac->sme );
9215 if ( HAL_STATUS_SUCCESS( status ) )
9216 {
9217 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9218 "%s: FastTransitionEnabled is changed from %d to %d", __func__,
9219 pMac->roam.configParam.isFastTransitionEnabled,
9220 isFastTransitionEnabled);
9221 pMac->roam.configParam.isFastTransitionEnabled = isFastTransitionEnabled;
9222 sme_ReleaseGlobalLock( &pMac->sme );
9223 }
9224
9225 return status ;
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009226}
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009227
9228/* ---------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009229 \fn sme_UpdateWESMode
9230 \brief Update WES Mode
9231 This function is called through dynamic setConfig callback function
9232 to configure isWESModeEnabled
9233 \param hHal - HAL handle for device
9234 \return eHAL_STATUS_SUCCESS - SME update isWESModeEnabled config successfully.
9235 Other status means SME is failed to update isWESModeEnabled.
9236 -------------------------------------------------------------------------*/
9237
9238eHalStatus sme_UpdateWESMode(tHalHandle hHal, v_BOOL_t isWESModeEnabled)
9239{
9240 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9241 eHalStatus status = eHAL_STATUS_SUCCESS;
9242
9243 status = sme_AcquireGlobalLock( &pMac->sme );
9244 if ( HAL_STATUS_SUCCESS( status ) )
9245 {
9246 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309247 "LFR runtime successfully set WES Mode to %d"
9248 "- old value is %d - roam state is %s",
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009249 isWESModeEnabled,
9250 pMac->roam.configParam.isWESModeEnabled,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309251 macTraceGetNeighbourRoamState(
9252 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -07009253 pMac->roam.configParam.isWESModeEnabled = isWESModeEnabled;
9254 sme_ReleaseGlobalLock( &pMac->sme );
9255 }
9256
9257 return status ;
9258}
9259
9260/* ---------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009261 \fn sme_SetRoamScanControl
9262 \brief Set roam scan control
9263 This function is called to set roam scan control
9264 if roam scan control is set to 0, roaming scan cache is cleared
9265 any value other than 0 is treated as invalid value
9266 \param hHal - HAL handle for device
9267 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9268 Other status means SME failure to update
9269 -------------------------------------------------------------------------*/
9270eHalStatus sme_SetRoamScanControl(tHalHandle hHal, v_BOOL_t roamScanControl)
9271{
9272 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9273 eHalStatus status = eHAL_STATUS_SUCCESS;
9274
Katya Nigambcb705f2013-12-26 14:26:22 +05309275 MTRACE(vos_trace(VOS_MODULE_ID_SME,
Leela Venkata Kiran Kumar Reddy Chirala7367c202013-04-10 22:39:51 -07009276 TRACE_CODE_SME_RX_HDD_SET_SCANCTRL, NO_SESSION, 0));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009277 status = sme_AcquireGlobalLock( &pMac->sme );
9278 if ( HAL_STATUS_SUCCESS( status ) )
9279 {
9280 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309281 "LFR runtime successfully set roam scan control to %d"
9282 " - old value is %d - roam state is %s",
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009283 roamScanControl,
9284 pMac->roam.configParam.nRoamScanControl,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309285 macTraceGetNeighbourRoamState(
9286 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009287 pMac->roam.configParam.nRoamScanControl = roamScanControl;
9288 if ( 0 == roamScanControl)
9289 {
9290 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
9291 "LFR runtime successfully cleared roam scan cache");
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009292 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009293#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9294 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9295 {
9296 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_FLUSH_CHANNEL_LIST);
9297 }
9298#endif
9299 }
9300 sme_ReleaseGlobalLock( &pMac->sme );
9301 }
9302 return status ;
9303}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009304#endif /* (WLAN_FEATURE_VOWIFI_11R) || (FEATURE_WLAN_ESE) || (FEATURE_WLAN_LFR) */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009305
9306#ifdef FEATURE_WLAN_LFR
9307/*--------------------------------------------------------------------------
9308 \brief sme_UpdateIsFastRoamIniFeatureEnabled() - enable/disable LFR support at runtime
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009309 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009310 isFastRoamIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009311 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009312 \param hHal - The handle returned by macOpen.
9313 \return eHAL_STATUS_SUCCESS - SME update isFastRoamIniFeatureEnabled config successfully.
9314 Other status means SME is failed to update isFastRoamIniFeatureEnabled.
9315 \sa
9316 --------------------------------------------------------------------------*/
Kalikinkar Dharaa4988972013-10-28 13:39:54 -07009317eHalStatus sme_UpdateIsFastRoamIniFeatureEnabled(tHalHandle hHal,
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009318 const v_BOOL_t isFastRoamIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009319{
9320 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9321
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009322 if (pMac->roam.configParam.isFastRoamIniFeatureEnabled == isFastRoamIniFeatureEnabled)
9323 {
9324 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9325 "%s: FastRoam is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9326 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9327 isFastRoamIniFeatureEnabled);
9328 return eHAL_STATUS_SUCCESS;
9329 }
9330
Srinivas Girigowdade697412013-02-14 16:31:48 -08009331 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9332 "%s: FastRoamEnabled is changed from %d to %d", __func__,
9333 pMac->roam.configParam.isFastRoamIniFeatureEnabled,
9334 isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009335 pMac->roam.configParam.isFastRoamIniFeatureEnabled = isFastRoamIniFeatureEnabled;
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009336 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009337
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009338 return eHAL_STATUS_SUCCESS;
9339}
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07009340
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08009341/*--------------------------------------------------------------------------
Mukul Sharma2a271632014-10-13 14:59:01 +05309342 \brief sme_ConfigFwrRoaming() - enable/disable LFR support at runtime
9343 When Supplicant issue enabled / disable fwr based roaming on the basis
9344 of the Bssid modification in network block ( e.g. AutoJoin mody N/W block)
9345
9346 This is a synchronous call
9347 \param hHal - The handle returned by macOpen.
9348 \return eHAL_STATUS_SUCCESS - SME (enabled/disabled) offload scan successfully.
9349 Other status means SME is failed to (enabled/disabled) offload scan.
9350 \sa
9351 --------------------------------------------------------------------------*/
9352
9353eHalStatus sme_ConfigFwrRoaming(tHalHandle hHal,
9354 const v_BOOL_t isFastRoamEnabled)
9355{
9356 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9357 if (!pMac->roam.configParam.isFastRoamIniFeatureEnabled)
9358 {
9359 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9360 "%s: FastRoam is disabled through ini", __func__);
9361 return eHAL_STATUS_FAILURE;
9362 }
9363 csrNeighborRoamUpdateFastRoamingEnabled(pMac, isFastRoamEnabled);
9364 return eHAL_STATUS_SUCCESS;
9365}
9366
9367/*--------------------------------------------------------------------------
Sameer Thalappil4ae66ec2013-11-05 14:17:35 -08009368 \brief sme_UpdateIsMAWCIniFeatureEnabled() -
9369 Enable/disable LFR MAWC support at runtime
9370 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9371 isMAWCIniFeatureEnabled.
9372 This is a synchronous call
9373 \param hHal - The handle returned by macOpen.
9374 \return eHAL_STATUS_SUCCESS - SME update MAWCEnabled config successfully.
9375 Other status means SME is failed to update MAWCEnabled.
9376 \sa
9377 --------------------------------------------------------------------------*/
9378eHalStatus sme_UpdateIsMAWCIniFeatureEnabled(tHalHandle hHal,
9379 const v_BOOL_t MAWCEnabled)
9380{
9381 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9382 eHalStatus status = eHAL_STATUS_SUCCESS;
9383
9384 status = sme_AcquireGlobalLock( &pMac->sme );
9385 if ( HAL_STATUS_SUCCESS( status ) )
9386 {
9387 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9388 "%s: MAWCEnabled is changed from %d to %d", __func__,
9389 pMac->roam.configParam.MAWCEnabled,
9390 MAWCEnabled);
9391 pMac->roam.configParam.MAWCEnabled = MAWCEnabled;
9392 sme_ReleaseGlobalLock( &pMac->sme );
9393 }
9394
9395 return status ;
9396
9397}
9398
Srinivas Girigowda830bbd02013-06-13 19:44:16 -07009399#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9400/*--------------------------------------------------------------------------
9401 \brief sme_UpdateEnableFastRoamInConcurrency() - enable/disable LFR if Concurrent session exists
9402 This is a synchronuous call
9403 \param hHal - The handle returned by macOpen.
9404 \return eHAL_STATUS_SUCCESS
9405 Other status means SME is failed
9406 \sa
9407 --------------------------------------------------------------------------*/
9408
9409eHalStatus sme_UpdateEnableFastRoamInConcurrency(tHalHandle hHal,
9410 v_BOOL_t bFastRoamInConIniFeatureEnabled)
9411{
9412
9413 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9414 eHalStatus status = eHAL_STATUS_SUCCESS;
9415
9416 status = sme_AcquireGlobalLock( &pMac->sme );
9417 if ( HAL_STATUS_SUCCESS( status ) )
9418 {
9419 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = bFastRoamInConIniFeatureEnabled;
9420 if (0 == pMac->roam.configParam.isRoamOffloadScanEnabled)
9421 {
9422 pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = 0;
9423 }
9424 sme_ReleaseGlobalLock( &pMac->sme );
9425 }
9426
9427 return status;
9428}
9429#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009430#endif /* FEATURE_WLAN_LFR */
9431
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009432#ifdef FEATURE_WLAN_ESE
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009433/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009434 \brief sme_UpdateIsEseFeatureEnabled() - enable/disable Ese support at runtime
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009435 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009436 isEseIniFeatureEnabled.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009437 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009438 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009439 \return eHAL_STATUS_SUCCESS - SME update isEseIniFeatureEnabled config successfully.
9440 Other status means SME is failed to update isEseIniFeatureEnabled.
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009441 \sa
9442 --------------------------------------------------------------------------*/
9443
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009444eHalStatus sme_UpdateIsEseFeatureEnabled(tHalHandle hHal,
9445 const v_BOOL_t isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009446{
9447 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9448
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009449 if (pMac->roam.configParam.isEseIniFeatureEnabled == isEseIniFeatureEnabled)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009450 {
9451 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009452 "%s: Ese Mode is already enabled or disabled, nothing to do (returning) old(%d) new(%d)", __func__,
9453 pMac->roam.configParam.isEseIniFeatureEnabled,
9454 isEseIniFeatureEnabled);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009455 return eHAL_STATUS_SUCCESS;
9456 }
9457
Srinivas Girigowdade697412013-02-14 16:31:48 -08009458 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009459 "%s: EseEnabled is changed from %d to %d", __func__,
9460 pMac->roam.configParam.isEseIniFeatureEnabled,
9461 isEseIniFeatureEnabled);
9462 pMac->roam.configParam.isEseIniFeatureEnabled = isEseIniFeatureEnabled;
9463 csrNeighborRoamUpdateEseModeEnabled(pMac, isEseIniFeatureEnabled);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009464
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009465 if(TRUE == isEseIniFeatureEnabled)
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009466 {
9467 sme_UpdateFastTransitionEnabled(hHal, TRUE);
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009468 }
Srinivas Girigowdaba173692013-08-07 11:55:38 -07009469
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009470#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9471 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9472 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009473 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_ESE_INI_CFG_CHANGED);
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009474 }
9475#endif
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009476 return eHAL_STATUS_SUCCESS;
9477}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009478#endif /* FEATURE_WLAN_ESE */
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009479
9480/*--------------------------------------------------------------------------
9481 \brief sme_UpdateConfigFwRssiMonitoring() - enable/disable firmware RSSI Monitoring at runtime
9482 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9483 fEnableFwRssiMonitoring.
Srinivas Girigowdade697412013-02-14 16:31:48 -08009484 This is a synchronous call
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009485 \param hHal - The handle returned by macOpen.
9486 \return eHAL_STATUS_SUCCESS - SME update fEnableFwRssiMonitoring. config successfully.
9487 Other status means SME is failed to update fEnableFwRssiMonitoring.
9488 \sa
9489 --------------------------------------------------------------------------*/
9490
9491eHalStatus sme_UpdateConfigFwRssiMonitoring(tHalHandle hHal,
9492 v_BOOL_t fEnableFwRssiMonitoring)
9493{
9494 eHalStatus halStatus = eHAL_STATUS_SUCCESS;
9495
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009496 if (ccmCfgSetInt(hHal, WNI_CFG_PS_ENABLE_RSSI_MONITOR, fEnableFwRssiMonitoring,
9497 NULL, eANI_BOOLEAN_FALSE)==eHAL_STATUS_FAILURE)
9498 {
9499 halStatus = eHAL_STATUS_FAILURE;
9500 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -08009501 "Failure: Could not pass on WNI_CFG_PS_RSSI_MONITOR configuration info to CCM");
Gopichand Nakkala98a98af2012-12-31 14:38:47 -08009502 }
9503
9504 return (halStatus);
9505}
9506
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009507#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
Srinivas Girigowdade697412013-02-14 16:31:48 -08009508/*--------------------------------------------------------------------------
9509 \brief sme_setNeighborLookupRssiThreshold() - update neighbor lookup rssi threshold
9510 This is a synchronous call
9511 \param hHal - The handle returned by macOpen.
9512 \return eHAL_STATUS_SUCCESS - SME update config successful.
9513 Other status means SME is failed to update
9514 \sa
9515 --------------------------------------------------------------------------*/
9516eHalStatus sme_setNeighborLookupRssiThreshold(tHalHandle hHal,
9517 v_U8_t neighborLookupRssiThreshold)
9518{
9519 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9520 eHalStatus status = eHAL_STATUS_SUCCESS;
9521
9522 status = sme_AcquireGlobalLock( &pMac->sme );
9523 if ( HAL_STATUS_SUCCESS( status ) )
9524 {
9525 status = csrNeighborRoamSetLookupRssiThreshold(pMac, neighborLookupRssiThreshold);
9526 if (HAL_STATUS_SUCCESS(status))
9527 {
9528 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309529 "LFR runtime successfully set Lookup threshold to %d"
9530 " - old value is %d - roam state is %s",
9531 neighborLookupRssiThreshold,
9532 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold,
9533 macTraceGetNeighbourRoamState(
9534 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009535 pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold =
9536 neighborLookupRssiThreshold;
9537 }
9538 sme_ReleaseGlobalLock( &pMac->sme );
9539 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009540 return status;
9541}
9542
9543/*--------------------------------------------------------------------------
9544 \brief sme_setNeighborReassocRssiThreshold() - update neighbor reassoc rssi threshold
9545 This is a synchronous call
9546 \param hHal - The handle returned by macOpen.
9547 \return eHAL_STATUS_SUCCESS - SME update config successful.
9548 Other status means SME is failed to update
9549 \sa
9550 --------------------------------------------------------------------------*/
9551eHalStatus sme_setNeighborReassocRssiThreshold(tHalHandle hHal,
9552 v_U8_t neighborReassocRssiThreshold)
9553{
9554 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9555 eHalStatus status = eHAL_STATUS_SUCCESS;
9556
9557 status = sme_AcquireGlobalLock( &pMac->sme );
9558 if ( HAL_STATUS_SUCCESS( status ) )
9559 {
9560 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309561 "LFR runtime successfully set Reassoc threshold to %d"
9562 "- old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009563 neighborReassocRssiThreshold,
9564 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309565 macTraceGetNeighbourRoamState(
9566 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009567 pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold =
9568 neighborReassocRssiThreshold;
9569 pMac->roam.neighborRoamInfo.cfgParams.neighborReassocThreshold =
9570 neighborReassocRssiThreshold;
9571 sme_ReleaseGlobalLock( &pMac->sme );
9572 }
9573
9574 return status ;
9575}
9576
9577
9578/*--------------------------------------------------------------------------
9579 \brief sme_getNeighborLookupRssiThreshold() - get neighbor lookup rssi threshold
9580 This is a synchronous call
9581 \param hHal - The handle returned by macOpen.
9582 \return eHAL_STATUS_SUCCESS - SME update config successful.
9583 Other status means SME is failed to update
9584 \sa
9585 --------------------------------------------------------------------------*/
9586v_U8_t sme_getNeighborLookupRssiThreshold(tHalHandle hHal)
9587{
9588 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9589 return pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold;
9590}
9591
9592/*--------------------------------------------------------------------------
9593 \brief sme_setNeighborScanRefreshPeriod() - set neighbor scan results refresh period
9594 This is a synchronous call
9595 \param hHal - The handle returned by macOpen.
9596 \return eHAL_STATUS_SUCCESS - SME update config successful.
9597 Other status means SME is failed to update
9598 \sa
9599 --------------------------------------------------------------------------*/
9600eHalStatus sme_setNeighborScanRefreshPeriod(tHalHandle hHal,
9601 v_U16_t neighborScanResultsRefreshPeriod)
9602{
9603 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9604 eHalStatus status = eHAL_STATUS_SUCCESS;
9605
9606 status = sme_AcquireGlobalLock( &pMac->sme );
9607 if ( HAL_STATUS_SUCCESS( status ) )
9608 {
9609 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309610 "LFR runtime successfully set roam scan refresh period to %d"
9611 " - old value is %d - roam state is %s",
Srinivas Girigowdade697412013-02-14 16:31:48 -08009612 neighborScanResultsRefreshPeriod,
9613 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309614 macTraceGetNeighbourRoamState(
9615 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009616 pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod =
9617 neighborScanResultsRefreshPeriod;
9618 pMac->roam.neighborRoamInfo.cfgParams.neighborResultsRefreshPeriod =
9619 neighborScanResultsRefreshPeriod;
9620
9621 sme_ReleaseGlobalLock( &pMac->sme );
9622 }
9623
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009624#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9625 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9626 {
9627 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9628 REASON_NEIGHBOR_SCAN_REFRESH_PERIOD_CHANGED);
9629 }
9630#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009631 return status ;
9632}
9633
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009634#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9635/*--------------------------------------------------------------------------
9636 \brief sme_UpdateRoamScanOffloadEnabled() - enable/disable roam scan offload feaure
9637 It is used at in the REG_DYNAMIC_VARIABLE macro definition of
9638 gRoamScanOffloadEnabled.
9639 This is a synchronous call
9640 \param hHal - The handle returned by macOpen.
9641 \return eHAL_STATUS_SUCCESS - SME update config successfully.
9642 Other status means SME is failed to update.
9643 \sa
9644 --------------------------------------------------------------------------*/
9645
9646eHalStatus sme_UpdateRoamScanOffloadEnabled(tHalHandle hHal,
9647 v_BOOL_t nRoamScanOffloadEnabled)
9648{
9649 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9650 eHalStatus status = eHAL_STATUS_SUCCESS;
9651
9652 status = sme_AcquireGlobalLock( &pMac->sme );
9653 if ( HAL_STATUS_SUCCESS( status ) )
9654 {
9655 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
9656 "%s: gRoamScanOffloadEnabled is changed from %d to %d", __func__,
9657 pMac->roam.configParam.isRoamOffloadScanEnabled,
9658 nRoamScanOffloadEnabled);
9659 pMac->roam.configParam.isRoamOffloadScanEnabled = nRoamScanOffloadEnabled;
9660 sme_ReleaseGlobalLock( &pMac->sme );
9661 }
9662
9663 return status ;
9664}
9665#endif
9666
Srinivas Girigowdade697412013-02-14 16:31:48 -08009667/*--------------------------------------------------------------------------
9668 \brief sme_getNeighborScanRefreshPeriod() - get neighbor scan results refresh period
9669 This is a synchronous call
9670 \param hHal - The handle returned by macOpen.
9671 \return v_U16_t - Neighbor scan results refresh period value
9672 \sa
9673 --------------------------------------------------------------------------*/
9674v_U16_t sme_getNeighborScanRefreshPeriod(tHalHandle hHal)
9675{
9676 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9677 return pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod;
9678}
9679
9680/*--------------------------------------------------------------------------
9681 \brief sme_getEmptyScanRefreshPeriod() - get empty scan refresh period
9682 This is a synchronuous call
9683 \param hHal - The handle returned by macOpen.
9684 \return eHAL_STATUS_SUCCESS - SME update config successful.
9685 Other status means SME is failed to update
9686 \sa
9687 --------------------------------------------------------------------------*/
9688v_U16_t sme_getEmptyScanRefreshPeriod(tHalHandle hHal)
9689{
9690 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9691 return pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod;
9692}
9693
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009694/* ---------------------------------------------------------------------------
9695 \fn sme_UpdateEmptyScanRefreshPeriod
9696 \brief Update nEmptyScanRefreshPeriod
9697 This function is called through dynamic setConfig callback function
9698 to configure nEmptyScanRefreshPeriod
9699 Usage: adb shell iwpriv wlan0 setConfig nEmptyScanRefreshPeriod=[0 .. 60]
9700 \param hHal - HAL handle for device
9701 \param nEmptyScanRefreshPeriod - scan period following empty scan results.
9702 \- return Success or failure
9703 -------------------------------------------------------------------------*/
9704
9705eHalStatus sme_UpdateEmptyScanRefreshPeriod(tHalHandle hHal, v_U16_t nEmptyScanRefreshPeriod)
9706{
9707 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9708 eHalStatus status = eHAL_STATUS_SUCCESS;
9709
9710 status = sme_AcquireGlobalLock( &pMac->sme );
9711 if ( HAL_STATUS_SUCCESS( status ) )
9712 {
9713 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309714 "LFR runtime successfully set roam scan period to %d -"
9715 "old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009716 nEmptyScanRefreshPeriod,
9717 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309718 macTraceGetNeighbourRoamState(
9719 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009720 pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9721 pMac->roam.neighborRoamInfo.cfgParams.emptyScanRefreshPeriod = nEmptyScanRefreshPeriod;
9722 sme_ReleaseGlobalLock( &pMac->sme );
9723 }
9724
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009725#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9726 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9727 {
9728 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9729 REASON_EMPTY_SCAN_REF_PERIOD_CHANGED);
9730 }
9731#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009732 return status ;
9733}
9734
9735/* ---------------------------------------------------------------------------
9736 \fn sme_setNeighborScanMinChanTime
9737 \brief Update nNeighborScanMinChanTime
9738 This function is called through dynamic setConfig callback function
9739 to configure gNeighborScanChannelMinTime
9740 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMinTime=[0 .. 60]
9741 \param hHal - HAL handle for device
9742 \param nNeighborScanMinChanTime - Channel minimum dwell time
9743 \- return Success or failure
9744 -------------------------------------------------------------------------*/
9745eHalStatus sme_setNeighborScanMinChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMinChanTime)
9746{
9747 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9748 eHalStatus status = eHAL_STATUS_SUCCESS;
9749
9750 status = sme_AcquireGlobalLock( &pMac->sme );
9751 if ( HAL_STATUS_SUCCESS( status ) )
9752 {
9753 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309754 "LFR runtime successfully set channel min dwell time to %d"
9755 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009756 nNeighborScanMinChanTime,
9757 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309758 macTraceGetNeighbourRoamState(
9759 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009760 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = nNeighborScanMinChanTime;
9761 pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime = nNeighborScanMinChanTime;
9762 sme_ReleaseGlobalLock( &pMac->sme );
9763 }
9764
9765 return status ;
9766}
9767
9768/* ---------------------------------------------------------------------------
9769 \fn sme_setNeighborScanMaxChanTime
9770 \brief Update nNeighborScanMaxChanTime
9771 This function is called through dynamic setConfig callback function
9772 to configure gNeighborScanChannelMaxTime
9773 Usage: adb shell iwpriv wlan0 setConfig gNeighborScanChannelMaxTime=[0 .. 60]
9774 \param hHal - HAL handle for device
9775 \param nNeighborScanMinChanTime - Channel maximum dwell time
9776 \- return Success or failure
9777 -------------------------------------------------------------------------*/
9778eHalStatus sme_setNeighborScanMaxChanTime(tHalHandle hHal, const v_U16_t nNeighborScanMaxChanTime)
9779{
9780 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9781 eHalStatus status = eHAL_STATUS_SUCCESS;
9782
9783 status = sme_AcquireGlobalLock( &pMac->sme );
9784 if ( HAL_STATUS_SUCCESS( status ) )
9785 {
9786 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309787 "LFR runtime successfully set channel max dwell time to %d"
9788 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009789 nNeighborScanMaxChanTime,
9790 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309791 macTraceGetNeighbourRoamState(
9792 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009793 pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = nNeighborScanMaxChanTime;
9794 pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime = nNeighborScanMaxChanTime;
9795 sme_ReleaseGlobalLock( &pMac->sme );
9796 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009797#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9798 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9799 {
9800 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9801 REASON_SCAN_CH_TIME_CHANGED);
9802 }
9803#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009804
9805 return status ;
9806}
9807
9808/* ---------------------------------------------------------------------------
9809 \fn sme_getNeighborScanMinChanTime
9810 \brief get neighbor scan min channel time
9811 \param hHal - The handle returned by macOpen.
9812 \return v_U16_t - channel min time value
9813 -------------------------------------------------------------------------*/
9814v_U16_t sme_getNeighborScanMinChanTime(tHalHandle hHal)
9815{
9816 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9817 return pMac->roam.neighborRoamInfo.cfgParams.minChannelScanTime;
9818}
9819
9820/* ---------------------------------------------------------------------------
9821 \fn sme_getNeighborScanMaxChanTime
9822 \brief get neighbor scan max channel time
9823 \param hHal - The handle returned by macOpen.
9824 \return v_U16_t - channel max time value
9825 -------------------------------------------------------------------------*/
9826v_U16_t sme_getNeighborScanMaxChanTime(tHalHandle hHal)
9827{
9828 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9829 return pMac->roam.neighborRoamInfo.cfgParams.maxChannelScanTime;
9830}
9831
9832/* ---------------------------------------------------------------------------
9833 \fn sme_setNeighborScanPeriod
9834 \brief Update nNeighborScanPeriod
9835 This function is called through dynamic setConfig callback function
9836 to configure nNeighborScanPeriod
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009837 Usage: adb shell iwpriv wlan0 setConfig nNeighborScanPeriod=[0 .. 1000]
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009838 \param hHal - HAL handle for device
9839 \param nNeighborScanPeriod - neighbor scan period
9840 \- return Success or failure
9841 -------------------------------------------------------------------------*/
9842eHalStatus sme_setNeighborScanPeriod(tHalHandle hHal, const v_U16_t nNeighborScanPeriod)
9843{
9844 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9845 eHalStatus status = eHAL_STATUS_SUCCESS;
9846
9847 status = sme_AcquireGlobalLock( &pMac->sme );
9848 if ( HAL_STATUS_SUCCESS( status ) )
9849 {
9850 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309851 "LFR runtime successfully set neighbor scan period to %d"
9852 " - old value is %d - roam state is %s",
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009853 nNeighborScanPeriod,
9854 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309855 macTraceGetNeighbourRoamState(
9856 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009857 pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = nNeighborScanPeriod;
9858 pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod = nNeighborScanPeriod;
9859 sme_ReleaseGlobalLock( &pMac->sme );
9860 }
Varun Reddy Yeturuce114f72013-06-05 14:09:58 -07009861#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9862 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9863 {
9864 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG,
9865 REASON_SCAN_HOME_TIME_CHANGED);
9866 }
9867#endif
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009868
9869 return status ;
9870}
9871
9872/* ---------------------------------------------------------------------------
9873 \fn sme_getNeighborScanPeriod
9874 \brief get neighbor scan period
9875 \param hHal - The handle returned by macOpen.
9876 \return v_U16_t - neighbor scan period
9877 -------------------------------------------------------------------------*/
9878v_U16_t sme_getNeighborScanPeriod(tHalHandle hHal)
9879{
9880 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9881 return pMac->roam.neighborRoamInfo.cfgParams.neighborScanPeriod;
9882}
9883
9884#endif
9885
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009886#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -07009887
Srinivas Girigowdade697412013-02-14 16:31:48 -08009888/*--------------------------------------------------------------------------
9889 \brief sme_getRoamRssiDiff() - get Roam rssi diff
9890 This is a synchronous call
9891 \param hHal - The handle returned by macOpen.
9892 \return v_U16_t - Rssi diff value
9893 \sa
9894 --------------------------------------------------------------------------*/
9895v_U8_t sme_getRoamRssiDiff(tHalHandle hHal)
9896{
9897 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9898 return pMac->roam.configParam.RoamRssiDiff;
9899}
9900
9901/*--------------------------------------------------------------------------
9902 \brief sme_ChangeRoamScanChannelList() - Change roam scan channel list
9903 This is a synchronous call
9904 \param hHal - The handle returned by macOpen.
9905 \return eHAL_STATUS_SUCCESS - SME update config successful.
9906 Other status means SME is failed to update
9907 \sa
9908 --------------------------------------------------------------------------*/
9909eHalStatus sme_ChangeRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
9910 tANI_U8 numChannels)
9911{
9912 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9913 eHalStatus status = eHAL_STATUS_SUCCESS;
9914 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009915 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Kiet Lam600d3ca2013-08-31 16:33:32 +05309916 tANI_U8 newChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
Srinivas Girigowdade697412013-02-14 16:31:48 -08009917 tANI_U8 i = 0, j = 0;
9918
9919 status = sme_AcquireGlobalLock( &pMac->sme );
9920 if ( HAL_STATUS_SUCCESS( status ) )
9921 {
9922 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
9923 {
9924 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
9925 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309926 if (j < sizeof(oldChannelList))
9927 {
9928 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
9929 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9930 }
9931 else
9932 {
9933 break;
9934 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009935 }
9936 }
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009937 csrFlushCfgBgScanRoamChannelList(pMac);
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009938 csrCreateBgScanRoamChannelList(pMac, pChannelList, numChannels);
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009939 sme_SetRoamScanControl(hHal, 1);
9940 if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009941 {
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009942 j = 0;
9943 for (i = 0; i < pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels; i++)
Srinivas Girigowdade697412013-02-14 16:31:48 -08009944 {
Kaushik, Sushantd39915b2014-04-23 15:12:28 +05309945 if (j < sizeof(oldChannelList))
9946 {
9947 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
9948 pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i]);
9949 }
9950 else
9951 {
9952 break;
9953 }
Srinivas Girigowdade697412013-02-14 16:31:48 -08009954 }
Srinivas Girigowda100eb322013-03-15 16:48:20 -07009955 }
Varun Reddy Yeturu9d4102c2013-12-02 15:47:03 -08009956
9957 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Mahesh A Saptasagar0616f582014-01-13 21:17:53 +05309958 "LFR runtime successfully set roam scan channels to %s"
9959 "- old value is %s - roam state is %s",
9960 newChannelList, oldChannelList,
9961 macTraceGetNeighbourRoamState(
9962 pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowdade697412013-02-14 16:31:48 -08009963 sme_ReleaseGlobalLock( &pMac->sme );
9964 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07009965#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
9966 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
9967 {
9968 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
9969 }
9970#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -08009971
9972 return status ;
9973}
9974
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009975
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009976#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009977/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009978 \brief sme_SetEseRoamScanChannelList() - set ese roam scan channel list
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009979 This is a synchronuous call
9980 \param hHal - The handle returned by macOpen.
9981 \return eHAL_STATUS_SUCCESS - SME update config successful.
9982 Other status means SME is failed to update
9983 \sa
9984 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08009985eHalStatus sme_SetEseRoamScanChannelList(tHalHandle hHal,
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07009986 tANI_U8 *pChannelList,
9987 tANI_U8 numChannels)
9988{
9989 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
9990 eHalStatus status = eHAL_STATUS_SUCCESS;
9991 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
9992 tpCsrChannelInfo currChannelListInfo = &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
9993 tANI_U8 oldChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN*2] = {0};
9994 tANI_U8 newChannelList[128] = {0};
9995 tANI_U8 i = 0, j = 0;
9996
9997 status = sme_AcquireGlobalLock( &pMac->sme );
9998 if ( HAL_STATUS_SUCCESS( status ) )
9999 {
10000 if (NULL != currChannelListInfo->ChannelList)
10001 {
10002 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
10003 {
10004 j += snprintf(oldChannelList + j, sizeof(oldChannelList) - j," %d",
10005 currChannelListInfo->ChannelList[i]);
10006 }
10007 }
10008 status = csrCreateRoamScanChannelList(pMac, pChannelList, numChannels, csrGetCurrentBand(hHal));
10009
10010 if ( HAL_STATUS_SUCCESS( status ))
10011 {
10012 if (NULL != currChannelListInfo->ChannelList)
10013 {
10014 j = 0;
10015 for (i = 0; i < currChannelListInfo->numOfChannels; i++)
10016 {
10017 j += snprintf(newChannelList + j, sizeof(newChannelList) - j," %d",
10018 currChannelListInfo->ChannelList[i]);
10019 }
10020 }
10021
10022 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010023 "ESE roam scan channel list successfully set to %s - old value is %s - roam state is %s",
10024 newChannelList, oldChannelList,
10025 macTraceGetNeighbourRoamState(pMac->roam.neighborRoamInfo.neighborRoamState));
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070010026 }
10027 sme_ReleaseGlobalLock( &pMac->sme );
10028 }
10029#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10030 if (pMac->roam.configParam.isRoamOffloadScanEnabled)
10031 {
10032 csrRoamOffloadScan(pMac, ROAM_SCAN_OFFLOAD_UPDATE_CFG, REASON_CHANNEL_LIST_CHANGED);
10033 }
10034#endif
10035
10036 return status ;
10037}
10038#endif
10039
Srinivas Girigowdade697412013-02-14 16:31:48 -080010040/*--------------------------------------------------------------------------
Srinivas Girigowdade697412013-02-14 16:31:48 -080010041 \brief sme_getRoamScanChannelList() - get roam scan channel list
10042 This is a synchronous call
10043 \param hHal - The handle returned by macOpen.
10044 \return eHAL_STATUS_SUCCESS - SME update config successful.
10045 Other status means SME is failed to update
10046 \sa
10047 --------------------------------------------------------------------------*/
10048eHalStatus sme_getRoamScanChannelList(tHalHandle hHal, tANI_U8 *pChannelList,
10049 tANI_U8 *pNumChannels)
10050{
10051 int i = 0;
10052 tANI_U8 *pOutPtr = pChannelList;
10053 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10054 tpCsrNeighborRoamControlInfo pNeighborRoamInfo = &pMac->roam.neighborRoamInfo;
10055 eHalStatus status = eHAL_STATUS_SUCCESS;
10056
10057 status = sme_AcquireGlobalLock( &pMac->sme );
10058 if ( HAL_STATUS_SUCCESS( status ) )
10059 {
10060 if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
10061 {
10062 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
10063 "Roam Scan channel list is NOT yet initialized");
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010064 *pNumChannels = 0;
Srinivas Girigowdade697412013-02-14 16:31:48 -080010065 sme_ReleaseGlobalLock( &pMac->sme );
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010066 return status;
Srinivas Girigowdade697412013-02-14 16:31:48 -080010067 }
10068
10069 *pNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
10070 for (i = 0; i < (*pNumChannels); i++)
10071 {
10072 pOutPtr[i] = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList[i];
10073 }
10074 pOutPtr[i] = '\0';
10075 sme_ReleaseGlobalLock( &pMac->sme );
10076 }
Srinivas Girigowdade697412013-02-14 16:31:48 -080010077 return status ;
10078}
10079
10080/*--------------------------------------------------------------------------
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010081 \brief sme_getIsEseFeatureEnabled() - get Ese feature enabled or not
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010082 This is a synchronuous call
10083 \param hHal - The handle returned by macOpen.
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010084 \return TRUE (1) - if the Ese feature is enabled
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010085 FALSE (0) - if feature is disabled (compile or runtime)
10086 \sa
10087 --------------------------------------------------------------------------*/
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010088tANI_BOOLEAN sme_getIsEseFeatureEnabled(tHalHandle hHal)
Srinivas Girigowdade697412013-02-14 16:31:48 -080010089{
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010090#ifdef FEATURE_WLAN_ESE
Srinivas Girigowdade697412013-02-14 16:31:48 -080010091 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080010092 return csrRoamIsEseIniFeatureEnabled(pMac);
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010093#else
10094 return eANI_BOOLEAN_FALSE;
10095#endif
Srinivas Girigowdade697412013-02-14 16:31:48 -080010096}
10097
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010098/*--------------------------------------------------------------------------
Srinivas Girigowdaad34ca92013-10-22 10:54:29 -070010099 \brief sme_GetWESMode() - get WES Mode
10100 This is a synchronous call
10101 \param hHal - The handle returned by macOpen
10102 \return v_U8_t - WES Mode Enabled(1)/Disabled(0)
10103 \sa
10104 --------------------------------------------------------------------------*/
10105v_BOOL_t sme_GetWESMode(tHalHandle hHal)
10106{
10107 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10108 return pMac->roam.configParam.isWESModeEnabled;
10109}
10110
10111/*--------------------------------------------------------------------------
Srinivas Girigowda100eb322013-03-15 16:48:20 -070010112 \brief sme_GetRoamScanControl() - get scan control
10113 This is a synchronous call
10114 \param hHal - The handle returned by macOpen.
10115 \return v_BOOL_t - Enabled(1)/Disabled(0)
10116 \sa
10117 --------------------------------------------------------------------------*/
10118v_BOOL_t sme_GetRoamScanControl(tHalHandle hHal)
10119{
10120 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10121 return pMac->roam.configParam.nRoamScanControl;
10122}
10123#endif
10124
10125/*--------------------------------------------------------------------------
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010126 \brief sme_getIsLfrFeatureEnabled() - get LFR feature enabled or not
10127 This is a synchronuous call
10128 \param hHal - The handle returned by macOpen.
10129 \return TRUE (1) - if the feature is enabled
10130 FALSE (0) - if feature is disabled (compile or runtime)
10131 \sa
10132 --------------------------------------------------------------------------*/
10133tANI_BOOLEAN sme_getIsLfrFeatureEnabled(tHalHandle hHal)
10134{
10135#ifdef FEATURE_WLAN_LFR
10136 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10137 return pMac->roam.configParam.isFastRoamIniFeatureEnabled;
10138#else
10139 return eANI_BOOLEAN_FALSE;
10140#endif
10141}
Madan Mohan Koyyalamudid5026072012-11-30 14:56:21 -080010142
Srinivas Girigowdabbd16eb2013-03-21 12:34:46 -070010143/*--------------------------------------------------------------------------
10144 \brief sme_getIsFtFeatureEnabled() - get FT feature enabled or not
10145 This is a synchronuous call
10146 \param hHal - The handle returned by macOpen.
10147 \return TRUE (1) - if the feature is enabled
10148 FALSE (0) - if feature is disabled (compile or runtime)
10149 \sa
10150 --------------------------------------------------------------------------*/
10151tANI_BOOLEAN sme_getIsFtFeatureEnabled(tHalHandle hHal)
10152{
10153#ifdef WLAN_FEATURE_VOWIFI_11R
10154 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10155 return pMac->roam.configParam.isFastTransitionEnabled;
10156#else
10157 return eANI_BOOLEAN_FALSE;
10158#endif
10159}
10160
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010161/* ---------------------------------------------------------------------------
10162 \fn sme_IsFeatureSupportedByFW
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010163
Kiet Lam0f320422013-11-21 19:29:17 +053010164 \brief Check if a feature is enabled by FW
10165
10166 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010167
Kiet Lam0f320422013-11-21 19:29:17 +053010168 \- return 1/0 (TRUE/FALSE)
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010169 -------------------------------------------------------------------------*/
10170tANI_U8 sme_IsFeatureSupportedByFW(tANI_U8 featEnumValue)
10171{
10172 return IS_FEATURE_SUPPORTED_BY_FW(featEnumValue);
10173}
Kiet Lam0f320422013-11-21 19:29:17 +053010174
10175/* ---------------------------------------------------------------------------
10176 \fn sme_IsFeatureSupportedByDriver
10177 \brief Check if a feature is enabled by Driver
10178
10179 \param featEnumValue - Enumeration value from placeHolderInCapBitmap
10180 \- return 1/0 (TRUE/FALSE)
10181 -------------------------------------------------------------------------*/
10182
10183tANI_U8 sme_IsFeatureSupportedByDriver(tANI_U8 featEnumValue)
10184{
10185 return IS_FEATURE_SUPPORTED_BY_DRIVER(featEnumValue);
10186}
10187
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010188#ifdef FEATURE_WLAN_TDLS
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +053010189
10190/* ---------------------------------------------------------------------------
10191 \fn sme_SendTdlsMgmtFrame
10192 \brief API to send TDLS management frames.
10193
10194 \param peerMac - peer's Mac Adress.
10195 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
10196 \- return VOS_STATUS_SUCCES
10197 -------------------------------------------------------------------------*/
10198VOS_STATUS sme_SendTdlsLinkEstablishParams(tHalHandle hHal,
10199 tANI_U8 sessionId,
10200 tSirMacAddr peerMac,
10201 tCsrTdlsLinkEstablishParams *tdlsLinkEstablishParams)
10202{
10203 eHalStatus status = eHAL_STATUS_SUCCESS;
10204 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10205
10206 status = sme_AcquireGlobalLock( &pMac->sme );
10207
10208 if ( HAL_STATUS_SUCCESS( status ) )
10209 {
10210 status = csrTdlsSendLinkEstablishParams(hHal, sessionId, peerMac, tdlsLinkEstablishParams) ;
10211 sme_ReleaseGlobalLock( &pMac->sme );
10212 }
10213 return status ;
10214}
10215
Atul Mittalc0f739f2014-07-31 13:47:47 +053010216// tdlsoffchan
10217
10218/* ---------------------------------------------------------------------------
10219 \fn sme_SendTdlsChanSwitchReq
10220 \brief API to send TDLS management frames.
10221
10222 \param peerMac - peer's Mac Adress.
10223 \param tdlsLinkEstablishParams - TDLS Peer Link Establishment Parameters
10224 \- return VOS_STATUS_SUCCES
10225 -------------------------------------------------------------------------*/
10226VOS_STATUS sme_SendTdlsChanSwitchReq(tHalHandle hHal,
10227 tANI_U8 sessionId,
10228 tSirMacAddr peerMac,
10229 tANI_S32 tdlsOffCh,
10230 tANI_S32 tdlsOffChBwOffset,
10231 tANI_U8 tdlsSwMode)
10232{
10233 eHalStatus status = eHAL_STATUS_SUCCESS;
10234 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10235
10236 status = sme_AcquireGlobalLock( &pMac->sme );
10237
10238 if ( HAL_STATUS_SUCCESS( status ) )
10239 {
10240 status = csrTdlsSendChanSwitchReq(hHal, sessionId, peerMac,
10241 tdlsOffCh, tdlsOffChBwOffset,
10242 tdlsSwMode);
10243 }
10244 sme_ReleaseGlobalLock( &pMac->sme );
10245 return status ;
10246}
10247
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010248/* ---------------------------------------------------------------------------
10249 \fn sme_SendTdlsMgmtFrame
10250 \brief API to send TDLS management frames.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010251
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010252 \param peerMac - peer's Mac Adress.
10253 \param frame_type - Type of TDLS mgmt frame to be sent.
10254 \param dialog - dialog token used in the frame.
10255 \param status - status to be incuded in the frame.
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010256 \param peerCapability - peer cpabilities
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010257 \param buf - additional IEs to be included
10258 \param len - lenght of additional Ies
Hoonki Leea34dd892013-02-05 22:56:02 -080010259 \param responder - Tdls request type
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010260 \- return VOS_STATUS_SUCCES
10261 -------------------------------------------------------------------------*/
10262VOS_STATUS sme_SendTdlsMgmtFrame(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010263 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 -080010264{
10265 eHalStatus status = eHAL_STATUS_SUCCESS;
10266 tCsrTdlsSendMgmt sendTdlsReq = {{0}} ;
10267 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10268
10269 status = sme_AcquireGlobalLock( &pMac->sme );
10270 if ( HAL_STATUS_SUCCESS( status ) )
10271 {
10272 vos_mem_copy(sendTdlsReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10273 sendTdlsReq.frameType = frame_type;
10274 sendTdlsReq.buf = buf;
10275 sendTdlsReq.len = len;
10276 sendTdlsReq.dialog = dialog;
10277 sendTdlsReq.statusCode = statusCode;
Hoonki Leea34dd892013-02-05 22:56:02 -080010278 sendTdlsReq.responder = responder;
Pradeep Reddy POTTETIca171f82014-03-21 14:17:35 +053010279 sendTdlsReq.peerCapability = peerCapability;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010280
10281 status = csrTdlsSendMgmtReq(hHal, sessionId, &sendTdlsReq) ;
10282
10283 sme_ReleaseGlobalLock( &pMac->sme );
10284 }
10285
10286 return status ;
10287
10288}
10289/* ---------------------------------------------------------------------------
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010290 \fn sme_ChangeTdlsPeerSta
10291 \brief API to Update TDLS peer sta parameters.
10292
10293 \param peerMac - peer's Mac Adress.
10294 \param staParams - Peer Station Parameters
10295 \- return VOS_STATUS_SUCCES
10296 -------------------------------------------------------------------------*/
10297VOS_STATUS sme_ChangeTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac,
10298 tCsrStaParams *pstaParams)
10299{
10300 eHalStatus status = eHAL_STATUS_SUCCESS;
10301 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10302
Sushant Kaushikd62d9782014-02-19 15:39:40 +053010303 if (NULL == pstaParams)
10304 {
10305 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10306 "%s :pstaParams is NULL",__func__);
10307 return eHAL_STATUS_FAILURE;
10308 }
Gopichand Nakkala681989c2013-03-06 22:27:48 -080010309 status = sme_AcquireGlobalLock( &pMac->sme );
10310 if ( HAL_STATUS_SUCCESS( status ) )
10311 {
10312 status = csrTdlsChangePeerSta(hHal, sessionId, peerMac,pstaParams);
10313
10314 sme_ReleaseGlobalLock( &pMac->sme );
10315 }
10316
10317 return status ;
10318
10319}
10320
10321/* ---------------------------------------------------------------------------
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010322 \fn sme_AddTdlsPeerSta
10323 \brief API to Add TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010324
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010325 \param peerMac - peer's Mac Adress.
10326 \- return VOS_STATUS_SUCCES
10327 -------------------------------------------------------------------------*/
10328VOS_STATUS sme_AddTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10329{
10330 eHalStatus status = eHAL_STATUS_SUCCESS;
10331 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10332
10333 status = sme_AcquireGlobalLock( &pMac->sme );
10334 if ( HAL_STATUS_SUCCESS( status ) )
10335 {
10336 status = csrTdlsAddPeerSta(hHal, sessionId, peerMac);
10337
10338 sme_ReleaseGlobalLock( &pMac->sme );
10339 }
10340
10341 return status ;
10342
10343}
10344/* ---------------------------------------------------------------------------
10345 \fn sme_DeleteTdlsPeerSta
10346 \brief API to Delete TDLS peer sta entry.
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070010347
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010348 \param peerMac - peer's Mac Adress.
10349 \- return VOS_STATUS_SUCCES
10350 -------------------------------------------------------------------------*/
10351VOS_STATUS sme_DeleteTdlsPeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10352{
10353 eHalStatus status = eHAL_STATUS_SUCCESS;
10354 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10355
10356 status = sme_AcquireGlobalLock( &pMac->sme );
10357 if ( HAL_STATUS_SUCCESS( status ) )
10358 {
10359 status = csrTdlsDelPeerSta(hHal, sessionId, peerMac) ;
10360
10361 sme_ReleaseGlobalLock( &pMac->sme );
10362 }
10363
10364 return status ;
10365
10366}
Gopichand Nakkala75e7b282013-03-15 18:37:13 -070010367/* ---------------------------------------------------------------------------
Gopichand Nakkalaccd3a382013-03-19 13:56:10 -070010368 \fn sme_SetTdlsPowerSaveProhibited
10369 \API to set/reset the isTdlsPowerSaveProhibited.
10370
10371 \- return void
10372 -------------------------------------------------------------------------*/
10373void sme_SetTdlsPowerSaveProhibited(tHalHandle hHal, v_BOOL_t val)
10374{
10375 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10376
10377 pMac->isTdlsPowerSaveProhibited = val;
10378 return;
10379}
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010380#endif
Gopichand Nakkalafe7246d2013-06-10 17:43:37 +053010381/* ---------------------------------------------------------------------------
10382 \fn sme_IsPmcBmps
10383 \API to Check if PMC state is BMPS.
10384
10385 \- return v_BOOL_t
10386 -------------------------------------------------------------------------*/
10387v_BOOL_t sme_IsPmcBmps(tHalHandle hHal)
10388{
10389 return (BMPS == pmcGetPmcState(hHal));
10390}
10391
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010392#ifdef FEATURE_WLAN_TDLS_INTERNAL
10393/*
10394 * SME API to start TDLS discovery Procedure
10395 */
10396VOS_STATUS sme_StartTdlsDiscoveryReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10397{
10398 VOS_STATUS status = VOS_STATUS_SUCCESS;
10399 tCsrTdlsDisRequest disReq = {{0}} ;
10400 vos_mem_copy(disReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10401 status = csrTdlsDiscoveryReq(hHal, sessionId, &disReq) ;
10402
10403 return status ;
10404
10405}
10406
10407/*
10408 * Process TDLS discovery results
10409 */
10410v_U8_t sme_GetTdlsDiscoveryResult(tHalHandle hHal,
10411 tSmeTdlsDisResult *disResult, v_U8_t listType)
10412{
10413 tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ;
10414 tSirTdlsPeerInfo *peerInfo = NULL ;
10415 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10416 tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ;
10417 tDblLinkList *peerList = &disInfo->tdlsPotentialPeerList ;
10418 tListElem *pEntry = NULL ;
10419 v_U8_t peerCnt = 0 ;
10420
10421 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010422 ("TDLS peer count = %d"),disInfo->tdlsPeerCount ) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010423 pEntry = csrLLPeekHead( peerList, LL_ACCESS_LOCK );
10424 while(pEntry)
10425 {
10426 peerLinkInfo = GET_BASE_ADDR( pEntry, tCsrTdlsPeerLinkinfo,
10427 tdlsPeerStaLink) ;
10428 peerInfo = &peerLinkInfo->tdlsDisPeerInfo ;
10429
10430 switch(listType)
10431 {
10432 case TDLS_SETUP_LIST:
10433 {
10434 if(TDLS_LINK_SETUP_STATE == peerInfo->tdlsPeerState)
10435 {
Kiet Lam64c1b492013-07-12 13:56:44 +053010436 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
10437 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010438 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
10439 peerCnt++ ;
10440 }
10441 break ;
10442 }
10443 case TDLS_DIS_LIST:
10444 {
Kiet Lam64c1b492013-07-12 13:56:44 +053010445 vos_mem_copy(disResult[peerCnt].tdlsPeerMac,
10446 peerInfo->peerMac, sizeof(tSirMacAddr));
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010447 disResult[peerCnt].tdlsPeerRssi = peerInfo->tdlsPeerRssi ;
10448 peerCnt++ ;
10449 break ;
10450 }
10451 default:
10452 {
10453 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere691dde12013-03-06 17:00:31 -080010454 ("unknown list type ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -080010455 break ;
10456 }
10457 }
10458
10459 pEntry = csrLLNext( peerList, pEntry, LL_ACCESS_LOCK) ;
10460 }
10461
10462 return peerCnt ;
10463
10464}
10465
10466/*
10467 * SME API to start TDLS link setup Procedure.
10468 */
10469VOS_STATUS sme_StartTdlsLinkSetupReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10470{
10471 VOS_STATUS status = VOS_STATUS_SUCCESS;
10472 tCsrTdlsSetupRequest setupReq = {{0}} ;
10473 vos_mem_copy(setupReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10474 status = csrTdlsSetupReq(hHal, sessionId, &setupReq) ;
10475 return status ;
10476
10477}
10478
10479/*
10480 * SME API to start TDLS link Teardown Procedure.
10481 */
10482VOS_STATUS sme_StartTdlsLinkTeardownReq(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac)
10483{
10484 VOS_STATUS status = VOS_STATUS_SUCCESS;
10485 tCsrTdlsTeardownRequest teardownReq = {{0}} ;
10486 vos_mem_copy(teardownReq.peerMac, peerMac, sizeof(tSirMacAddr)) ;
10487 status = csrTdlsTeardownReq(hHal, sessionId, &teardownReq) ;
10488 return status ;
10489
10490}
10491
10492#endif /* FEATURE_WLAN_TDLS */
10493
Tushnim Bhattacharyya9cdf6082013-04-21 16:33:30 -070010494eHalStatus sme_UpdateDfsSetting(tHalHandle hHal, tANI_U8 fUpdateEnableDFSChnlScan)
10495{
10496 eHalStatus status = eHAL_STATUS_FAILURE;
10497 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10498
10499 smsLog(pMac, LOG2, FL("enter"));
10500 status = sme_AcquireGlobalLock( &pMac->sme );
10501 if ( HAL_STATUS_SUCCESS( status ) )
10502 {
10503 pMac->scan.fEnableDFSChnlScan = fUpdateEnableDFSChnlScan;
10504 sme_ReleaseGlobalLock( &pMac->sme );
10505 }
10506 smsLog(pMac, LOG2, FL("exit status %d"), status);
10507
10508 return (status);
10509}
10510
Gopichand Nakkalae620d5a2013-04-26 05:45:57 -070010511/*
10512 * SME API to enable/disable WLAN driver initiated SSR
10513 */
10514void sme_UpdateEnableSSR(tHalHandle hHal, tANI_BOOLEAN enableSSR)
10515{
10516 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10517 eHalStatus status = eHAL_STATUS_SUCCESS;
10518
10519 status = sme_AcquireGlobalLock(&pMac->sme);
10520 if (HAL_STATUS_SUCCESS(status))
10521 {
10522 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_DEBUG,
10523 "SSR level is changed %d", enableSSR);
10524 /* not serializing this messsage, as this is only going
10525 * to set a variable in WDA/WDI
10526 */
10527 WDA_SetEnableSSR(enableSSR);
10528 sme_ReleaseGlobalLock(&pMac->sme);
10529 }
10530 return;
10531}
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010532
10533/*
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010534 * SME API to stringify bonding mode. (hostapd convention)
10535 */
10536
10537static const char* sme_CBMode2String( tANI_U32 mode)
10538{
10539 switch (mode)
10540 {
10541 case eCSR_INI_SINGLE_CHANNEL_CENTERED:
10542 return "HT20";
10543 case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
10544 return "HT40-"; /* lower secondary channel */
10545 case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
10546 return "HT40+"; /* upper secondary channel */
10547#ifdef WLAN_FEATURE_11AC
10548 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
10549 return "VHT80+40+"; /* upper secondary channels */
10550 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
10551 return "VHT80+40-"; /* 1 lower and 2 upper secondary channels */
10552 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
10553 return "VHT80-40+"; /* 2 lower and 1 upper secondary channels */
10554 case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
10555 return "VHT80-40-"; /* lower secondary channels */
10556#endif
10557 default:
10558 VOS_ASSERT(0);
10559 return "Unknown";
10560 }
10561}
10562
10563/*
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010564 * SME API to determine the channel bonding mode
10565 */
10566VOS_STATUS sme_SelectCBMode(tHalHandle hHal, eCsrPhyMode eCsrPhyMode, tANI_U8 channel)
10567{
10568 tSmeConfigParams smeConfig;
10569 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10570
10571 if (
10572#ifdef WLAN_FEATURE_11AC
10573 eCSR_DOT11_MODE_11ac != eCsrPhyMode &&
10574 eCSR_DOT11_MODE_11ac_ONLY != eCsrPhyMode &&
10575#endif
10576 eCSR_DOT11_MODE_11n != eCsrPhyMode &&
krunal soni634aba32014-03-06 17:46:50 -080010577 eCSR_DOT11_MODE_11n_ONLY != eCsrPhyMode &&
10578
10579 eCSR_DOT11_MODE_11a != eCsrPhyMode &&
10580 eCSR_DOT11_MODE_11a_ONLY != eCsrPhyMode &&
10581
10582 eCSR_DOT11_MODE_abg != eCsrPhyMode
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010583 )
10584 {
10585 return VOS_STATUS_SUCCESS;
10586 }
10587
Kaushik, Sushant553a06c2014-11-26 15:29:40 +053010588 vos_mem_zero(&smeConfig, sizeof (tSmeConfigParams));
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010589 sme_GetConfigParam(pMac, &smeConfig);
10590
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010591 /* If channel bonding mode is not required */
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010592#ifdef WLAN_FEATURE_AP_HT40_24G
10593 if ( !pMac->roam.configParam.channelBondingMode5GHz
10594 && !smeConfig.csrConfig.apHT40_24GEnabled ) {
10595#else
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010596 if ( !pMac->roam.configParam.channelBondingMode5GHz ) {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010597#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010598 return VOS_STATUS_SUCCESS;
10599 }
10600
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010601
10602#ifdef WLAN_FEATURE_11AC
10603 if ( eCSR_DOT11_MODE_11ac == eCsrPhyMode ||
10604 eCSR_DOT11_MODE_11ac_ONLY == eCsrPhyMode )
10605 {
10606 if ( channel== 36 || channel == 52 || channel == 100 ||
10607 channel == 116 || channel == 149 )
10608 {
10609 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010610 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010611 }
10612 else if ( channel == 40 || channel == 56 || channel == 104 ||
10613 channel == 120 || channel == 153 )
10614 {
10615 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010616 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010617 }
10618 else if ( channel == 44 || channel == 60 || channel == 108 ||
10619 channel == 124 || channel == 157 )
10620 {
10621 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010622 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010623 }
10624 else if ( channel == 48 || channel == 64 || channel == 112 ||
Leo Changd0a49842013-12-30 11:41:04 -080010625 channel == 128 || channel == 144 || channel == 161 )
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010626 {
10627 smeConfig.csrConfig.channelBondingMode5GHz =
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010628 eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010629 }
10630 else if ( channel == 165 )
10631 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010632 smeConfig.csrConfig.channelBondingMode5GHz =
10633 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010634 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010635
10636#ifdef WLAN_FEATURE_AP_HT40_24G
10637 if (smeConfig.csrConfig.apHT40_24GEnabled)
10638 {
10639 if (channel >= 1 && channel <= 7)
10640 smeConfig.csrConfig.channelBondingAPMode24GHz =
10641 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
10642 else if (channel >= 8 && channel <= 13)
10643 smeConfig.csrConfig.channelBondingAPMode24GHz =
10644 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
10645 else if (channel ==14)
10646 smeConfig.csrConfig.channelBondingAPMode24GHz =
10647 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10648 }
10649#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010650 }
10651#endif
10652
10653 if ( eCSR_DOT11_MODE_11n == eCsrPhyMode ||
10654 eCSR_DOT11_MODE_11n_ONLY == eCsrPhyMode )
10655 {
10656 if ( channel== 40 || channel == 48 || channel == 56 ||
10657 channel == 64 || channel == 104 || channel == 112 ||
10658 channel == 120 || channel == 128 || channel == 136 ||
10659 channel == 144 || channel == 153 || channel == 161 )
10660 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010661 smeConfig.csrConfig.channelBondingMode5GHz =
10662 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010663 }
10664 else if ( channel== 36 || channel == 44 || channel == 52 ||
10665 channel == 60 || channel == 100 || channel == 108 ||
10666 channel == 116 || channel == 124 || channel == 132 ||
10667 channel == 140 || channel == 149 || channel == 157 )
10668 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010669 smeConfig.csrConfig.channelBondingMode5GHz =
10670 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010671 }
10672 else if ( channel == 165 )
10673 {
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010674 smeConfig.csrConfig.channelBondingMode5GHz =
10675 eCSR_INI_SINGLE_CHANNEL_CENTERED;
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010676 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010677
10678#ifdef WLAN_FEATURE_AP_HT40_24G
10679 if (smeConfig.csrConfig.apHT40_24GEnabled)
10680 {
10681 if (channel >= 1 && channel <= 7)
10682 smeConfig.csrConfig.channelBondingAPMode24GHz =
10683 eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
10684 else if (channel >= 8 && channel <= 13)
10685 smeConfig.csrConfig.channelBondingAPMode24GHz =
10686 eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
10687 else if (channel ==14)
10688 smeConfig.csrConfig.channelBondingAPMode24GHz =
10689 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10690 }
10691#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010692 }
krunal soni634aba32014-03-06 17:46:50 -080010693
10694 /*
10695 for 802.11a phy mode, channel bonding should be zero.
10696 From default config, it is set as PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3
10697 through csrChangeDefaultConfigParam function. We will override this
10698 value here.
10699 */
10700 if ( eCSR_DOT11_MODE_11a == eCsrPhyMode ||
10701 eCSR_DOT11_MODE_11a_ONLY == eCsrPhyMode ||
10702 eCSR_DOT11_MODE_abg == eCsrPhyMode)
10703 {
10704 smeConfig.csrConfig.channelBondingMode5GHz = 0;
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010705#ifdef WLAN_FEATURE_AP_HT40_24G
10706 } else if ( eCSR_DOT11_MODE_11g_ONLY == eCsrPhyMode)
10707 smeConfig.csrConfig.channelBondingAPMode24GHz =
10708 eCSR_INI_SINGLE_CHANNEL_CENTERED;
10709#else
krunal soni634aba32014-03-06 17:46:50 -080010710 }
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010711#endif
krunal soni634aba32014-03-06 17:46:50 -080010712
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010713#ifdef WLAN_FEATURE_AP_HT40_24G
10714 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10715 FL("%s cbmode selected=%d bonding mode:%s"),
10716 (channel <= 14) ? "2G" : "5G",
10717 (channel <= 14) ? smeConfig.csrConfig.channelBondingAPMode24GHz :
10718 smeConfig.csrConfig.channelBondingMode5GHz,
10719 (channel <= 14) ?
10720 sme_CBMode2String(smeConfig.csrConfig.channelBondingAPMode24GHz) :
10721 sme_CBMode2String(smeConfig.csrConfig.channelBondingMode5GHz));
10722#else
Agarwal Ashishbf98caf2014-03-25 13:29:11 +053010723 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +053010724 "cbmode selected=%d", smeConfig.csrConfig.channelBondingMode5GHz);
10725#endif
Ravi Joshiaeb7d9e2013-05-02 12:28:14 -070010726
10727 sme_UpdateConfig (pMac, &smeConfig);
10728 return VOS_STATUS_SUCCESS;
10729}
10730
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -070010731/*--------------------------------------------------------------------------
10732
10733 \brief sme_SetCurrDeviceMode() - Sets the current operating device mode.
10734 \param hHal - The handle returned by macOpen.
10735 \param currDeviceMode - Current operating device mode.
10736 --------------------------------------------------------------------------*/
10737
10738void sme_SetCurrDeviceMode (tHalHandle hHal, tVOS_CON_MODE currDeviceMode)
10739{
10740 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10741 pMac->sme.currDeviceMode = currDeviceMode;
10742 return;
10743}
10744
Varun Reddy Yeturucc661d22013-05-20 11:47:10 -070010745#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
10746/*--------------------------------------------------------------------------
10747 \brief sme_HandoffRequest() - a wrapper function to Request a handoff
10748 from CSR.
10749 This is a synchronous call
10750 \param hHal - The handle returned by macOpen
10751 \param pHandoffInfo - info provided by HDD with the handoff request (namely:
10752 BSSID, channel etc.)
10753 \return eHAL_STATUS_SUCCESS - SME passed the request to CSR successfully.
10754 Other status means SME is failed to send the request.
10755 \sa
10756 --------------------------------------------------------------------------*/
10757
10758eHalStatus sme_HandoffRequest(tHalHandle hHal,
10759 tCsrHandoffRequest *pHandoffInfo)
10760{
10761 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10762 eHalStatus status = eHAL_STATUS_SUCCESS;
10763
10764 status = sme_AcquireGlobalLock( &pMac->sme );
10765 if ( HAL_STATUS_SUCCESS( status ) )
10766 {
10767 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10768 "%s: invoked", __func__);
10769 status = csrHandoffRequest(pMac, pHandoffInfo);
10770 sme_ReleaseGlobalLock( &pMac->sme );
10771 }
10772
10773 return status ;
10774}
10775#endif
10776
Sudhir Sattayappa Kohallib1d8c3a2013-06-18 14:47:20 -070010777/*
10778 * SME API to check if there is any infra station or
10779 * P2P client is connected
10780 */
10781VOS_STATUS sme_isSta_p2p_clientConnected(tHalHandle hHal)
10782{
10783 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10784 if(csrIsInfraConnected(pMac))
10785 {
10786 return VOS_STATUS_SUCCESS;
10787 }
10788 return VOS_STATUS_E_FAILURE;
10789}
10790
Agarwal Ashish57e84372014-12-05 18:26:53 +053010791/*
10792 * SME API to check if any sessoion connected.
10793 */
10794VOS_STATUS sme_is_any_session_connected(tHalHandle hHal)
10795{
10796 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10797 if(csrIsAnySessionConnected(pMac))
10798 {
10799
10800 return VOS_STATUS_SUCCESS;
10801 }
10802 return VOS_STATUS_E_FAILURE;
10803}
10804
Leo Chang9056f462013-08-01 19:21:11 -070010805
10806#ifdef FEATURE_WLAN_LPHB
10807/* ---------------------------------------------------------------------------
10808 \fn sme_LPHBConfigReq
10809 \API to make configuration LPHB within FW.
10810 \param hHal - The handle returned by macOpen
10811 \param lphdReq - LPHB request argument by client
10812 \param pCallbackfn - LPHB timeout notification callback function pointer
10813 \- return Configuration message posting status, SUCCESS or Fail
10814 -------------------------------------------------------------------------*/
10815eHalStatus sme_LPHBConfigReq
10816(
10817 tHalHandle hHal,
10818 tSirLPHBReq *lphdReq,
10819 void (*pCallbackfn)(void *pAdapter, void *indParam)
10820)
10821{
10822 eHalStatus status = eHAL_STATUS_SUCCESS;
10823 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
10824 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10825 vos_msg_t vosMessage;
10826
10827 status = sme_AcquireGlobalLock(&pMac->sme);
10828 if (eHAL_STATUS_SUCCESS == status)
10829 {
10830 if ((LPHB_SET_EN_PARAMS_INDID == lphdReq->cmd) &&
10831 (NULL == pCallbackfn) &&
Leo Changd9df8aa2013-09-26 13:32:26 -070010832 (NULL == pMac->sme.pLphbIndCb))
Leo Chang9056f462013-08-01 19:21:11 -070010833 {
10834 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10835 "%s: Indication Call back did not registered", __func__);
10836 sme_ReleaseGlobalLock(&pMac->sme);
10837 return eHAL_STATUS_FAILURE;
10838 }
10839 else if (NULL != pCallbackfn)
10840 {
Leo Changd9df8aa2013-09-26 13:32:26 -070010841 pMac->sme.pLphbIndCb = pCallbackfn;
Leo Chang9056f462013-08-01 19:21:11 -070010842 }
10843
10844 /* serialize the req through MC thread */
10845 vosMessage.bodyptr = lphdReq;
10846 vosMessage.type = WDA_LPHB_CONF_REQ;
10847 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
10848 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
10849 {
10850 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
10851 "%s: Post Config LPHB MSG fail", __func__);
10852 status = eHAL_STATUS_FAILURE;
10853 }
10854 sme_ReleaseGlobalLock(&pMac->sme);
10855 }
10856
10857 return(status);
10858}
10859#endif /* FEATURE_WLAN_LPHB */
Sudhir Sattayappa Kohalli37620692013-08-05 14:02:26 -070010860/*--------------------------------------------------------------------------
10861 \brief sme_enable_disable_split_scan() - a wrapper function to set the split
10862 scan parameter.
10863 This is a synchronous call
10864 \param hHal - The handle returned by macOpen
10865 \return NONE.
10866 \sa
10867 --------------------------------------------------------------------------*/
10868void sme_enable_disable_split_scan (tHalHandle hHal, tANI_U8 nNumStaChan,
10869 tANI_U8 nNumP2PChan)
10870{
10871 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10872
10873 pMac->roam.configParam.nNumStaChanCombinedConc = nNumStaChan;
10874 pMac->roam.configParam.nNumP2PChanCombinedConc = nNumP2PChan;
10875
10876 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
10877 "%s: SCAN nNumStaChanCombinedConc : %d,"
10878 "nNumP2PChanCombinedConc : %d ",
10879 __func__, nNumStaChan, nNumP2PChan);
10880
10881 return;
10882
10883}
Leo Chang9056f462013-08-01 19:21:11 -070010884
Yue Mab9c86f42013-08-14 15:59:08 -070010885/* ---------------------------------------------------------------------------
10886 \fn sme_AddPeriodicTxPtrn
10887 \brief API to Periodic TX Pattern Offload feature
10888 \param hHal - The handle returned by macOpen
10889 \param addPeriodicTxPtrnParams - Pointer to the add pattern structure
10890 \return eHalStatus
10891 ---------------------------------------------------------------------------*/
10892eHalStatus sme_AddPeriodicTxPtrn(tHalHandle hHal, tSirAddPeriodicTxPtrn
10893 *addPeriodicTxPtrnParams)
10894{
10895 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10896 eHalStatus status;
10897 vos_msg_t msg;
10898
10899 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10900 {
10901 msg.type = WDA_ADD_PERIODIC_TX_PTRN_IND;
10902 msg.bodyptr = addPeriodicTxPtrnParams;
10903
10904 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10905 {
10906 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10907 "to post WDA_ADD_PERIODIC_TX_PTRN_IND to WDA!",
10908 __func__);
10909
10910 sme_ReleaseGlobalLock(&pMac->sme);
10911 return eHAL_STATUS_FAILURE;
10912 }
10913
10914 sme_ReleaseGlobalLock(&pMac->sme);
10915 return eHAL_STATUS_SUCCESS;
10916 }
10917
10918 return status;
10919}
10920
10921/* ---------------------------------------------------------------------------
10922 \fn sme_DelPeriodicTxPtrn
10923 \brief API to Periodic TX Pattern Offload feature
10924 \param hHal - The handle returned by macOpen
10925 \param delPeriodicTxPtrnParams - Pointer to the delete pattern structure
10926 \return eHalStatus
10927 ---------------------------------------------------------------------------*/
10928eHalStatus sme_DelPeriodicTxPtrn(tHalHandle hHal, tSirDelPeriodicTxPtrn
10929 *delPeriodicTxPtrnParams)
10930{
10931 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
10932 eHalStatus status;
10933 vos_msg_t msg;
10934
10935 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
10936 {
10937 msg.type = WDA_DEL_PERIODIC_TX_PTRN_IND;
10938 msg.bodyptr = delPeriodicTxPtrnParams;
10939
10940 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
10941 {
10942 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
10943 "to post WDA_DEL_PERIODIC_TX_PTRN_IND to WDA!",
10944 __func__);
10945
10946 sme_ReleaseGlobalLock(&pMac->sme);
10947 return eHAL_STATUS_FAILURE;
10948 }
10949
10950 sme_ReleaseGlobalLock(&pMac->sme);
10951 return eHAL_STATUS_SUCCESS;
10952 }
10953
10954 return status;
10955}
10956
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010957void smeGetCommandQStatus( tHalHandle hHal )
10958{
10959 tSmeCmd *pTempCmd = NULL;
10960 tListElem *pEntry;
10961 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
10962
10963 if (NULL == pMac)
10964 {
Kiet Lamcffc5862013-10-30 16:28:45 +053010965 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
10966 "%s: pMac is null", __func__);
Tushnim Bhattacharyyaad37df12013-10-02 12:01:33 -070010967 return;
10968 }
10969
10970 pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK );
10971 if( pEntry )
10972 {
10973 pTempCmd = GET_BASE_ADDR( pEntry, tSmeCmd, Link );
10974 }
10975 smsLog( pMac, LOGE, "Currently smeCmdActiveList has command (0x%X)",
10976 (pTempCmd) ? pTempCmd->command : eSmeNoCommand );
10977 if(pTempCmd)
10978 {
10979 if( eSmeCsrCommandMask & pTempCmd->command )
10980 {
10981 //CSR command is stuck. See what the reason code is for that command
10982 dumpCsrCommandInfo(pMac, pTempCmd);
10983 }
10984 } //if(pTempCmd)
10985
10986 smsLog( pMac, LOGE, "Currently smeCmdPendingList has %d commands",
10987 csrLLCount(&pMac->sme.smeCmdPendingList));
10988
10989 smsLog( pMac, LOGE, "Currently roamCmdPendingList has %d commands",
10990 csrLLCount(&pMac->roam.roamCmdPendingList));
10991
10992 return;
10993}
Rajeev79dbe4c2013-10-05 11:03:42 +053010994
10995#ifdef FEATURE_WLAN_BATCH_SCAN
10996/* ---------------------------------------------------------------------------
10997 \fn sme_SetBatchScanReq
10998 \brief API to set batch scan request in FW
10999 \param hHal - The handle returned by macOpen.
11000 \param pRequest - Pointer to the batch request.
11001 \param sessionId - session ID
11002 \param callbackRoutine - HDD callback which needs to be invoked after
11003 getting set batch scan response from FW
11004 \param callbackContext - pAdapter context
11005 \return eHalStatus
11006 ---------------------------------------------------------------------------*/
11007eHalStatus sme_SetBatchScanReq
11008(
11009 tHalHandle hHal, tSirSetBatchScanReq *pRequest, tANI_U8 sessionId,
11010 void (*callbackRoutine) (void *callbackCtx, tSirSetBatchScanRsp *pRsp),
11011 void *callbackContext
11012)
11013{
11014 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11015 eHalStatus status;
11016
Yue Mae36e3552014-03-05 17:06:20 -080011017 if (!pMac)
11018 {
11019 return eHAL_STATUS_FAILURE;
11020 }
11021
Rajeev79dbe4c2013-10-05 11:03:42 +053011022 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11023 {
11024 status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,
11025 callbackContext);
11026 sme_ReleaseGlobalLock( &pMac->sme );
11027 }
11028
11029 return status;
11030}
11031
11032/* ---------------------------------------------------------------------------
Chittajit Mitraf5413a42013-10-18 14:20:08 -070011033 \fn sme_SendRateUpdateInd
11034 \brief API to Update rate
11035 \param hHal - The handle returned by macOpen
11036 \param rateUpdateParams - Pointer to rate update params
11037 \return eHalStatus
11038 ---------------------------------------------------------------------------*/
11039eHalStatus sme_SendRateUpdateInd(tHalHandle hHal, tSirRateUpdateInd *rateUpdateParams)
11040{
11041 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11042 eHalStatus status;
11043 vos_msg_t msg;
11044
11045 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11046 {
11047 msg.type = WDA_RATE_UPDATE_IND;
11048 msg.bodyptr = rateUpdateParams;
11049
11050 if (!VOS_IS_STATUS_SUCCESS(vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
11051 {
11052 VOS_TRACE( VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,"%s: Not able "
11053 "to post WDA_SET_RMC_RATE_IND to WDA!",
11054 __func__);
11055
11056 sme_ReleaseGlobalLock(&pMac->sme);
11057 return eHAL_STATUS_FAILURE;
11058 }
11059
11060 sme_ReleaseGlobalLock(&pMac->sme);
11061 return eHAL_STATUS_SUCCESS;
11062 }
11063
11064 return status;
11065}
11066
11067/* ---------------------------------------------------------------------------
Rajeev79dbe4c2013-10-05 11:03:42 +053011068 \fn sme_TriggerBatchScanResultInd
11069 \brief API to trigger batch scan result indications from FW
11070 \param hHal - The handle returned by macOpen.
11071 \param pRequest - Pointer to get batch request.
11072 \param sessionId - session ID
11073 \param callbackRoutine - HDD callback which needs to be invoked after
11074 getting batch scan result indication from FW
11075 \param callbackContext - pAdapter context
11076 \return eHalStatus
11077 ---------------------------------------------------------------------------*/
11078eHalStatus sme_TriggerBatchScanResultInd
11079(
11080 tHalHandle hHal, tSirTriggerBatchScanResultInd *pRequest, tANI_U8 sessionId,
11081 void (*callbackRoutine) (void *callbackCtx, void *pRsp),
11082 void *callbackContext
11083)
11084{
11085 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11086 eHalStatus status;
11087
11088 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11089 {
11090 status = pmcTriggerBatchScanResultInd(hHal, pRequest, sessionId,
11091 callbackRoutine, callbackContext);
11092 sme_ReleaseGlobalLock( &pMac->sme );
11093 }
11094
11095 return status;
11096}
11097
11098
11099/* ---------------------------------------------------------------------------
11100 \fn sme_StopBatchScanInd
11101 \brief API to stop batch scan request in FW
11102 \param hHal - The handle returned by macOpen.
11103 \param pRequest - Pointer to the batch request.
11104 \param sessionId - session ID
11105 \return eHalStatus
11106 ---------------------------------------------------------------------------*/
11107eHalStatus sme_StopBatchScanInd
11108(
11109 tHalHandle hHal, tSirStopBatchScanInd *pRequest, tANI_U8 sessionId
11110)
11111{
11112 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11113 eHalStatus status;
11114
11115 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11116 {
11117 status = pmcStopBatchScanInd(hHal, pRequest, sessionId);
11118 sme_ReleaseGlobalLock( &pMac->sme );
11119 }
11120
11121 return status;
11122}
11123
11124#endif
Leo Chang0b0e45a2013-12-15 15:18:55 -080011125
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011126
Leo Chang0b0e45a2013-12-15 15:18:55 -080011127#ifdef FEATURE_WLAN_CH_AVOID
11128/* ---------------------------------------------------------------------------
11129 \fn sme_AddChAvoidCallback
11130 \brief Used to plug in callback function
11131 Which notify channel may not be used with SAP or P2PGO mode.
11132 Notification come from FW.
11133 \param hHal
11134 \param pCallbackfn : callback function pointer should be plugged in
11135 \- return eHalStatus
11136 -------------------------------------------------------------------------*/
11137eHalStatus sme_AddChAvoidCallback
11138(
11139 tHalHandle hHal,
11140 void (*pCallbackfn)(void *pAdapter, void *indParam)
11141)
11142{
11143 eHalStatus status = eHAL_STATUS_SUCCESS;
11144 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11145
11146 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
11147 "%s: Plug in CH AVOID CB", __func__);
11148
11149 status = sme_AcquireGlobalLock(&pMac->sme);
11150 if (eHAL_STATUS_SUCCESS == status)
11151 {
11152 if (NULL != pCallbackfn)
11153 {
11154 pMac->sme.pChAvoidNotificationCb = pCallbackfn;
11155 }
11156 sme_ReleaseGlobalLock(&pMac->sme);
11157 }
11158
11159 return(status);
11160}
11161#endif /* FEATURE_WLAN_CH_AVOID */
11162
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011163void activeListCmdTimeoutHandle(void *userData)
11164{
11165 if (NULL == userData)
11166 return;
11167 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11168 "%s: Active List command timeout Cmd List Count %d", __func__,
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080011169 csrLLCount(&((tpAniSirGlobal) userData)->sme.smeCmdActiveList) );
Kalikinkar Dharaa4988972013-10-28 13:39:54 -070011170 smeGetCommandQStatus((tHalHandle) userData);
11171}
11172
Sunil Duttc69bccb2014-05-26 21:30:20 +053011173#ifdef WLAN_FEATURE_LINK_LAYER_STATS
11174
11175/* ---------------------------------------------------------------------------
11176 \fn sme_LLStatsSetReq
11177 \brief API to set link layer stats request to FW
11178 \param hHal - The handle returned by macOpen.
11179
11180 \Param pStatsReq - a pointer to a caller allocated object of
11181 typedef struct tSirLLStatsSetReq, signifying the parameters to link layer
11182 stats set.
11183
11184 \return eHalStatus
11185 ---------------------------------------------------------------------------*/
11186eHalStatus sme_LLStatsSetReq(tHalHandle hHal,
11187 tSirLLStatsSetReq *pLinkLayerStatsSetReq)
11188{
11189 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11190 vos_msg_t msg;
11191 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011192 tSirLLStatsSetReq *plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011193
Dino Mycledf0a5d92014-07-04 09:41:55 +053011194 plinkLayerSetReq = vos_mem_malloc(sizeof(*plinkLayerSetReq));
11195 if ( !plinkLayerSetReq)
11196 {
11197 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11198 "%s: Not able to allocate memory for "
11199 "WDA_LINK_LAYER_STATS_SET_REQ",
11200 __func__);
11201 return eHAL_STATUS_FAILURE;
11202 }
Sunil Duttc69bccb2014-05-26 21:30:20 +053011203
Dino Mycledf0a5d92014-07-04 09:41:55 +053011204 *plinkLayerSetReq = *pLinkLayerStatsSetReq;
11205
Sunil Duttc69bccb2014-05-26 21:30:20 +053011206
11207 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11208 {
11209 msg.type = WDA_LINK_LAYER_STATS_SET_REQ;
11210 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011211 msg.bodyptr = plinkLayerSetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011212
11213 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11214 {
11215 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11216 "Not able to post SIR_HAL_LL_STATS_SET message to HAL", __func__);
11217 status = eHAL_STATUS_FAILURE;
11218 }
11219 sme_ReleaseGlobalLock( &pMac->sme );
11220 }
11221 else
11222 {
11223 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11224 "sme_AcquireGlobalLock error", __func__);
11225 }
11226 return status;
11227}
11228
11229/* ---------------------------------------------------------------------------
11230 \fn sme_LLStatsGetReq
11231 \brief API to get link layer stats request to FW
11232 \param hHal - The handle returned by macOpen.
11233
11234 \Param pStatsReq - a pointer to a caller allocated object of
11235 typedef struct tSirLLStatsGetReq, signifying the parameters to link layer
11236 stats get.
11237
11238 \return eHalStatus
11239 ---------------------------------------------------------------------------*/
11240eHalStatus sme_LLStatsGetReq(tHalHandle hHal,
11241 tSirLLStatsGetReq *pLinkLayerStatsGetReq)
11242{
11243 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11244 vos_msg_t msg;
11245 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011246 tSirLLStatsGetReq *pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011247
Dino Mycledf0a5d92014-07-04 09:41:55 +053011248 pGetStatsReq = vos_mem_malloc(sizeof(*pGetStatsReq));
11249 if ( !pGetStatsReq)
11250 {
11251 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11252 "%s: Not able to allocate memory for "
11253 "WDA_LINK_LAYER_STATS_GET_REQ",
11254 __func__);
11255 return eHAL_STATUS_FAILURE;
11256 }
11257 *pGetStatsReq = *pLinkLayerStatsGetReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011258
11259 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11260 {
11261 msg.type = WDA_LINK_LAYER_STATS_GET_REQ;
11262 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011263 msg.bodyptr = pGetStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011264 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11265 {
11266 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11267 "Not able to post SIR_HAL_LL_STATS_GET message to HAL", __func__);
11268 status = eHAL_STATUS_FAILURE;
11269 }
11270 sme_ReleaseGlobalLock( &pMac->sme );
11271 }
11272 else
11273 {
11274 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11275 "sme_AcquireGlobalLock error", __func__);
11276 }
11277 return status;
11278}
11279
11280/* ---------------------------------------------------------------------------
11281 \fn sme_LLStatsClearReq
11282 \brief API to clear link layer stats request to FW
11283 \param hHal - The handle returned by macOpen.
11284
11285 \Param pStatsReq - a pointer to a caller allocated object of
11286 typedef struct tSirLLStatsClearReq, signifying the parameters to link layer
11287 stats clear.
11288
11289 \return eHalStatus
11290 ---------------------------------------------------------------------------*/
11291eHalStatus sme_LLStatsClearReq(tHalHandle hHal,
11292 tSirLLStatsClearReq *pLinkLayerStatsClear)
11293{
11294 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11295 vos_msg_t msg;
11296 eHalStatus status = eHAL_STATUS_FAILURE;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011297 tSirLLStatsClearReq *pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011298
11299
Sunil Duttc69bccb2014-05-26 21:30:20 +053011300
Dino Mycledf0a5d92014-07-04 09:41:55 +053011301 pClearStatsReq = vos_mem_malloc(sizeof(*pClearStatsReq));
11302 if ( !pClearStatsReq)
11303 {
11304 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11305 "%s: Not able to allocate memory for "
11306 "WDA_LINK_LAYER_STATS_CLEAR_REQ",
11307 __func__);
11308 return eHAL_STATUS_FAILURE;
11309 }
11310
11311 *pClearStatsReq = *pLinkLayerStatsClear;
11312
Sunil Duttc69bccb2014-05-26 21:30:20 +053011313 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11314 {
11315 msg.type = WDA_LINK_LAYER_STATS_CLEAR_REQ;
11316 msg.reserved = 0;
Dino Mycledf0a5d92014-07-04 09:41:55 +053011317 msg.bodyptr = pClearStatsReq;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011318
11319 if(VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
11320 {
11321 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11322 "Not able to post SIR_HAL_LL_STATS_CLEAR message to HAL", __func__);
11323 status = eHAL_STATUS_FAILURE;
11324 }
11325 sme_ReleaseGlobalLock( &pMac->sme );
11326 }
11327 else
11328 {
11329 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR, "%s: "
11330 "sme_AcquireGlobalLock error", __func__);
11331 }
11332
11333 return status;
11334}
11335
11336/* ---------------------------------------------------------------------------
11337 \fn sme_SetLinkLayerStatsIndCB
11338 \brief API to trigger Link Layer Statistic indications from FW
11339 \param hHal - The handle returned by macOpen.
11340 \param sessionId - session ID
11341 \param callbackRoutine - HDD callback which needs to be invoked after
11342 getting Link Layer Statistics from FW
11343 \param callbackContext - pAdapter context
11344 \return eHalStatus
11345 ---------------------------------------------------------------------------*/
11346eHalStatus sme_SetLinkLayerStatsIndCB
11347(
Dino Mycled3d50022014-07-07 12:58:25 +053011348 tHalHandle hHal,
11349 void (*callbackRoutine) (void *callbackCtx, int indType, void *pRsp,
11350 tANI_U8 *macAddr)
Sunil Duttc69bccb2014-05-26 21:30:20 +053011351)
11352{
11353 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11354 eHalStatus status;
11355
11356 if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
11357 {
11358 if (NULL != callbackRoutine)
11359 {
11360 pMac->sme.pLinkLayerStatsIndCallback = callbackRoutine;
Sunil Duttc69bccb2014-05-26 21:30:20 +053011361 }
11362 sme_ReleaseGlobalLock( &pMac->sme );
11363 }
11364
11365 return status;
11366}
11367#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
11368
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -080011369eHalStatus sme_UpdateConnectDebug(tHalHandle hHal, tANI_U32 set_value)
11370{
11371 eHalStatus status = eHAL_STATUS_SUCCESS;
11372 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11373 pMac->fEnableDebugLog = set_value;
11374 return (status);
11375}
11376
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011377VOS_STATUS sme_UpdateDSCPtoUPMapping( tHalHandle hHal,
Kumar Anand82c009f2014-05-29 00:29:42 -070011378 sme_QosWmmUpType *dscpmapping,
11379 v_U8_t sessionId )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011380{
11381 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
Kumar Anand82c009f2014-05-29 00:29:42 -070011382 eHalStatus status = eHAL_STATUS_SUCCESS;
11383 v_U8_t i, j, peSessionId;
11384 tCsrRoamSession *pCsrSession = NULL;
11385 tpPESession pSession = NULL;
11386
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011387 status = sme_AcquireGlobalLock( &pMac->sme );
11388 if ( HAL_STATUS_SUCCESS( status ) )
11389 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011390 if (!CSR_IS_SESSION_VALID( pMac, sessionId ))
11391 {
11392 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11393 "%s: Invalid session Id %u", __func__, sessionId);
11394 sme_ReleaseGlobalLock( &pMac->sme);
11395 return eHAL_STATUS_FAILURE;
11396 }
11397 pCsrSession = CSR_GET_SESSION( pMac, sessionId );
11398
11399 if (pCsrSession == NULL)
11400 {
11401 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11402 "%s: CSR Session lookup fails %u", __func__, sessionId);
11403 sme_ReleaseGlobalLock( &pMac->sme);
11404 return eHAL_STATUS_FAILURE;
11405 }
11406
11407 pSession = peFindSessionByBssid( pMac,
11408 pCsrSession->connectedProfile.bssid, &peSessionId );
11409
11410 if (pSession == NULL)
11411 {
11412 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11413 "%s: Session lookup fails for BSSID", __func__);
11414 sme_ReleaseGlobalLock( &pMac->sme);
11415 return eHAL_STATUS_FAILURE;
11416 }
11417
11418 if ( !pSession->QosMapSet.present )
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011419 {
11420 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11421 "%s: QOS Mapping IE not present", __func__);
11422 sme_ReleaseGlobalLock( &pMac->sme);
11423 return eHAL_STATUS_FAILURE;
11424 }
11425 else
11426 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011427 for (i = 0; i < SME_QOS_WMM_UP_MAX; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011428 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011429 for (j = pSession->QosMapSet.dscp_range[i][0];
11430 j <= pSession->QosMapSet.dscp_range[i][1]; j++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011431 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011432 if ((pSession->QosMapSet.dscp_range[i][0] == 255) &&
11433 (pSession->QosMapSet.dscp_range[i][1] == 255))
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011434 {
11435 dscpmapping[j]= 0;
11436 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11437 "%s: User Priority %d is not used in mapping",
11438 __func__, i);
11439 break;
11440 }
11441 else
11442 {
11443 dscpmapping[j]= i;
11444 }
11445 }
11446 }
Kumar Anand82c009f2014-05-29 00:29:42 -070011447 for (i = 0; i< pSession->QosMapSet.num_dscp_exceptions; i++)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011448 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011449 if (pSession->QosMapSet.dscp_exceptions[i][0] != 255)
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011450 {
Kumar Anand82c009f2014-05-29 00:29:42 -070011451 dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0] ] =
11452 pSession->QosMapSet.dscp_exceptions[i][1];
Leela Venkata Kiran Kumar Reddy Chirala8e69fbc2013-10-30 18:51:13 -070011453 }
11454 }
11455 }
11456 }
11457 sme_ReleaseGlobalLock( &pMac->sme);
11458 return status;
11459}
Agarwal Ashish5e414792014-06-08 15:25:23 +053011460
Agarwal Ashish5e414792014-06-08 15:25:23 +053011461tANI_BOOLEAN sme_Is11dCountrycode(tHalHandle hHal)
11462{
11463 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
11464
11465 if (VOS_TRUE == vos_mem_compare(pMac->scan.countryCodeCurrent,
11466 pMac->scan.countryCode11d, 2))
11467 {
11468 return eANI_BOOLEAN_TRUE;
11469 }
11470 else
11471 {
11472 return eANI_BOOLEAN_FALSE;
11473 }
11474}
Dino Mycle2c198072014-06-10 10:15:52 +053011475
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011476eHalStatus sme_SpoofMacAddrReq(tHalHandle hHal, v_MACADDR_t *macaddr)
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011477{
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011478 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11479 eHalStatus status = eHAL_STATUS_SUCCESS;
11480 tSmeCmd *pMacSpoofCmd;
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011481
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011482 pMacSpoofCmd = csrGetCommandBuffer(pMac);
11483 if (pMacSpoofCmd)
11484 {
11485 pMacSpoofCmd->command = eSmeCommandMacSpoofRequest;
11486 vos_mem_set(&pMacSpoofCmd->u.macAddrSpoofCmd,
11487 sizeof(tSirSpoofMacAddrReq), 0);
11488 vos_mem_copy(pMacSpoofCmd->u.macAddrSpoofCmd.macAddr,
11489 macaddr->bytes, VOS_MAC_ADDRESS_LEN);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011490
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011491 status = csrQueueSmeCommand(pMac, pMacSpoofCmd, eANI_BOOLEAN_TRUE);
11492 if ( !HAL_STATUS_SUCCESS( status ) )
11493 {
11494 smsLog( pMac, LOGE, FL("fail to send msg status = %d\n"), status );
11495 csrReleaseCommandScan(pMac, pMacSpoofCmd);
11496 }
11497 }
11498 else
11499 {
11500 //log error
11501 smsLog(pMac, LOGE, FL("can not obtain a common buffer\n"));
11502 status = eHAL_STATUS_RESOURCES;
11503 }
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011504
Siddharth Bhald8a95e82015-02-12 20:14:52 +053011505 return (status);
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +053011506}
11507
Dino Mycle2c198072014-06-10 10:15:52 +053011508#ifdef WLAN_FEATURE_EXTSCAN
11509/* ---------------------------------------------------------------------------
11510 \fn sme_GetValidChannelsByBand
11511 \brief SME API to fetch all valid channel filtered by band
11512 \param hHal
11513 \param wifiBand: RF band information
11514 \param aValidChannels: Array to store channel info
11515 \param len: number of channels
11516 \- return eHalStatus
11517 -------------------------------------------------------------------------*/
11518eHalStatus sme_GetValidChannelsByBand (tHalHandle hHal, tANI_U8 wifiBand,
11519 tANI_U32 *aValidChannels, tANI_U8 *pNumChannels)
11520{
11521 eHalStatus status = eHAL_STATUS_SUCCESS;
11522 tANI_U8 chanList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
11523 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11524 tANI_U8 numChannels = 0;
11525 tANI_U8 i = 0;
11526 tANI_U32 totValidChannels = WNI_CFG_VALID_CHANNEL_LIST_LEN;
11527
11528 if (!aValidChannels || !pNumChannels) {
11529 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11530 FL("Output channel list/NumChannels is NULL"));
11531 return eHAL_STATUS_INVALID_PARAMETER;
11532 }
11533
11534 if ((wifiBand < WIFI_BAND_UNSPECIFIED) || (wifiBand >= WIFI_BAND_MAX)) {
11535 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11536 FL("Invalid wifiBand (%d)"), wifiBand);
11537 return eHAL_STATUS_INVALID_PARAMETER;
11538 }
11539
11540 status = sme_GetCfgValidChannels(hHal, &chanList[0],
11541 &totValidChannels);
11542 if (!HAL_STATUS_SUCCESS(status)) {
11543 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11544 FL("Failed to get valid channel list (err=%d)"), status);
11545 return status;
11546 }
11547
11548 switch (wifiBand) {
11549 case WIFI_BAND_UNSPECIFIED:
11550 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("Unspecified wifiBand, "
11551 "return all (%d) valid channels"), totValidChannels);
11552 numChannels = totValidChannels;
11553 for (i = 0; i < numChannels; i++)
11554 aValidChannels[i] = vos_chan_to_freq(chanList[i]);
11555 break;
11556
11557 case WIFI_BAND_BG:
11558 smsLog(pMac, VOS_TRACE_LEVEL_INFO, FL("WIFI_BAND_BG (2.4 GHz)"));
11559 for (i = 0; i < totValidChannels; i++)
11560 if (CSR_IS_CHANNEL_24GHZ(chanList[i]))
11561 aValidChannels[numChannels++] =
11562 vos_chan_to_freq(chanList[i]);
11563 break;
11564
11565 case WIFI_BAND_A:
11566 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11567 FL("WIFI_BAND_A (5 GHz without DFS)"));
11568 for (i = 0; i < totValidChannels; i++)
11569 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11570 !CSR_IS_CHANNEL_DFS(chanList[i]))
11571 aValidChannels[numChannels++] =
11572 vos_chan_to_freq(chanList[i]);
11573 break;
11574
11575 case WIFI_BAND_ABG:
11576 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11577 FL("WIFI_BAND_ABG (2.4 GHz + 5 GHz; no DFS)"));
11578 for (i = 0; i < totValidChannels; i++)
11579 if ((CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11580 CSR_IS_CHANNEL_5GHZ(chanList[i])) &&
11581 !CSR_IS_CHANNEL_DFS(chanList[i]))
11582 aValidChannels[numChannels++] =
11583 vos_chan_to_freq(chanList[i]);
11584 break;
11585
11586 case WIFI_BAND_A_DFS_ONLY:
11587 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11588 FL("WIFI_BAND_A_DFS (5 GHz DFS only)"));
11589 for (i = 0; i < totValidChannels; i++)
11590 if (CSR_IS_CHANNEL_5GHZ(chanList[i]) &&
11591 CSR_IS_CHANNEL_DFS(chanList[i]))
11592 aValidChannels[numChannels++] =
11593 vos_chan_to_freq(chanList[i]);
11594 break;
11595
11596 case WIFI_BAND_A_WITH_DFS:
11597 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11598 FL("WIFI_BAND_A_WITH_DFS (5 GHz with DFS)"));
11599 for (i = 0; i < totValidChannels; i++)
11600 if (CSR_IS_CHANNEL_5GHZ(chanList[i]))
11601 aValidChannels[numChannels++] =
11602 vos_chan_to_freq(chanList[i]);
11603 break;
11604
11605 case WIFI_BAND_ABG_WITH_DFS:
11606 smsLog(pMac, VOS_TRACE_LEVEL_INFO,
11607 FL("WIFI_BAND_ABG_WITH_DFS (2.4 GHz + 5 GHz with DFS)"));
11608 for (i = 0; i < totValidChannels; i++)
11609 if (CSR_IS_CHANNEL_24GHZ(chanList[i]) ||
11610 CSR_IS_CHANNEL_5GHZ(chanList[i]))
11611 aValidChannels[numChannels++] =
11612 vos_chan_to_freq(chanList[i]);
11613 break;
11614
11615 default:
11616 smsLog(pMac, VOS_TRACE_LEVEL_ERROR,
11617 FL("Unknown wifiBand (%d))"), wifiBand);
11618 return eHAL_STATUS_INVALID_PARAMETER;
11619 break;
11620 }
11621 *pNumChannels = numChannels;
11622
11623 return status;
11624}
11625/* ---------------------------------------------------------------------------
11626 \fn sme_EXTScanGetCapabilities
11627 \brief SME API to fetch Extended Scan capabilities
11628 \param hHal
11629 \param pReq: Extended Scan capabilities structure
11630 \- return eHalStatus
11631 -------------------------------------------------------------------------*/
11632eHalStatus sme_EXTScanGetCapabilities (tHalHandle hHal,
11633 tSirGetEXTScanCapabilitiesReqParams *pReq)
11634{
11635 eHalStatus status = eHAL_STATUS_SUCCESS;
11636 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11637 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11638 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011639 tSirGetEXTScanCapabilitiesReqParams *pGetEXTScanCapabilitiesReq;
11640
11641 pGetEXTScanCapabilitiesReq =
11642 vos_mem_malloc(sizeof(*pGetEXTScanCapabilitiesReq));
11643 if ( !pGetEXTScanCapabilitiesReq)
11644 {
11645 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11646 "%s: Not able to allocate memory for "
11647 "WDA_EXTSCAN_GET_CAPABILITIES_REQ",
11648 __func__);
11649 return eHAL_STATUS_FAILURE;
11650 }
11651
11652 *pGetEXTScanCapabilitiesReq = *pReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011653
11654 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11655 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CAPABILITIES, NO_SESSION, 0));
11656 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11657 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011658 vosMessage.bodyptr = pGetEXTScanCapabilitiesReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011659 vosMessage.type = WDA_EXTSCAN_GET_CAPABILITIES_REQ;
11660 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11661 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11662 status = eHAL_STATUS_FAILURE;
11663
11664 sme_ReleaseGlobalLock(&pMac->sme);
11665 }
11666 return(status);
11667}
11668
11669/* ---------------------------------------------------------------------------
11670 \fn sme_EXTScanStart
11671 \brief SME API to issue Extended Scan start
11672 \param hHal
11673 \param pStartCmd: Extended Scan start structure
11674 \- return eHalStatus
11675 -------------------------------------------------------------------------*/
11676eHalStatus sme_EXTScanStart (tHalHandle hHal,
11677 tSirEXTScanStartReqParams *pStartCmd)
11678{
11679 eHalStatus status = eHAL_STATUS_SUCCESS;
11680 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11681 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11682 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011683 tSirEXTScanStartReqParams *pextScanStartReq;
11684
11685 pextScanStartReq = vos_mem_malloc(sizeof(*pextScanStartReq));
11686 if ( !pextScanStartReq)
11687 {
11688 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11689 "%s: Not able to allocate memory for "
11690 "WDA_EXTSCAN_START_REQ",
11691 __func__);
11692 return eHAL_STATUS_FAILURE;
11693 }
11694
11695 *pextScanStartReq = *pStartCmd;
11696
Dino Mycle2c198072014-06-10 10:15:52 +053011697
11698 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11699 TRACE_CODE_SME_RX_HDD_EXTSCAN_START, NO_SESSION, 0));
11700 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11701 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011702 vosMessage.bodyptr = pextScanStartReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011703 vosMessage.type = WDA_EXTSCAN_START_REQ;
11704 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11705 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11706 status = eHAL_STATUS_FAILURE;
11707
11708 sme_ReleaseGlobalLock(&pMac->sme);
11709 }
11710 return(status);
11711}
11712
11713/* ---------------------------------------------------------------------------
11714 \fn sme_EXTScanStop
11715 \brief SME API to issue Extended Scan stop
11716 \param hHal
11717 \param pStopReq: Extended Scan stop structure
11718 \- return eHalStatus
11719 -------------------------------------------------------------------------*/
11720eHalStatus sme_EXTScanStop(tHalHandle hHal, tSirEXTScanStopReqParams *pStopReq)
11721{
11722 eHalStatus status = eHAL_STATUS_SUCCESS;
11723 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11724 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11725 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011726 tSirEXTScanStopReqParams *pEXTScanStopReq;
11727
11728 pEXTScanStopReq = vos_mem_malloc(sizeof(*pEXTScanStopReq));
11729 if ( !pEXTScanStopReq)
11730 {
11731 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11732 "%s: Not able to allocate memory for "
11733 "WDA_EXTSCAN_STOP_REQ",
11734 __func__);
11735 return eHAL_STATUS_FAILURE;
11736 }
11737
11738 *pEXTScanStopReq = *pStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011739
11740 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11741 TRACE_CODE_SME_RX_HDD_EXTSCAN_STOP, NO_SESSION, 0));
11742 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme)))
11743 {
11744 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011745 vosMessage.bodyptr = pEXTScanStopReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011746 vosMessage.type = WDA_EXTSCAN_STOP_REQ;
11747 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11748 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11749 {
11750 status = eHAL_STATUS_FAILURE;
11751 }
11752 sme_ReleaseGlobalLock(&pMac->sme);
11753 }
11754 return(status);
11755}
11756
11757/* ---------------------------------------------------------------------------
11758 \fn sme_SetBssHotlist
11759 \brief SME API to set BSSID hotlist
11760 \param hHal
11761 \param pSetHotListReq: Extended Scan set hotlist structure
11762 \- return eHalStatus
11763 -------------------------------------------------------------------------*/
11764eHalStatus sme_SetBssHotlist (tHalHandle hHal,
11765 tSirEXTScanSetBssidHotListReqParams *pSetHotListReq)
11766{
11767 eHalStatus status = eHAL_STATUS_SUCCESS;
11768 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11769 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11770 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011771 tSirEXTScanSetBssidHotListReqParams *pEXTScanSetBssidHotlistReq;
11772
11773 pEXTScanSetBssidHotlistReq =
11774 vos_mem_malloc(sizeof(*pEXTScanSetBssidHotlistReq));
11775 if ( !pEXTScanSetBssidHotlistReq)
11776 {
11777 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11778 "%s: Not able to allocate memory for "
11779 "WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ",
11780 __func__);
11781 return eHAL_STATUS_FAILURE;
11782 }
11783
11784 *pEXTScanSetBssidHotlistReq = *pSetHotListReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011785
11786 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11787 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_BSS_HOTLIST, NO_SESSION, 0));
11788 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11789 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011790 vosMessage.bodyptr = pEXTScanSetBssidHotlistReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011791 vosMessage.type = WDA_EXTSCAN_SET_BSSID_HOTLIST_REQ;
11792 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11793 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11794 status = eHAL_STATUS_FAILURE;
11795
11796 sme_ReleaseGlobalLock(&pMac->sme);
11797 }
11798
11799 return(status);
11800}
11801
11802/* ---------------------------------------------------------------------------
11803 \fn sme_ResetBssHotlist
11804 \brief SME API to reset BSSID hotlist
11805 \param hHal
11806 \param pSetHotListReq: Extended Scan set hotlist structure
11807 \- return eHalStatus
11808 -------------------------------------------------------------------------*/
11809eHalStatus sme_ResetBssHotlist (tHalHandle hHal,
11810 tSirEXTScanResetBssidHotlistReqParams *pResetReq)
11811{
11812 eHalStatus status = eHAL_STATUS_SUCCESS;
11813 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11814 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11815 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011816 tSirEXTScanResetBssidHotlistReqParams *pEXTScanHotlistResetReq;
11817
11818 pEXTScanHotlistResetReq = vos_mem_malloc(sizeof(*pEXTScanHotlistResetReq));
11819 if ( !pEXTScanHotlistResetReq)
11820 {
11821 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11822 "%s: Not able to allocate memory for "
11823 "WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ",
11824 __func__);
11825 return eHAL_STATUS_FAILURE;
11826 }
11827
11828 *pEXTScanHotlistResetReq = *pResetReq;
11829
Dino Mycle2c198072014-06-10 10:15:52 +053011830
11831 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11832 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_BSS_HOTLIST, NO_SESSION, 0));
11833 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11834 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011835 vosMessage.bodyptr = pEXTScanHotlistResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011836 vosMessage.type = WDA_EXTSCAN_RESET_BSSID_HOTLIST_REQ;
11837 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11838 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11839 status = eHAL_STATUS_FAILURE;
11840
11841 sme_ReleaseGlobalLock(&pMac->sme);
11842 }
11843 return(status);
11844}
11845
11846/* ---------------------------------------------------------------------------
11847 \fn sme_SetSignificantChange
11848 \brief SME API to set significant change
11849 \param hHal
11850 \param pSetSignificantChangeReq: Extended Scan set significant change structure
11851 \- return eHalStatus
11852 -------------------------------------------------------------------------*/
11853eHalStatus sme_SetSignificantChange (tHalHandle hHal,
11854 tSirEXTScanSetSignificantChangeReqParams *pSetSignificantChangeReq)
11855{
11856 eHalStatus status = eHAL_STATUS_SUCCESS;
11857 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11858 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11859 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011860 tSirEXTScanSetSignificantChangeReqParams *pEXTScanSetSignificantReq;
11861
11862 pEXTScanSetSignificantReq = vos_mem_malloc(sizeof(*pEXTScanSetSignificantReq));
11863 if ( !pEXTScanSetSignificantReq)
11864 {
11865 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11866 "%s: Not able to allocate memory for "
11867 "WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ",
11868 __func__);
11869 return eHAL_STATUS_FAILURE;
11870 }
11871
11872 *pEXTScanSetSignificantReq = *pSetSignificantChangeReq;
11873
11874
Dino Mycle2c198072014-06-10 10:15:52 +053011875
11876 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11877 TRACE_CODE_SME_RX_HDD_EXTSCAN_SET_SIGNF_CHANGE, NO_SESSION, 0));
11878 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11879 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011880 vosMessage.bodyptr = pEXTScanSetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011881 vosMessage.type = WDA_EXTSCAN_SET_SIGNF_RSSI_CHANGE_REQ;
11882 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11883 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11884 status = eHAL_STATUS_FAILURE;
11885
11886 sme_ReleaseGlobalLock(&pMac->sme);
11887 }
11888 return(status);
11889}
11890
11891/* ---------------------------------------------------------------------------
11892 \fn sme_ResetSignificantChange
11893 \brief SME API to reset significant change
11894 \param hHal
11895 \param pResetReq: Extended Scan reset significant change structure
11896 \- return eHalStatus
11897 -------------------------------------------------------------------------*/
11898eHalStatus sme_ResetSignificantChange (tHalHandle hHal,
11899 tSirEXTScanResetSignificantChangeReqParams *pResetReq)
11900{
11901 eHalStatus status = eHAL_STATUS_SUCCESS;
11902 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11903 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11904 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011905 tSirEXTScanResetSignificantChangeReqParams *pEXTScanResetSignificantReq;
11906
11907 pEXTScanResetSignificantReq =
11908 vos_mem_malloc(sizeof(*pEXTScanResetSignificantReq));
11909 if ( !pEXTScanResetSignificantReq)
11910 {
11911 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11912 "%s: Not able to allocate memory for "
11913 "WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ",
11914 __func__);
11915 return eHAL_STATUS_FAILURE;
11916 }
11917
11918 *pEXTScanResetSignificantReq = *pResetReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011919
11920 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11921 TRACE_CODE_SME_RX_HDD_EXTSCAN_RESET_SIGNF_CHANGE, NO_SESSION, 0));
11922 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11923 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011924 vosMessage.bodyptr = pEXTScanResetSignificantReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011925 vosMessage.type = WDA_EXTSCAN_RESET_SIGNF_RSSI_CHANGE_REQ;
11926 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11927 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11928 status = eHAL_STATUS_FAILURE;
11929
11930 sme_ReleaseGlobalLock(&pMac->sme);
11931 }
11932 return(status);
11933}
11934
11935/* ---------------------------------------------------------------------------
11936 \fn sme_getCachedResults
11937 \brief SME API to get cached results
11938 \param hHal
11939 \param pCachedResultsReq: Extended Scan get cached results structure
11940 \- return eHalStatus
11941 -------------------------------------------------------------------------*/
11942eHalStatus sme_getCachedResults (tHalHandle hHal,
11943 tSirEXTScanGetCachedResultsReqParams *pCachedResultsReq)
11944{
11945 eHalStatus status = eHAL_STATUS_SUCCESS;
11946 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
11947 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11948 vos_msg_t vosMessage;
Dino Myclee8843b32014-07-04 14:21:45 +053011949 tSirEXTScanGetCachedResultsReqParams *pEXTScanCachedResultsReq;
11950
11951 pEXTScanCachedResultsReq =
11952 vos_mem_malloc(sizeof(*pEXTScanCachedResultsReq));
11953 if ( !pEXTScanCachedResultsReq)
11954 {
11955 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
11956 "%s: Not able to allocate memory for "
11957 "WDA_EXTSCAN_GET_CACHED_RESULTS_REQ",
11958 __func__);
11959 return eHAL_STATUS_FAILURE;
11960 }
11961
11962 *pEXTScanCachedResultsReq = *pCachedResultsReq;
11963
Dino Mycle2c198072014-06-10 10:15:52 +053011964
11965 MTRACE(vos_trace(VOS_MODULE_ID_SME,
11966 TRACE_CODE_SME_RX_HDD_EXTSCAN_GET_CACHED_RESULTS, NO_SESSION, 0));
11967 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11968 /* Serialize the req through MC thread */
Dino Myclee8843b32014-07-04 14:21:45 +053011969 vosMessage.bodyptr = pEXTScanCachedResultsReq;
Dino Mycle2c198072014-06-10 10:15:52 +053011970 vosMessage.type = WDA_EXTSCAN_GET_CACHED_RESULTS_REQ;
11971 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
11972 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
11973 status = eHAL_STATUS_FAILURE;
11974
11975 sme_ReleaseGlobalLock(&pMac->sme);
11976 }
11977 return(status);
11978}
11979
11980eHalStatus sme_EXTScanRegisterCallback (tHalHandle hHal,
11981 void (*pEXTScanIndCb)(void *, const tANI_U16, void *),
11982 void *callbackContext)
11983{
11984 eHalStatus status = eHAL_STATUS_SUCCESS;
11985 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11986
11987 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
11988 pMac->sme.pEXTScanIndCb = pEXTScanIndCb;
11989 pMac->sme.pEXTScanCallbackContext = callbackContext;
11990 sme_ReleaseGlobalLock(&pMac->sme);
11991 }
11992 return(status);
11993}
11994
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053011995void sme_SetMiracastMode (tHalHandle hHal,tANI_U8 mode)
11996{
11997 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
11998
11999 pMac->miracast_mode = mode;
12000}
Dino Mycle2c198072014-06-10 10:15:52 +053012001#endif /* WLAN_FEATURE_EXTSCAN */
c_hpothuef45bc32014-09-11 10:10:18 +053012002
12003void sme_resetCoexEevent(tHalHandle hHal)
12004{
12005 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12006
12007 if (pMac == NULL)
12008 {
12009 printk("btc: %s pMac is NULL \n",__func__);
12010 return;
12011 }
12012
12013 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12014 FL("isCoexScoIndSet: %d"), pMac->isCoexScoIndSet);
12015
12016 if (pMac->isCoexScoIndSet)
12017 {
12018 pMac->isCoexScoIndSet = 0;
12019 ccmCfgSetInt(pMac, WNI_CFG_DEL_ALL_RX_TX_BA_SESSIONS_2_4_G_BTC, 0,
12020 NULL, eANI_BOOLEAN_FALSE);
12021 }
12022
12023 return;
12024}
Agarwal Ashish738843c2014-09-25 12:27:56 +053012025
12026void sme_disable_dfs_channel(tHalHandle hHal, bool disbale_dfs)
12027{
12028 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12029 pMac->scan.fEnableDFSChnlScan = !disbale_dfs;
12030 csrDisableDfsChannel(pMac);
12031
12032}
Srinivas Dasarib8fdd422014-11-27 10:44:20 +053012033
12034/* ---------------------------------------------------------------------------
12035 \fn sme_Encryptmsgsend
12036 \brief SME API to issue encrypt message request
12037 \param hHal
12038 \param pCmd: Data to be encrypted
12039 \- return eHalStatus
12040 -------------------------------------------------------------------------*/
12041eHalStatus sme_Encryptmsgsend (tHalHandle hHal,
12042 u8 *pCmd,
12043 int length,
12044 pEncryptMsgRSPCb encMsgCbk)
12045{
12046 eHalStatus status = eHAL_STATUS_SUCCESS;
12047 VOS_STATUS vosStatus = VOS_STATUS_SUCCESS;
12048 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12049 vos_msg_t vosMessage;
12050 u8 *pEncryptMsg;
12051
12052 pEncryptMsg = vos_mem_malloc(length);
12053 if ( !pEncryptMsg)
12054 {
12055 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12056 "%s: Not able to allocate memory for "
12057 "SIR_HAL_ENCRYPT_MSG_REQ",
12058 __func__);
12059 return eHAL_STATUS_FAILURE;
12060 }
12061
12062 vos_mem_copy(pEncryptMsg, pCmd, length);
12063
12064 if (eHAL_STATUS_SUCCESS == (status = sme_AcquireGlobalLock(&pMac->sme))) {
12065
12066 pMac->sme.pEncMsgInfoParams.pEncMsgCbk = encMsgCbk;
12067 pMac->sme.pEncMsgInfoParams.pUserData = hHal;
12068 /* Serialize the req through MC thread */
12069 vosMessage.bodyptr = pEncryptMsg;
12070 vosMessage.type = SIR_HAL_ENCRYPT_MSG_REQ;
12071 vosStatus = vos_mq_post_message(VOS_MQ_ID_WDA, &vosMessage);
12072 if (!VOS_IS_STATUS_SUCCESS(vosStatus))
12073 status = eHAL_STATUS_FAILURE;
12074
12075 sme_ReleaseGlobalLock(&pMac->sme);
12076 }
12077 return(status);
12078}
Pradeep Reddy POTTETIf0569d72014-12-13 16:54:03 +053012079
12080/* ---------------------------------------------------------------------------
12081 \fn sme_RegisterBtCoexTDLSCallback
12082 \brief Used to plug in callback function
12083 Which notify btcoex on or off.
12084 Notification come from FW.
12085 \param hHal
12086 \param pCallbackfn : callback function pointer should be plugged in
12087 \- return eHalStatus
12088 -------------------------------------------------------------------------*/
12089eHalStatus sme_RegisterBtCoexTDLSCallback
12090(
12091 tHalHandle hHal,
12092 void (*pCallbackfn)(void *pAdapter, int )
12093)
12094{
12095 eHalStatus status = eHAL_STATUS_SUCCESS;
12096 tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
12097
12098 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12099 "%s: Plug in BtCoex TDLS CB", __func__);
12100
12101 status = sme_AcquireGlobalLock(&pMac->sme);
12102 if (eHAL_STATUS_SUCCESS == status)
12103 {
12104 if (NULL != pCallbackfn)
12105 {
12106 pMac->sme.pBtCoexTDLSNotification = pCallbackfn;
12107 }
12108 sme_ReleaseGlobalLock(&pMac->sme);
12109 }
12110 return(status);
12111}
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012112
12113/* ---------------------------------------------------------------------------
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012114 \fn smeNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012115
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012116 \brief This function is a wrapper to call csrNeighborMiddleOfRoaming
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012117
12118 \param hHal - The handle returned by macOpen.
12119
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012120 \return eANI_BOOLEAN_TRUE if reassoc in progress,
12121 eANI_BOOLEAN_FALSE otherwise
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012122---------------------------------------------------------------------------*/
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012123
12124tANI_BOOLEAN smeNeighborMiddleOfRoaming(tHalHandle hHal)
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012125{
Padma, Santhosh Kumar3b9657d2015-02-04 19:37:32 +053012126 return (csrNeighborMiddleOfRoaming(PMAC_STRUCT(hHal)));
Padma, Santhosh Kumar98f271d2014-12-31 17:23:31 +053012127}
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012128
12129/* ---------------------------------------------------------------------------
12130
12131 \fn sme_IsTdlsOffChannelValid
12132
12133 \brief To check if the channel is valid for currently established domain
12134 This is a synchronous API.
12135
12136 \param hHal - The handle returned by macOpen.
12137 \param channel - channel to verify
12138
12139 \return TRUE/FALSE, TRUE if channel is valid
12140
12141 -------------------------------------------------------------------------------*/
12142tANI_BOOLEAN sme_IsTdlsOffChannelValid(tHalHandle hHal, tANI_U8 channel)
12143{
12144 eHalStatus status = eHAL_STATUS_FAILURE;
12145 tANI_BOOLEAN valid = FALSE;
12146 tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
12147
12148 status = sme_AcquireGlobalLock( &pMac->sme );
12149 if ( HAL_STATUS_SUCCESS( status ) )
12150 {
12151 /* check whether off channel is valid and non DFS */
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053012152 if (csrRoamIsChannelValid(pMac, channel))
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012153 {
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053012154 if (!CSR_IS_CHANNEL_DFS(channel))
12155 valid = TRUE;
12156 else {
12157 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12158 "%s: configured channel is DFS", __func__);
12159 }
12160 }
12161 else {
12162 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
12163 "%s: configured channel is not valid", __func__);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012164 }
12165 sme_ReleaseGlobalLock( &pMac->sme );
12166 }
Pradeep Reddy POTTETIb9c5f992015-02-18 14:15:55 +053012167 VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
12168 "%s: current country code %c%c channel %d valid %d",
12169 __func__, pMac->scan.countryCodeCurrent[0],
12170 pMac->scan.countryCodeCurrent[1], channel, valid);
Pradeep Reddy POTTETIe8bd41a2015-01-29 14:52:43 +053012171 return (valid);
12172}